protected Response doUpdate(final P anyPatch) { anyPatch.setKey(getActualKey(getAnyDAO(), anyPatch.getKey())); Date etagDate = findLastChange(anyPatch.getKey()); checkETag(String.valueOf(etagDate.getTime())); ProvisioningResult<TO> updated = getAnyLogic().update(anyPatch, isNullPriorityAsync()); return modificationResponse(updated); }
protected void setRealm(final Any<?> any, final AnyPatch anyPatch) { if (anyPatch.getRealm() != null && StringUtils.isNotBlank(anyPatch.getRealm().getValue())) { Realm newRealm = realmDAO.findByFullPath(anyPatch.getRealm().getValue()); if (newRealm == null) { LOG.debug("Invalid realm specified: {}, ignoring", anyPatch.getRealm().getValue()); } else { any.setRealm(newRealm); } } }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AnyObjectPatch other = (AnyObjectPatch) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(name, other.name). append(relationships, other.relationships). append(memberships, other.memberships). build(); } }
private static <T extends AnyTO, K extends AnyPatch> void patch(final T to, final K patch, final T result) { if (to.getKey() == null || !to.getKey().equals(patch.getKey())) { throw new IllegalArgumentException( to.getClass().getSimpleName() + " and " + patch.getClass().getSimpleName() if (patch.getRealm() != null) { result.setRealm(patch.getRealm().getValue()); for (StringPatchItem auxClassPatch : patch.getAuxClasses()) { switch (auxClassPatch.getOperation()) { case ADD_REPLACE: result.getPlainAttrs().addAll(patch(EntityTOUtils.buildAttrMap(to.getPlainAttrs()), patch.getPlainAttrs())); result.getVirAttrs().addAll(patch.getVirAttrs()); for (StringPatchItem resourcePatch : patch.getResources()) { switch (resourcePatch.getOperation()) { case ADD_REPLACE:
result.setKey(updated.getKey()); result.setRealm(replacePatchItem(updated.getRealm(), original.getRealm(), new StringReplacePatchItem())); result.getAuxClasses().clear(); result.getAuxClasses().add(new StringPatchItem.Builder(). operation(PatchOperation.DELETE).value(auxClass).build()); }); result.getAuxClasses().add(new StringPatchItem.Builder(). operation(PatchOperation.ADD_REPLACE).value(auxClass).build()); }); result.getPlainAttrs().clear(); result.getPlainAttrs().add(new AttrPatch.Builder(). operation(PatchOperation.DELETE). attrTO(new AttrTO.Builder().schema(schema).build()). if (isEmpty(attrTO)) { if (!incremental) { result.getPlainAttrs().add(new AttrPatch.Builder(). operation(PatchOperation.DELETE). attrTO(new AttrTO.Builder().schema(attrTO.getSchema()).build()). build(); if (!patch.isEmpty()) { result.getPlainAttrs().add(patch);
for (StringPatchItem patch : anyPatch.getAuxClasses()) { AnyTypeClass auxClass = anyTypeClassDAO.find(patch.getValue()); if (auxClass == null) { for (StringPatchItem patch : anyPatch.getResources()) { ExternalResource resource = resourceDAO.find(patch.getValue()); if (resource == null) { anyPatch.getPlainAttrs().stream(). filter(patch -> patch.getAttrTO() != null).forEach(patch -> { PlainSchema schema = getPlainSchema(patch.getAttrTO().getSchema());
private void addUpdateOrReplaceAttr( final String key, final SchemaType schemaType, final AttrTO attrTO, final PatchOperation operation) { if (attrTO.getSchema() == null) { throw new NotFoundException("Must specify schema"); } P patch = newPatch(key); switch (schemaType) { case VIRTUAL: patch.getVirAttrs().add(attrTO); break; case PLAIN: patch.getPlainAttrs().add(new AttrPatch.Builder().operation(operation).attrTO(attrTO).build()); break; case DERIVED: default: } doUpdate(patch); }
updated.getResult().getKey(), false, null, updated.getPropByRes(), ((AnyPatch) actual).getVirAttrs(), excludedResources); PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
protected void unassign(final Any<?> any, final ConnectorObject beforeObj, final ProvisioningReport result) { AnyPatch patch = getAnyUtils().newAnyPatch(any.getKey()); patch.getResources().add(new StringPatchItem.Builder(). operation(PatchOperation.DELETE). value(profile.getTask().getResource().getKey()).build()); update(patch); deprovision(any, beforeObj, result); }
/** * Add PLAIN attribute DELETE patch for those attributes of the input AnyTO without values or containing null value * * @param anyTO User, Group or Any Object to look for attributes with no value * @param patch patch to enrich with DELETE statements */ public static void cleanEmptyAttrs(final AnyTO anyTO, final AnyPatch patch) { patch.getPlainAttrs().addAll(anyTO.getPlainAttrs().stream(). filter(plainAttrTO -> isEmpty(plainAttrTO)). map(plainAttrTO -> new AttrPatch.Builder(). operation(PatchOperation.DELETE). attrTO(new AttrTO.Builder().schema(plainAttrTO.getSchema()).build()). build()).collect(Collectors.toSet())); }
@Override public Response remedy(final String remediationKey, final AnyPatch anyPatch) { check(remediationKey, anyPatch.getKey()); ProvisioningResult<?> updated = logic.remedy(remediationKey, anyPatch, isNullPriorityAsync()); return modificationResponse(updated); }
@Override public <P extends AnyPatch> P newAnyPatch(final String key) { P result = null; switch (anyTypeKind) { case USER: result = (P) new UserPatch(); break; case GROUP: result = (P) new GroupPatch(); break; case ANY_OBJECT: result = (P) new AnyObjectPatch(); break; default: } if (result != null) { result.setKey(key); } return result; }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(name). append(userOwner). append(groupOwner). append(udynMembershipCond). append(adynMembershipConds). append(typeExtensions). build(); }
protected void link(final Any<?> any, final boolean unlink, final ProvisioningReport result) { AnyPatch patch = getAnyUtils().newAnyPatch(any.getKey()); patch.getResources().add(new StringPatchItem.Builder(). operation(unlink ? PatchOperation.DELETE : PatchOperation.ADD_REPLACE). value(profile.getTask().getResource().getKey()).build()); update(patch); result.setStatus(ProvisioningReport.Status.SUCCESS); }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(name). append(relationships). append(memberships). build(); }
protected void assign(final Any<?> any, final Boolean enabled, final ProvisioningReport result) { AnyPatch patch = getAnyUtils().newAnyPatch(any.getKey()); patch.getResources().add(new StringPatchItem.Builder(). operation(PatchOperation.ADD_REPLACE). value(profile.getTask().getResource().getKey()).build()); update(patch); provision(any, enabled, result); }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(username). append(password). append(securityQuestion). append(securityAnswer). append(mustChangePassword). append(relationships). append(memberships). append(roles). build(); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final UserPatch other = (UserPatch) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(username, other.username). append(securityQuestion, other.securityQuestion). append(securityAnswer, other.securityAnswer). append(mustChangePassword, other.mustChangePassword). append(relationships, other.relationships). append(memberships, other.memberships). append(roles, other.roles). build(); } }
anyPatch.getResources().add(new StringPatchItem.Builder(). operation(unlink ? PatchOperation.DELETE : PatchOperation.ADD_REPLACE). value(profile.getTask().getResource().getKey()).build());
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GroupPatch other = (GroupPatch) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(name, other.name). append(userOwner, other.userOwner). append(groupOwner, other.groupOwner). append(udynMembershipCond, other.udynMembershipCond). append(adynMembershipConds, other.adynMembershipConds). append(typeExtensions, other.typeExtensions). build(); } }