Sha256: c44356ff11be3b9662b1ee76beaac0ebba051078091ed87aef18510bd1adb388

Contents?: true

Size: 1.88 KB

Versions: 31

Compression:

Stored size: 1.88 KB

Contents

# unpack vector object
# Reader - ADIwg JSON to internal data structure

# History:
# 	Stan Smith 2016-10-19 original script

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module VectorObject

                    def self.unpack(hVecObj, responseObj)

                        # return nil object if input is empty
                        if hVecObj.empty?
                            responseObj[:readerExecutionMessages] << 'Vector Object object is empty'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intVecObj = intMetadataClass.newVectorObject

                        # vector object - object type (required)
                        if hVecObj.has_key?('objectType')
                            if hVecObj['objectType'] != ''
                                intVecObj[:objectType] = hVecObj['objectType']
                            end
                        end
                        if intVecObj[:objectType].nil?
                            responseObj[:readerExecutionMessages] << 'Vector Object attribute objectType is missing'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # vector object - object count
                        if hVecObj.has_key?('objectCount')
                            if hVecObj['objectCount'] != ''
                                intVecObj[:objectCount] = hVecObj['objectCount']
                            end
                        end

                        return intVecObj

                    end

                end

            end
        end
    end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.3.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.2.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.1.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.1.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.1.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb
adiwg-mdtranslator-2.0.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb