Module: Adiwg_LegalConstraints

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_legalConstraint.rb

Overview

History: Stan Smith 2013-11-14 original script Stan Smith 2013-11-27 modified to process a single legal constraint

Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0

Class Method Summary collapse

Class Method Details

.unpack(hLegalCon) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_legalConstraint.rb', line 11

def self.unpack(hLegalCon)

	# instance classes needed in script
	intMetadataClass = InternalMetadata.new
	hIntCon = intMetadataClass.newLegalConstraint

	# legal constraint - access code
	if hLegalCon.has_key?('accessConstraint')
		aAccCodes = hLegalCon['accessConstraint']
		unless aAccCodes.empty?
			hIntCon[:accessCodes] = aAccCodes
		end
	end

	# legal constraint - use code
	if hLegalCon.has_key?('useConstraint')
		aUseCodes = hLegalCon['useConstraint']
		unless aUseCodes.empty?
			hIntCon[:useCodes] = aUseCodes
		end
	end

	# legal constraint - other constraints
	if hLegalCon.has_key?('otherConstraint')
		aOtherCons = hLegalCon['otherConstraint']
		unless aOtherCons.empty?
			hIntCon[:otherCons] = aOtherCons
		end
	end

	return hIntCon

end