Skip to content

Instantly share code, notes, and snippets.

View meyerdan's full-sized avatar

Daniel Meyer meyerdan

View GitHub Profile
@meyerdan
meyerdan / camundaBpmAssert.java
Created June 3, 2014 06:53
With camunda BPM assert
assertThat(processInstance).isStarted()
.task().hasDefinitionKey("approveInvoice")
.hasCandidateGroup("backoffice")
.isNotAssigned();
@meyerdan
meyerdan / without camunda BPM assert.java
Last active August 29, 2015 14:02
without camunda BPM assert
// make sure process instance is started
assertNotNull(runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstance.getId())
.singleResult());
// make sure the task with id "approveInvoice" & candidate group "backoffice" exists
Task task = taskService.createTaskQuery()
.taskCandidateGroup("backoffice")
.processInstanceId(processInstance.getId())
.taskDefinitionKey("approveInvoice")
@meyerdan
meyerdan / gist:9112468
Created February 20, 2014 12:30
User Operation Log Query Example
// who worked on this task?
historyService.createUserOperationLogQuery()
.taskId("someTaskId")
.list();
// all operations performed by a given user
historyService.createUserOperationLogQuery()
.userId("jonny")
.list();
@meyerdan
meyerdan / gist:9112186
Last active August 29, 2015 13:56
Bpmn Model Api Delegation Code
public class ExampleServiceTask implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
BpmnModelInstance modelInstance = execution.getBpmnModelInstance();
ServiceTask serviceTask = (ServiceTask) execution.getBpmnModelElementInstance();
// read properties from model:
serviceTask.getIoSpecification();
//...
}
@meyerdan
meyerdan / gist:9112096
Created February 20, 2014 12:05
Bpmn Model API Repository Service access
// get the BpmnModelInstance for a deployed process
BpmnModelInstance processModel = runtimeService.getBpmnModelInstance("someProcessDefinitionId");
// find all User Tasks
ModelElementType taskType = processModel.getModel().getType(UserTask.class);
Collection<ModelElementInstance> taskInstances = modelInstance.getModelElementsByType(taskType);
// Iterate the tasks ...
@meyerdan
meyerdan / gist:9112021
Created February 20, 2014 11:59
Fluent Bpmn Model API Example
BpmnModelInstance modelInstance = Bpmn.createProcess()
.name("Example process")
.executable()
.startEvent()
.userTask()
.name("Some work to do")
.endEvent()
.done();
public class DummySerializable implements Serializable {
private static final long serialVersionUID = 1L;
}