Class ArtifactTypeMappingService
java.lang.Object
com.sodius.oslc.server.process.types.services.ArtifactTypeMappingService
Manages the mapping of native artifact types with resource types.
- Since:
- 3.7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResolves the available artifact type containers.getArtifactTypeMapping(String containerId, String artifactTypeId) Resolves theArtifact Type Mappingfor a container and artifact type.getArtifactTypeMappings(String containerId, List<String> domains) Resolves theArtifact Type Mappingsfor a container.getResourceTypes(String containerId) Resolves the available resource types.protected List<SuggestedMapping> getSuggestedMappings(Collection<ArtifactTypeMapping> mappings) Verify the mappings to check if better mappings can be suggested.Resolves the available OSLC usages.importArtifactTypeMappings(String containerId, String importedContainerId, String targetContainerTitle) Takes the currently mappedartifact type mappingsof a container, theartifact type mappingsof another container and tries to apply the mapping of the second one to the first one.restoreArtifactTypeMapping(String containerId, String artifactTypeId) Removes a customizedArtifact Type Mappingof a container and artifact type.restoreArtifactTypeMappings(String containerId) Removes all customizedArtifact Type Mappings of a container.setArtifactTypeMapping(String containerId) Updates anArtifact Type Mappingof a container.setArtifactTypeMappings(String containerId) Updates a list ofArtifact Type Mappings of a container.unmapArtifactTypeMapping(String containerId, String artifactTypeId) Unmap anArtifact Type Mappingof a container, meaning deletingresource type,incomingLinkingPolicyandoutgoingPolicysettings and storing the result.unmapArtifactTypeMappings(String containerId) Unmap allArtifact Type Mappingsof a container, meaning deletingresource type,incomingLinkingPolicyandoutgoingPolicysettings and storing the result.protected FeedbackvalidateArtifactTypeMappings(String containerId, Collection<ArtifactTypeMapping> mappings, List<String> domains) 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).
-
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
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 theProcessScope; 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,nullto 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 theArtifact Type Mappingsfor 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
wrappedalong with afeedbackif 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 ofArtifact 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 mappedartifact type mappingsof a container, theartifact type mappingsof 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 missingartifact typein the importedartifact type mappingswill be listed in a warningfeedback. 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 infeedbacks.- 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 customizedArtifact 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 theArtifact Type Mappingfor 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 anArtifact Type Mappingof 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 anArtifact Type Mappingof a container, meaning deletingresource type,incomingLinkingPolicyandoutgoingPolicysettings 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 allArtifact Type Mappingsof a container, meaning deletingresource type,incomingLinkingPolicyandoutgoingPolicysettings 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 customizedArtifact Type Mappingof a container and artifact type.- Parameters:
containerId- the container id.artifactTypeId- the artifact type id.- Returns:
- an empty response with a success message header.
-