adiwg-mdtranslator 2.13.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +26 -14
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +56 -41
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +377 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +10 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +11 -21
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +18 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +22 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +17 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +9 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +17 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +12 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +14 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +20 -19
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +7 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +8 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +10 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +4 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +13 -20
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +12 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +9 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +59 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +9 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +10 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +16 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +25 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +15 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +29 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +10 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +14 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +14 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +22 -26
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +13 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +10 -10
- data/lib/adiwg/mdtranslator/version.rb +8 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +78 -84
- data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibility.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +23 -14
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +2 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +10 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +5 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_medium.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_party.rb +1 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_repository.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +11 -11
- metadata +4 -3
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-12 original script
|
7
7
|
|
8
8
|
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
@@ -14,11 +14,13 @@ module ADIWG
|
|
14
14
|
|
15
15
|
module Date
|
16
16
|
|
17
|
-
def self.unpack(hDate, responseObj)
|
17
|
+
def self.unpack(hDate, responseObj, inContext = nil)
|
18
|
+
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
20
|
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hDate.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(150, responseObj, inContext)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -31,17 +33,13 @@ module ADIWG
|
|
31
33
|
if hDate.has_key?('date') && hDate['date'] != ''
|
32
34
|
aDateTimeReturn = AdiwgDateTimeFun.dateTimeFromString(hDate['date'])
|
33
35
|
if aDateTimeReturn[1] == 'ERROR'
|
34
|
-
responseObj
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
36
|
+
@MessagePath.issueError(151, responseObj, inContext)
|
37
37
|
else
|
38
38
|
intDate[:date] = aDateTimeReturn[0]
|
39
39
|
intDate[:dateResolution] = aDateTimeReturn[1]
|
40
40
|
end
|
41
41
|
else
|
42
|
-
responseObj
|
43
|
-
responseObj[:readerExecutionPass] = false
|
44
|
-
return nil
|
42
|
+
@MessagePath.issueError(152, responseObj, inContext)
|
45
43
|
end
|
46
44
|
|
47
45
|
# date - date type (required)
|
@@ -49,9 +47,7 @@ module ADIWG
|
|
49
47
|
intDate[:dateType] = hDate['dateType']
|
50
48
|
end
|
51
49
|
if intDate[:dateType].nil? || intDate[:dateType] == ''
|
52
|
-
responseObj
|
53
|
-
responseObj[:readerExecutionPass] = false
|
54
|
-
return nil
|
50
|
+
@MessagePath.issueError(153, responseObj, inContext)
|
55
51
|
end
|
56
52
|
|
57
53
|
# date - description
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-05 refactored for mdJson 2.0
|
7
7
|
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
8
8
|
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
@@ -18,11 +18,13 @@ module ADIWG
|
|
18
18
|
|
19
19
|
module DateTime
|
20
20
|
|
21
|
-
def self.unpack(sDateTime, responseObj)
|
21
|
+
def self.unpack(sDateTime, responseObj, inContext = nil)
|
22
|
+
|
23
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
24
|
|
23
25
|
# return nil object if input is empty
|
24
26
|
if sDateTime == ''
|
25
|
-
responseObj
|
27
|
+
@MessagePath.issueWarning(160, responseObj, inContext)
|
26
28
|
return nil
|
27
29
|
end
|
28
30
|
|
@@ -34,9 +36,7 @@ module ADIWG
|
|
34
36
|
# if dateTimeFromString fails, [0] = nil; [1] = 'ERROR'
|
35
37
|
aDateTimeReturn = AdiwgDateTimeFun.dateTimeFromString(sDateTime)
|
36
38
|
if aDateTimeReturn[1] == 'ERROR'
|
37
|
-
responseObj
|
38
|
-
responseObj[:readerExecutionPass] = false
|
39
|
-
return nil
|
39
|
+
@MessagePath.issueError(161, responseObj, inContext)
|
40
40
|
else
|
41
41
|
intDateTime[:dateTime] = aDateTimeReturn[0]
|
42
42
|
intDateTime[:dateResolution] = aDateTimeReturn[1]
|
@@ -2,11 +2,9 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal dimension
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-18 original script
|
7
7
|
|
8
|
-
require_relative 'module_measure'
|
9
|
-
|
10
8
|
module ADIWG
|
11
9
|
module Mdtranslator
|
12
10
|
module Readers
|
@@ -14,11 +12,13 @@ module ADIWG
|
|
14
12
|
|
15
13
|
module Dimension
|
16
14
|
|
17
|
-
def self.unpack(hDimension, responseObj)
|
15
|
+
def self.unpack(hDimension, responseObj, inContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
18
|
|
19
19
|
# return nil object if input is empty
|
20
20
|
if hDimension.empty?
|
21
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(170, responseObj, inContext)
|
22
22
|
return nil
|
23
23
|
end
|
24
24
|
|
@@ -33,9 +33,7 @@ module ADIWG
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
if intDimension[:dimensionType].nil?
|
36
|
-
responseObj
|
37
|
-
responseObj[:readerExecutionPass] = false
|
38
|
-
return nil
|
36
|
+
@MessagePath.issueError(171, responseObj, inContext)
|
39
37
|
end
|
40
38
|
|
41
39
|
# dimension - dimension size (required)
|
@@ -45,9 +43,7 @@ module ADIWG
|
|
45
43
|
end
|
46
44
|
end
|
47
45
|
if intDimension[:dimensionSize].nil?
|
48
|
-
responseObj
|
49
|
-
responseObj[:readerExecutionPass] = false
|
50
|
-
return nil
|
46
|
+
@MessagePath.issueError(172, responseObj, inContext)
|
51
47
|
end
|
52
48
|
|
53
49
|
# dimension - resolution {measure}
|
@@ -2,10 +2,11 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2018-01-29 add liabilityStatement
|
7
7
|
# Stan Smith 2016-10-21 original script
|
8
8
|
|
9
|
+
require_relative '../mdJson_reader'
|
9
10
|
require_relative 'module_distributor'
|
10
11
|
|
11
12
|
module ADIWG
|
@@ -17,9 +18,11 @@ module ADIWG
|
|
17
18
|
|
18
19
|
def self.unpack(hDistribution, responseObj)
|
19
20
|
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
|
+
|
20
23
|
# return nil object if input is empty
|
21
24
|
if hDistribution.empty?
|
22
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(180, responseObj)
|
23
26
|
return nil
|
24
27
|
end
|
25
28
|
|
@@ -58,9 +61,7 @@ module ADIWG
|
|
58
61
|
|
59
62
|
# error messages
|
60
63
|
unless haveDist
|
61
|
-
responseObj
|
62
|
-
responseObj[:readerExecutionPass] = false
|
63
|
-
return nil
|
64
|
+
@MessagePath.issueError(181, responseObj)
|
64
65
|
end
|
65
66
|
|
66
67
|
return intDistribution
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-21 original script
|
7
7
|
|
8
8
|
require_relative 'module_responsibleParty'
|
@@ -18,9 +18,11 @@ module ADIWG
|
|
18
18
|
|
19
19
|
def self.unpack(hDistrib, responseObj)
|
20
20
|
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
|
+
|
21
23
|
# return nil object if input is empty
|
22
24
|
if hDistrib.empty?
|
23
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(190, responseObj)
|
24
26
|
return nil
|
25
27
|
end
|
26
28
|
|
@@ -28,27 +30,34 @@ module ADIWG
|
|
28
30
|
intMetadataClass = InternalMetadata.new
|
29
31
|
intDistrib = intMetadataClass.newDistributor
|
30
32
|
|
33
|
+
outContext = 'distributor'
|
34
|
+
|
31
35
|
# distributor - contact {responsibleParty} (required)
|
32
36
|
if hDistrib.has_key?('contact')
|
33
37
|
hObject = hDistrib['contact']
|
34
38
|
unless hObject.empty?
|
35
|
-
hReturn = ResponsibleParty.unpack(hObject, responseObj)
|
39
|
+
hReturn = ResponsibleParty.unpack(hObject, responseObj, outContext)
|
36
40
|
unless hReturn.nil?
|
37
41
|
intDistrib[:contact] = hReturn
|
42
|
+
contactId = hReturn[:parties][0][:contactId]
|
43
|
+
unless contactId.nil?
|
44
|
+
contactName = @MessagePath.findContact(contactId)[2]
|
45
|
+
unless contactName.nil?
|
46
|
+
outContext = outContext + ' > ' + contactName
|
47
|
+
end
|
48
|
+
end
|
38
49
|
end
|
39
50
|
end
|
40
51
|
end
|
41
52
|
if intDistrib[:contact].empty?
|
42
|
-
responseObj
|
43
|
-
responseObj[:readerExecutionPass] = false
|
44
|
-
return nil
|
53
|
+
@MessagePath.issueError(191, responseObj)
|
45
54
|
end
|
46
55
|
|
47
56
|
# distributor - order process [orderProcess]
|
48
57
|
if hDistrib.has_key?('orderProcess')
|
49
58
|
aItems = hDistrib['orderProcess']
|
50
59
|
aItems.each do |item|
|
51
|
-
hReturn = OrderProcess.unpack(item, responseObj)
|
60
|
+
hReturn = OrderProcess.unpack(item, responseObj, outContext)
|
52
61
|
unless hReturn.nil?
|
53
62
|
intDistrib[:orderProcess] << hReturn
|
54
63
|
end
|
@@ -59,7 +68,7 @@ module ADIWG
|
|
59
68
|
if hDistrib.has_key?('transferOption')
|
60
69
|
aItemss = hDistrib['transferOption']
|
61
70
|
aItemss.each do |item|
|
62
|
-
hReturn = TransferOption.unpack(item, responseObj)
|
71
|
+
hReturn = TransferOption.unpack(item, responseObj, outContext)
|
63
72
|
unless hReturn.nil?
|
64
73
|
intDistrib[:transferOptions] << hReturn
|
65
74
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-11-01 added domainReference
|
7
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
8
8
|
# Stan Smith 2015-07-23 added error reporting of missing items
|
@@ -23,9 +23,11 @@ module ADIWG
|
|
23
23
|
|
24
24
|
def self.unpack(hDomain, responseObj)
|
25
25
|
|
26
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
27
|
+
|
26
28
|
# return nil object if input is empty
|
27
29
|
if hDomain.empty?
|
28
|
-
responseObj
|
30
|
+
@MessagePath.issueWarning(200, responseObj)
|
29
31
|
return nil
|
30
32
|
end
|
31
33
|
|
@@ -33,14 +35,16 @@ module ADIWG
|
|
33
35
|
intMetadataClass = InternalMetadata.new
|
34
36
|
intDomain = intMetadataClass.newDictionaryDomain
|
35
37
|
|
38
|
+
outContext = nil
|
39
|
+
|
36
40
|
# data dictionary domain - id (required)
|
37
41
|
if hDomain.has_key?('domainId')
|
38
42
|
intDomain[:domainId] = hDomain['domainId']
|
39
43
|
end
|
40
44
|
if intDomain[:domainId].nil? || intDomain[:domainId] == ''
|
41
|
-
responseObj
|
42
|
-
|
43
|
-
|
45
|
+
@MessagePath.issueError(201, responseObj)
|
46
|
+
else
|
47
|
+
outContext = 'domain ID ' + hDomain['domainId']
|
44
48
|
end
|
45
49
|
|
46
50
|
# data dictionary domain - name
|
@@ -55,9 +59,7 @@ module ADIWG
|
|
55
59
|
intDomain[:domainCode] = hDomain['codeName']
|
56
60
|
end
|
57
61
|
if intDomain[:domainCode].nil? || intDomain[:domainCode] == ''
|
58
|
-
responseObj
|
59
|
-
responseObj[:readerExecutionPass] = false
|
60
|
-
return nil
|
62
|
+
@MessagePath.issueError(202, responseObj, outContext)
|
61
63
|
end
|
62
64
|
|
63
65
|
# data dictionary domain - description (required)
|
@@ -65,9 +67,7 @@ module ADIWG
|
|
65
67
|
intDomain[:domainDescription] = hDomain['description']
|
66
68
|
end
|
67
69
|
if intDomain[:domainDescription].nil? || intDomain[:domainDescription] == ''
|
68
|
-
responseObj
|
69
|
-
responseObj[:readerExecutionPass] = false
|
70
|
-
return nil
|
70
|
+
@MessagePath.issueError(203, responseObj, outContext)
|
71
71
|
end
|
72
72
|
|
73
73
|
# data dictionary domain - domain reference {citation}
|
@@ -84,7 +84,7 @@ module ADIWG
|
|
84
84
|
# data dictionary domain - items []
|
85
85
|
if hDomain.has_key?('domainItem')
|
86
86
|
hDomain['domainItem'].each do |item|
|
87
|
-
hDom = DomainItem.unpack(item, responseObj)
|
87
|
+
hDom = DomainItem.unpack(item, responseObj, outContext)
|
88
88
|
unless hDom.nil?
|
89
89
|
intDomain[:domainItems] << hDom
|
90
90
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2018-01-24 add domain item reference
|
7
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
8
8
|
# Stan Smith 2015-07-23 added error reporting of missing items
|
@@ -20,11 +20,13 @@ module ADIWG
|
|
20
20
|
|
21
21
|
module DomainItem
|
22
22
|
|
23
|
-
def self.unpack(hDomItem, responseObj)
|
23
|
+
def self.unpack(hDomItem, responseObj, inContext = nil)
|
24
|
+
|
25
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
24
26
|
|
25
27
|
# return nil object if input is empty
|
26
28
|
if hDomItem.empty?
|
27
|
-
responseObj
|
29
|
+
@MessagePath.issueWarning(210, responseObj, inContext)
|
28
30
|
return nil
|
29
31
|
end
|
30
32
|
|
@@ -37,9 +39,7 @@ module ADIWG
|
|
37
39
|
intItem[:itemName] = hDomItem['name']
|
38
40
|
end
|
39
41
|
if intItem[:itemName].nil? || intItem[:itemName] == ''
|
40
|
-
responseObj
|
41
|
-
responseObj[:readerExecutionPass] = false
|
42
|
-
return nil
|
42
|
+
@MessagePath.issueError(211, responseObj, inContext)
|
43
43
|
end
|
44
44
|
|
45
45
|
# data dictionary domain item - value (required)
|
@@ -47,9 +47,7 @@ module ADIWG
|
|
47
47
|
intItem[:itemValue] = hDomItem['value']
|
48
48
|
end
|
49
49
|
if intItem[:itemValue].nil? || intItem[:itemValue] == ''
|
50
|
-
responseObj
|
51
|
-
responseObj[:readerExecutionPass] = false
|
52
|
-
return nil
|
50
|
+
@MessagePath.issueError(212, responseObj, inContext)
|
53
51
|
end
|
54
52
|
|
55
53
|
# data dictionary domain item - definition (required)
|
@@ -57,16 +55,14 @@ module ADIWG
|
|
57
55
|
intItem[:itemDefinition] = hDomItem['definition']
|
58
56
|
end
|
59
57
|
if intItem[:itemDefinition].nil? || intItem[:itemDefinition] == ''
|
60
|
-
responseObj
|
61
|
-
responseObj[:readerExecutionPass] = false
|
62
|
-
return nil
|
58
|
+
@MessagePath.issueError(213, responseObj, inContext)
|
63
59
|
end
|
64
60
|
|
65
61
|
# data dictionary domain item - reference {citation}
|
66
62
|
if hDomItem.has_key?('reference')
|
67
63
|
hCitation = hDomItem['reference']
|
68
64
|
unless hCitation.empty?
|
69
|
-
hReturn = Citation.unpack(hCitation, responseObj)
|
65
|
+
hReturn = Citation.unpack(hCitation, responseObj, inContext)
|
70
66
|
unless hReturn.nil?
|
71
67
|
intItem[:itemReference] = hReturn
|
72
68
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-03 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module Duration
|
14
14
|
|
15
|
-
def self.unpack(hDuration, responseObj)
|
15
|
+
def self.unpack(hDuration, responseObj, inContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
16
18
|
|
17
19
|
# return nil object if input is empty
|
18
20
|
if hDuration.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(220, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -98,9 +100,7 @@ module ADIWG
|
|
98
100
|
intDuration[:minutes] +
|
99
101
|
intDuration[:seconds]
|
100
102
|
unless totalDuration > 0
|
101
|
-
responseObj
|
102
|
-
responseObj[:readerExecutionPass] = false
|
103
|
-
return nil
|
103
|
+
@MessagePath.issueError(221, responseObj, inContext)
|
104
104
|
end
|
105
105
|
|
106
106
|
return intDuration
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - mdJson to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-11-01 added entityReference, fieldSeparator, headerLines, quoteCharacter
|
7
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
8
8
|
# Stan Smith 2015-07-24 added error reporting of missing items
|
@@ -26,9 +26,11 @@ module ADIWG
|
|
26
26
|
|
27
27
|
def self.unpack(hEntity, responseObj)
|
28
28
|
|
29
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
30
|
+
|
29
31
|
# return nil object if input is empty
|
30
32
|
if hEntity.empty?
|
31
|
-
responseObj
|
33
|
+
@MessagePath.issueWarning(230, responseObj)
|
32
34
|
return nil
|
33
35
|
end
|
34
36
|
|
@@ -36,6 +38,8 @@ module ADIWG
|
|
36
38
|
intMetadataClass = InternalMetadata.new
|
37
39
|
intEntity = intMetadataClass.newEntity
|
38
40
|
|
41
|
+
outContext = nil
|
42
|
+
|
39
43
|
# entity - id
|
40
44
|
if hEntity.has_key?('entityId')
|
41
45
|
s = hEntity['entityId']
|
@@ -56,9 +60,9 @@ module ADIWG
|
|
56
60
|
intEntity[:entityCode] = hEntity['codeName']
|
57
61
|
end
|
58
62
|
if intEntity[:entityCode].nil? || intEntity[:entityCode] == ''
|
59
|
-
responseObj
|
60
|
-
|
61
|
-
|
63
|
+
@MessagePath.issueError(231, responseObj)
|
64
|
+
else
|
65
|
+
outContext = 'entity code name ' + hEntity['codeName']
|
62
66
|
end
|
63
67
|
|
64
68
|
# entity - alias []
|
@@ -75,16 +79,14 @@ module ADIWG
|
|
75
79
|
intEntity[:entityDefinition] = hEntity['definition']
|
76
80
|
end
|
77
81
|
if intEntity[:entityDefinition].nil? || intEntity[:entityDefinition] == ''
|
78
|
-
responseObj
|
79
|
-
responseObj[:readerExecutionPass] = false
|
80
|
-
return nil
|
82
|
+
@MessagePath.issueError(232, responseObj, outContext)
|
81
83
|
end
|
82
84
|
|
83
85
|
# entity - entity reference [] {citation}
|
84
86
|
if hEntity.has_key?('entityReference')
|
85
87
|
hEntity['entityReference'].each do |hCitation|
|
86
88
|
unless hCitation.empty?
|
87
|
-
hReturn = Citation.unpack(hCitation, responseObj)
|
89
|
+
hReturn = Citation.unpack(hCitation, responseObj, outContext)
|
88
90
|
unless hReturn.nil?
|
89
91
|
intEntity[:entityReferences] << hReturn
|
90
92
|
end
|
@@ -105,7 +107,7 @@ module ADIWG
|
|
105
107
|
if hEntity.has_key?('index')
|
106
108
|
hEntity['index'].each do |hIndex|
|
107
109
|
unless hIndex.empty?
|
108
|
-
index = EntityIndex.unpack(hIndex, responseObj)
|
110
|
+
index = EntityIndex.unpack(hIndex, responseObj, outContext)
|
109
111
|
unless index.nil?
|
110
112
|
intEntity[:indexes] << index
|
111
113
|
end
|
@@ -117,7 +119,7 @@ module ADIWG
|
|
117
119
|
if hEntity.has_key?('attribute')
|
118
120
|
hEntity['attribute'].each do |hAttribute|
|
119
121
|
unless hAttribute.empty?
|
120
|
-
attribute = EntityAttribute.unpack(hAttribute, responseObj)
|
122
|
+
attribute = EntityAttribute.unpack(hAttribute, responseObj, outContext)
|
121
123
|
unless attribute.nil?
|
122
124
|
intEntity[:attributes] << attribute
|
123
125
|
end
|
@@ -129,7 +131,7 @@ module ADIWG
|
|
129
131
|
if hEntity.has_key?('foreignKey')
|
130
132
|
hEntity['foreignKey'].each do |hFKey|
|
131
133
|
unless hFKey.empty?
|
132
|
-
fKey = EntityForeignKey.unpack(hFKey, responseObj)
|
134
|
+
fKey = EntityForeignKey.unpack(hFKey, responseObj, outContext)
|
133
135
|
unless fKey.nil?
|
134
136
|
intEntity[:foreignKeys] << fKey
|
135
137
|
end
|