use of org.apache.syncope.common.lib.to.BulkActionResult in project syncope by apache.
the class UserRestClient method reactivate.
public BulkActionResult reactivate(final String etag, final String userKey, final List<StatusBean> statuses) {
StatusPatch statusPatch = StatusUtils.buildStatusPatch(statuses, true);
statusPatch.setKey(userKey);
statusPatch.setType(StatusPatchType.REACTIVATE);
BulkActionResult result;
synchronized (this) {
result = new BulkActionResult();
Map<String, BulkActionResult.Status> res = result.getResults();
UserService service = getService(etag, UserService.class);
@SuppressWarnings("unchecked") ProvisioningResult<UserTO> provisions = (ProvisioningResult<UserTO>) service.status(statusPatch).readEntity(ProvisioningResult.class);
if (statusPatch.isOnSyncope()) {
res.put(StringUtils.capitalize(Constants.SYNCOPE), "active".equalsIgnoreCase(provisions.getEntity().getStatus()) ? BulkActionResult.Status.SUCCESS : BulkActionResult.Status.FAILURE);
}
for (PropagationStatus status : provisions.getPropagationStatuses()) {
res.put(status.getResource(), BulkActionResult.Status.valueOf(status.getStatus().name()));
}
resetClient(UserService.class);
}
return result;
}
use of org.apache.syncope.common.lib.to.BulkActionResult in project syncope by apache.
the class TaskLogic method deleteExecutions.
@PreAuthorize("hasRole('" + StandardEntitlement.TASK_DELETE + "')")
@Override
public BulkActionResult deleteExecutions(final String key, final Date startedBefore, final Date startedAfter, final Date endedBefore, final Date endedAfter) {
Task task = taskDAO.find(key);
if (task == null) {
throw new NotFoundException("Task " + key);
}
BulkActionResult result = new BulkActionResult();
taskExecDAO.findAll(task, startedBefore, startedAfter, endedBefore, endedAfter).forEach(exec -> {
try {
taskExecDAO.delete(exec);
result.getResults().put(String.valueOf(exec.getKey()), BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error deleting execution {} of task {}", exec.getKey(), key, e);
result.getResults().put(String.valueOf(exec.getKey()), BulkActionResult.Status.FAILURE);
}
});
return result;
}
use of org.apache.syncope.common.lib.to.BulkActionResult in project syncope by apache.
the class ReportLogic method deleteExecutions.
@PreAuthorize("hasRole('" + StandardEntitlement.REPORT_DELETE + "')")
@Override
public BulkActionResult deleteExecutions(final String key, final Date startedBefore, final Date startedAfter, final Date endedBefore, final Date endedAfter) {
Report report = reportDAO.find(key);
if (report == null) {
throw new NotFoundException("Report " + key);
}
BulkActionResult result = new BulkActionResult();
reportExecDAO.findAll(report, startedBefore, startedAfter, endedBefore, endedAfter).forEach(exec -> {
try {
reportExecDAO.delete(exec);
result.getResults().put(String.valueOf(exec.getKey()), BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error deleting execution {} of report {}", exec.getKey(), key, e);
result.getResults().put(String.valueOf(exec.getKey()), BulkActionResult.Status.FAILURE);
}
});
return result;
}
Aggregations