@Override protected UserCR newInstance() { return new UserCR(); }
public Builder storePassword(final boolean storePassword) { getInstance().setStorePassword(storePassword); return this; }
public Builder membership(final MembershipTO membership) { getInstance().getMemberships().add(membership); return this; }
UserTO userTO = (UserTO) anyTO; userCR.setUsername(userTO.getUsername()); userCR.setPassword(userTO.getPassword()); userCR.setSecurityQuestion(userTO.getSecurityQuestion()); userCR.setSecurityAnswer(userTO.getSecurityAnswer()); userCR.setMustChangePassword(userTO.isMustChangePassword()); userCR.getRelationships().addAll(userTO.getRelationships()); userCR.getMemberships().addAll(userTO.getMemberships()); userCR.getRoles().addAll(userTO.getRoles()); } else if (anyCR instanceof GroupCR && anyTO instanceof GroupTO) { GroupCR groupCR = (GroupCR) anyCR;
UserCR userCR = (UserCR) anyCR; userTO.setUsername(userCR.getUsername()); userTO.setPassword(userCR.getPassword()); userTO.setSecurityQuestion(userCR.getSecurityQuestion()); userTO.setSecurityAnswer(userCR.getSecurityAnswer()); userTO.setMustChangePassword(userCR.isMustChangePassword()); userTO.getRelationships().addAll(userCR.getRelationships()); userTO.getMemberships().addAll(userCR.getMemberships()); userTO.getRoles().addAll(userCR.getRoles()); } else if (anyTO instanceof GroupTO && anyCR instanceof GroupCR) { GroupTO groupTO = (GroupTO) anyTO;
@Override protected Serializable onApplyInternal(final AnyWrapper<UserTO> modelObject) { UserTO inner = modelObject.getInnerObject(); ProvisioningResult<UserTO> result; if (inner.getKey() == null) { UserCR req = new UserCR(); EntityTOUtils.toAnyCR(inner, req); req.setStorePassword(modelObject instanceof UserWrapper ? UserWrapper.class.cast(modelObject).isStorePasswordInSyncope() : StringUtils.isNotBlank(inner.getPassword())); result = userRestClient.create(req); } else { fixPlainAndVirAttrs(inner, getOriginalItem().getInnerObject()); UserUR userUR = AnyOperations.diff(inner, getOriginalItem().getInnerObject(), false); if (StringUtils.isNotBlank(inner.getPassword())) { PasswordPatch passwordPatch = new PasswordPatch.Builder(). value(inner.getPassword()).onSyncope(true).resources(inner.getResources()).build(); userUR.setPassword(passwordPatch); } // update just if it is changed if (userUR.isEmpty()) { result = new ProvisioningResult<>(); result.setEntity(inner); } else { result = userRestClient.update(getOriginalItem().getInnerObject().getETagValue(), userUR); } } return result; }
public Builder roles(final Collection<String> roles) { getInstance().getRoles().addAll(roles); return this; } }
public Builder relationships(final Collection<RelationshipTO> relationships) { getInstance().getRelationships().addAll(relationships); return this; }
public Builder role(final String role) { getInstance().getRoles().add(role); return this; }
public Builder relationship(final RelationshipTO relationship) { getInstance().getRelationships().add(relationship); return this; }
@Override protected Serializable onApplyInternal(final AnyWrapper<UserTO> modelObject) { UserTO inner = modelObject.getInnerObject(); ProvisioningResult<UserTO> result; if (remediationTO.getAnyURPayload() == null) { UserCR req = new UserCR(); EntityTOUtils.toAnyCR(inner, req); result = restClient.remedy(remediationTO.getKey(), req); } else { UserUR req = AnyOperations.diff(inner, previousUserTO, false); if (StringUtils.isNotBlank(inner.getPassword())) { PasswordPatch passwordPatch = new PasswordPatch.Builder(). value(inner.getPassword()).onSyncope(true).resources(inner. getResources()). build(); req.setPassword(passwordPatch); } // update just if it is changed if (req.isEmpty()) { result = new ProvisioningResult<>(); result.setEntity(inner); } else { result = restClient.remedy(remediationTO.getKey(), req); } } return result; } }
public Builder roles(final String... roles) { getInstance().getRoles().addAll(Arrays.asList(roles)); return this; }
public Builder relationships(final RelationshipTO... relationships) { getInstance().getRelationships().addAll(Arrays.asList(relationships)); return this; }
public Builder memberships(final Collection<MembershipTO> memberships) { getInstance().getMemberships().addAll(memberships); return this; }
public Builder memberships(final MembershipTO... memberships) { getInstance().getMemberships().addAll(Arrays.asList(memberships)); return this; }