Sha256: 801c5e5b3d495f79197daf683ff8849cee48661b76380629d87b931a5067e30d

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# unpack a data dictionary domain
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-12-01 original script

require ADIWG::Mdtranslator.reader_module('module_domainItem', $response[:readerVersionUsed])

module Md_Domain

	def self.unpack(hDomain)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		intDomain = intMetadataClass.newDictionaryDomain

		# data dictionary domain - id
		if hDomain.has_key?('domainId')
			s = hDomain['domainId']
			if s != ''
				intDomain[:domainId] = s
			end
		end

		# data dictionary domain - name
		if hDomain.has_key?('commonName')
			s = hDomain['commonName']
			if s != ''
				intDomain[:domainName] = s
			end
		end

		# data dictionary domain - code
		if hDomain.has_key?('codeName')
			s = hDomain['codeName']
			if s != ''
				intDomain[:domainCode] = s
			end
		end

		# data dictionary domain - description
		if hDomain.has_key?('description')
			s = hDomain['description']
			if s != ''
				intDomain[:domainDescription] = s
			end
		end

		# data dictionary domain - members
		if hDomain.has_key?('member')
			aDoItems = hDomain['member']
			aDoItems.each do |hDoItem|
				unless hDoItem.empty?
					intDomain[:domainItems] << Md_DomainItem.unpack(hDoItem)
				end
			end
		end

		return intDomain
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.10.2 lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb