Package org.silverpeas.core.webapi.pdc
Class PdcServiceProvider
- java.lang.Object
-
- org.silverpeas.core.webapi.pdc.PdcServiceProvider
-
@Provider public class PdcServiceProvider extends Object
A provider of services on the classification plan (named PdC). This class implements the adaptor pattern by wrapping all the features about the PdC and provided by several business services so that an unified and a unique access point is provided to the PdC web resources. The instances of this class are managed by the IoC container and can be then injected as dependency into the PdC web resources.
-
-
Constructor Summary
Constructors Constructor Description PdcServiceProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPosition(ClassifyPosition position, String contentId, String componentId)
Adds a new position of the specified resource content on the PdC configured for the specified Silverpeas component instance.void
deletePosition(int positionId, String contentId, String componentId)
Deletes the specified position of the specified resource content on the PdC configured for the specified component instance.static String
forContentOfId(String contentId)
A convenient method to enhance the readability of method calls when a resource content identifier is expected as argument.List<Axis>
getAllAxis()
Gets all the axis of the PdC in Silverpeas.List<ClassifyPosition>
getAllPositions(String contentId, String componentId)
Gets the positions of the specified resource content on the PdC of the specified component instance.List<UsedAxis>
getAxisUsedInClassificationsByCriteria(PdcFilterCriteria criteria)
Gets the axis and, for each of them, the values that are used in the classification of the contents that match the specified criteria.List<UsedAxis>
getAxisUsedInPdcFor(String componentId)
Gets the axis used in the PdC configured for the specified Silverpeas component instance.List<UsedAxis>
getAxisUsedInPdcToClassify(String contentId, String inComponentId)
Gets the axis used in the PdC configured for the specified component instance in order to classify the specified resource content.OrganizationController
getOrganisationController()
UserThesaurusHolder
getThesaurusOfUser(UserDetail user)
Gets a holder of the thesaurus for the specified user.static String
inComponentOfId(String componentId)
A convenient method to enhance the readability of method calls when a component identifier is expected as argument.void
updatePosition(ClassifyPosition position, String contentId, String componentId)
Updates the specified position of the specified resource content on the PdC configured for the specified Silverpeas component instance.
-
-
-
Method Detail
-
inComponentOfId
public static String inComponentOfId(String componentId)
A convenient method to enhance the readability of method calls when a component identifier is expected as argument.- Parameters:
componentId
- the identifier of a Silverpeas component instance.- Returns:
- the identifier.
-
forContentOfId
public static String forContentOfId(String contentId)
A convenient method to enhance the readability of method calls when a resource content identifier is expected as argument.- Parameters:
contentId
- the identifier of a Silverpeas resource content.- Returns:
- the identifier.
-
addPosition
public void addPosition(ClassifyPosition position, String contentId, String componentId) throws ContentManagerException, PdcException
Adds a new position of the specified resource content on the PdC configured for the specified Silverpeas component instance. Once added, an identifier is set for the specified position.- Parameters:
position
- the classification position to add.contentId
- the identifier of the content for which a new position is created on the PdC.componentId
- the identifier of the component instance that owns the PdC instance.- Throws:
ContentManagerException
- if no such content or component instance exists with the specified identifier.PdcException
- if the position adding fails.
-
updatePosition
public void updatePosition(ClassifyPosition position, String contentId, String componentId) throws ContentManagerException, PdcException
Updates the specified position of the specified resource content on the PdC configured for the specified Silverpeas component instance. The position of the content on the PdC whose the identifier is the one of the specified position is replaced by the passed position.- Parameters:
position
- the classification position to update.contentId
- the identifier of the content for which the position is to update on the PdC.componentId
- the identifier of the component instance that owns the PdC instance.- Throws:
ContentManagerException
- if no such content or component instance exists with the specified identifier.PdcException
- if the position update fails.
-
deletePosition
public void deletePosition(int positionId, String contentId, String componentId) throws PdcException, ContentManagerException
Deletes the specified position of the specified resource content on the PdC configured for the specified component instance.- Parameters:
positionId
- the identifier of the position to delete.componentId
- the identifier of the component that owns the PdC instance.- Throws:
PdcException
- if the position or the component identifier doesn't exist or if the deletion fails.ContentManagerException
-
getAllPositions
public List<ClassifyPosition> getAllPositions(String contentId, String componentId) throws ContentManagerException, PdcException
Gets the positions of the specified resource content on the PdC of the specified component instance.- Parameters:
contentId
- the identifier of the content.componentId
- the identifier of the Silverpeas component instance.- Returns:
- a list of classification positions of the specified content.
- Throws:
ContentManagerException
- if no such content or component instance exists with the specified identifier.PdcException
- if the position fetching fails.
-
getAxisUsedInPdcToClassify
public List<UsedAxis> getAxisUsedInPdcToClassify(String contentId, String inComponentId) throws ContentManagerException, PdcException
Gets the axis used in the PdC configured for the specified component instance in order to classify the specified resource content. If the resource content is already classified, then the positions of the resource content on the invariant axis are kept as the only possible value on theses axis. In the case no axis are specifically used for the component instance, then all the PdC axis are sent back as axis that can be used to classify the specified content.- Parameters:
contentId
- the identifier of the content to classify (or to refine the classification). It is used to find its previous classification in order to fix the value of the invariant axis.inComponentId
- the identifier of the component instance.- Returns:
- a list of used axis.
- Throws:
ContentManagerException
- if no such content or component instance exists with the specified identifier.PdcException
- if the axis cannot be fetched.
-
getAxisUsedInPdcFor
public List<UsedAxis> getAxisUsedInPdcFor(String componentId) throws PdcException
Gets the axis used in the PdC configured for the specified Silverpeas component instance.- Parameters:
componentId
- the unique identifier of the component instance.- Returns:
- a list of axis used in the PdC configured for the component instance.
- Throws:
PdcException
- if the axis cannot be fetched.
-
getThesaurusOfUser
public UserThesaurusHolder getThesaurusOfUser(UserDetail user)
Gets a holder of the thesaurus for the specified user.- Parameters:
user
- the user for which a holder will hold the thesaurus.- Returns:
- a UserThesaurusHolder instance.
-
getAxisUsedInClassificationsByCriteria
public List<UsedAxis> getAxisUsedInClassificationsByCriteria(PdcFilterCriteria criteria) throws PdcException
Gets the axis and, for each of them, the values that are used in the classification of the contents that match the specified criteria.- Parameters:
criteria
- the criteria the classified contents have to satisfy. The expected criteria are on the component instance or the workspace in which they were published, on some axis values with which they were classified, and on the inclusion of the secondary axis.- Returns:
- the axis with the values used in a classification. The secondary axis are inserted at the end of the list.
- Throws:
PdcException
- if an error occurs while getting the PdC's axis that are used in a classification.
-
getAllAxis
public List<Axis> getAllAxis() throws PdcException
Gets all the axis of the PdC in Silverpeas.- Returns:
- the axis of the PdC.
- Throws:
PdcException
- if an error occurs while getting the PdC's axis.
-
getOrganisationController
public OrganizationController getOrganisationController()
-
-