Package org.silverpeas.core.node.dao
Class NodeDAO
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.AbstractDAO
-
- org.silverpeas.core.node.dao.NodeDAO
-
@Repository public class NodeDAO extends AbstractDAO
This is the Node Data Access Object.- Author:
- Nicolas Eysseric
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteComponentInstanceData(String componentInstanceId)
Deletes all nodes linked to the component instance represented by the given identifier.void
deleteRow(Connection con, NodePK nodePK)
Delete into the database a node but not it's descendants.List<NodeDetail>
getAllHeaders(Connection con, NodePK nodePK)
Get all nodeDetailsList<NodeDetail>
getAllHeaders(Connection con, NodePK nodePK, int level)
List<NodeDetail>
getAllHeaders(Connection con, NodePK nodePK, String sorting)
List<NodeDetail>
getAllHeaders(Connection con, NodePK nodePK, String sorting, int level)
Get all nodeDetailsCollection<NodeDetail>
getChildrenDetails(Connection con, NodePK nodePK)
Get the header of each child of the nodeint
getChildrenNumber(Connection con, NodePK nodePK)
Get the children number of this nodeCollection<NodePK>
getChildrenPKs(Connection con, NodePK nodePK)
Get children node PKs of a nodeList<NodeDetail>
getDescendantDetails(Connection con, NodeDetail node)
Get descendant nodeDetails of a nodeList<NodeDetail>
getDescendantDetails(Connection con, NodePK nodePK)
Get descendant nodeDetails of a nodeCollection<NodePK>
getDescendantPKs(Connection con, NodePK nodePK)
Get descendant node PKs of a nodeList<NodeDetail>
getHeadersByLevel(Connection con, NodePK nodePK, int level)
Get nodeDetails by level.List<NodeDetail>
getMinimalDataByInstances(Connection con, Collection<String> instanceIds)
Selects massively simple data about nodes.NodePath
getNodePath(Connection con, NodePK nodePK)
Get the path from root to a nodeList<NodeDetail>
getSubTree(Connection con, NodePK nodePK, String status)
List<NodeDetail>
getTree(Connection con, NodePK nodePK)
NodePK
insertRow(Connection con, NodeDetail nd)
Insert into the database the data of a nodeboolean
isSameNameSameLevelOnCreation(Connection con, NodeDetail nd)
On node creation, check if another node have got the same name with same fatherboolean
isSameNameSameLevelOnUpdate(Connection con, NodeDetail nd)
On node update, check if another node have got the same name with same fatherNodeDetail
loadRow(Connection con, NodePK nodePK)
NodeDetail
loadRow(Connection con, NodePK nodePK, boolean getTranslations)
Load node attributes from databaseNodeDetail
loadRow(Connection con, NodePK nodePK, String name, int nodeFatherId)
void
moveNode(Connection con, NodeDetail nodeDetail)
NodeDetail
resultSet2NodeDetail(ResultSet rs, NodePK nodePK)
Create a NodeDetail from a ResultSetNodeDetail
selectByNameAndFatherId(Connection con, NodePK pk, String name, int nodeFatherId)
NodeDetail
selectByPrimaryKey(Connection con, NodePK pk)
Check if a Node exists in database.void
sortNodes(Connection con, List<NodePK> nodePKs)
void
storeRow(Connection con, NodeDetail nodeDetail)
Store node attributes into databasevoid
unvalidateTree(Connection con, NodePK nodePK)
void
updateRightsDependency(Connection con, NodePK pk, String rightsDependsOn)
-
Methods inherited from class org.silverpeas.core.persistence.jdbc.AbstractDAO
asDate, setDateParameter, setStringParameter
-
-
-
-
Method Detail
-
deleteComponentInstanceData
public void deleteComponentInstanceData(String componentInstanceId) throws SQLException
Deletes all nodes linked to the component instance represented by the given identifier.- Parameters:
componentInstanceId
- the identifier of the component instance for which the resources must be deleted.- Throws:
SQLException
-
getTree
public List<NodeDetail> getTree(Connection con, NodePK nodePK) throws SQLException
- Throws:
SQLException
-
unvalidateTree
public void unvalidateTree(Connection con, NodePK nodePK)
-
isSameNameSameLevelOnCreation
public boolean isSameNameSameLevelOnCreation(Connection con, NodeDetail nd) throws SQLException
On node creation, check if another node have got the same name with same father- Parameters:
con
- A connection to the databasend
- A NodeDetail contains new node data to compare- Returns:
- true if there is already a node with same name with same father false else
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
isSameNameSameLevelOnUpdate
public boolean isSameNameSameLevelOnUpdate(Connection con, NodeDetail nd) throws SQLException
On node update, check if another node have got the same name with same father- Parameters:
con
- A connection to the databasend
- A NodeDetail contains new node data to compare- Returns:
- true if there is already a node with same name with same father false else
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
getChildrenPKs
public Collection<NodePK> getChildrenPKs(Connection con, NodePK nodePK) throws SQLException
Get children node PKs of a node- Parameters:
con
- A connection to the databasenodePK
- A NodePK- Returns:
- A collection of NodePK
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodePK
-
getDescendantPKs
public Collection<NodePK> getDescendantPKs(Connection con, NodePK nodePK) throws SQLException
Get descendant node PKs of a node- Parameters:
con
- A connection to the databasenodePK
- A NodePK- Returns:
- A collection of NodePK
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodePK
-
getDescendantDetails
public List<NodeDetail> getDescendantDetails(Connection con, NodePK nodePK) throws SQLException
Get descendant nodeDetails of a node- Parameters:
con
- A connection to the databasenodePK
- A NodePK- Returns:
- A List of NodeDetail
- Throws:
SQLException
- Since:
- 1.6
- See Also:
NodePK
-
getDescendantDetails
public List<NodeDetail> getDescendantDetails(Connection con, NodeDetail node) throws SQLException
Get descendant nodeDetails of a node- Parameters:
con
- A connection to the databasenode
- A NodeDetail- Returns:
- A List of NodeDetail
- Throws:
SQLException
- Since:
- 4.07
-
getHeadersByLevel
public List<NodeDetail> getHeadersByLevel(Connection con, NodePK nodePK, int level) throws SQLException
Get nodeDetails by level.- Parameters:
con
- A connection to the databasenodePK
-level
-- Returns:
- A collection of NodeDetail
- Throws:
SQLException
- Since:
- 1.6
-
getMinimalDataByInstances
public List<NodeDetail> getMinimalDataByInstances(Connection con, Collection<String> instanceIds) throws SQLException
Selects massively simple data about nodes.For now, only the following data are retrieved:
- nodeId
- instanceId
- rightsDependsOn
- Parameters:
con
- the database connection.instanceIds
- the instance ids aimed.- Returns:
- a list of
NodeDetail
instances. - Throws:
SQLException
- on database error.
-
getAllHeaders
public List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK) throws SQLException
Get all nodeDetails- Parameters:
con
- A connection to the databasenodePK
-- Returns:
- A collection of NodeDetail
- Throws:
SQLException
- Since:
- 1.6
-
getAllHeaders
public List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, String sorting) throws SQLException
- Throws:
SQLException
-
getAllHeaders
public List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, int level) throws SQLException
- Throws:
SQLException
-
getAllHeaders
public List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, String sorting, int level) throws SQLException
Get all nodeDetails- Parameters:
con
- A connection to the databasenodePK
-sorting
-level
-- Returns:
- A collection of NodeDetail
- Throws:
SQLException
- Since:
- 1.6
-
getSubTree
public List<NodeDetail> getSubTree(Connection con, NodePK nodePK, String status) throws SQLException
- Throws:
SQLException
-
getNodePath
public NodePath getNodePath(Connection con, NodePK nodePK) throws SQLException
Get the path from root to a node- Parameters:
con
- A connection to the databasenodePK
- A NodePK- Returns:
- A
NodePath
instance. - Throws:
SQLException
- Since:
- 1.0
- See Also:
NodePK
,NodeDetail
-
resultSet2NodeDetail
public NodeDetail resultSet2NodeDetail(ResultSet rs, NodePK nodePK) throws SQLException
Create a NodeDetail from a ResultSet- Parameters:
rs
- the ResultSet which contains datanodePK
-- Returns:
- the NodeDetail
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
getChildrenDetails
public Collection<NodeDetail> getChildrenDetails(Connection con, NodePK nodePK) throws SQLException
Get the header of each child of the node- Parameters:
con
- A connection to the databasenodePK
-- Returns:
- a NodeDetail collection
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
getChildrenNumber
public int getChildrenNumber(Connection con, NodePK nodePK) throws SQLException
Get the children number of this node- Parameters:
con
- A connection to the databasenodePK
-- Returns:
- a int
- Throws:
SQLException
- Since:
- 1.0
-
insertRow
public NodePK insertRow(Connection con, NodeDetail nd) throws SQLException
Insert into the database the data of a node- Parameters:
con
- A connection to the databasend
- the NodeDetail which contains data- Returns:
- a NodePK which contains the new row id
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
deleteRow
public void deleteRow(Connection con, NodePK nodePK) throws SQLException
Delete into the database a node but not it's descendants.- Parameters:
con
- a connection to the databasenodePK
- the node PK to delete.- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodeDetail
-
selectByPrimaryKey
public NodeDetail selectByPrimaryKey(Connection con, NodePK pk) throws SQLException
Check if a Node exists in database.- Parameters:
con
- the current connection to the database.pk
- the node PK to find- Returns:
- the fat pk (pk + detail)
- Throws:
SQLException
- Since:
- 1.0
- See Also:
NodePK
-
selectByNameAndFatherId
public NodeDetail selectByNameAndFatherId(Connection con, NodePK pk, String name, int nodeFatherId) throws SQLException
- Throws:
SQLException
-
loadRow
public NodeDetail loadRow(Connection con, NodePK nodePK) throws SQLException
- Throws:
SQLException
-
loadRow
public NodeDetail loadRow(Connection con, NodePK nodePK, boolean getTranslations) throws SQLException
Load node attributes from database- Parameters:
con
- a connection to the databasenodePK
-getTranslations
-- Returns:
- the loaded node details.
- Throws:
SQLException
- Since:
- 1.0
-
loadRow
public NodeDetail loadRow(Connection con, NodePK nodePK, String name, int nodeFatherId) throws SQLException
- Throws:
SQLException
-
storeRow
public void storeRow(Connection con, NodeDetail nodeDetail) throws SQLException
Store node attributes into database- Parameters:
con
- a connection to the databasenodeDetail
-- Throws:
SQLException
- Since:
- 1.0
-
moveNode
public void moveNode(Connection con, NodeDetail nodeDetail) throws SQLException
- Throws:
SQLException
-
updateRightsDependency
public void updateRightsDependency(Connection con, NodePK pk, String rightsDependsOn) throws SQLException
- Throws:
SQLException
-
sortNodes
public void sortNodes(Connection con, List<NodePK> nodePKs) throws SQLException
- Throws:
SQLException
-
-