use of eu.bcvsolutions.idm.core.model.event.TreeNodeEvent in project CzechIdMng by bcvsolutions.
the class TreeNodeDeleteBulkAction method processDto.
@Override
protected OperationResult processDto(IdmTreeNodeDto treeNode) {
boolean forceDelete = getParameterConverter().toBoolean(getProperties(), EntityEventProcessor.PROPERTY_FORCE_DELETE, false);
if (!forceDelete) {
return super.processDto(treeNode);
}
// force delete - without request by event
try {
// force delete can execute tree node admin only
getService().checkAccess(treeNode, IdmBasePermission.ADMIN);
//
TreeNodeEvent treeNodeEvent = new TreeNodeEvent(TreeNodeEventType.DELETE, treeNode, new ConfigurationMap(getProperties()).toMap());
treeNodeEvent.setPriority(PriorityType.HIGH);
EventContext<IdmTreeNodeDto> result = treeNodeService.publish(treeNodeEvent);
processedIds.add(result.getContent().getId());
//
return new OperationResult.Builder(OperationState.EXECUTED).build();
} catch (ResultCodeException ex) {
return new OperationResult.Builder(OperationState.EXCEPTION).setException(ex).build();
} catch (Exception ex) {
Throwable resolvedException = ExceptionUtils.resolveException(ex);
if (resolvedException instanceof ResultCodeException) {
return new OperationResult.Builder(OperationState.EXCEPTION).setException((ResultCodeException) resolvedException).build();
}
return new OperationResult.Builder(OperationState.EXCEPTION).setCause(ex).build();
}
}
Aggregations