private static Collection<AttrTO> patch(final Map<String, AttrTO> attrs, final Set<AttrPatch> attrPatches) { Map<String, AttrTO> rwattrs = new HashMap<>(attrs); attrPatches.forEach(patch -> { if (patch.getAttrTO() == null) { LOG.warn("Invalid {} specified: {}", AttrPatch.class.getName(), patch); } else { AttrTO removed = rwattrs.remove(patch.getAttrTO().getSchema()); if (patch.getOperation() == PatchOperation.ADD_REPLACE && !patch.getAttrTO().getValues().isEmpty()) { rwattrs.put(patch.getAttrTO().getSchema(), patch.getAttrTO()); } } }); return rwattrs.values(); }
@Override protected AttrPatch newInstance() { return new AttrPatch(); }
public Builder attrTO(final AttrTO attrTO) { getInstance().setAttrTO(attrTO); return this; }
if (!patch.isEmpty()) { result.getPlainAttrs().add(patch);
@Override protected AnyPatch doUpdate( final AnyTO before, final AnyPatch anyPatch, final SyncDelta delta, final ProvisioningReport result) { GroupPatch groupPatch = GroupPatch.class.cast(anyPatch); Pair<GroupPatch, List<PropagationStatus>> updated = groupProvisioningManager.update( groupPatch, Collections.singleton(profile.getTask().getResource().getKey()), true); String groupOwner = null; for (AttrPatch attrPatch : groupPatch.getPlainAttrs()) { if (attrPatch.getOperation() == PatchOperation.ADD_REPLACE && attrPatch.getAttrTO() != null && attrPatch.getAttrTO().getSchema().isEmpty() && !attrPatch.getAttrTO().getValues().isEmpty()) { groupOwner = attrPatch.getAttrTO().getValues().get(0); } } if (groupOwner != null) { groupOwnerMap.put(updated.getLeft().getKey(), groupOwner); } return anyPatch; }
final SyncopeClientException invalidValues) { switch (patch.getOperation()) { case ADD_REPLACE: && !patch.getAttrTO().getValues().isEmpty() && !patch.getAttrTO().getValues().get(0).equals(attr.getUniqueValue().getValueAsString())) { List<String> valuesToBeAdded = patch.getAttrTO().getValues(); if (!valuesToBeAdded.isEmpty() && (!schema.isUniqueConstraint() || attr.getUniqueValue() == null
filter(patch -> patch.getAttrTO() != null).forEach(patch -> { PlainSchema schema = getPlainSchema(patch.getAttrTO().getSchema()); if (schema == null) { LOG.debug("Invalid " + PlainSchema.class.getSimpleName() + " {}, ignoring...", patch.getAttrTO().getSchema()); } else { PlainAttr<?> attr = (PlainAttr<?>) any.getPlainAttr(schema.getKey()).orElse(null); LOG.debug("No plain attribute found for schema {}", schema); if (patch.getOperation() == PatchOperation.ADD_REPLACE) { attr = anyUtils.newPlainAttr(); ((PlainAttr) attr).setOwner(any);