com.silverpeas.pdc.service
Class DefaultPdcClassificationService

java.lang.Object
  extended by com.silverpeas.pdc.service.DefaultPdcClassificationService
All Implemented Interfaces:
PdcClassificationService

@Transactional
@Named(value="pdcClassificationService")
public class DefaultPdcClassificationService
extends Object
implements PdcClassificationService

The default implementation of the PdcClassificationService by using both the JPA-based repository and the older business services on the PdC to find, save, update or delete some classifications or some positions on the PdC.


Constructor Summary
DefaultPdcClassificationService()
           
 
Method Summary
 void axisDeleted(String axisId)
          An axis comes to be removed from the PdC.
 void axisValuesDeleted(List<PdcAxisValue> deletedValues)
          Some values come to be removed from the PdC.
 void classifyContent(SilverpeasContent content, PdcClassification withClassification)
          Classifies the specified content on the PdC with the specified classification.
 void classifyContent(SilverpeasContent content, PdcClassification withClassification, boolean alertSubscribers)
          Classifies the specified content on the PdC with the specified classification.
 void deletePreDefinedClassification(String nodeId, String instanceId)
          Deletes the predefined classification set for the specified node in the specified component instance.
 PdcClassification findAPreDefinedClassification(String nodeId, String instanceId)
          Finds a predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance.
protected  NodeBm getNodeBm()
           
 PdcClassification getPreDefinedClassification(String instanceId)
          Gets the predefined classification on the PdC that was set for any new contents managed in the specified component instance.
 PdcClassification getPreDefinedClassification(String nodeId, String instanceId)
          Gets the predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance.
 PdcClassification savePreDefinedClassification(PdcClassification classification)
          Saves the specified predefined classification on the PdC.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPdcClassificationService

public DefaultPdcClassificationService()
Method Detail

findAPreDefinedClassification

public PdcClassification findAPreDefinedClassification(String nodeId,
                                                       String instanceId)
Finds a predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance. If the specified node isn't defined, then the predefined classification associated with the whole component instance is seeked. If no predefined classification is found for the specified node, then it is seeked back upto the root node (that is the component instance ifself). In the case no predefined classification is set for the whole component instance, an empty classification is then returned. To get the predefined classification that is set exactly for the specified node (if any), then use the getPreDefinedClassification(java.lang.String, java.lang.String method.

Specified by:
findAPreDefinedClassification in interface PdcClassificationService
Parameters:
nodeId - the unique identifier of the node.
instanceId - the unique identifier of the Silverpeas component instance.
Returns:
a predefined classification on the PdC ready to be used to classify a content published in the specified node or an empty classification.

getPreDefinedClassification

public PdcClassification getPreDefinedClassification(String nodeId,
                                                     String instanceId)
Gets the predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance. If the specified node isn't defined, then the predefined classification associated with the whole component instance is get. In the case no predefined classification is set for the specified node or for the component instance, then a none classification is then returned.

Specified by:
getPreDefinedClassification in interface PdcClassificationService
Parameters:
nodeId - the unique node identifier.
instanceId - the unique component instance identifier.
Returns:
a predefined classification on the PdC associated with the specified node or with the specified component instance or an empty classification.

getPreDefinedClassification

public PdcClassification getPreDefinedClassification(String instanceId)
Gets the predefined classification on the PdC that was set for any new contents managed in the specified component instance. This method is for the component instances that don't support the categorization. In the case no predefined classification is set for the whole component instance, a none classification is then returned.

Specified by:
getPreDefinedClassification in interface PdcClassificationService
Parameters:
instanceId - the unique identifier of the Silverpeas component instance.
Returns:
a predefined classification on the PdC ready to be used to classify a content published within the component instance or an empty classification.

savePreDefinedClassification

public PdcClassification savePreDefinedClassification(PdcClassification classification)
Saves the specified predefined classification on the PdC. If a predefined classification already exists for the node (if any) and the component instance to which this classification is related, then it is replaced by the specified one. If the specified classification is empty (all positions were deleted), then it is deleted and the NONE_CLASSIFICATION is sent back. The node (if any) and the component instance for which this classification has to be saved are indicated by the specified classification itself. If no node is refered by it, then the predefined classification will serv for the whole component instance.

Specified by:
savePreDefinedClassification in interface PdcClassificationService
Parameters:
classification - either the saved predefined classification or NONE_CLASSIFICATION.
Returns:

deletePreDefinedClassification

public void deletePreDefinedClassification(String nodeId,
                                           String instanceId)
Deletes the predefined classification set for the specified node in the specified component instance. If the specified node is null, then the predefined classification set for the whole component instance is deleted.

Specified by:
deletePreDefinedClassification in interface PdcClassificationService
Parameters:
nodeId - the unique identifier of the node for which the predefined classification has to be deleted.
instanceId - the unique identifier of the component instance to which the node belongs.

classifyContent

public void classifyContent(SilverpeasContent content,
                            PdcClassification withClassification)
                     throws PdcRuntimeException
Classifies the specified content on the PdC with the specified classification. If the content is already classified, then the given classification replaces the existing one. The content must exist in Silverpeas before being classified. If an error occurs while classifying the content, a runtime exception PdcRuntimeException is thrown. Subscribers are notified if at least one of their subscription matches given classification.

Specified by:
classifyContent in interface PdcClassificationService
Parameters:
content - the Silverpeas content to classify.
withClassification - the classification with which the content is positioned on the PdC.
Throws:
PdcRuntimeException

classifyContent

public void classifyContent(SilverpeasContent content,
                            PdcClassification withClassification,
                            boolean alertSubscribers)
                     throws PdcRuntimeException
Classifies the specified content on the PdC with the specified classification. If the content is already classified, then the given classification replaces the existing one. The content must exist in Silverpeas before being classified. If an error occurs while classifying the content, a runtime exception PdcRuntimeException is thrown.

Specified by:
classifyContent in interface PdcClassificationService
Parameters:
content - the Silverpeas content to classify.
withClassification - the classification with which the content is positioned on the PdC.
alertSubscribers - indicates if subscribers must be notified or not
Throws:
PdcRuntimeException

axisValuesDeleted

public void axisValuesDeleted(List<PdcAxisValue> deletedValues)
Some values come to be removed from the PdC. Triggers the update of all concerned classifications taken in charge by this service (for instance, only the predefined classifications). For each value, according to its level in the hierarchical tree representing the PdC's axis, the correct update behaviour is selected for a given classification:

Specified by:
axisValuesDeleted in interface PdcClassificationService
Parameters:
deletedValues - the values that are removed from a PdC's axis.

axisDeleted

public void axisDeleted(String axisId)
An axis comes to be removed from the PdC. Triggers the update of all concerned classifications taken in charge by this service (for instance, only the predefined classifications). The classifications are updated as following:

Specified by:
axisDeleted in interface PdcClassificationService
Parameters:
axisId - the unique identifier of the axis.

getNodeBm

protected NodeBm getNodeBm()


Copyright © 2016 Silverpeas. All Rights Reserved.