public Response getById()

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


  public Response getById(String id, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) throws ScimException, ResourceException {
    if (uriInfo.getQueryParameters().getFirst("filter") != null) {
      return Response.status(Status.FORBIDDEN).build();
    }

    Repository<T> repository = getRepositoryInternal();

    T resource = null;
    try {
      resource = repository.get(id);
    } catch (UnableToRetrieveResourceException e2) {
      Status status = Status.fromStatusCode(e2.getStatus());
      if (status.getFamily().equals(Family.SERVER_ERROR)) {
        throw e2;
      }
    }

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

    EntityTag etag = fromVersion(resource);
    if (etag != null) {
      ResponseBuilder evaluatePreconditionsResponse = request.evaluatePreconditions(etag);
      if (evaluatePreconditionsResponse != null) {
        return Response.status(Status.NOT_MODIFIED).build();
      }
    }

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

    // Process Attributes
    resource = processFilterAttributeExtensions(repository, resource, attributeReferences, excludedAttributeReferences);
    resource = attributesForDisplayThrowOnError(resource, attributeReferences, excludedAttributeReferences);
    return Response.ok()
                   .entity(resource)
                   .location(uriInfo.getAbsolutePath())
                   .tag(etag)
                   .build();
  }