Exemplo n.º 1
0
 def from_obj(action_relationship_obj):
     if not action_relationship_obj:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = VocabString.from_obj(action_relationship_obj.get_Type())
     action_relationship_.action_references = [ActionReference.from_obj(x) for x in action_relationship_obj.get_Action_Reference()]
     return action_relationship_
Exemplo n.º 2
0
 def from_obj(action_relationship_obj):
     if not action_relationship_obj:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = VocabString.from_obj(action_relationship_obj.Type)
     action_relationship_.action_references = [ActionReference.from_obj(x) for x in action_relationship_obj.Action_Reference]
     return action_relationship_
Exemplo n.º 3
0
 def from_dict(action_relationship_dict):
     if not action_relationship_dict:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = VocabString.from_dict(action_relationship_dict.get('type'))
     action_relationship_.action_references = [ActionReference.from_dict(x) for x in action_relationship_dict.get('action_reference')]
     return action_relationship_
Exemplo n.º 4
0
 def from_dict(action_relationship_dict):
     if not action_relationship_dict:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = VocabString.from_dict(action_relationship_dict.get('type'))
     action_relationship_.action_references = [ActionReference.from_dict(x) for x in action_relationship_dict.get('action_reference', [])]
     return action_relationship_
Exemplo n.º 5
0
 def from_obj(action_relationship_obj):
     if not action_relationship_obj:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = ActionType.from_obj(action_relationship_obj.Type)
     action_relationship_.action_references = [ActionReference.from_obj(x) for x in action_relationship_obj.Action_Reference]
     return action_relationship_
Exemplo n.º 6
0
 def from_obj(action_relationship_obj):
     if not action_relationship_obj:
         return None
     action_relationship_ = ActionRelationship()
     action_relationship_.type = ActionType.from_obj(action_relationship_obj.get_Type())
     action_relationship_.action_references = [ActionReference.from_obj(x) for x in action_relationship_obj.get_Action_Reference()]
     return action_relationship_
Exemplo n.º 7
0
 def from_obj(candidate_indc_comp_obj):
     if not candidate_indc_comp_obj:
         return None
     candidate_indicator_composition_ = CandidateIndicatorComposition()
     candidate_indicator_composition_.operator = candidate_indc_comp_obj.get_operator()
     if len(candidate_indc_comp_obj.get_Behavior_Reference()) > 0:
         for behavior_reference_obj in candidate_indc_comp_obj.get_Behavior_Reference():
             candidate_indicator_composition_.behavior_references.append(BehaviorReference.from_obj(behavior_reference_obj))
     if len(candidate_indc_comp_obj.get_Action_Reference()) > 0:
         for action_reference_obj in candidate_indc_comp_obj.get_Action_Reference():
             candidate_indicator_composition_.action_references.append(ActionReference.from_obj(action_reference_obj))
     if len(candidate_indc_comp_obj.get_Object_Reference()) > 0:
         for object_reference_obj in candidate_indc_comp_obj.get_Object_Reference():
             candidate_indicator_composition_.object_references.append(ObjectReference.from_obj(object_reference_obj))
     if len(candidate_indc_comp_obj.get_Sub_Composition()) > 0:
         for sub_composition_obj in candidate_indc_comp_obj.get_Sub_Composition():
             candidate_indicator_composition_.sub_compositions.append(CandidateIndicatorComposition.from_obj(sub_composition_obj))
     return candidate_indicator_composition_
Exemplo n.º 8
0
 def from_dict(candidate_indc_comp_dict):
     if not candidate_indc_comp_dict:
         return None
     candidate_indicator_composition_ = CandidateIndicatorComposition()
     candidate_indicator_composition_.operator = candidate_indc_comp_dict.get('operator')
     if candidate_indc_comp_dict.get('behavior_references') is not None:
         for behavior_reference_dict in candidate_indc_comp_dict.get('behavior_references'):
             candidate_indicator_composition_.behavior_references.append(BehaviorReference.from_dict(behavior_reference_dict))
     if candidate_indc_comp_dict.get('action_references') is not None:
         for action_reference_dict in candidate_indc_comp_dict.get('action_references'):
             candidate_indicator_composition_.action_references.append(ActionReference.from_dict(action_reference_dict))
     if candidate_indc_comp_dict.get('object_references') is not None:
         for object_reference_dict in candidate_indc_comp_dict.get('object_references'):
             candidate_indicator_composition_.object_references.append(ObjectReference.from_dict(object_reference_dict))
     if candidate_indc_comp_dict.get('sub_compositions') is not None:
         for sub_composition_dict in candidate_indc_comp_dict.get('sub_compositions'):
             candidate_indicator_composition_.sub_compositions.append(CandidateIndicatorComposition.from_dict(sub_composition_dict))
     return candidate_indicator_composition_
Exemplo n.º 9
0
 def test_construction(self):
     aref = ActionReference(action_id="example:Action-1")
     logger.info(aref.to_xml())
     logger.info(aref.to_dict())
     self.assertTrue(b"example:Action-1" in aref.to_xml())
     self.assertTrue("example:Action-1" in aref.to_json())
Exemplo n.º 10
0
 def test_construction(self):
     aref = ActionReference(action_id="example:Action-1")
     print aref.to_xml()
     print aref.to_dict()
     self.assertTrue("example:Action-1" in aref.to_xml())
     self.assertTrue("example:Action-1" in aref.to_json())