Class ArtifactTypeMappingService
- java.lang.Object
-
- com.sodius.oslc.server.process.types.services.ArtifactTypeMappingService
-
public class ArtifactTypeMappingService extends Object
Manages the mapping of native artifact types with resource types.- Since:
- 3.7.0
-
-
Constructor Summary
Constructors Constructor Description ArtifactTypeMappingService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Response
getArtifactTypeMapping(String containerId, String artifactTypeId)
Resolves theArtifact Type Mapping
for a container and artifact type.Response
getArtifactTypeMappings(String containerId, List<String> domains)
Resolves theArtifact Type Mappings
for a container.Response
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.Response
getUsages(URI resourceType)
Resolves the available OSLC usages.Response
importArtifactTypeMappings(String containerId, String importedContainerId, String targetContainerTitle)
Takes the currently mappedartifact type mappings
of a container, theartifact type mappings
of another container and tries to apply the mapping of the second one to the first one.Response
restoreArtifactTypeMapping(String containerId, String artifactTypeId)
Removes a customizedArtifact Type Mapping
of a container and artifact type.Response
restoreArtifactTypeMappings(String containerId)
Removes all customizedArtifact Type Mapping
s of a container.Response
setArtifactTypeMapping(String containerId)
Updates anArtifact Type Mapping
of a container.Response
setArtifactTypeMappings(String containerId)
Updates a list ofArtifact Type Mapping
s of a container.Response
unmapArtifactTypeMapping(String containerId, String artifactTypeId)
Unmap anArtifact Type Mapping
of a container, meaning deletingresource type
,incomingLinkingPolicy
andoutgoingPolicy
settings and storing the result.Response
unmapArtifactTypeMappings(String containerId)
Unmap allArtifact Type Mappings
of a container, meaning deletingresource type
,incomingLinkingPolicy
andoutgoingPolicy
settings and storing the result.protected Feedback
validateArtifactTypeMappings(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).
-
-
-
Method Detail
-
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.- Returns:
- a feedback instance.
- Throws:
ArtifactTypeMappingStoreException
- if validations cannot be performed.
-
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
public Response getResourceTypes(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.
- Since:
- 3.9.0
-
getUsages
public Response getUsages(URI resourceType)
Resolves the available OSLC usages.- Returns:
- the available OSLC usages.
-
getArtifactTypeMappings
public Response getArtifactTypeMappings(String containerId, List<String> domains)
Resolves theArtifact Type Mappings
for a container.
-
setArtifactTypeMappings
public Response setArtifactTypeMappings(String containerId)
Updates a list ofArtifact Type Mapping
s of a container.- Parameters:
containerId
- the container id.- Returns:
- nothing.
-
importArtifactTypeMappings
public Response importArtifactTypeMappings(String containerId, String importedContainerId, String targetContainerTitle)
Takes the currently mappedartifact type mappings
of a container, theartifact 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 missingartifact type
in the importedartifact type mappings
will 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:
- Since:
- 3.9.0
-
restoreArtifactTypeMappings
public Response restoreArtifactTypeMappings(String containerId)
Removes all customizedArtifact Type Mapping
s of a container.- Parameters:
containerId
- the container id.- Returns:
- nothing but a success message header.
-
getArtifactTypeMapping
public Response getArtifactTypeMapping(String containerId, String artifactTypeId)
Resolves theArtifact Type Mapping
for a container and artifact type.- Parameters:
containerId
- the container id.artifactTypeId
- the artifact type id.- Returns:
- the corresponding mapping.
-
setArtifactTypeMapping
public Response setArtifactTypeMapping(String containerId)
Updates anArtifact Type Mapping
of a container.- Parameters:
containerId
- the container id.- Returns:
- the updated mapping.
-
unmapArtifactTypeMapping
public Response unmapArtifactTypeMapping(String containerId, String artifactTypeId)
Unmap anArtifact Type Mapping
of a container, meaning deletingresource type
,incomingLinkingPolicy
andoutgoingPolicy
settings and storing the result.- Parameters:
containerId
- the container id.- Returns:
- nothing but a success message header.
- Since:
- 3.9.0
-
unmapArtifactTypeMappings
public Response unmapArtifactTypeMappings(String containerId)
Unmap allArtifact Type Mappings
of a container, meaning deletingresource type
,incomingLinkingPolicy
andoutgoingPolicy
settings and storing the result.- Parameters:
containerId
- the container id.- Returns:
- nothing but a success message header.
- Since:
- 3.9.0
-
restoreArtifactTypeMapping
public Response restoreArtifactTypeMapping(String containerId, String artifactTypeId)
Removes a customizedArtifact Type Mapping
of a container and artifact type.- Parameters:
containerId
- the container id.artifactTypeId
- the artifact type id.- Returns:
- nothing but a success message header.
-
-