Class ArtifactTypeMappingService

java.lang.Object
com.sodius.oslc.server.process.types.services.ArtifactTypeMappingService

@Path("/process/types/mapping") public class ArtifactTypeMappingService extends Object
Manages the mapping of native artifact types with resource types.
Since:
3.7.0
  • Constructor Details

    • ArtifactTypeMappingService

      public ArtifactTypeMappingService()
  • Method Details

    • validateArtifactTypeMappings

      protected Feedback validateArtifactTypeMappings(String containerId, Collection<ArtifactTypeMapping> mappings, List<String> domains) throws ArtifactTypeMappingStoreException
      Validates the artifact type mappings to detect if any of the following issues exists:
      • There are no mappings at all.
      • There are no custom mappings.
      • There are duplicate dialog names (per resource type).
      • There is no default usage (per resource type).
      • There are duplicate usages (per resource type).
      • Configuration is not compliance with CM usages (if apply).

      Applications can override this method to add validations if need it.

      Parameters:
      containerId - the container id.
      mappings - the corresponding resolved mappings.
      domains - the OSLC domains that are to use with the mappings
      Returns:
      a feedback instance.
      Throws:
      ArtifactTypeMappingStoreException - if validations cannot be performed.
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom resource types - added in 3.13.0
    • getSuggestedMappings

      protected List<SuggestedMapping> getSuggestedMappings(Collection<ArtifactTypeMapping> mappings)
      Verify the mappings to check if better mappings can be suggested. Default implementation returns an empty list, it’s up to each application to override the behavior if required.
      Parameters:
      mappings - the mappings to check
      Returns:
      an empty collection if no suggestion is to make; the suggested mappings otherwise.
    • getResourceTypes

      @GET @Path("resources") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getResourceTypes(@QueryParam("containerId") String containerId)
      Resolves the available resource types.
      Parameters:
      containerId - optional container id. If missing, this service returns the enabled resource types in the ProcessScope; otherwise, it returns the mapped resource types for the given container.
      Returns:
      the available resource types.
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom resource types - added in 3.13.0
      Since:
      3.9.0
    • getArtifactTypeContainers

      @GET @Path("containers") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getArtifactTypeContainers()
      Resolves the available artifact type containers.
      Returns:
      the available artifact type containers.
      Since:
      4.2.0
    • getUsages

      @GET @Path("usages") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getUsages(@QueryParam("resourceType") URI resourceType)
      Resolves the available OSLC usages.
      Parameters:
      resourceType - the resource type for which usages must be applicable, null to retrieve all usages
      Returns:
      the available OSLC usages.
    • getArtifactTypeMappings

      @GET @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getArtifactTypeMappings(@QueryParam("containerId") String containerId, @QueryParam("domain") List<String> domains)
      Resolves the Artifact Type Mappings for a container.
      Parameters:
      containerId - the container id.
      domains - the domain URLs to limit the artifact types mappings, an empty list if no filtering is desired.
      Returns:
      the corresponding mappings wrapped along with a feedback if some issues exist.
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom linking types - added in 3.13.0
    • setArtifactTypeMappings

      @POST @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response setArtifactTypeMappings(@QueryParam("containerId") String containerId)
      Updates a list of Artifact Type Mappings of a container.
      Parameters:
      containerId - the container id.
      Returns:
      an empty response
    • importArtifactTypeMappings

      @GET @Path("import") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response importArtifactTypeMappings(@QueryParam("containerId") String containerId, @QueryParam("importedContainerId") String importedContainerId, @QueryParam("targetContainerTitle") String targetContainerTitle)
      Takes the currently mapped artifact type mappings of a container, the artifact type mappings of another container and tries to apply the mapping of the second one to the first one. Nothing is saved in the store, the result is returned and any missing artifact type in the imported artifact type mappings will be listed in a warning feedback. The user will have to save the new mapping separately if he chooses.
      Parameters:
      containerId - the id of the container we're importing to.
      importedContainerId - the id of a different container we want to import the mappings from.
      targetContainerTitle - target container title, to display in feedbacks.
      Returns:
      a response with the artifact type mappings
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom linking types - added in 3.13.0
      Since:
      3.9.0
    • restoreArtifactTypeMappings

      @DELETE @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response restoreArtifactTypeMappings(@QueryParam("containerId") String containerId)
      Removes all customized Artifact Type Mappings of a container.
      Parameters:
      containerId - the container id.
      Returns:
      an empty response with a success message header.
    • getArtifactTypeMapping

      @GET @Path("artifact") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getArtifactTypeMapping(@QueryParam("containerId") String containerId, @QueryParam("artifactTypeId") String artifactTypeId)
      Resolves the Artifact Type Mapping for a container and artifact type.
      Parameters:
      containerId - the container id.
      artifactTypeId - the artifact type id.
      Returns:
      the corresponding mapping.
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom linking types - added in 3.13.0
    • setArtifactTypeMapping

      @POST @Path("artifact") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response setArtifactTypeMapping(@QueryParam("containerId") String containerId)
      Updates an Artifact Type Mapping of a container.
      Parameters:
      containerId - the container id.
      Returns:
      the updated mapping.
    • unmapArtifactTypeMapping

      @POST @Path("artifact/unmap") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response unmapArtifactTypeMapping(@QueryParam("containerId") String containerId, @QueryParam("artifactTypeId") String artifactTypeId)
      Unmap an Artifact Type Mapping of a container, meaning deleting resource type, incomingLinkingPolicy and outgoingPolicy settings and storing the result.
      Parameters:
      containerId - the container id.
      artifactTypeId - the artifact type id.
      Returns:
      an empty response with a success message header.
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom linking types - added in 3.13.0
    • unmapArtifactTypeMappings

      @POST @Path("unmap") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) @Consumes({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response unmapArtifactTypeMappings(@QueryParam("containerId") String containerId)
      Unmap all Artifact Type Mappings of a container, meaning deleting resource type, incomingLinkingPolicy and outgoingPolicy settings and storing the result.
      Parameters:
      containerId - the container id.
      Returns:
      an empty response with a success message header.
      Throws:
      OslcWebApplicationException - (server error) if an error occurred while retrieving custom linking types - added in 3.13.0
    • restoreArtifactTypeMapping

      @DELETE @Path("artifact") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response restoreArtifactTypeMapping(@QueryParam("containerId") String containerId, @QueryParam("artifactTypeId") String artifactTypeId)
      Removes a customized Artifact Type Mapping of a container and artifact type.
      Parameters:
      containerId - the container id.
      artifactTypeId - the artifact type id.
      Returns:
      an empty response with a success message header.