use of io.crnk.activiti.mapper.ActivitiResourceMapper 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());
for (ProcessInstanceConfig processInstanceConfig : config.getProcessInstances().values()) {
context.addRepository(new ProcessInstanceResourceRepository(runtimeService, resourceMapper, processInstanceConfig.getProcessInstanceClass(), 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 FormResource> formClass = taskConfig.getFormClass();
if (formClass != null) {
context.addRepository(new FormResourceRepository(formService, taskService, resourceMapper, formClass));
context.addRepository(new FormRelationshipRepository(taskConfig.getTaskClass(), formClass));
}
}
}
use of io.crnk.activiti.mapper.ActivitiResourceMapper in project crnk-framework by crnk-project.
the class ApprovalManagerTest method setup.
@Before
public void setup() {
runtimeService = Mockito.mock(RuntimeService.class);
TaskService taskService = Mockito.mock(TaskService.class);
repositoryFacade = Mockito.mock(ResourceRepositoryV2.class);
ApprovalMapper approvalMapper = new ApprovalMapper();
ActivitiResourceMapper resourceMapper = new ActivitiResourceMapper(new TypeParser(), new DefaultDateTimeMapper());
ResourceInformation information = Mockito.mock(ResourceInformation.class);
registryEntry = Mockito.mock(RegistryEntry.class);
ResourceRegistry resourceRegistry = Mockito.mock(ResourceRegistry.class);
Mockito.when(registryEntry.getResourceInformation()).thenReturn(information);
Mockito.when(registryEntry.getResourceRepositoryFacade()).thenReturn(repositoryFacade);
Mockito.when(information.getResourceType()).thenReturn("schedule");
Mockito.when(information.getId(Mockito.any())).thenReturn(mockId);
Mockito.when(resourceRegistry.getEntry(Mockito.any(Class.class))).thenReturn(registryEntry);
Mockito.when(resourceRegistry.getEntry(Mockito.any(String.class))).thenReturn(registryEntry);
ModuleRegistry moduleRegistry = Mockito.mock(ModuleRegistry.class);
Mockito.when(moduleRegistry.getResourceRegistry()).thenReturn(resourceRegistry);
originalResource = new Schedule();
originalResource.setId(mockId);
originalResource.setName("Jane");
Mockito.when(repositoryFacade.findOne(Mockito.any(Long.class), Mockito.any(QuerySpec.class))).thenReturn(originalResource);
manager = new ApprovalManager();
manager.init(runtimeService, taskService, resourceMapper, approvalMapper, moduleRegistry);
}
Aggregations