use of io.crnk.data.activiti.internal.repository.TaskResourceRepository in project crnk-framework by crnk-project.
the class ActivitiModule method setupModule.
@Override
public void setupModule(ModuleContext context) {
this.moduleContext = context;
TaskService taskService = processEngine.getTaskService();
RuntimeService runtimeService = processEngine.getRuntimeService();
FormService formService = processEngine.getFormService();
resourceMapper = new ActivitiResourceMapper(context.getTypeParser(), config.getDateTimeMapper());
HistoryService historyService = processEngine.getHistoryService();
for (ProcessInstanceConfig processInstanceConfig : config.getProcessInstances().values()) {
context.addRepository(new ProcessInstanceResourceRepository(runtimeService, historyService, resourceMapper, processInstanceConfig.getProcessInstanceClass(), processInstanceConfig.getBaseFilters()));
Class<? extends HistoricProcessInstanceResource> historyClass = processInstanceConfig.getHistoryClass();
if (historyClass != null) {
context.addRepository(new HistoricProcessInstanceResourceRepository(historyService, resourceMapper, historyClass, processInstanceConfig.getBaseFilters()));
}
for (ProcessInstanceConfig.TaskRelationshipConfig taskRel : processInstanceConfig.getTaskRelationships().values()) {
context.addRepository(new TaskRelationshipRepository(processInstanceConfig.getProcessInstanceClass(), taskRel.getTaskClass(), taskRel.getRelationshipName(), taskRel.getTaskDefinitionKey()));
}
}
for (TaskRepositoryConfig taskConfig : config.getTasks().values()) {
context.addRepository(new TaskResourceRepository(taskService, resourceMapper, taskConfig.getTaskClass(), taskConfig.getBaseFilters()));
Class<? extends TaskResource> historyClass = taskConfig.getHistoryClass();
if (historyClass != null) {
context.addRepository(new HistoricTaskResourceRepository(historyService, resourceMapper, historyClass, taskConfig.getBaseFilters()));
}
Class<? extends FormResource> formClass = taskConfig.getFormClass();
if (formClass != null) {
context.addRepository(new FormResourceRepository(formService, taskService, resourceMapper, formClass));
}
}
context.addRepository(new FormRelationshipRepository());
}
Aggregations