Documentation ¶
Index ¶
- func AddElementToProcess(process *Process, xe any, elementType, elementId string) error
- func AddElementToSubProcess(process *Process, subprocess *SubProcess, xe any, ...) error
- func CreateElements(process *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func GenerateCode(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func GenerateCodeForSingleOutgoingElement(currentElement *Element, outgoingElements []*Element, process *Process, ...) string
- func GenerateNextStateCode(element any, process *Process, processor ElementProcessor, ps *ProcessorSet)
- func GetModuleName(fileName string) (string, error)
- func IsBPMN(input string) bool
- func IsDir(input string) bool
- type Element
- type ElementProcessor
- type EndEventProcessor
- func (ep EndEventProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (ep EndEventProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (ep EndEventProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (ep EndEventProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type ExclusiveGatewayProcessor
- func (ep ExclusiveGatewayProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (ep ExclusiveGatewayProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (ep ExclusiveGatewayProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (ep ExclusiveGatewayProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type IDName
- type Incoming
- type Outgoing
- type OutputDefProcessCode
- type ParallelGatewayProcessor
- func (pp ParallelGatewayProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (pp ParallelGatewayProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (pp ParallelGatewayProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (pp ParallelGatewayProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type Process
- type ProcessCode
- type ProcessGenerator
- type ProcessorSet
- type Script
- type ScriptProcessor
- func (sp ScriptProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (sp ScriptProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (sp ScriptProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (sp ScriptProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type SequenceFlowProcessor
- func (sf SequenceFlowProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (sf SequenceFlowProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (sf SequenceFlowProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (sf SequenceFlowProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type StartEventProcessor
- func (sp StartEventProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (sp StartEventProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (sp StartEventProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (sp StartEventProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type SubProcess
- type SubProcessProcessor
- func (s SubProcessProcessor) CreateElements(process *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (s SubProcessProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (s SubProcessProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (s SubProcessProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type UserTaskProcessor
- func (up UserTaskProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, ...) error
- func (up UserTaskProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
- func (up UserTaskProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
- func (up UserTaskProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ...) string
- type XMLBPMNDefinitions
- type XMLBPMNElements
- type XMLBPMNProcess
- type XMLBPMNStartEvent
- type XMLConditionExpression
- type XMLEndEvent
- type XMLExclusiveGateway
- type XMLIDName
- type XMLIncomingElements
- type XMLMultiInstanceLoopCharacteristics
- type XMLOutgoingElements
- type XMLParallelGateway
- type XMLScript
- type XMLScriptTask
- type XMLSequenceFlow
- type XMLSubProcess
- type XMLTimeCycle
- type XMLTimerEventDefinition
- type XMLUserTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddElementToProcess ¶ added in v0.9.0
AddElementToProcess creates a new element based on the XML element, type, and id and adds it to the current process and lookup for all elements in the process
func AddElementToSubProcess ¶ added in v0.9.0
func AddElementToSubProcess(process *Process, subprocess *SubProcess, xe any, elementType, elementId string) error
AddElementToSubProcess creates a new element based on the XML element, type, and id and adds it to the current subprocess and lookup for all elements in the process
func CreateElements ¶ added in v0.9.0
func CreateElements(process *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
CreateElements executes the element processors to create elements based on the XML BPMN elements. The elements are used for code generattion.
func GenerateCode ¶ added in v0.9.0
func GenerateCode(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
GenerateCode generates the code for a process by sequentially calling the element processors in order. Order can matter in some cases such as subprocesses.
func GenerateCodeForSingleOutgoingElement ¶ added in v0.9.0
func GenerateCodeForSingleOutgoingElement(currentElement *Element, outgoingElements []*Element, process *Process, ps *ProcessorSet) string
GenerateCodeForSingleOutgoingElement generates the code for the current element assuming there is only one outgoing element.
func GenerateNextStateCode ¶ added in v0.9.0
func GenerateNextStateCode(element any, process *Process, processor ElementProcessor, ps *ProcessorSet)
GenerateNextStateCode generates the code for the next state that comes after the current BPMN element
func GetModuleName ¶ added in v0.9.0
GetModuleName gets the name of a module given a fileName for the go.mod
Types ¶
type Element ¶
func GetProcessElement ¶ added in v0.9.0
GetProcessElement looks up an element in a process by element id
func GetProcessOutgoingElements ¶ added in v0.9.0
GetProcessOutgoingElements returns the outgoing elements for an element. If there are no outgoing elements it returns nil
type ElementProcessor ¶ added in v0.9.0
type ElementProcessor interface { // CreateElements creates new elements and adds them to the process and/or subprocess for the given element BPMN processor type CreateElements(process *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error // GenerateElementNextStateCodes generates the code for the next state for each element of the element BPMN processor type GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet) // GenerateNextStateCode generates the code of the next elements for the current element GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string // GenerateCodeForNewElement generates code for a new instance of this BPMN element GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string }
ElementProcessor generates code for a specific BPMN element type
type EndEventProcessor ¶ added in v0.9.0
type EndEventProcessor struct { }
func (EndEventProcessor) CreateElements ¶ added in v0.9.0
func (ep EndEventProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (EndEventProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (ep EndEventProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (EndEventProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (ep EndEventProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (EndEventProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (ep EndEventProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type ExclusiveGatewayProcessor ¶ added in v0.9.0
type ExclusiveGatewayProcessor struct { }
func (ExclusiveGatewayProcessor) CreateElements ¶ added in v0.9.0
func (ep ExclusiveGatewayProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (ExclusiveGatewayProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (ep ExclusiveGatewayProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (ExclusiveGatewayProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (ep ExclusiveGatewayProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (ExclusiveGatewayProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (ep ExclusiveGatewayProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type OutputDefProcessCode ¶
type OutputDefProcessCode struct { InputFile string // Input BPMN file path including file name OutputFile string // Output go code path including file name Defs *XMLBPMNDefinitions OutputCode *ProcessCode // Output code PkgName string }
type ParallelGatewayProcessor ¶ added in v0.9.0
type ParallelGatewayProcessor struct { }
func (ParallelGatewayProcessor) CreateElements ¶ added in v0.9.0
func (pp ParallelGatewayProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (ParallelGatewayProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (pp ParallelGatewayProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (ParallelGatewayProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (pp ParallelGatewayProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (ParallelGatewayProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (pp ParallelGatewayProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type ProcessCode ¶
type ProcessGenerator ¶
type ProcessGenerator struct { // Input BPMN file or path to process BPMN files Input string // Output BPMN file or path for generated code Output string // Generates the output file path/name for a given input file, and the input/output args. OutputFileNameGenerator func(inputFile string, process *XMLBPMNProcess, input, output string, isOutputDir bool) string // Stores output definitions and code given input file path and name OutputGen map[string]*OutputDefProcessCode ProcessTemplate string ProcessorSet *ProcessorSet PackageName string }
ProcessGenerator generates go code for a process
func NewProcessGenerator ¶
func NewProcessGenerator(input, output string) *ProcessGenerator
func (*ProcessGenerator) GenerateAndWriteCodeFromBPMN ¶
func (p *ProcessGenerator) GenerateAndWriteCodeFromBPMN() error
type ProcessorSet ¶ added in v0.9.0
type ProcessorSet struct { ElementProcessors []ElementProcessor // Ordered sequence of element processors ElementProcessorMap map[string]ElementProcessor // Look up processors by key }
ProcessorSet contains a set of processors
func NewDefaultProcessorSet ¶ added in v0.9.0
func NewDefaultProcessorSet() *ProcessorSet
NewDefaultProcessorSet creates the default processor set
func NewProcessorSet ¶ added in v0.9.0
func NewProcessorSet() *ProcessorSet
NewProcessorSet creates an empty processor set. A custom set of element processors may be created by calling AddElementProcessor
func (*ProcessorSet) AddElementProcessor ¶ added in v0.9.0
func (p *ProcessorSet) AddElementProcessor(elementType string, e ElementProcessor)
AddElementProcessor adds an element processor to be executed by the code generator in the order they are added. Order may matter for some processors such as subprocesses.
func (*ProcessorSet) SetElementProcessor ¶ added in v0.9.0
func (p *ProcessorSet) SetElementProcessor(elementType string, e ElementProcessor)
SetElementProcessor sets the processor for a specific element type. If a processor already exists, it is replaced with the processor passed in
type ScriptProcessor ¶ added in v0.9.0
type ScriptProcessor struct { }
func (ScriptProcessor) CreateElements ¶ added in v0.9.0
func (sp ScriptProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (ScriptProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (sp ScriptProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (ScriptProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (sp ScriptProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (ScriptProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (sp ScriptProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type SequenceFlowProcessor ¶ added in v0.9.0
type SequenceFlowProcessor struct { }
func (SequenceFlowProcessor) CreateElements ¶ added in v0.9.0
func (sf SequenceFlowProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (SequenceFlowProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (sf SequenceFlowProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (SequenceFlowProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (sf SequenceFlowProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (SequenceFlowProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (sf SequenceFlowProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type StartEventProcessor ¶ added in v0.9.0
type StartEventProcessor struct { }
func (StartEventProcessor) CreateElements ¶ added in v0.9.0
func (sp StartEventProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (StartEventProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (sp StartEventProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (StartEventProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (sp StartEventProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (StartEventProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (sp StartEventProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type SubProcess ¶ added in v0.7.0
type SubProcess struct { Id string Name string Elements []*Element SubProcesses []*SubProcess // contains filtered or unexported fields }
type SubProcessProcessor ¶ added in v0.9.0
type SubProcessProcessor struct { }
func (SubProcessProcessor) CreateElements ¶ added in v0.9.0
func (s SubProcessProcessor) CreateElements(process *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (SubProcessProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (s SubProcessProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (SubProcessProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (s SubProcessProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (SubProcessProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (s SubProcessProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type UserTaskProcessor ¶ added in v0.9.0
type UserTaskProcessor struct { }
func (UserTaskProcessor) CreateElements ¶ added in v0.9.0
func (up UserTaskProcessor) CreateElements(p *Process, subprocess *SubProcess, spElements *XMLSubProcess, elements *XMLBPMNElements, ps *ProcessorSet) error
func (UserTaskProcessor) GenerateCodeForNewElement ¶ added in v0.9.0
func (up UserTaskProcessor) GenerateCodeForNewElement(currentElement, newElement *Element, process *Process, ps *ProcessorSet) string
func (UserTaskProcessor) GenerateElementNextStateCodes ¶ added in v0.9.0
func (up UserTaskProcessor) GenerateElementNextStateCodes(process *Process, defs *XMLBPMNElements, ps *ProcessorSet)
func (UserTaskProcessor) GenerateNextStateCode ¶ added in v0.9.0
func (up UserTaskProcessor) GenerateNextStateCode(currentElement *Element, nextElements []*Element, process *Process, ps *ProcessorSet) string
type XMLBPMNDefinitions ¶
type XMLBPMNDefinitions struct { XMLName xml.Name `xml:"definitions"` Process XMLBPMNProcess `xml:"process"` }
type XMLBPMNElements ¶ added in v0.7.0
type XMLBPMNElements struct { StartEvents []XMLBPMNStartEvent `xml:"startEvent"` ExclusiveGateways []XMLExclusiveGateway `xml:"exclusiveGateway"` ParallelGateways []XMLParallelGateway `xml:"parallelGateway"` SequenceFlows []XMLSequenceFlow `xml:"sequenceFlow"` UserTasks []XMLUserTask `xml:"userTask"` EndEvents []XMLEndEvent `xml:"endEvent"` ScriptTasks []XMLScriptTask `xml:"scriptTask"` SubProcesses []XMLSubProcess `xml:"subProcess"` }
type XMLBPMNProcess ¶
type XMLBPMNStartEvent ¶
type XMLBPMNStartEvent struct { XMLName xml.Name `xml:"startEvent"` XMLIDName XMLOutgoingElements TimerEventDefinition XMLTimerEventDefinition `xml:"timerEventDefinition"` }
type XMLConditionExpression ¶
type XMLEndEvent ¶
type XMLEndEvent struct { XMLIDName XMLIncomingElements XMLName xml.Name `xml:"endEvent"` }
type XMLExclusiveGateway ¶
type XMLExclusiveGateway struct { XMLIDName XMLIncomingElements XMLOutgoingElements XMLName xml.Name `xml:"exclusiveGateway"` Default string `xml:"default,attr"` }
type XMLIncomingElements ¶
type XMLIncomingElements struct {
Incoming []string `xml:"incoming"`
}
func (*XMLIncomingElements) GetIncoming ¶
func (e *XMLIncomingElements) GetIncoming() []string
type XMLMultiInstanceLoopCharacteristics ¶ added in v0.7.0
type XMLOutgoingElements ¶
type XMLOutgoingElements struct {
Outgoing []string `xml:"outgoing"`
}
func (*XMLOutgoingElements) GetOutgoing ¶
func (e *XMLOutgoingElements) GetOutgoing() []string
type XMLParallelGateway ¶
type XMLParallelGateway struct { XMLIDName XMLIncomingElements XMLOutgoingElements XMLName xml.Name `xml:"parallelGateway"` }
type XMLScriptTask ¶
type XMLScriptTask struct { XMLIDName XMLIncomingElements XMLOutgoingElements XMLScript XMLName xml.Name `xml:"scriptTask"` }
type XMLSequenceFlow ¶
type XMLSequenceFlow struct { XMLIDName XMLConditionExpression XMLName xml.Name `xml:"sequenceFlow"` SourceRef string `xml:"sourceRef,attr"` TargetRef string `xml:"targetRef,attr"` }
func (*XMLSequenceFlow) GetOutgoing ¶
func (x *XMLSequenceFlow) GetOutgoing() []string
type XMLSubProcess ¶ added in v0.7.0
type XMLSubProcess struct { XMLIDName XMLBPMNElements XMLIncomingElements XMLOutgoingElements XMLName xml.Name `xml:"subProcess"` MultiInstanceLoopCharacteristics XMLMultiInstanceLoopCharacteristics `xml:"multiInstanceLoopCharacteristics"` }
type XMLTimeCycle ¶
type XMLTimerEventDefinition ¶
type XMLTimerEventDefinition struct { XMLName xml.Name `xml:"timerEventDefinition"` XMLTimeCycle }
type XMLUserTask ¶
type XMLUserTask struct { XMLIDName XMLIncomingElements XMLOutgoingElements XMLName xml.Name `xml:"userTask"` GoDataType string `xml:"dataType,attr"` }