/** * 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())); }
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); }
result.getPlainAttrs().addAll(patch(EntityTOUtils.buildAttrMap(to.getPlainAttrs()), patch.getPlainAttrs()));
Map<String, AttrTO> originalAttrs = EntityTOUtils.buildAttrMap(original.getPlainAttrs()); 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);
anyPatch.getPlainAttrs().stream(). filter(patch -> patch.getAttrTO() != null).forEach(patch -> { PlainSchema schema = getPlainSchema(patch.getAttrTO().getSchema());