module ADIWG::Mdtranslator::Readers::MdJson::EntityIndex
Public Class Methods
unpack(hIndex, responseObj, inContext = nil)
click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb, line 20 def self.unpack(hIndex, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson # return nil object if input is empty if hIndex.empty? @MessagePath.issueWarning(260, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new intIndex = intMetadataClass.newEntityIndex # entity index - code name (required) # return nil if no entity index is provided if hIndex.has_key?('codeName') intIndex[:indexCode] = hIndex['codeName'] end if intIndex[:indexCode].nil? || intIndex[:indexCode] == '' @MessagePath.issueError(261, responseObj, inContext) end # entity index - allow duplicates (required) if hIndex.has_key?('allowDuplicates') if hIndex['allowDuplicates'] === true intIndex[:duplicate] = true end end # entity index - attribute list [] (required) # return nil if no attribute list is provided if hIndex.has_key?('attributeCodeName') intIndex[:attributeNames] = hIndex['attributeCodeName'] end if intIndex[:attributeNames].empty? @MessagePath.issueError(262, responseObj, inContext) end return intIndex end