adiwg-mdtranslator 2.0.0rc11 → 2.0.0rc13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Rakefile +1 -0
- data/adiwg-mdtranslator.gemspec +2 -0
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +32 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +96 -96
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +35 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +102 -105
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +49 -49
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_additionalDocumentation.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_boundingBox.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_browseGraphic.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_citation.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_contacts.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_dateTime.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_distributionInfo.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_extent.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_geoCoordSystem.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_geoProperties.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_geographicElement.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_metadata.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_metadataInfo.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_onlineResource.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_resourceIdentifier.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_resourceInfo.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/{modules_v0 → modules/Old}/module_responsibleParty.rb +0 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_body.rb +41 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_citation.rb +32 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_id.rb +35 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb +46 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_purpose.rb +32 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_rights.rb +43 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +106 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_titles.rb +42 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb +56 -198
- data/lib/adiwg/mdtranslator/readers/sbJson/version.rb +14 -0
- data/lib/adiwg/mdtranslator/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_codelist.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dateTime.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_abstract.rb +27 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +90 -12
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +12 -4
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_date.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_id.rb +16 -17
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_materialRequest.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_provenance.rb +2 -18
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb +13 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +23 -2
- metadata +59 -22
- data/lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_sbJson.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/sbJson/modules_v0/version.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6dae2d4d0b4f056465097adf48a786332a8e1ac
|
4
|
+
data.tar.gz: 4d120c45abcf7459c45271c4e4a626e4bc2aa426
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59a2afd957514a20c5d2497d6627a08516dcfb40df807fb9fcbd6039263bb83ec512717b141abfe43153b91fe4430877e360964bdcdb51c82e195826c9017941
|
7
|
+
data.tar.gz: 1e080a421fad0efb0139437922a021d5b7402c252ed2dda1ca3fbd0695eed882309c2f345a4170e015606142689a17364914b1784df99c7ccce3610568412c4f
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/adiwg-mdtranslator.gemspec
CHANGED
@@ -36,5 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_runtime_dependency "adiwg-mdjson_schemas", ">= 2.2"
|
37
37
|
spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.1"
|
38
38
|
spec.add_runtime_dependency "jbuilder", "~> 2.5"
|
39
|
+
spec.add_runtime_dependency "kramdown", "~> 1.13"
|
40
|
+
spec.add_runtime_dependency "coderay", "~> 1.1"
|
39
41
|
|
40
42
|
end
|
@@ -140,23 +140,37 @@ module AdiwgDateTimeFun
|
|
140
140
|
return sDuration
|
141
141
|
end
|
142
142
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
143
|
+
def self.stringDateFromDateObject(obj)
|
144
|
+
|
145
|
+
date = obj[:date]
|
146
|
+
if date.nil?
|
147
|
+
date = obj[:dateTime]
|
148
|
+
end
|
149
|
+
dateRes = obj[:dateResolution]
|
150
|
+
unless date.nil?
|
151
|
+
dateStr = stringDateFromDateTime(date, dateRes)
|
152
|
+
end
|
153
|
+
return dateStr
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.stringDateTimeFromDateObject(obj)
|
158
|
+
|
159
|
+
date = obj[:date]
|
160
|
+
if date.nil?
|
161
|
+
date = obj[:dateTime]
|
162
|
+
end
|
163
|
+
dateRes = obj[:dateResolution]
|
164
|
+
unless date.nil?
|
165
|
+
case dateRes
|
166
|
+
when 'Y', 'YM', 'YMD'
|
167
|
+
dateStr = stringDateFromDateTime(date, dateRes)
|
168
|
+
else
|
169
|
+
dateStr = stringDateTimeFromDateTime(date, dateRes)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
return dateStr
|
174
|
+
end
|
161
175
|
|
162
176
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# mdJson reader - process and direct mdJson ingest to internal data structure
|
2
2
|
|
3
3
|
# History:
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
4
|
+
# Stan Smith 2016-11-12 refactor for mdTranslator 2.0
|
5
|
+
# Stan Smith 2016-10-09 modify 'findContact' to also return contact index and type
|
6
|
+
# Stan Smith 2016-10-07 refactored 'readerModule' to remove mdJson version checking
|
7
|
+
# Stan Smith 2015-07-14 added support for mdJson version numbers
|
8
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2015-06-12 added method to lookup contact in contact array
|
11
|
+
# Stan Smith 2014-12-11 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-12-03 changed class name to MdJsonReader from AdiwgJsonReader
|
13
|
+
# Stan Smith 2014-12-01 add data dictionary
|
14
|
+
# Stan Smith 2014-08-18 add json name/version to internal object
|
15
|
+
# Stan Smith 2014-07-08 moved json schema version testing to 'adiwg_1_get_version'
|
16
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
17
|
+
# Stan Smith 2014-06-05 capture an test json version
|
18
18
|
# Stan Smith 2014-04-23 add json schema version to internal object
|
19
19
|
# Stan Smith 2013-08-23 split out metadata to module_metadata
|
20
20
|
# Stan Smith 2013-08-19 split out contacts to module_contacts
|
@@ -26,97 +26,97 @@ require_relative 'version'
|
|
26
26
|
require_relative 'modules/module_mdJson'
|
27
27
|
|
28
28
|
module ADIWG
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
module Mdtranslator
|
30
|
+
module Readers
|
31
|
+
module MdJson
|
32
32
|
|
33
|
-
|
33
|
+
def self.readFile(file, hResponseObj)
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
# parse mdJson file
|
36
|
+
begin
|
37
|
+
hMdJson = JSON.parse(file)
|
38
|
+
rescue JSON::JSONError => err
|
39
|
+
hResponseObj[:readerStructureMessages] << 'Parsing mdJson Failed - see following message(s):\n'
|
40
|
+
hResponseObj[:readerStructureMessages] << err.to_s.slice(0, 300)
|
41
|
+
hResponseObj[:readerStructurePass] = false
|
42
|
+
return {}
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
# file must contain an mdJson object
|
46
|
+
if hMdJson.empty?
|
47
|
+
hResponseObj[:readerStructureMessages] << 'mdJson object is empty'
|
48
|
+
hResponseObj[:readerStructurePass] = false
|
49
|
+
return {}
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
# schema - (required)
|
53
|
+
unless hMdJson.has_key?('schema')
|
54
|
+
hResponseObj[:readerStructureMessages] << 'mdJson is missing schema object'
|
55
|
+
hResponseObj[:readerStructurePass] = false
|
56
|
+
return {}
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
59
|
+
# schema - name (required) (must = 'mdJson')
|
60
|
+
unless hMdJson['schema'].has_key?('name')
|
61
|
+
hResponseObj[:readerStructureMessages] << 'mdJson schema:name attribute is missing'
|
62
|
+
hResponseObj[:readerStructurePass] = false
|
63
|
+
return {}
|
64
|
+
end
|
65
|
+
schemaName = hMdJson['schema']['name']
|
66
|
+
if schemaName.nil? || schemaName == ''
|
67
|
+
hResponseObj[:readerStructureMessages] << 'mdJson schema name is missing'
|
68
|
+
hResponseObj[:readerStructurePass] = false
|
69
|
+
return {}
|
70
|
+
end
|
71
|
+
unless schemaName.downcase == 'mdjson'
|
72
|
+
hResponseObj[:readerStructureMessages] << "mdJson schema name is '#{schemaName}', should be mdJson"
|
73
|
+
hResponseObj[:readerStructurePass] = false
|
74
|
+
return {}
|
75
|
+
end
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
77
|
+
# schema - version (required)
|
78
|
+
unless hMdJson['schema'].has_key?('version')
|
79
|
+
hResponseObj[:readerStructureMessages] << 'mdJson schema:version attribute is missing'
|
80
|
+
hResponseObj[:readerStructurePass] = false
|
81
|
+
return {}
|
82
|
+
end
|
83
|
+
requestedVersion = hMdJson['schema']['version']
|
84
|
+
if requestedVersion.nil? || requestedVersion == ''
|
85
|
+
hResponseObj[:readerStructureMessages] << 'mdJson schema version is missing'
|
86
|
+
hResponseObj[:readerStructurePass] = false
|
87
|
+
return {}
|
88
|
+
end
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
90
|
+
# schema - 2.0.0 =< requested version =< current version
|
91
|
+
currentVersion = ADIWG::Mdtranslator::Readers::MdJson::VERSION
|
92
|
+
hResponseObj[:readerVersionRequested] = requestedVersion
|
93
|
+
hResponseObj[:readerVersionUsed] = currentVersion
|
94
|
+
aCurVersion = currentVersion.split('.')
|
95
|
+
aReqVersion = requestedVersion.split('.')
|
96
|
+
approved = false
|
97
|
+
if aReqVersion[0] == aCurVersion[0]
|
98
|
+
if aReqVersion[1] <= aCurVersion[1]
|
99
|
+
approved = true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
unless approved
|
103
|
+
hResponseObj[:readerStructureMessages] << "mdJson schema version '#{requestedVersion}' is not supported"
|
104
|
+
hResponseObj[:readerStructurePass] = false
|
105
|
+
return {}
|
106
|
+
end
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
# validate file against mdJson schema definition
|
109
|
+
validate(hMdJson, hResponseObj)
|
110
|
+
unless hResponseObj[:readerValidationPass]
|
111
|
+
return {}
|
112
|
+
end
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
114
|
+
# unpack the mdJson into the internal object
|
115
|
+
return MdJson.unpack(hMdJson, hResponseObj)
|
118
116
|
|
119
117
|
end
|
120
|
-
|
121
|
-
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
122
|
end
|
@@ -17,43 +17,43 @@ require 'json-schema'
|
|
17
17
|
require 'adiwg-mdjson_schemas'
|
18
18
|
|
19
19
|
module ADIWG
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
20
|
+
module Mdtranslator
|
21
|
+
module Readers
|
22
|
+
module MdJson
|
23
|
+
|
24
|
+
# validate json against the adiwg-json_schemas
|
25
|
+
# only a single schema version is supported at this time
|
26
|
+
def self.validate(file, responseObj)
|
27
|
+
|
28
|
+
bStrict = false
|
29
|
+
if responseObj[:readerValidationLevel] == 'strict'
|
30
|
+
bStrict = true
|
31
|
+
end
|
32
|
+
ADIWG::MdjsonSchemas::Utils.load_schemas(false)
|
33
|
+
|
34
|
+
begin
|
35
|
+
aErrors = []
|
36
|
+
aErrors = JSON::Validator.fully_validate('schema.json', file, :strict => bStrict)
|
37
|
+
|
38
|
+
if aErrors.length > 0
|
39
|
+
responseObj[:readerValidationPass] = false
|
40
|
+
responseObj[:readerValidationMessages] << 'mdJson schema validation Failed - see following message(s):\n'
|
41
|
+
responseObj[:readerValidationMessages] << aErrors
|
42
|
+
return
|
43
|
+
end
|
44
|
+
|
45
|
+
rescue JSON::Schema::ValidationError
|
46
|
+
responseObj[:readerValidationPass] = false
|
47
|
+
responseObj[:readerValidationMessages] << 'mdJson schema validation Failed - see following message(s):\n'
|
48
|
+
responseObj[:readerValidationMessages] << $!.message
|
49
|
+
return
|
50
|
+
end
|
53
51
|
|
54
52
|
end
|
55
|
-
|
56
|
-
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
57
|
end
|
58
58
|
|
59
59
|
|
@@ -12,125 +12,122 @@ require_relative 'module_dataDictionary'
|
|
12
12
|
require_relative 'module_metadataRepository'
|
13
13
|
|
14
14
|
module ADIWG
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
module MdJson
|
15
|
+
module Mdtranslator
|
16
|
+
module Readers
|
17
|
+
module MdJson
|
20
18
|
|
21
|
-
|
19
|
+
module MdJson
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
def self.unpack(hMdJson, responseObj)
|
22
|
+
|
23
|
+
# return nil object if input is empty
|
24
|
+
if hMdJson.empty?
|
25
|
+
responseObj[:readerExecutionMessages] << 'mdJson object is empty'
|
26
|
+
responseObj[:readerExecutionPass] = false
|
27
|
+
return nil
|
28
|
+
end
|
29
|
+
|
30
|
+
# instance classes needed in script
|
31
|
+
intMetadataClass = InternalMetadata.new
|
32
|
+
intObj = intMetadataClass.newBase
|
33
|
+
|
34
|
+
# mdJson - schema {schema} (required)
|
35
|
+
if hMdJson.has_key?('schema')
|
36
|
+
hObject = hMdJson['schema']
|
37
|
+
unless hObject.empty?
|
38
|
+
hReturn = Schema.unpack(hObject, responseObj)
|
39
|
+
unless hReturn.nil?
|
40
|
+
intObj[:schema] = hReturn
|
28
41
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
end
|
43
|
+
end
|
44
|
+
if intObj[:schema].empty?
|
45
|
+
responseObj[:readerExecutionMessages] << 'mdJson object is missing schema'
|
46
|
+
responseObj[:readerExecutionPass] = false
|
47
|
+
return nil
|
48
|
+
end
|
49
|
+
|
50
|
+
# mdJson - contact [] {contact} (required)
|
51
|
+
if hMdJson.has_key?('contact')
|
52
|
+
aItems = hMdJson['contact']
|
53
|
+
aItems.each do |item|
|
54
|
+
hReturn = Contact.unpack(item, responseObj)
|
55
|
+
unless hReturn.nil?
|
56
|
+
intObj[:contacts] << hReturn
|
57
|
+
@contacts = intObj[:contacts]
|
43
58
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
59
|
+
end
|
60
|
+
end
|
61
|
+
if intObj[:contacts].empty?
|
62
|
+
responseObj[:readerExecutionMessages] << 'mdJson object is missing contact'
|
63
|
+
responseObj[:readerExecutionPass] = false
|
64
|
+
return nil
|
65
|
+
end
|
66
|
+
|
67
|
+
# mdJson - metadata {metadata}
|
68
|
+
if hMdJson.has_key?('metadata')
|
69
|
+
hObject = hMdJson['metadata']
|
70
|
+
unless hObject.empty?
|
71
|
+
hReturn = Metadata.unpack(hObject, responseObj)
|
72
|
+
unless hReturn.nil?
|
73
|
+
intObj[:metadata] = hReturn
|
48
74
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# mdJson - data dictionary [] {dataDictionary}
|
79
|
+
if hMdJson.has_key?('dataDictionary')
|
80
|
+
aItems = hMdJson['dataDictionary']
|
81
|
+
aItems.each do |hItem|
|
82
|
+
hReturn = DataDictionary.unpack(hItem, responseObj)
|
83
|
+
unless hReturn.nil?
|
84
|
+
intObj[:dataDictionaries] << hReturn
|
60
85
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# metadata - metadata distribution [] {metadataDistribution}
|
90
|
+
if hMdJson.has_key?('metadataRepository')
|
91
|
+
aItems = hMdJson['metadataRepository']
|
92
|
+
aItems.each do |item|
|
93
|
+
hReturn = MetadataRepository.unpack(item, responseObj)
|
94
|
+
unless hReturn.nil?
|
95
|
+
intObj[:metadataRepositories] << hReturn
|
65
96
|
end
|
97
|
+
end
|
98
|
+
end
|
66
99
|
|
67
|
-
|
68
|
-
if hMdJson.has_key?('metadata')
|
69
|
-
hObject = hMdJson['metadata']
|
70
|
-
unless hObject.empty?
|
71
|
-
hReturn = Metadata.unpack(hObject, responseObj)
|
72
|
-
unless hReturn.nil?
|
73
|
-
intObj[:metadata] = hReturn
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
100
|
+
return intObj
|
77
101
|
|
78
|
-
|
79
|
-
if hMdJson.has_key?('dataDictionary')
|
80
|
-
aItems = hMdJson['dataDictionary']
|
81
|
-
aItems.each do |hItem|
|
82
|
-
hReturn = DataDictionary.unpack(hItem, responseObj)
|
83
|
-
unless hReturn.nil?
|
84
|
-
intObj[:dataDictionaries] << hReturn
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
102
|
+
end
|
88
103
|
|
89
|
-
|
90
|
-
|
91
|
-
aItems = hMdJson['metadataRepository']
|
92
|
-
aItems.each do |item|
|
93
|
-
hReturn = MetadataRepository.unpack(item, responseObj)
|
94
|
-
unless hReturn.nil?
|
95
|
-
intObj[:metadataRepositories] << hReturn
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
104
|
+
# find the array pointer and type for a contact
|
105
|
+
def self.findContact(contactId)
|
99
106
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
i = 0
|
110
|
-
@contacts.each do |contact|
|
111
|
-
if contact[:contactId] == contactId
|
112
|
-
contactIndex = i
|
113
|
-
if contact[:isOrganization]
|
114
|
-
contactType = 'organization'
|
115
|
-
else
|
116
|
-
contactType = 'individual'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
i += 1
|
107
|
+
contactIndex = nil
|
108
|
+
contactType = nil
|
109
|
+
@contacts.each_with_index do |contact, i|
|
110
|
+
if contact[:contactId] == contactId
|
111
|
+
contactIndex = i
|
112
|
+
if contact[:isOrganization]
|
113
|
+
contactType = 'organization'
|
114
|
+
else
|
115
|
+
contactType = 'individual'
|
120
116
|
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
return contactIndex, contactType
|
121
120
|
|
122
|
-
|
123
|
-
|
124
|
-
end
|
121
|
+
end
|
125
122
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
end
|
123
|
+
# set contacts array for reader test modules
|
124
|
+
def self.setContacts(contacts)
|
125
|
+
@contacts = contacts
|
126
|
+
end
|
132
127
|
|
133
128
|
end
|
134
|
-
|
135
|
-
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
136
133
|
end
|