Class PdcAxisValue
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<PdcAxisValue,PdcAxisValuePk>
-
- org.silverpeas.core.pdc.pdc.model.PdcAxisValue
-
- All Implemented Interfaces:
Serializable
,IdentifiableEntity
- Direct Known Subclasses:
LocalizedPdcAxisValue
@Entity public class PdcAxisValue extends BasicJpaEntity<PdcAxisValue,PdcAxisValuePk>
A value of one of the PdC's axis. A value belongs to an axis. An axis represents a given concept for which it defines an hierarchic tree of semantic terms belonging to the concept. A value of an axis is then the path from the axis origin down to a given node of the tree, where each node is a term refining or specifying the parent term a little more. For example, for an axis representing the concept of geography, one possible value can be "France / Rhônes-Alpes / Isère / Grenoble" where France, Rhônes-Alpes, Isère and Grenoble are each a term (thus a node) in the axis. "France" is another value, parent of the above one, and that is also a base value of the axis as it has no parent (one of the root values of the axis).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PdcAxisValue()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PdcAxisValue
aPdcAxisValue(String valueId, String axisId)
Creates a value of a PdC's axis from the specified value information.static PdcAxisValue
aPdcAxisValueFromTreeNode(TreeNode treeNode)
Creates a value of a PdC's axis from the specified tree node.protected PdcAxisValue
copy()
Copies this value into another one.boolean
equals(Object obj)
protected PdcAxisValue
fromTreeNode(TreeNode treeNode)
String
getAxisId()
Gets the unique identifier of the axis to which this value belongs to.Set<PdcAxisValue>
getChildValues()
Gets all the values into which this one can be refined or specifying in a little more.String
getMeaning()
Gets the meaning carried by this value.String
getMeaningTranslatedIn(String language)
Gets the meaning carried by this value translated in the specified language.PdcAxisValue
getParentValue()
Gets the value this one refines or specifies a little more.String
getTerm()
Gets the term carried by this value.String
getTermTranslatedIn(String language)
Gets the term carried by this value and translated in the specified language.protected TreeNode
getTreeNode()
Gets the persisted representation of this axis value.protected org.silverpeas.core.pdc.pdc.model.PdcAxisValue.TreeNodeList
getTreeNodeParents()
protected UsedAxis
getUsedAxis()
Gets the axis to which this value belongs to and that is used to classify contents on the PdC.String
getValueId()
Gets the unique value identifier.String
getValuePath()
Gets the path of this value from the root value (that is a base value of the axis).int
hashCode()
protected PdcAxisValue
inAxisId(String axisId)
boolean
isBaseValue()
Is this value is a base one?protected void
setId(long id)
ClassifyValue
toClassifyValue()
Converts this PdC axis value to a ClassifyValue instance.String
toString()
protected PdcAxisValue
withAsTreeNodeParents(List<? extends TreeNode> parents)
protected PdcAxisValue
withId(String id)
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity
performBeforePersist, performBeforeRemove, performBeforeUpdate
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
-
-
-
Method Detail
-
aPdcAxisValueFromTreeNode
public static PdcAxisValue aPdcAxisValueFromTreeNode(TreeNode treeNode)
Creates a value of a PdC's axis from the specified tree node. Currently, an axis of the PdC is persisted as an hierarchical tree in which each node is a value of the axis.- Parameters:
treeNode
- the current persistence representation of the axis value.- Returns:
- a PdC axis value.
-
aPdcAxisValue
public static PdcAxisValue aPdcAxisValue(String valueId, String axisId)
Creates a value of a PdC's axis from the specified value information. Currently, an axis of the PdC is persisted as an hierarchical tree in which each node is a value of the axis. The parameters refers the unique identifier of the node and in the tree related to the axis identifier.- Parameters:
valueId
- the unique identifier of the existing value.axisId
- the unique identifier of the axis the value belongs to.- Returns:
- a PdC axis value.
-
getAxisId
public String getAxisId()
Gets the unique identifier of the axis to which this value belongs to.- Returns:
- the unique identifier of the axis value.
-
getValueId
public String getValueId()
Gets the unique value identifier.- Returns:
- the unique value identifier.
-
getChildValues
public Set<PdcAxisValue> getChildValues()
Gets all the values into which this one can be refined or specifying in a little more. Theses values are the children of this one in the semantic tree represented by the axis to which this value belongs.- Returns:
- an unmodifiable set of values that are children of this one. If this value is a leaf, then an empty set is returned.
-
getParentValue
public PdcAxisValue getParentValue()
Gets the value this one refines or specifies a little more. The returned value is the parent of this one in the semantic tree represented by the axis to which this value belongs.- Returns:
- the axis value parent of this one or null if this value has no parent (in that case, this value is a base one).
-
getTerm
public String getTerm()
Gets the term carried by this value.- Returns:
- the term of the value.
-
getTermTranslatedIn
public String getTermTranslatedIn(String language)
Gets the term carried by this value and translated in the specified language.- Parameters:
language
- the language in which the term should be translated.- Returns:
- the term translated in the specified language. If no such translation exists, then return the default term as get by calling getTerm() method.
-
isBaseValue
public boolean isBaseValue()
Is this value is a base one?- Returns:
- true if this value is an axis base value.
-
getMeaning
public String getMeaning()
Gets the meaning carried by this value. The meaning is in fact the complete path of terms that made this value. For example, in an axis representing the geography, the meaning of the value "France / Rhônes-Alpes / Isère" is "Geography / France / Rhônes-Alpes / Isère".- Returns:
- the meaning carried by this value, in other words the complete path of this value.
-
getMeaningTranslatedIn
public String getMeaningTranslatedIn(String language)
Gets the meaning carried by this value translated in the specified language. The meaning is in fact the complete path of translated terms that made this value. For example, in an axis representing the geography, the meaning of the value "France / Rhônes-Alpes / Isère" is in french "Geographie / France / Rhônes-Alpes / Isère".- Returns:
- the meaning carried by this value, in other words the complete path of this value translated in the specified language. If no such translations exist, then the result is equivalent to the call of the getMeaning() method.
-
getValuePath
public String getValuePath()
Gets the path of this value from the root value (that is a base value of the axis). The path is made up of the identifiers of each parent value; for example : /0/2/3- Returns:
- the path of its value.
-
copy
protected PdcAxisValue copy()
Copies this value into another one. In fact, the attributes of the copy refers to the same object referred by the attributes of this instance.- Returns:
- a copy of this PdC axis value.
-
getUsedAxis
protected UsedAxis getUsedAxis()
Gets the axis to which this value belongs to and that is used to classify contents on the PdC.- Returns:
- a PdC axis configured to be used in the classification of contents.
-
getTreeNode
protected TreeNode getTreeNode()
Gets the persisted representation of this axis value. By the same way, the parents of this tree node are also set.- Returns:
- a tree node representing this axis value in the persistence layer.
-
setId
protected void setId(long id)
-
withId
protected PdcAxisValue withId(String id)
-
inAxisId
protected PdcAxisValue inAxisId(String axisId)
-
fromTreeNode
protected PdcAxisValue fromTreeNode(TreeNode treeNode)
-
withAsTreeNodeParents
protected PdcAxisValue withAsTreeNodeParents(List<? extends TreeNode> parents)
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractJpaEntity<PdcAxisValue,PdcAxisValuePk>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractJpaEntity<PdcAxisValue,PdcAxisValuePk>
-
toClassifyValue
public ClassifyValue toClassifyValue()
Converts this PdC axis value to a ClassifyValue instance. This method is for compatibility with the old way to manage the classification.- Returns:
- a ClassifyValue instance.
- Throws:
PdcException
- if an error occurs while transforming this value into a ClassifyValue instance.
-
getTreeNodeParents
protected org.silverpeas.core.pdc.pdc.model.PdcAxisValue.TreeNodeList getTreeNodeParents()
-
-