...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents | ||||
---|---|---|---|---|
|
make <Field f>,<Closure behaviour> on <Transition t> when <Closure<Boolean> condition>
Changes behaviour of given data field f on transition t, iff condition returns true. Behaviour can be one of:
visible,
editable,
required,
optional,
hidden.
forbidden
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
garage_check: f.garage_check, garage_cost: f.garage_cost, garage: t.garage; make garage_cost,visible on garage when { return garage_check.value == true; } |
change <Field> about <Closure>
Warning |
---|
DeprecatedSee change value. |
change <Field f> value <Closure calculation>
Anchor | ||||
---|---|---|---|---|
|
Sets new value to data field f returned by calculation closure. If the returned value is null, fields value is set to default value. If the returned value is unchanged, fields value is unchanged and actions with a trigger set on given field are not triggered.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
period: f.108001, sum: f.308011; change period value { def limit = 20.0; if (period.value == "polročná") limit = 40.0; if (period.value == "štvrťročná") limit = 80.0; if ((sum.value as Double) < (limit as Double)) return "ročná"; return unchanged; } |
change <Field> choices <Closure choices>
Sets a new set of choices to data field f.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
other:other: f.410001, field: f.this; change field choices { if (other.value == "Nehnutelnost") return field.choices + ["rozostavaná stavba"]; return field.choices; } |
...
Calls method and saves generated value into data field f. The field can be only of type Text or File. If repeat is equal to always new value is generated on each run of action. If repeat is equal to once new value is generated only if fields value is null.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
self: f.this; generate "Insurance.offerPDF",always into self |
changeCaseProperty <String property> about <Closure supplier>
Changes the property of the current case, the new value is generated by the supplier.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
trans: t.this; changeCaseProperty "icon" about { trans.icon } |
...
Creates a new instance of the newest version of net identified by the identifier. If the title is not specified, nets default case name is used. If the colour is null, the default colour is used (black at the moment).
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
createCase("create_case_net","Create Case Case","color-fg-amber-500", otherUser); createCase("create_case_net","Create Case Case","color-fg-amber-500"); createCase("create_case_net","Create Case Case"); createCase("create_case_net"); |
...
Creates a new instance of the given net. If the title is not specified, nets default case name is used. If the colour is null, the default colour is used (black at the moment).
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def net = petriNetService.getNewestVersionByIdentifier("insurance") createCase(net) createCase(net, "My insurance") createCase(net, "My insurance", "color-fg-amber-500") createCase(net, "Other insurance", "color-fg-amber-500", otherUser) |
List<Case> findCases(Closure<Predicate> predicate)
Finds all the cases that match the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
List<Case> cases = findCases( { it.title.eq("Case 1") } ); ... List<Case> cases = findCases( { it.dataSet.get("name").value.eq("Jozko") } ); |
List<Case> findCases(Closure<Predicate> predicate, Pageable page)
Finds all the cases that match the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate. Pageable determines the requested page number, page size, sort fields, and sort direction.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// returns the first page of 5 cases sorted by the title List<Case> cases = findCases( { it.dataSet.get("name").value.eq("Jozko") }, new PageRequest(0, 10, Sort.by("title").ascending() ) ); ... // returns the second page of 5 cases sorted from the newest to oldest List<Case> cases = findCases( { it.dataSet.get("name").value.eq("Jozko") }, new PageRequest(1, 5, Sort.by("creationDate").descending() ) ); |
...
Finds the first case that matches the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Case useCase = findCaseCase useCase = findCase( { it.title.eq("Case 1") & it.processIdentifier.eq("insurance") } ); ... Case useCase = findCase( { it.dataSet.get("name").value.eq("Jozko") & it.processIdentifier.eq("insurance") } ); |
...
Finds all tasks that match the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def useCase = findCase(...) Task task = findTask( { it.caseId.eq(useCase.stringId) & it.transitionId.eq("edit_limit") } ); |
List<Task> findTasks(Closure<Predicate> predicate, Pageable page)
Finds all tasks that match the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate. Pageable determines the requested page number, page size, sort fields, and sort direction.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// find 10 tasks sorted by priority def newTasks = findTasks( { it.transitionId.eq("new_task") }, new PageRequest(0, 10, Sort.by("priority").descending() ) ) |
Task findTask(Closure<Predicate> predicate)
Finds the first task that matches the given predicate. The predicate is a groovy closure that accepts QCase object and returns QueryDSL Predicate.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
List<Task> tasks = findTasks( { it.transitionId.eq("edit_limit") } ) ... def useCase = findCase(...) List<Task> tasks = findTasks( { it.caseId.eq(useCase.stringId) } ); |
close <List<Transition>>
Warning | |
---|---|
title | DeprecatedSee cancel. |
execute <String transitionId> where <Closure<Predicate>> with <Map>
Executes all fireable transitions identified by the transitionId in all case where the predicate returns true. For each task following actions are called:
assign to the system user
save new data values
finish.
The predicate is a list of Querydsl queries. Every case property can be used in a query. For more info see querydsl doc and QCase javadoc.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
field: f.field; execute "synchronized" where ([ "title eq Case 1" ] as List) with ([ "field": [ value: 128.0, type: "number" ] ] as Map) |
...
Assign the task in current case with given transitionId. Optional parameter aCase identifies case which the task belongs to. Optional parameter user identifies actor who will perform assign.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
selectedUser: f.select_controler; if (selectedUser.value) { def aCase = findCase({ it.author.id.eq(selectedUser.value.id) }) def user = userService.findById(selectedUser.value.id, false) assignTask("control", aCase, user); } |
Task assignTask(Task task, User user = userService.loggedOrSystem)
Assign the task to user. Optional parameter user identifies actor who will perform assign.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
selectedUser: f.select_controler; if (selectedUser.value) { def usecase = findCase({ it.title("Some case") }).first() def task = findTask({ it.importId.eq("control") & it.caseId.eq(usecase.stringId) }) def user = userService.findById(selectedUser.value.id, false) assignTask(task, user); } |
assignTasks(List<Task> tasks, User assignee = userService.loggedOrSystem)
Assign the tasks to user. Optional parameter user identifies actor who will perform assign.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// find all // find all my cases and assign all their control tasks to me def cases = findCases( { it.author.id.eq(loggedUser().id)) } ) def caseIds = cases.collect { it.stringId } def tasks = findTasks({ it.importId.eq("control") & it.caseId.in(cases) }) assignTasks(tasks) |
...
Cancels the task in current case with given transitionId. Optional parameter aCase identifies case which the task belongs to. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def taskId = "work_task"; def aCase = findCase({ it.author.id.eq(loggedUser().id) }) cancelTask(taskId, aCase); |
...
Cancels the provided task. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// cancel the task "work_task", currently assigned to me, in the current case def task = findTask( { it.transitionId.eq("work_task") } ); cancelTask(task); |
...
Cancels all the provided tasks. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// cancel the task "work_task", currently assigned to me, in the current case def tasks = findTasks( { it.transitionId.eq("work_task") } ); cancelTasks(tasks); |
...
Finish the task in current case with given transitionId. Optional parameter aCase identifies case which the task belongs to. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// finish the task "work_task", currently assigned to me, in the current case def taskId = "work_task"; def aCase = findCase({ it.author.id.eq(loggedUser().id) }) finishTask(taskId, aCase); |
...
Finish the provided task. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// finish the task "work_task", currently assigned to me in current case def task = findTask( { it.transitionId.eq("work_task") & it.caseId.eq(useCase.stringId) & it.userId.eq(loggedUser().id) } ); finishTask(task); |
...
Finish all the provided tasks. Optional parameter user identifies actor who will perform cancel.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// finish all the tasks "work_task", currently assigned to me def tasks = findTasks( { it.transitionId.eq("work_task") & it.userId.eq(loggedUser().id) } ); finishTasks(tasks); |
...
Sets values of data fields on given task. Values are mapped to data fields in dataSet using data fields import Id as key.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def usecase = findCasedef usecase = findCase({ it.title.eq("Limits") }).first() def task = findTask({ it.caseId.eq(usecase.stringId & it.transitionId.eq("edit_limit")) }) setData(task, [ "new_limit": [ "value": "10000", "type" : "number" ], ]) |
...
Sets values of data fields on taskof transition in current case. Values are mapped to data fields in dataSet using data fields import Id as key.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
transition: t.edit_limit; setData(transition, [ "new_limit": [ "value": "10000", "type" : "number" ], ]) |
...
Sets values of data fields on task identified by transitionId of given case. Values are mapped to data fields in dataSet using data fields import Id as key.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def usecase = findCase({ it.title.eq("Limits") }).first() setData("edit_limit", usecase, [ "new_limit": [ "value": "10000", "type" : "number" ], ]) |
...
Gets all data fields on given task, mapped by its import Id.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
actual_limit: f.actual_limit; def usecase = findCase({ it.title.eq("Limits") }).first() def task = findTask({ it.transitionId.eq("view_limit") & it.caseId.eq(usecase.stringId) }) def data = getData(task) change actual_limit value { data["remote_limit"].value } |
...
Gets all data fields on the task of transition in the current case, mapped by its import Id.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
view_limit: t.view_limit; actual_limit: f.actual_limit; def data = getData(view_limit) change actual_limit value { data["remote_limit"].value } |
...
Gets all data fields on the task defined by its transitionId in given case, mapped by its import Id.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
view_limit: t.view_limit; def usecase = findCase({ it.title.eq("Limits") }).first() def data = getData("view_limit", usecase) change actual_limit value { data["remote_limit"].value } |
...
Assigns role identified by roleId to user. User is optional parameter, default value is currently logged user. Returns updated object of user.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
transition: t.task; assignRole(transition.defaultRoleId); |
...
Returns currently logged user.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
userField: t.user; change userField value { return loggedUser() } |
...