Пример #1
0
 def __init__(self, name=None, source=None, target=None, guard=None):
     # TODO: bool(source) evals to False if IControlNode.providedBy(source)
     if IActivityNode.providedBy(source):
         self.source = source
     if IActivityNode.providedBy(target):
         self.target = target
     self.guard = guard
     super(ActivityEdge, self).__init__(name)
Пример #2
0
    def check_model_constraints(self):
        super(ActivityEdge, self).check_model_constraints()
        try:
            assert self.source or self.target is not None
        except AssertionError:
            raise ModelIllFormedException,\
                  str(self) +  " " +\
                  "An ActivityEdge must have source and target set"

        # [1]
        try:
            assert self.source.activity is self.target.activity
        except AssertionError:
            raise ModelIllFormedException,\
                  str(self) +  " " +\
                  "Source and target must be in the same activity"

        # [2]
        try:
            assert self.__parent__ is not None
            assert IActivity.providedBy(self.__parent__)
        except AssertionError:
            raise ModelIllFormedException,\
                  str(self) +  " " +\
                  "An ActivityEdge must have an Activity as parent"

        try:
            assert IActivityNode.providedBy(self.source)
        except AssertionError:
            raise ModelIllFormedException,\
                  str(self) +  " " +\
                  "An ActivityEdge must have an ActivityNode as source"

        try:
            assert IActivityNode.providedBy(self.target)
        except AssertionError:
            raise ModelIllFormedException,\
                  str(self) +  " " +\
                  "An ActivityEdge must have an ActivityNode as target"