Class JobFunctions
- java.lang.Object
-
- com.avoka.fc.core.service.job.impl.JobFunctions
-
public class JobFunctions extends Object
Provides Job Definition functions which can be called during the evaluation of a job definition.Job Functions
Below is a listing of the job functions which are available for use in Job Definition property values, and in Step preConditions and Action preConditions.
formProperty
The
formProperty
function returns the specified form version property value (String) of the job's starting submission.The property function example below looks up a form version property value named 'Managers Group' from the start submission form.
"properties": [ { "name": "Task Assign Group", "value": "$func.formProperty('Managers Group')" }, .. ]
invoke
The
invoke
function invoke the specified Groovy Service name, with the given lists of args and return the result.The example below invokes the Groovy Service named 'Manager Lookup' passing it an empty parameter map.
"properties": [ { "name": "Task Assign User", "value": "$func.invoke('Manager Lookup')" }, .. ]
The example below invokes the Groovy Service named 'Reviewer Lookup' passing it a list of arguments.
"properties": [ { "name": "Task Assign User", "value": "$func.invoke('Reviewer Lookup', $formDataMap.state, $formDataMap.email)" }, .. ]
In the example above the invoke function parameters are passed to the Groovy Service as an
args
list object. For example:// Groovy Script args parameter. def state = args[0] def email = args[1]
The Groovy Service will also be passed the
job
(Job
) andjobAction
(JobAction
) parameters, of the currently execution job and job action. This enables you to access all the properties of the currently executing job.// Job and JobAction parameters. def jobName = job.getName() def stepName = jobAction.getJobStep().getName() def actionName = jobAction.getName() println jobName + ' : ' + stepName + ' : ' + actionName
previousSubmission
The
previousSubmission
function returns the first submission (Submission
) of the previously executing step.The example below adds a processing status message to the previous submission.
"actions": [ { "name": "Process Message", "type": "Job Process Message", "properties": [ { "name": "Process Message Submission", "value": "$func.previousSubmission()" }, { "name": "Process Message Text", "value": "Your application has been approved." } ] } ]
startForm
The
startForm
function returns the job start submission form (Form
), or null if not availableThe form task assign message example below uses the form name of the starting submission form.
"actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Message", "value": "Please complete $func.startForm().formName." }, .. ] } ]
startFormCode
The
startFormCode
function returns the form code of the job start submission form, or null if not available.The form task assign example below uses the form code of the starting form submission for the review form.
"actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Form Code", "value": "$func.startFormCode()" }, { "name": "Task Subject", "value": "Please complete direct debit form." }, .. ] } ]
startSubmission
The
startSubmission
function returns the job's starting submission (Submission
), or null if not found.The example below adds a processing status message to the job start form submission.
"actions": [ { "name": "Process Message", "type": "Job Process Message", "properties": [ { "name": "Process Message Submission", "value": "$func.startSubmission()" }, { "name": "Process Message Text", "value": "Your application has been approved." } ] } ]
startSubmissionXml
The
startSubmissionXml
function returns the job's starting submission XML (String), or null if not found.The example below uses the job's start submission XML data as the Form XML Data for the assigned Form Task.
"actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Type", "value": "Form" }, { "name": "Task Form Code", "value": "Debit Form" }, { "name": "Task Form XML Data", "value": "$func.startSubmissionXml()" } .. ] } ]
startUser
The
startUser
function returns the job's starting submission user (UserAccount
), or null if not found.The form task assign example below assigns the task to the initial form submission user.
"actions": [ { "name": "Application Update", "type": "Job Task Assign", "properties": [ { "name": "Task Assign User", "value": "$func.startUser()" }, { "name": "Task Subject", "value": "Please complete update your application." }, .. ] } ]
stepOrPreviousSubmissionXml
The
stepOrPreviousSubmissionXml
function returns the submission XML (String) for another submission in the same step, or the previous submission, or null if not found.This function should be used where the steps
dynamicPreConditions
flag andshareFormData
flag are enabled.{ "name": "Additional Products", "type": "", "dynamicPreConditions": true, "shareFormData": true, "allFormsEditable": true, "showPreviousForms": true, "redirectNext": true, "actions": [ { "name": "Credit Cards Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productCreditCards == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-credit-test" }, { "name": "Task Message", "value": "Please complete the Credit Card Application form." }, { "name": "Task Subject", "value": "Complete Credit Card Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrPreviousSubmissionXml()" }, { "name": "Task Type", "value": "Anonymous" } ] }, { "name": "Insurance Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productInsurance == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-insure-test" }, { "name": "Task Message", "value": "Please complete the Insurance Application form." }, { "name": "Task Subject", "value": "Complete Insurance Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrPreviousSubmissionXml()" }, { "name": "Task Type", "value": "Anonymous" } ] } ]
stepOrStartSubmissionXml
The
stepOrStartSubmissionXml
function returns the submission XML (String) for another submission in the same step, if not found the or the job's starting submission, or null if not found.This function should be used where the steps
dynamicPreConditions
flag andshareFormData
flag are enabled.{ "name": "Additional Products", "type": "", "dynamicPreConditions": true, "shareFormData": true, "allFormsEditable": true, "showPreviousForms": true, "redirectNext": true, "actions": [ { "name": "Credit Cards Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productCreditCards == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-credit-test" }, { "name": "Task Message", "value": "Please complete the Credit Card Application form." }, { "name": "Task Subject", "value": "Complete Credit Card Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrStartSubmissionXml()" }, { "name": "Task Type", "value": "Anonymous" } ] }, { "name": "Insurance Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productInsurance == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-insure-test" }, { "name": "Task Message", "value": "Please complete the Insurance Application form." }, { "name": "Task Subject", "value": "Complete Insurance Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrStartSubmissionXml()" }, { "name": "Task Type", "value": "Anonymous" } ] } ]
stepOrSubmissionXml
The
stepOrSubmissionXml
function returns the submission XML (String) for another submission in the same step, or if not found the submission specified, or null if that submission cannot be found.This function should be used where the steps
dynamicPreConditions
flag andshareFormData
flag are enabled.The example below uses the job's 2nd submission XML data as the Input XML Prefill data for the assigned Form Task.
{ "name": "Additional Products", "type": "", "dynamicPreConditions": true, "shareFormData": true, "allFormsEditable": true, "showPreviousForms": true, "redirectNext": true, "actions": [ { "name": "Credit Cards Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productCreditCards == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-credit-test" }, { "name": "Task Message", "value": "Please complete the Credit Card Application form." }, { "name": "Task Subject", "value": "Complete Credit Card Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrSubmissionXml($job.submissions.get(1))" }, { "name": "Task Type", "value": "Anonymous" } ] }, { "name": "Insurance Application", "type": "Job Task Assign", "preCondition": "$formDataMap.productInsurance == 'true'", "redirectNext": true, "properties": [ { "name": "Task Assign Email", "value": "$formDataMap.emailAddress" }, { "name": "Task Form Code", "value": "onboard-insure-test" }, { "name": "Task Message", "value": "Please complete the Insurance Application form." }, { "name": "Task Subject", "value": "Complete Insurance Application" }, { "name": "Task Input XML Prefill", "value": "$func.stepOrSubmissionXml($job.submissions.get(1))" }, { "name": "Task Type", "value": "Anonymous" } ] } ]
submissionXml
The
submissionXml
function returns the submission XML (String) of the specified submission, or null if not found.The example below uses the job's 2nd submission XML data as the Input XML Prefill data for the assigned Form Task.
"actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Type", "value": "Form" }, { "name": "Task Form Code", "value": "Debit Form" }, { "name": "Task Input XML Prefill", "value": "$func.submissionXml($job.submissions.get(1))" } .. ] } ]
userForEmail
The
userForEmail
function returns the user (UserAccount
) for the specified email, or null if not found.The form task assign example below assigns the task to TM
UserAccount
looked up from the specified email address. In the example below the input email address is resolved from a submitted form data extract."actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Assign User", "value": "$func.userForEmail($formDataMap.managersEmail)" }, { "name": "Task Subject", "value": "Please review the application." }, .. ] } ]
userForLogin
The
userForLogin
function returns the user (UserAccount
) for the specified user login name, or null if not found.The form task assign example below assigns the task to TM
UserAccount
looked up from the specified login user name. In the example below the input login user name is resolved from a submitted form data extract."actions": [ { "name": "Application Review", "type": "Job Task Assign", "properties": [ { "name": "Task Assign User", "value": "$func.userForLogin($formDataMap.managerUsername)" }, { "name": "Task Subject", "value": "Please review the application." }, .. ] } ]
- Since:
- 4.1.0
-
-
Constructor Summary
Constructors Constructor Description JobFunctions(Job job)
Create a JobFunctions object with the given job.JobFunctions(JobAction jobAction)
Create a JobFunctions object with the given jobAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
containsFuncCall(String propertyValue)
Return true if the given property value contains a func call reference.static Object
dispatch(String propertyName, String propertyValue, JobAction jobAction, Map<String,String> formDataMap, boolean evaluateTemplate)
Dispatch the function call and return the object result.String
formProperty(String name)
Return the named form version property value of the job start submission.static List<String>
getJobFuncInvokeServiceNames(JobDef jobDef)
Return the list of job func.invoke service names referenced in the jobDefObject
invoke(String serviceName, Object... args)
Invoke the specified named Groovy Service, with the given arguments and return the result.static boolean
isObjectFuncCall(String propertyValue)
Return true if the given property value contains a direct object func call.Submission
previousSubmission()
Form
startForm()
String
startFormCode()
Submission
startSubmission()
String
startSubmissionXml()
UserAccount
startUser()
String
stepOrPreviousSubmissionXml()
Returns the submission XML data for the first submission in the current step, if there are no submissions then the XML Data from previous step submission, or null if not found or submission XML data has been deleted.String
stepOrStartSubmissionXml()
Returns the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the start step, or null if not found or submission XML data has been deleted.String
stepOrSubmissionXml(Submission submission)
Returns the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the given submission object, or null if not found or submission XML data has been deleted.String
submissionXml(Submission submission)
Return the submission XML data for the given submission object, or null if not found or submission XML data has been deleted.UserAccount
userForEmail(String email)
Return the user account for the given email address.UserAccount
userForLogin(String loginName)
Return the user account for the given login name.static String
validateFuncCall(Client client, String propertyValue)
Validate the job function call property value, returning null if valid or the error message if not valid.static String
validateFuncCall(String propertyValue)
Deprecated.usevalidateFuncCall(Client, String)
instead
-
-
-
Field Detail
-
KEY
public static final String KEY
The function calling "func" key value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JobFunctions
public JobFunctions(JobAction jobAction)
Create a JobFunctions object with the given jobAction.- Parameters:
jobAction
- the currently executing jobAction
-
JobFunctions
public JobFunctions(Job job)
Create a JobFunctions object with the given job.- Parameters:
job
- the currently executing job
-
-
Method Detail
-
formProperty
public String formProperty(String name)
Return the named form version property value of the job start submission.- Parameters:
name
- the form version property name- Returns:
- the named form version property value of the job start submission, or null if not found
-
invoke
public Object invoke(String serviceName, Object... args)
Invoke the specified named Groovy Service, with the given arguments and return the result.- Parameters:
serviceName
- the Groovy Service definition nameargs
- the service arguments- Returns:
- the executed Groovy Service result
-
previousSubmission
public Submission previousSubmission()
- Returns:
- return the first submission of the previously executing step
-
startForm
public Form startForm()
- Returns:
- the job start submission form, or null if not available
-
startFormCode
public String startFormCode()
- Returns:
- the form code of the job start submission form, or null if not available
-
startSubmission
public Submission startSubmission()
- Returns:
- the starting submission of the job, or null if not found
-
startSubmissionXml
public String startSubmissionXml()
- Returns:
- the starting submission XML of the job, or null if not found or submission XML data has been deleted
-
submissionXml
public String submissionXml(Submission submission)
Return the submission XML data for the given submission object, or null if not found or submission XML data has been deleted.- Parameters:
submission
- the submission object (optional)- Returns:
- the submission XML data for the given submission object, or null if not found or submission XML data has been deleted
-
stepOrSubmissionXml
public String stepOrSubmissionXml(Submission submission)
Returns the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the given submission object, or null if not found or submission XML data has been deleted.
Used where the step flags DynamicPreConditions and ShareFormData are enabled.- Parameters:
submission
- the submission object (optional)- Returns:
- the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the given submission object, or null if not found or submission XML data has been deleted.
- Since:
- 4.3.0
-
stepOrStartSubmissionXml
public String stepOrStartSubmissionXml()
Returns the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the start step, or null if not found or submission XML data has been deleted.
Used where the step flags DynamicPreConditions and ShareFormData are enabled.- Returns:
- the submission XML data for the first submission in the current step, if there are no submissions then the submission XML data for the start step, or null if not found or submission XML data has been deleted.
- Since:
- 4.3.0
-
stepOrPreviousSubmissionXml
public String stepOrPreviousSubmissionXml()
Returns the submission XML data for the first submission in the current step, if there are no submissions then the XML Data from previous step submission, or null if not found or submission XML data has been deleted.
Used where the step flags DynamicPreConditions and ShareFormData are enabled.- Returns:
- the submission XML data for the first submission in the current step, if there are no submissions then the XML Data from previous step submission, or null if not found or submission XML data has been deleted.
- Since:
- 4.3.0
-
startUser
public UserAccount startUser()
- Returns:
- the job start submission user, or null if not found
-
userForEmail
public UserAccount userForEmail(String email)
Return the user account for the given email address.- Parameters:
email
- the user account email address- Returns:
- the user account for the given email address, or null if not found
-
userForLogin
public UserAccount userForLogin(String loginName)
Return the user account for the given login name.- Parameters:
loginName
- the user account login name- Returns:
- the user account for the given login name, or null if not found
-
containsFuncCall
public static boolean containsFuncCall(String propertyValue)
Return true if the given property value contains a func call reference.- Parameters:
propertyValue
- the property value to test- Returns:
- true if the given property value contains a func call reference
-
isObjectFuncCall
public static boolean isObjectFuncCall(String propertyValue)
Return true if the given property value contains a direct object func call.- Parameters:
propertyValue
- the property value to test- Returns:
- true if the given property value contains a direct object func call
-
dispatch
public static Object dispatch(String propertyName, String propertyValue, JobAction jobAction, Map<String,String> formDataMap, boolean evaluateTemplate)
Dispatch the function call and return the object result.- Parameters:
propertyName
- the property name (required)propertyValue
- the property value (required)jobAction
- the currently executing job action (required)formDataMap
- the form data map (optional)evaluateTemplate
- the evaluate function as a Velocity template- Returns:
- dispatch the function call and return the object result
-
getJobFuncInvokeServiceNames
public static List<String> getJobFuncInvokeServiceNames(JobDef jobDef)
Return the list of job func.invoke service names referenced in the jobDef- Parameters:
jobDef
- the job definition (required)- Returns:
- the list of job func.invoke service names referenced in the jobDef
-
validateFuncCall
public static String validateFuncCall(String propertyValue)
Deprecated.usevalidateFuncCall(Client, String)
insteadValidate the job function call property value, returning null if valid or the error message if not valid.- Parameters:
propertyValue
- the property value to test- Returns:
- null if valid, or the error message if not valid
-
validateFuncCall
public static String validateFuncCall(Client client, String propertyValue)
Validate the job function call property value, returning null if valid or the error message if not valid.- Parameters:
client
- the client of the jobpropertyValue
- the property value to test- Returns:
- null if valid, or the error message if not valid
- Since:
- 5.0.0
-
-