com.silverpeas.pdc.model
Class PdcClassification

java.lang.Object
  extended by com.silverpeas.pdc.model.PdcClassification
All Implemented Interfaces:
Serializable, Cloneable

@Entity
public class PdcClassification
extends Object
implements Serializable, Cloneable

A classification of a content in Silverpeas on the classification plan (named PdC). A classification of a content is made up of one or more positions on the axis of the PdC. Each position consists of one or several values on some PdC's axis. A classification cannot have two or more identical positions; each of them must be unique. It can also represent, for a Silverpeas component instance or for a node in a component instance, a predefined classification with which any published contents can be classified on the PdC. In this case, the contentId attribute is null. A classification can be or not modifiable; by default, a predefined classification, that is used to classify new contents, is not modifiable whereas a classification of a content can be modified.

See Also:
Serialized Form

Field Summary
static PdcClassification NONE_CLASSIFICATION
          Represents an empty classification (id est no classification on the PdC).
 
Constructor Summary
protected PdcClassification()
          Creates an empty classification on the PdC, ready to be completed for a given content published in a given component instance.
protected PdcClassification(long id)
           
 
Method Summary
static PdcClassification aPdcClassificationOfContent(String contentId, String inComponentInstanceId)
          Creates an empty classification on the PdC of the specified content published in the specified component instance.
static PdcClassification aPredefinedPdcClassificationForComponentInstance(String instanceId)
          Creates an empty predefined classification for the contents that will published in the specified component instance.
 PdcClassification clone()
           
 PdcClassification forNode(String nodeId)
           
 List<ClassifyPosition> getClassifyPositions()
          Gets the positions on the PdC of this classification in the form of ClassifyPosition instances.
 String getComponentInstanceId()
           
 String getContentId()
           
 Long getId()
          Gets the unique identifier of this classification on the PdC.
 String getNodeId()
           
 Set<PdcPosition> getPositions()
          Gets the positions on the PdC's axis with which the content is classified.
 PdcClassification inComponentInstance(String instanceId)
           
 boolean isEmpty()
          Is this classification empty?
 boolean isModifiable()
          Is the PdC classifications generated from this template can be changed?
 boolean isPredefined()
          Is this classification on the PdC is a predefined one to classify any new contents in the given node or for the given whole component instance?
 boolean isPredefinedForANode()
          Is this classification on the PdC is a predefined one for the contents published in a given node?
 boolean isPredefinedForTheWholeComponentInstance()
          Is this classification on the PdC is a predefined one for the contents published in the given whole component instance?
 PdcClassification modifiable()
          Sets this PdC classification as modifiable.
 PdcClassification ofContent(String contentId)
           
protected  void setId(Long id)
           
 String toString()
           
 PdcClassification unmodifiable()
          Sets this PdC classification as unmodifiable.
 void updateForPdcAxisValuesDeletion(List<PdcAxisValue> deletedValues)
          Updates this classification by removing from its positions the specified values because they will be deleted from the PdC's axis.
 PdcClassification withPosition(PdcPosition aPosition)
          Adds the specified position on the PdC in this classification.
 PdcClassification withPositions(Collection<PdcPosition> thePositions)
          Sets the positions on the PdC for this classification.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE_CLASSIFICATION

public static final PdcClassification NONE_CLASSIFICATION
Represents an empty classification (id est no classification on the PdC).

Constructor Detail

PdcClassification

protected PdcClassification()
Creates an empty classification on the PdC, ready to be completed for a given content published in a given component instance. By default, a classification of a content is modifiable.


PdcClassification

protected PdcClassification(long id)
Method Detail

aPredefinedPdcClassificationForComponentInstance

public static PdcClassification aPredefinedPdcClassificationForComponentInstance(String instanceId)
Creates an empty predefined classification for the contents that will published in the specified component instance. By default, a predefined classification isn't modifiable and servs to classify automatically new contents published in the specied component instance.

Parameters:
instanceId - the unique identifier of the component instance to which the predefined classification will be attached.
Returns:
an empty predefined classification.

aPdcClassificationOfContent

public static PdcClassification aPdcClassificationOfContent(String contentId,
                                                            String inComponentInstanceId)
Creates an empty classification on the PdC of the specified content published in the specified component instance. By default, the classification of a content can be updated.

Parameters:
contentId - the unique identifier of the content to classify.
inComponentInstanceId - the unique identifier of the component instance in which the content is published.
Returns:
an empty classification on the PdC.

getPositions

public Set<PdcPosition> getPositions()
Gets the positions on the PdC's axis with which the content is classified. Positions on the PdC can be added or removed with the returned set.

Returns:
a set of positions of this classification.

isEmpty

public boolean isEmpty()
Is this classification empty?

Returns:
true if this classification is an empty one, false otherwise.

isModifiable

public boolean isModifiable()
Is the PdC classifications generated from this template can be changed?

Returns:
false if the content have to be automatically classified, true if the classifications from this template should serv as a proposition of classification.

modifiable

public PdcClassification modifiable()
Sets this PdC classification as modifiable.

Returns:
itself.

unmodifiable

public PdcClassification unmodifiable()
Sets this PdC classification as unmodifiable.

Returns:
itself.

ofContent

public PdcClassification ofContent(String contentId)

forNode

public PdcClassification forNode(String nodeId)

inComponentInstance

public PdcClassification inComponentInstance(String instanceId)

getComponentInstanceId

public String getComponentInstanceId()

getContentId

public String getContentId()

getNodeId

public String getNodeId()

isPredefined

public boolean isPredefined()
Is this classification on the PdC is a predefined one to classify any new contents in the given node or for the given whole component instance? If this classification serves as a template for classifying the contents in a whole component instance or in a node, then true is returned. If this classification is the one of a given content, then false is returned.

Returns:
true if this classification is a predefined one, false otherwise.

isPredefinedForTheWholeComponentInstance

public boolean isPredefinedForTheWholeComponentInstance()
Is this classification on the PdC is a predefined one for the contents published in the given whole component instance? If this classification serves as a template for classifying the contents in a whole component instance, then true is returned. If this classification is a predefined one dedicated to classify only the content in a given node, then false is returned. If this classification is the one of a given content, then false is returned.

Returns:
true if this classification is a predefined one for the whole component instance, false otherwise.

isPredefinedForANode

public boolean isPredefinedForANode()
Is this classification on the PdC is a predefined one for the contents published in a given node? If this classification serves to classify the contents published in a single node of the component instance, then true is returned. If this classification is the one of a given content, then false is returned. If this classification is the predefined one for the whole component instance, then false is returned.

Returns:
true if this classification is a predefined one for a given node, false otherwise.

updateForPdcAxisValuesDeletion

public void updateForPdcAxisValuesDeletion(List<PdcAxisValue> deletedValues)
Updates this classification by removing from its positions the specified values because they will be deleted from the PdC's axis. This method is invoked at axis value deletion. Accordingly, it performs an update of this classification by applying the following algorithm for each deleted value:

Parameters:
deletedValues - the values that are removed from a PdC's axis.

withPositions

public PdcClassification withPositions(Collection<PdcPosition> thePositions)
Sets the positions on the PdC for this classification.

Parameters:
thePositions - the position to set in this classification.
Returns:
itself.

withPosition

public PdcClassification withPosition(PdcPosition aPosition)
Adds the specified position on the PdC in this classification.

Parameters:
aPosition - a position on the PdC to add in this classification.
Returns:
itself.

getId

public Long getId()
Gets the unique identifier of this classification on the PdC. The identifier is set when the classification is persisted over the Silverpeas runtime. If the content this classification is about were at a time unclassified, then the identifier of the classification isn't expected to be not the one of the previous classification as they are considered distinct objects (the previous classification was removed from the persistence context in Silverpeas).

Returns:
the classification unique identifier.

setId

protected void setId(Long id)

toString

public String toString()
Overrides:
toString in class Object

clone

public PdcClassification clone()
Overrides:
clone in class Object

getClassifyPositions

public List<ClassifyPosition> getClassifyPositions()
Gets the positions on the PdC of this classification in the form of ClassifyPosition instances. This method is for compatibility with the old way to manage the classification.

Returns:
a list of ClassifyPosition instances, each of them representing a position on the PdC.


Copyright © 2016 Silverpeas. All Rights Reserved.