use of eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewRoleCompositionTaskExecutor in project CzechIdMng by bcvsolutions.
the class RoleCompositionAfterCreateProcessor method process.
@Override
public EventResult<IdmRoleCompositionDto> process(EntityEvent<IdmRoleCompositionDto> event) {
IdmRoleCompositionDto roleComposition = event.getContent();
Assert.notNull(roleComposition.getId(), "Composition identifier is required.");
// just for sure
Assert.notNull(roleComposition.getSub(), "Composition sub role is required.");
//
AddNewRoleCompositionTaskExecutor addRoleCompositionTask = AutowireHelper.createBean(AddNewRoleCompositionTaskExecutor.class);
addRoleCompositionTask.setRoleCompositionId(roleComposition.getId());
try {
if (event.getPriority() == PriorityType.IMMEDIATE) {
longRunningTaskManager.executeSync(addRoleCompositionTask);
} else {
longRunningTaskManager.execute(addRoleCompositionTask);
}
} catch (AcceptedException ex) {
DefaultEventResult<IdmRoleCompositionDto> result = new DefaultEventResult<>(event, this);
result.setSuspended(true);
//
return result;
}
//
return new DefaultEventResult<>(event, this);
}
Aggregations