public Response create()

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


  public Response create(T resource, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) throws ScimException, ResourceException {
    Repository<T> repository = getRepositoryInternal();

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

    T created = repository.create(resource);

    EntityTag etag = fromVersion(created);

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

    try {
      created = attributesForDisplay(created, attributeReferences, excludedAttributeReferences);
    } catch (AttributeException e) {
        log.debug("Exception thrown while processing attributes", e);
    }

    Objects.requireNonNull(created.getId(), "Repository must supply an id for a resource");
    URI location = uriInfo.getAbsolutePathBuilder()
      .path(created.getId())
      .build();

    return Response.status(Status.CREATED)
      .location(location)
      .tag(etag)
      .entity(created)
      .build();
  }