UserTO user = (UserTO) item; StatusR req = new StatusR.Builder(). key(user.getKey()). type(StatusRType.SUSPEND). onSyncope(true). resources(user.getResources()). build(); UserTO user = (UserTO) item; StatusR req = new StatusR.Builder(). key(user.getKey()). type(StatusRType.REACTIVATE). onSyncope(true). resources(user.getResources()). build();
public static StatusR.Builder statusR(final Collection<StatusBean> statuses) { StatusR.Builder builder = new StatusR.Builder(); builder.onSyncope(false); statuses.forEach(status -> { if (Constants.SYNCOPE.equalsIgnoreCase(status.getResource())) { builder.onSyncope(true); } else { builder.resource(status.getResource()); } }); return builder; }
StatusR statusR = StatusUtils.statusR(statuses).build();
public Map<String, String> deassociate( final ResourceDeassociationAction action, final String etag, final String key, final List<StatusBean> statuses) { Map<String, String> result = new LinkedHashMap<>(); synchronized (this) { AnyService<?> service = getService(etag, getAnyServiceClass()); Client client = WebClient.client(service); List<String> accept = client.getHeaders().get(HttpHeaders.ACCEPT); if (!accept.contains(RESTHeaders.MULTIPART_MIXED)) { client.accept(RESTHeaders.MULTIPART_MIXED); } ResourceDR resourceDR = new ResourceDR.Builder().key(key). action(action). resources(StatusUtils.statusR(statuses).build().getResources()).build(); try { List<BatchResponseItem> items = parseBatchResponse(service.deassociate(resourceDR)); for (int i = 0; i < items.size(); i++) { result.put( resourceDR.getResources().get(i), getStatus(items.get(i).getStatus())); } } catch (IOException e) { LOG.error("While processing Batch response", e); } resetClient(getAnyServiceClass()); } return result; }
public Builder type(final StatusRType type) { getInstance().setType(type); return this; }
public Builder token(final String token) { getInstance().setToken(token); return this; } }
public Builder key(final String key) { getInstance().setKey(key); return this; }