def run(): annot = TextAnnotation(id='textAnnot1', name='This is an annotation') grp = Group(id='grp1', name='A group') obj = DataObject(id='dtObj1') ref = DataStoreReference(id='dtRef1') print (to_pretty_xml(annot.serialize())) print (to_pretty_xml(grp.serialize())) print (to_pretty_xml(obj.serialize())) print (to_pretty_xml(ref.serialize()))
def run(): t = Task(id='Receive Message', type=TaskType.User) e = Event(id='event_1', definition=EventDefinition.Message, type=EventType.Start) t1 = Task(id='Process Message',type=TaskType.Service) t.add_link(e) t.add_link(t1, Task.OUT) print (to_pretty_xml(t.serialize())) print (to_pretty_xml(e.serialize())) print (list(EventType))
def run(): p = Process(id='prc_1') sp1 = SubProcess(id='subprc_1', name='Perform Credit Check') e1 = Event(id='evt_start', name='Check Requested') e2 = Event(id='evt_check1', name='Credit Check Performed', type=EventType.IntermediateCatch, definition=EventDefinition.Signal) e3 = Event(id='evt_end', name='Credit Check Performed', type=EventType.End, definition=EventDefinition.Signal) t1 = Task(id='tsk1', name='Check for running instances') g = Gateway(id='gt1', name='Running instances of the same customer?') str1 = DataStoreReference(id='dtStr1') p.add('task', t1) p.add('event', e1, e2, e3) p.add('gateway', g) p.add('dataStore', str1) p.add('subProcess', sp1) e1.add_link(t1, Task.OUT) t1.add_link(g, Task.OUT) g.add_link(sp1, Task.OUT) g.add_link(e2, Task.OUT) e2.add_link(sp1, Task.OUT) sp1.add_link(e3, Task.OUT) t1.link_data(str1, DataAssocDirection.IN) print (to_pretty_xml(p.serialize()))
def run(): t1 = Task(id='t1', name='Testing Default Sequence') t2 = Task(id='t2', name='Displaying Results') # a = Linkable(name='yeah') # t1.add_link(t2, Task.IN) # print ('okay', to_pretty_xml(a.serialize())) # t1.add_link(t2, Task.OUT) s = SequenceFlow(id='seqId', source=t1, target=t2, type=SequenceType.DEFAULT) link = t1.add_link(t2) print(to_pretty_xml(s.serialize())) # print (to_pretty_xml(t2.serialize())) print(to_pretty_xml(link.serialize()))
def run(): process = Process(id='prc1', name='Main Participant') task1 = Task(id='tsk1', name='Connect to data object') task2 = Task(id='tsk2', name='Do Another Thing') start_event = Event(definition=EventDefinition.Escalation, type=EventType.Start) dtObj1 = DataObject(id='dtObj1', name='whatEverDtObj') dtStore = DataStoreReference(id='dtStore1', name='Database') # the direction of this assoc is IN in default task1.link_data(dtObj1, DataAssocDirection.IN) start_event.link_data(dtStore, DataAssocDirection.IN) print(to_pretty_xml(task1.serialize())) print(to_pretty_xml(dtObj1.serialize())) print(to_pretty_xml(dtObj1.reference.serialize()))
def run(): e = BPMNDIElement(id='di_e', element=Task(id='tsk1', name='TASK')) lbl = BPMNLabel(bounds=Bounds((10, 20), (100, 25))) shape = BPMNShape(bounds=Bounds((15, 13), (12, 13)), label=lbl) edge = BPMNEdge(id='edge_id', start=(15, 15), end=(30, 12), label=lbl) plane = BPMNPlane(element=edge) plane.add('edge', edge) plane.add('shape', shape) print(to_pretty_xml(plane.serialize()))
def run(): p = Process(id='prc_1', name='Participant 01') l1 = Lane(id='ln_1', name='Areda', process=p) l2 = Lane(id='ln_2', name='Areda', process=p) t1 = Task(id='tsk_1', name='Do something 1') t2 = Task(id='tsk_2', name='Do something 2') t3 = Task(id='tsk_3', name='Do something 3') l1.add('task', t1) l2.add('task', t2) l1.add('task', t3) print(to_pretty_xml(p.serialize()))
def run(): # Instanciation section p = Process(id='prc', name='participant1') sp = SubProcess(id='sub_prc', name='Evaluate Grans') e1 = Event(id='event_start', type=EventType.Start, definition=EventDefinition.Conditional) e2 = Event(id='event_compensation', type=EventType.IntermediateCatch, definition=EventDefinition.Compensation) e3 = Event(id='event_timer', type=EventType.IntermediateCatch, definition=EventDefinition.Timer) e4 = Event(id='event_error', type=EventType.IntermediateCatch, definition=EventDefinition.Error) e5 = Event(id='event_end', type=EventType.End, definition=EventDefinition.Message) t1 = Task(id='task_develop', name='Develop Criteria') t2 = Task(id='task_record', name='Record') t3 = Task(id='task_roll', name='Roll out Record') t4 = Task(id='task_timeout', name='Timeout Error') t5 = Task(id='task_any', name='Any Exception') # Links section p.add('subprocess', sp) p.add('task', t3, t4, t5) p.add('event', e1, e2, e3, e4, e5) sp.add('task', t1, t2) e2.attach(sp) e3.attach(sp) e4.attach(sp) sequence = e1.add_link(sp, Task.OUT) p.add('sequence', sequence) p.add('sequence', sp.add_link(e5, Task.OUT)) p.add('sequence', e2.add_link(t3, Task.OUT)) p.add('sequence', e3.add_link(t4, Task.OUT)) p.add('sequence', e4.add_link(t5, Task.OUT)) # print(to_pretty_xml(p.serialize())) # print(to_pretty_xml(sp.serialize())) print(to_pretty_xml(p.serialize()))
def run(): d = Definitions(author='Areda Ibrahim & Mohamed El Kalai') p1 = Process(id='prc_1', name='1st Approver', definitions=d) e1 = Event(id='evt_start_1', name='Approval Requested', definition=EventDefinition.Message) e2 = Event(id='evt_end_1', name='Task Completed', type=EventType.End) t1 = Task(id='tsk_1', name='evaluate request') t2 = Task(id='tsk_2', name='document and submit decision') p1.add('task', t1, t2) p1.add('event', e1, e2) print(to_pretty_xml(d.serialize()))
def run(): process = Process(id="proc", name='Participant') task = Task(id="mainTask", name="eat chinese food") startEvent = Event(id="start", type=EventType.Start, definition=EventDefinition.Default) endEvent = Event(id="end", type=EventType.End, definition=EventDefinition.Default) process.add('sequence', startEvent.add_link(task, Task.OUT)) process.add('sequence', task.add_link(endEvent, Task.OUT)) process.add('task', task) process.add('event', startEvent) process.add('event', endEvent) print(to_pretty_xml(process.serialize()))
def run(): # Instantiation Section p = Process(id='prc_1') e1 = Event(id='start', definition=EventDefinition.Default, type=EventType.Start, name='Complete Order') e2 = Event(id='rejected', definition=EventDefinition.Default, type=EventType.End, name='Rejected') e3 = Event(id='approved', definition=EventDefinition.Default, type=EventType.End, name='Approved') t1 = Task(id='tsk1', name='Approve Order', type=TaskType.User) t2 = Task(id='tsk2', name='Notification Order Approved', type=TaskType.Send) t3 = Task(id='tsk3', name='Notification order rejected', type=TaskType.Send) g = Gateway(id='gt1') # Flow/Link Section p.add('event', e1) p.add('event', e2) p.add('event', e3) p.add('task', t1) p.add('task', t2) p.add('task', t3) p.add('gateway', g) p.add('sequence', e1.add_link(t1, Task.OUT)) p.add('sequence', t1.add_link(g, Task.OUT)) p.add('sequence', g.add_link(t3, Task.OUT)) p.add('sequence', g.add_link(t2, Task.OUT)) p.add('sequence', t2.add_link(e3, Task.OUT)) p.add('sequence', t3.add_link(e2, Task.OUT)) print(to_pretty_xml(p.serialize()))
def run(): p = Process(id='prc_main', name='Purchase Process') t1 = Task(id='tsk1', name='Requisition') t2 = Task(id='tsk2', name='Dispatch product') t3 = Task(id='tsk3', name='Buy Product') e1 = Event(id='evnt_start') e2 = Event(id='evnt_end', type=EventType.End) g1 = Gateway(id='gt1', name='Product is available?') g2 = Gateway(id='gt2') lane1 = Lane(id='laneEmployee', name='Employee') lane2 = Lane(id='laneWarehouse', name='Warehouse') lane3 = Lane(id='lanePurchasing', name='Purchasing') p.add('lane', lane1, lane2, lane3) p.add('sequence', e1.add_link(t1, Task.OUT)) p.add('sequence', t1.add_link(g1, Task.OUT)) p.add('sequence', g1.add_link(g2, Task.OUT)) p.add('sequence', g1.add_link(t3, Task.OUT)) p.add('sequence', g2.add_link(t2, Task.OUT)) p.add('sequence', t2.add_link(e2, Task.OUT)) p.add('sequence', t3.add_link(g2, Task.OUT)) lane1.add('event', e1) lane1.add('task', t1) lane2.add('gateway', g1) lane2.add('gateway', g2) lane2.add('event', e2) lane2.add('task', t2) lane3.add('task', t3) print(to_pretty_xml(p.serialize()))
def run(): g = Gateway(type=GatewayType.Inclusive) for gt in list(GatewayType): print(to_pretty_xml(Gateway(type=gt).serialize()))
def run(): d = Definitions(author='Areda Ibrahim & Mohamed El Kalai') p1 = Process(id='prc_1', name='1st Approver', definitions=d) p2 = Process(id='prc_2', name='Process Engine', definitions=d) p3 = Process(id='prc_3', name='2nd Approver', definitions=d) e1 = Event(id='evt_start_1', name='Approval Requested', definition=EventDefinition.Message) e2 = Event(id='evt_end_1', name='Task Completed', type=EventType.End) t1 = Task(id='tsk_1', name='evaluate request') t2 = Task(id='tsk_2', name='document and submit decision') e4 = Event(id='evt_start_2', name='Approval Requested') e5 = Event(id='evt_end_2', name='Request Rejected <First Stage>', type=EventType.End) e6 = Event(id='evt_end_3', name='Request Rejected <Second Stage>', type=EventType.End) e7 = Event(id='evt_end_4', name='Request Approved', type=EventType.End) g1 = Gateway(id='gt_1', name='approved') g2 = Gateway(id='gt_2', name='approved') t3 = Task(id='tsk_3', type=TaskType.User, name='Decide on approval <1st stage>') t4 = Task(id='tsk_4', type=TaskType.User, name='Decide on approval <2nd stage>') e8 = Event(id='evt_start_3', name='Approval requested', definition=EventDefinition.Message) e9 = Event(id='evt_end_5', type=EventType.End, name='Task completed') t5 = Task(id='tsk_5', name='evaluate request') t6 = Task(id='tsk_5', name='document and submit decision') # Appending p1.add('task', t1, t2) p1.add('event', e1, e2) p2.add('task', t3, t4) p2.add('event', e4, e5, e6, e7) p2.add('gateway', g1, g2) p3.add('task', t5, t6) p3.add('event', e8, e9) # Linking p1.add('sequence', e1.add_link(t1)) p1.add('sequence', t1.add_link(t2)) p1.add('sequence', t2.add_link(e2)) p2.add('sequence', e4.add_link(t3)) p2.add('sequence', t3.add_link(g1)) p2.add('sequence', g1.add_link(t4)) p2.add('sequence', g1.add_link(e5)) p2.add('sequence', t4.add_link(g2)) p2.add('sequence', g2.add_link(e6)) p2.add('sequence', g2.add_link(e7)) p3.add('sequence', e8.add_link(t5)) p3.add('sequence', t5.add_link(t6)) p3.add('sequence', t6.add_link(e9)) d.add('message', MessageFlow(source=t3, target=e1)) d.add('message', MessageFlow(source=t2, target=t3)) d.add('message', MessageFlow(source=t4, target=e8)) d.add('message', MessageFlow(source=t6, target=t4)) print(to_pretty_xml(d.serialize()))