Exemplo n.º 1
0
    def serialize(self):
        # Fix Tag Name
        eventElement = Linkable.serialize(self)
        eventElement.tag = bpmn + ('boundary' if self.attachedTo != None else
                                   camel_case(self.type.name)) + 'Event'
        # Add Cancel Attribute
        if self.attachedTo != None:
            eventElement.attrib['cancelActivity'] = str(self.cancelActivity)
            eventElement.attrib['attachedToRef'] = str(self.attachedTo.id)
        # Add Definition Element
        if self.definition != EventDefinition.Default:
            eventDefElement = et.Element(
                camel_case(self.definition.name) + 'EventDefinition')
            eventDefElement.attrib[
                'id'] = f'{self.id}_{self.definition.name}Definition'
            eventElement.append(eventDefElement)

        return eventElement
Exemplo n.º 2
0
    def serialize(self):
        e = Linkable.serialize(self)

        if self.flag in [
                ActivityFlag.ParallelMultiple, ActivityFlag.SequentialMultiple,
                ActivityFlag.Loop
        ]:
            # instantiate characteristics element
            element = et.Element(bpmn +
                                 ('standard' if self.flag ==
                                  ActivityFlag.Loop else 'multiInstance') +
                                 'LoopCharacteristics')
            # mark as sequential
            if self.flag == ActivityFlag.SequentialMultiple:
                element.attrib['isSequential'] = 'true'
            # add characteristics element
            e.append(element)

        return e
Exemplo n.º 3
0
 def serialize(self):
     element = Linkable.serialize(self)
     element.tag = bpmn + camel_case(self.type.name) + 'Gateway'
     return element
Exemplo n.º 4
0
def run_test():
    l = Linkable(id='whatever')
    print(et.tostring(l.serialize()))