Skip to content

Commit

Permalink
update example 02
Browse files Browse the repository at this point in the history
  • Loading branch information
deemount committed Mar 16, 2024
1 parent 7814c3a commit 6d44775
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 59 deletions.
4 changes: 2 additions & 2 deletions examples/02/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/deemount/gobpmnByExample/examples/02
go 1.21.7

require (
github.com/deemount/gobpmnBuilder v0.0.0-20240315111814-b114d4d799fd
github.com/deemount/gobpmnBuilder v0.0.0-20240316083355-5dfdbda2bf8a
github.com/deemount/gobpmnCounter v0.0.0-20240312102840-227373d7f040
github.com/deemount/gobpmnHash v0.0.0-20240315111928-57ec04ea2163
github.com/deemount/gobpmnModels v0.0.0-20240315195348-76e2d8110fe8
github.com/deemount/gobpmnModels v0.0.0-20240316085912-7831ff39ffa4
)

require (
Expand Down
6 changes: 4 additions & 2 deletions examples/02/go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
github.com/deemount/gobpmnBuilder v0.0.0-20240315111814-b114d4d799fd h1:3Nc+mG2HNhD4P0gLddMKEx99BXRIAUS2+vQyfixDJ3I=
github.com/deemount/gobpmnBuilder v0.0.0-20240315111814-b114d4d799fd/go.mod h1:MpiuQyv295osxKuA/Jnu8Xq5zURvlLqYG1kUzj29Fnk=
github.com/deemount/gobpmnBuilder v0.0.0-20240316083355-5dfdbda2bf8a h1:gHfAYqNfTpTvLFwv2EyhMyvs9kzSSua68gxCwG6Klyo=
github.com/deemount/gobpmnBuilder v0.0.0-20240316083355-5dfdbda2bf8a/go.mod h1:MpiuQyv295osxKuA/Jnu8Xq5zURvlLqYG1kUzj29Fnk=
github.com/deemount/gobpmnCounter v0.0.0-20240312102840-227373d7f040 h1:vMsKGBWBsdy2UEDaOO+yCG4RLjYVyoLNARopS8o1/XM=
github.com/deemount/gobpmnCounter v0.0.0-20240312102840-227373d7f040/go.mod h1:gtlVIb4tlWVLxCZmme7ORdXFpbeVajRXKCI4KtaQ0l0=
github.com/deemount/gobpmnHash v0.0.0-20240315111928-57ec04ea2163 h1:5Tw5ltCBflq+1nSMYZzq6F6fHrjRCZG5BAK6I0eukQg=
github.com/deemount/gobpmnHash v0.0.0-20240315111928-57ec04ea2163/go.mod h1:OXXe8NaxMtfeDVH2/IgpYSJPm2TnzGbQnl1tzClGwLs=
github.com/deemount/gobpmnModels v0.0.0-20240315195348-76e2d8110fe8 h1:GIBwEU2hQIfXphDxI6Anv3dwO4Iorp6EFMRgTFIZ3Co=
github.com/deemount/gobpmnModels v0.0.0-20240315195348-76e2d8110fe8/go.mod h1:bv2zkkqCzzaGV5gYP3gDQfMXuqjxMBjSl9GjHFo2mY8=
github.com/deemount/gobpmnModels v0.0.0-20240316085912-7831ff39ffa4 h1:xAqg4ZIeMDxME0O8O4UpwpcS3AeXB+3IspauNX2G2AA=
github.com/deemount/gobpmnModels v0.0.0-20240316085912-7831ff39ffa4/go.mod h1:bv2zkkqCzzaGV5gYP3gDQfMXuqjxMBjSl9GjHFo2mY8=
github.com/deemount/gobpmnReflection v0.0.0-20240312080001-0601dc0824b6 h1:ZRHog+R0LurHMet3bliWHEUDM4z6mTe7j/eVGocMyrs=
github.com/deemount/gobpmnReflection v0.0.0-20240312080001-0601dc0824b6/go.mod h1:j8WCmdzEkTq/FVsWJAdoPtjTiRryLZp/WjOLcIqtt5c=
github.com/deemount/gobpmnTypes v0.0.0-20240315111519-43046016ad9f h1:0gux6KtY8XgrN/L9tiZ7B+wx3th7x4hBYu1+wtUkHYY=
Expand Down
115 changes: 60 additions & 55 deletions examples/02/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ type (

// ExampleProcess ...
ExampleProcess struct {
Def core.DefinitionsRepository
IsExecutable bool
TenantProcess gobpmn_hash.Injection
TenantStartEvent gobpmn_hash.Injection
FromTenantStartEvent gobpmn_hash.Injection
TenantTask gobpmn_hash.Injection
FromTenantTask gobpmn_hash.Injection
TenantEndEvent gobpmn_hash.Injection
Def core.DefinitionsRepository
IsExecutable bool
Process gobpmn_hash.Injection
StartEvent gobpmn_hash.Injection
FromStartEvent gobpmn_hash.Injection
Task gobpmn_hash.Injection
FromTask gobpmn_hash.Injection
EndEvent gobpmn_hash.Injection
}
)

Expand All @@ -48,8 +48,6 @@ func New() Proxy {
c := count.In(ExampleProcess{})
p := hash.Inject(ExampleProcess{}).(ExampleProcess)

//log.Printf("ExampleProcess: %+v\n", c)

p.Def = core.NewDefinitions()
p.Def.SetDefaultAttributes()

Expand All @@ -66,7 +64,7 @@ func New() Proxy {
func (p ExampleProcess) Build() ExampleProcess {
p.elements()
p.attributes()
p.setTenantProcessArgs()
p.setProcess()
p.setStartEvent()
p.setTask()
p.setEndEvent()
Expand All @@ -82,83 +80,90 @@ func (p ExampleProcess) Call() core.DefinitionsRepository {
* @Local Methods
*/

// attributes ...
func (p *ExampleProcess) attributes() {
p.Def.SetDefaultAttributes()
}

// elements ...
func (p *ExampleProcess) elements() {
p.tenantProcess().SetStartEvent(1)
p.tenantProcess().SetTask(1)
p.tenantProcess().SetEndEvent(1)
p.tenantProcess().SetSequenceFlow(2)
p.process().SetStartEvent(1)
p.process().SetTask(1)
p.process().SetEndEvent(1)
p.process().SetSequenceFlow(2)
}

/****************************************************************************************/

func (p ExampleProcess) process() *process.Process {
return p.Def.GetProcess(0)
}

func (p ExampleProcess) startEvent() *elements.StartEvent {
return p.process().GetStartEvent(0)
}

func (p ExampleProcess) task() *tasks.Task {
return p.process().GetTask(0)
}

func (p ExampleProcess) endEvent() *elements.EndEvent {
return p.process().GetEndEvent(0)
}

// setTenantProcess ...
func (p *ExampleProcess) setTenantProcessArgs() {
p.tenantProcess().SetID("process", p.TenantProcess.Suffix)
p.tenantProcess().SetIsExecutable(p.IsExecutable)
/****************************************************************************************/

// setProcess ...
func (p *ExampleProcess) setProcess() {
p.process().SetID("process", p.Process.Suffix)
p.process().SetIsExecutable(p.IsExecutable)
}

// setStartEvent ...
func (p *ExampleProcess) setStartEvent() {
el := p.tenantStartEvent()
el.SetID("startevent", p.TenantStartEvent.Suffix)
el := p.startEvent()
el.SetID("startevent", p.StartEvent.Suffix)
el.SetName("Begin of Process")
el.SetOutgoing(1)
el.GetOutgoing(0).SetFlow(p.TenantTask.Suffix)
el.GetOutgoing(0).SetFlow(p.Task.Suffix)
p.fromStartEvent()
}

// fromStartEvent ...
func (p *ExampleProcess) fromStartEvent() {
el := p.tenantProcess().GetSequenceFlow(0)
el.SetID("flow", p.FromTenantStartEvent.Suffix)
el.SetSourceRef("startevent", p.TenantStartEvent.Suffix)
el.SetTargetRef("activity", p.TenantTask.Suffix)
el := p.process().GetSequenceFlow(0)
el.SetID("flow", p.FromStartEvent.Suffix)
el.SetSourceRef("startevent", p.StartEvent.Suffix)
el.SetTargetRef("activity", p.Task.Suffix)
}

// setTask ...
func (p *ExampleProcess) setTask() {
el := p.tenantTask()
el.SetID("activity", p.TenantTask.Suffix)
el := p.task()
el.SetID("activity", p.Task.Suffix)
el.SetName("Task")
el.SetIncoming(1)
el.GetIncoming(0).SetFlow(p.FromTenantStartEvent.Suffix)
el.GetIncoming(0).SetFlow(p.FromStartEvent.Suffix)
el.SetOutgoing(1)
el.GetOutgoing(0).SetFlow(p.TenantEndEvent.Suffix)
el.GetOutgoing(0).SetFlow(p.EndEvent.Suffix)
p.fromTask()
}

// fromTask ...
func (p *ExampleProcess) fromTask() {
el := p.tenantProcess().GetSequenceFlow(1)
el.SetID("flow", p.FromTenantTask.Suffix)
el.SetSourceRef("activity", p.TenantTask.Suffix)
el.SetTargetRef("endevent", p.TenantEndEvent.Suffix)
el := p.process().GetSequenceFlow(1)
el.SetID("flow", p.FromTask.Suffix)
el.SetSourceRef("activity", p.Task.Suffix)
el.SetTargetRef("event", p.EndEvent.Suffix)
}

// setEndEvent ...
func (p *ExampleProcess) setEndEvent() {
el := p.tenantProcess().GetEndEvent(0)
el.SetID("endevent", p.TenantEndEvent.Suffix)
el := p.endEvent()
el.SetID("event", p.EndEvent.Suffix)
el.SetName("End of Process")
el.SetIncoming(1)
el.GetIncoming(0).SetFlow(p.FromTenantTask.Suffix)
}

/**** Default Setter/Getter ****/

func (p *ExampleProcess) attributes() {
p.Def.SetDefaultAttributes()
}

func (p ExampleProcess) tenantProcess() *process.Process {
return p.Def.GetProcess(0)
}

func (p ExampleProcess) tenantStartEvent() *elements.StartEvent {
return p.tenantProcess().GetStartEvent(0)
}

func (p ExampleProcess) tenantTask() *tasks.Task {
return p.tenantProcess().GetTask(0)
el.GetIncoming(0).SetFlow(p.FromTask.Suffix)
}

/*
Expand Down

0 comments on commit 6d44775

Please sign in to comment.