private Response update()

in scim-server/src/main/java/org/apache/directory/scim/server/rest/BaseResourceTypeResourceImpl.java [280:309]


  private Response update(String id, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes, Function<T, UpdateRequest<T>> updateRequestFunction) throws ScimException, ResourceException {

    Repository<T> repository = getRepositoryInternal();

    Set<AttributeReference> attributeReferences = AttributeReferenceListWrapper.getAttributeReferences(attributes);
    Set<AttributeReference> excludedAttributeReferences = AttributeReferenceListWrapper.getAttributeReferences(excludedAttributes);
    validateAttributes(attributeReferences, excludedAttributeReferences);

    T stored = repository.get(id);

    if (stored == null) {
      throw notFoundException(id);
    }

    EntityTag backingETag = requireEtag(stored);
    validatePreconditions(id, backingETag);

    UpdateRequest<T> updateRequest = updateRequestFunction.apply(stored);
    T updated = repository.update(updateRequest);

    // Process Attributes
    updated = processFilterAttributeExtensions(repository, updated, attributeReferences, excludedAttributeReferences);
    updated = attributesForDisplayIgnoreErrors(updated, attributeReferences, excludedAttributeReferences);

    EntityTag etag = etag(updated);
    return Response.ok(updated)
      .location(buildLocationTag(updated))
      .tag(etag)
      .build();
  }