use of org.apache.syncope.common.lib.patch.StatusPatch in project syncope by apache.
the class AbstractAnyRestClient method link.
public BulkActionResult link(final String etag, final String key, final List<StatusBean> statuses) {
BulkActionResult result;
synchronized (this) {
AnyService<?> service = getService(etag, getAnyServiceClass());
StatusPatch statusPatch = StatusUtils.buildStatusPatch(statuses);
AssociationPatch associationPatch = new AssociationPatch.Builder().key(key).action(ResourceAssociationAction.LINK).onSyncope(statusPatch.isOnSyncope()).resources(statusPatch.getResources()).build();
result = service.associate(associationPatch).readEntity(BulkActionResult.class);
resetClient(getAnyServiceClass());
}
return result;
}
use of org.apache.syncope.common.lib.patch.StatusPatch 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;
}
Aggregations