Exemple #1
0
    def to_obj(self):
        attr_obj = self._binding_class()

        attr_obj.set_valueOf_(normalize_to_xml(self.serialized_value))
        # For now, don't output the datatype, as it is not required and is
        # usually not needed, as it can be inferred from the context.
        #attr_obj.set_datatype(self.datatype)

        if self.id_ is not None:
            attr_obj.set_id(self.id_)
        if self.idref is not None:
            attr_obj.set_idref(self.idref)
        if self.appears_random is not None:
            attr_obj.set_appears_random(self.appears_random)
        if self.is_obfuscated is not None:
            attr_obj.set_is_obfuscated(self.is_obfuscated)
        if self.obfuscation_algorithm_ref is not None:
            attr_obj.set_obfuscation_algorithm_ref(self.obfuscation_algorithm_ref)
        if self.is_defanged is not None:
            attr_obj.set_is_defanged(self.is_defanged)
        if self.defanging_algorithm_ref is not None:
            attr_obj.set_defanging_algorithm_ref(self.defanging_algorithm_ref)
        if self.refanging_transform_type is not None:
            attr_obj.set_refanging_transform_type(self.refanging_transform_type)
        if self.refanging_transform is not None:
            attr_obj.set_refanging_transform(self.refanging_transform)
        #Datatype output logic
        if self._force_datatype:
            attr_obj.set_datatype(self.datatype)
        else:
            attr_obj.set_datatype(None)

        PatternFieldGroup.to_obj(self, attr_obj)

        return attr_obj
Exemple #2
0
    def to_obj(self):
        vocab_obj = common_binding.ControlledVocabularyStringType()

        vocab_obj.set_valueOf_(normalize_to_xml(self.value, self.delimiter))
        vocab_obj.set_xsi_type(self.xsi_type)

        if self.vocab_name is not None:
            vocab_obj.set_vocab_name(self.vocab_name)
        if self.vocab_reference is not None:
            vocab_obj.set_vocab_reference(self.vocab_reference)

        PatternFieldGroup.to_obj(self, vocab_obj)

        return vocab_obj
Exemple #3
0
    def to_obj(self):
        vocab_obj = common_binding.ControlledVocabularyStringType()

        vocab_obj.set_valueOf_(normalize_to_xml(self.value))
        vocab_obj.set_xsi_type(self.xsi_type)

        if self.vocab_name is not None:
            vocab_obj.set_vocab_name(self.vocab_name)
        if self.vocab_reference is not None:
            vocab_obj.set_vocab_reference(self.vocab_reference)

        PatternFieldGroup.to_obj(self, vocab_obj)

        return vocab_obj
Exemple #4
0
    def to_obj(self):
        if not self.is_valid():
            raise ValueError("Vocab being used has not been specified")

        vocab_obj = common_binding.ControlledVocabularyStringType()

        vocab_obj.set_valueOf_(normalize_to_xml(self.value, self.delimiter))
        vocab_obj.set_xsi_type(self.xsi_type)

        if self.vocab_name is not None:
            vocab_obj.set_vocab_name(self.vocab_name)
        if self.vocab_reference is not None:
            vocab_obj.set_vocab_reference(self.vocab_reference)

        PatternFieldGroup.to_obj(self, vocab_obj)

        return vocab_obj
    def to_obj(self):
        if not self.is_valid():
            raise ValueError("Vocab being used has not been specified")

        vocab_obj = common_binding.ControlledVocabularyStringType()

        vocab_obj.set_valueOf_(normalize_to_xml(self.value, self.delimiter))
        vocab_obj.set_xsi_type(self.xsi_type)

        if self.vocab_name is not None:
            vocab_obj.set_vocab_name(self.vocab_name)
        if self.vocab_reference is not None:
            vocab_obj.set_vocab_reference(self.vocab_reference)

        PatternFieldGroup.to_obj(self, vocab_obj)

        return vocab_obj
Exemple #6
0
    def to_obj(self, return_obj=None, ns_info=None):
        self._collect_ns_info(ns_info)

        if not return_obj:
            return_obj = self._binding_class()
            
        return_obj.valueOf_ = normalize_to_xml(self.value, self.delimiter)
        return_obj.xsi_type = self.xsi_type

        if self.vocab_name is not None:
            return_obj.vocab_name = self.vocab_name
        if self.vocab_reference is not None:
            return_obj.vocab_reference = self.vocab_reference

        PatternFieldGroup.to_obj(self, return_obj=return_obj, ns_info=ns_info)

        return return_obj
Exemple #7
0
    def to_obj(self, return_obj=None, ns_info=None):
        self._collect_ns_info(ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.valueOf_ = normalize_to_xml(self.value, self.delimiter)
        return_obj.xsi_type = self.xsi_type

        if self.vocab_name is not None:
            return_obj.vocab_name = self.vocab_name
        if self.vocab_reference is not None:
            return_obj.vocab_reference = self.vocab_reference

        PatternFieldGroup.to_obj(self, return_obj=return_obj, ns_info=ns_info)

        return return_obj
Exemple #8
0
    def to_obj(self, return_obj=None, ns_info=None):
        if not self.is_valid():
            raise ValueError("Vocab being used has not been specified")

        self._collect_ns_info(ns_info)
        vocab_obj = common_binding.ControlledVocabularyStringType()

        vocab_obj.valueOf_ = normalize_to_xml(self.value, self.delimiter)
        vocab_obj.xsi_type = self.xsi_type

        if self.vocab_name is not None:
            vocab_obj.vocab_name = self.vocab_name
        if self.vocab_reference is not None:
            vocab_obj.vocab_reference = self.vocab_reference

        PatternFieldGroup.to_obj(self, return_obj=vocab_obj, ns_info=ns_info)

        return vocab_obj
Exemple #9
0
    def to_obj(self, return_obj=None, ns_info=None):
        self._collect_ns_info(ns_info)

        attr_obj = self._binding_class()
        attr_obj.set_valueOf_(
            normalize_to_xml(self.serialized_value, self.delimiter))
        # For now, don't output the datatype, as it is not required and is
        # usually not needed, as it can be inferred from the context.
        #attr_obj.datatype = self.datatype

        if self.id_ is not None:
            attr_obj.id = self.id_
        if self.idref is not None:
            attr_obj.idref = self.idref
        if self.appears_random is not None:
            attr_obj.appears_random = self.appears_random
        if self.is_obfuscated is not None:
            attr_obj.is_obfuscated = self.is_obfuscated
        if self.obfuscation_algorithm_ref is not None:
            attr_obj.obfuscation_algorithm_ref = self.obfuscation_algorithm_ref
        if self.is_defanged is not None:
            attr_obj.is_defanged = self.is_defanged
        if self.defanging_algorithm_ref is not None:
            attr_obj.defanging_algorithm_ref = self.defanging_algorithm_ref
        if self.refanging_transform_type is not None:
            attr_obj.refanging_transform_type = self.refanging_transform_type
        if self.refanging_transform is not None:
            attr_obj.refanging_transform = self.refanging_transform
        if self.observed_encoding is not None:
            attr_obj.observed_encoding = self.observed_encoding
        #Datatype output logic
        if self._force_datatype or (self.datatype != self.default_datatype):
            attr_obj.datatype = self.datatype
        else:
            attr_obj.datatype = None

        PatternFieldGroup.to_obj(self, return_obj=attr_obj, ns_info=ns_info)

        return attr_obj
Exemple #10
0
    def to_obj(self, return_obj=None, ns_info=None):
        self._collect_ns_info(ns_info)

        attr_obj = self._binding_class()
        attr_obj.set_valueOf_(normalize_to_xml(self.serialized_value,
                                               self.delimiter))
        # For now, don't output the datatype, as it is not required and is
        # usually not needed, as it can be inferred from the context.
        #attr_obj.datatype = self.datatype

        if self.id_ is not None:
            attr_obj.id = self.id_
        if self.idref is not None:
            attr_obj.idref = self.idref
        if self.appears_random is not None:
            attr_obj.appears_random = self.appears_random
        if self.is_obfuscated is not None:
            attr_obj.is_obfuscated = self.is_obfuscated
        if self.obfuscation_algorithm_ref is not None:
            attr_obj.obfuscation_algorithm_ref = self.obfuscation_algorithm_ref
        if self.is_defanged is not None:
            attr_obj.is_defanged = self.is_defanged
        if self.defanging_algorithm_ref is not None:
            attr_obj.defanging_algorithm_ref = self.defanging_algorithm_ref
        if self.refanging_transform_type is not None:
            attr_obj.refanging_transform_type = self.refanging_transform_type
        if self.refanging_transform is not None:
            attr_obj.refanging_transform = self.refanging_transform
        if self.observed_encoding is not None:
            attr_obj.observed_encoding = self.observed_encoding
        #Datatype output logic
        if self._force_datatype or (self.datatype != self.default_datatype):
            attr_obj.datatype = self.datatype
        else:
            attr_obj.datatype = None

        PatternFieldGroup.to_obj(self, return_obj=attr_obj, ns_info=ns_info)

        return attr_obj
Exemple #11
0
    def to_obj(self):
        attr_obj = self._binding_class()

        attr_obj.set_valueOf_(normalize_to_xml(self.serialized_value,
                                               self.delimiter))
        # For now, don't output the datatype, as it is not required and is
        # usually not needed, as it can be inferred from the context.
        #attr_obj.set_datatype(self.datatype)

        if self.id_ is not None:
            attr_obj.set_id(self.id_)
        if self.idref is not None:
            attr_obj.set_idref(self.idref)
        if self.appears_random is not None:
            attr_obj.set_appears_random(self.appears_random)
        if self.is_obfuscated is not None:
            attr_obj.set_is_obfuscated(self.is_obfuscated)
        if self.obfuscation_algorithm_ref is not None:
            attr_obj.set_obfuscation_algorithm_ref(self.obfuscation_algorithm_ref)
        if self.is_defanged is not None:
            attr_obj.set_is_defanged(self.is_defanged)
        if self.defanging_algorithm_ref is not None:
            attr_obj.set_defanging_algorithm_ref(self.defanging_algorithm_ref)
        if self.refanging_transform_type is not None:
            attr_obj.set_refanging_transform_type(self.refanging_transform_type)
        if self.refanging_transform is not None:
            attr_obj.set_refanging_transform(self.refanging_transform)
        if self.observed_encoding is not None:
            attr_obj.set_observed_encoding(self.observed_encoding)
        #Datatype output logic
        if self._force_datatype or (self.datatype != self.default_datatype):
            attr_obj.set_datatype(self.datatype)
        else:
            attr_obj.set_datatype(None)

        PatternFieldGroup.to_obj(self, attr_obj)

        return attr_obj
 def test_list_dates(self):
     dt = DateTime([self.dt, self.dt, self.dt])
     self.assertEqual(3, len(dt.value))
     expected = "{0}{1}{0}{1}{0}".format(self.dt.isoformat(), "##comma##")
     actual = normalize_to_xml(dt.serialized_value)
     self.assertEqual(expected, actual)
Exemple #13
0
 def to_obj(self, ns_info=None):
     obj = super(VocabString, self).to_obj(ns_info=ns_info)
     obj.valueOf_ = normalize_to_xml(self.value, self.delimiter)
     return obj
Exemple #14
0
 def to_obj(self, ns_info=None):
     attr_obj = super(BaseProperty, self).to_obj(ns_info=ns_info)
     attr_obj.datatype = self._datatype_serialized_value()
     attr_obj.valueOf_ = normalize_to_xml(self.serialized_value,
                                          self.delimiter)
     return attr_obj
Exemple #15
0
 def test_list_dates(self):
     dt = DateTime([self.dt, self.dt, self.dt])
     self.assertEqual(3, len(dt.value))
     expected = "{0}{1}{0}{1}{0}".format(self.dt.isoformat(), DEFAULT_DELIM)
     actual = normalize_to_xml(dt.serialized_value, DEFAULT_DELIM)
     self.assertEqual(expected, actual)
Exemple #16
0
 def to_obj(self, ns_info=None):
     obj = super(VocabString, self).to_obj(ns_info=ns_info)
     obj.valueOf_ = normalize_to_xml(self.value, self.delimiter)
     return obj
 def to_obj(self, ns_info=None):
     attr_obj = super(BaseProperty, self).to_obj(ns_info=ns_info)
     attr_obj.datatype = self._datatype_serialized_value()
     attr_obj.valueOf_ = normalize_to_xml(self.serialized_value,
                                          self.delimiter)
     return attr_obj