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"
def __init__(self, activity): try: assert(IActivity.providedBy(activity)) except AssertionError: raise ActivityRuntimeError,\ " ActivityRuntime must be initialized with an Activity instance" self.activity = activity self.token_pool = TokenPool()
def check_model_constraints(self): super(ActivityNode, self).check_model_constraints() try: assert self.__parent__ is not None assert IActivity.providedBy(self.__parent__) except AssertionError: raise ModelIllFormedException,\ str(self) + " " +\ "An ActivityNode must have an Activity as parent"