Permalink
Browse files

(#27) Implemented possibility immediately to start first activity node

  • Loading branch information...
ivouchak-sc committed Apr 13, 2018
1 parent 5b0c8c3 commit db3c160d47733d117d40ecbd4e1425916027fb34
@@ -47,11 +47,13 @@ class ProcessNodeDef {
String protocolGroup
boolean forcedStart
static belongsTo = [ processDef: ProcessDef ]
static hasMany = [ actionStatements: ActionStatement, assignees: ProcessDefAssignee, transitions: ProcessTransitionDef, transitions2DestinationNode: Transition2DestinationNode, variables2NodeVisibility: Variable2NodeVisibility ]
static mappedBy = [ assignees: "processNodeDef", transitions: "fromNode", transitions2DestinationNode: "destinationNode", variables2NodeVisibility: "node" ]
static transients = [ "incomingTransitions", "variablesVisibility" ]
static transients = [ "incomingTransitions", "variablesVisibility", "forcedStart" ]
static constraints = {
nodeID(unique: 'processDef')
@@ -1,3 +1,5 @@
package com.jcatalog.grailsflow.jobs
import com.jcatalog.grailsflow.model.process.ProcessNode
import com.jcatalog.grailsflow.model.process.BasicProcess
/**
@@ -1,6 +1,7 @@
package com.jcatalog.grailsflow
import com.jcatalog.grailsflow.bean.DynamicProcessVariableDetails
import com.jcatalog.grailsflow.jobs.SendEventJob
/*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -294,7 +295,7 @@ class ProcessManagerService implements InitializingBean {
ProcessNodeDef startNodeDef = processClass.startNode
startNodeDef.processDef = new ProcessDef(processID: processTypeID)
// initialize start node
def startNode = initNewNode(startNodeDef, null, user, processClass.nodeInfos[startNodeDef.nodeID])
ProcessNode startNode = initNewNode(startNodeDef, null, user, processClass.nodeInfos[startNodeDef.nodeID])
threadRuntimeInfoService.invokeInCurrentThread(basicProcess.id,{ ProcessNotifier notifier ->
try {
@@ -335,8 +336,17 @@ class ProcessManagerService implements InitializingBean {
}
}
}
if (startNodeDef.forcedStart) {
grailsflowLockService.lockProcessExecution(startNode)
log.info "Forced start is enabled for '$startNode.nodeID' node of process #$basicProcess.id($processTypeID)"
invokeNodeExecution(basicProcess.id, startNode.nodeID, null, user, variables)
}
} catch (Throwable ex) {
log.error("Unexpected exception occurred during process starting! ", ex)
} finally {
grailsflowLockService.unlockProcessExecution(startNode)
}
})
@@ -216,6 +216,14 @@ class NodesSectionBuilder extends AbstractSectionBuilder {
}
}
if (properties.forcedStart) {
if (properties.forcedStart instanceof Boolean) {
processNode.forcedStart = properties.forcedStart
} else {
log.error "Property 'forcedStart' should be a boolean value"
}
}
if (properties.expectedDuration && properties.expectedDuration instanceof Number) {
try {
processNode.expectedDuration = Long.valueOf(properties.expectedDuration as String)

0 comments on commit db3c160

Please sign in to comment.