Search in sources :

Example 1 with ScheduleApprovalValues

use of io.crnk.activiti.example.model.ScheduleApprovalValues in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method postProcess.

private ScheduleApprovalProcessInstance postProcess(String name, String businessKey, String tenantId) {
    QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
    ScheduleApprovalValues newValues = new ScheduleApprovalValues();
    newValues.setName("newScheduleName");
    ScheduleApprovalProcessInstance resource = new ScheduleApprovalProcessInstance();
    resource.setName(name);
    resource.setResourceId("newScheduleId");
    resource.setResourceType("schedules");
    resource.setTenantId(tenantId);
    resource.setBusinessKey(businessKey);
    resource.setProcessDefinitionKey("scheduleChange");
    resource.setNewValues(newValues);
    resource.setDescription(ENFORCED_DESCRIPTION);
    ScheduleApprovalProcessInstance createdProcessInstance = processRepository.create(resource);
    Assert.assertEquals(name, createdProcessInstance.getName());
    Assert.assertNotNull(createdProcessInstance.getId());
    createdProcessInstance = processRepository.findOne(createdProcessInstance.getId(), querySpec);
    Assert.assertNotNull(createdProcessInstance.getId());
    Assert.assertEquals(name, createdProcessInstance.getName());
    Assert.assertEquals(businessKey, createdProcessInstance.getBusinessKey());
    Assert.assertEquals("newScheduleName", createdProcessInstance.getNewValues().getName());
    return createdProcessInstance;
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) ScheduleApprovalValues(io.crnk.activiti.example.model.ScheduleApprovalValues) QuerySpec(io.crnk.core.queryspec.QuerySpec)

Example 2 with ScheduleApprovalValues

use of io.crnk.activiti.example.model.ScheduleApprovalValues in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method addProcessInstance.

private ProcessInstance addProcessInstance() {
    ScheduleApprovalValues newValues = new ScheduleApprovalValues();
    newValues.setName("newName");
    ScheduleApprovalProcessInstance resource = new ScheduleApprovalProcessInstance();
    resource.setResourceType("schedules");
    resource.setResourceId("12");
    resource.setNewValues(newValues);
    Map<String, Object> processVariables = resourceMapper.mapToVariables(resource);
    runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("scheduleChange", "testBusinessKey", processVariables);
    runtimeService.setProcessInstanceName(processInstance.getId(), "testName");
    processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).includeProcessVariables().singleResult();
    return processInstance;
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) ScheduleApprovalValues(io.crnk.activiti.example.model.ScheduleApprovalValues)

Example 3 with ScheduleApprovalValues

use of io.crnk.activiti.example.model.ScheduleApprovalValues in project crnk-framework by crnk-project.

the class ApprovalMapper method mapValues.

protected ScheduleApprovalValues mapValues(Schedule entity) {
    ScheduleApprovalValues values = new ScheduleApprovalValues();
    values.setName(entity.getName());
    return values;
}
Also used : ScheduleApprovalValues(io.crnk.activiti.example.model.ScheduleApprovalValues)

Aggregations

ScheduleApprovalValues (io.crnk.activiti.example.model.ScheduleApprovalValues)3 ScheduleApprovalProcessInstance (io.crnk.activiti.example.model.ScheduleApprovalProcessInstance)2 QuerySpec (io.crnk.core.queryspec.QuerySpec)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1