com.stratelia.webactiv.util.node.control.dao
Class NodeDAO

java.lang.Object
  extended by com.stratelia.webactiv.util.node.control.dao.NodeDAO

public class NodeDAO
extends Object

This is the Node Data Access Object.

Author:
Nicolas Eysseric

Constructor Summary
NodeDAO()
          This class must not be instanciated
 
Method Summary
static void deleteRow(Connection con, NodePK nodePK)
          Delete into the database a node but not it's descendants.
static List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK)
          Get all nodeDetails
static List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, int level)
           
static List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, String sorting)
           
static List<NodeDetail> getAllHeaders(Connection con, NodePK nodePK, String sorting, int level)
          Get all nodeDetails
static NodeDetail getAnotherHeader(Connection con, NodePK nodePK)
          Get the detail of another Node
static Collection<NodeDetail> getAnotherPath(Connection con, NodePK nodePK)
          Get the path from root to a node
static Collection<NodeDetail> getChildrenDetails(Connection con, NodePK nodePK)
          Get the header of each child of the node
static int getChildrenNumber(Connection con, NodePK nodePK)
          Get the children number of this node
static Collection<NodePK> getChildrenPKs(Connection con, NodePK nodePK)
          Get children node PKs of a node
static List<NodeDetail> getDescendantDetails(Connection con, NodeDetail node)
          Get descendant nodeDetails of a node
static List<NodeDetail> getDescendantDetails(Connection con, NodePK nodePK)
          Get descendant nodeDetails of a node
static Collection<NodePK> getDescendantPKs(Connection con, NodePK nodePK)
          Get descendant node PKs of a node
static List<NodeDetail> getHeadersByLevel(Connection con, NodePK nodePK, int level)
          Get nodeDetails by level.
static List<NodeDetail> getSubTree(Connection con, NodePK nodePK, String status)
           
static ArrayList<NodeDetail> getTree(Connection con, NodePK nodePK)
           
static NodePK insertRow(Connection con, NodeDetail nd)
          Insert into the database the data of a node
static boolean isSameNameSameLevelOnCreation(Connection con, NodeDetail nd)
          On node creation, check if another node have got the same name with same father
static boolean isSameNameSameLevelOnUpdate(Connection con, NodeDetail nd)
          On node update, check if another node have got the same name with same father
static NodeDetail loadRow(Connection con, NodePK nodePK)
           
static NodeDetail loadRow(Connection con, NodePK nodePK, boolean getTranslations)
          Load node attributes from database
static NodeDetail loadRow(Connection con, NodePK nodePK, String name, int nodeFatherId)
           
static void moveNode(Connection con, NodeDetail nodeDetail)
           
static NodeDetail resultSet2NodeDetail(ResultSet rs, NodePK nodePK)
          Create a NodeDetail from a ResultSet
static Collection<NodePK> selectByFatherPrimaryKey(Connection con, NodePK pk)
          Method declaration
static NodePK selectByNameAndFatherId(Connection con, NodePK pk, String name, int nodeFatherId)
           
static NodePK selectByPrimaryKey(Connection con, NodePK pk)
          Check if a Node exists in database.
static void sortNodes(Connection con, List<NodePK> nodePKs)
           
static void storeRow(Connection con, NodeDetail nodeDetail)
          Store node attributes into database
static void unvalidateTree(Connection con, NodePK nodePK)
           
static void updateRightsDependency(Connection con, NodePK pk, int rightsDependsOn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeDAO

public NodeDAO()
This class must not be instanciated

Since:
1.0
Method Detail

getTree

public static ArrayList<NodeDetail> getTree(Connection con,
                                            NodePK nodePK)
                                     throws SQLException
Throws:
SQLException

unvalidateTree

public static void unvalidateTree(Connection con,
                                  NodePK nodePK)

isSameNameSameLevelOnCreation

public static 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 database
nd - 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 static 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 database
nd - 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 static Collection<NodePK> getChildrenPKs(Connection con,
                                                NodePK nodePK)
                                         throws SQLException
Get children node PKs of a node

Parameters:
con - A connection to the database
nodePK - A NodePK
Returns:
A collection of NodePK
Throws:
SQLException
Since:
1.0
See Also:
NodePK

getDescendantPKs

public static Collection<NodePK> getDescendantPKs(Connection con,
                                                  NodePK nodePK)
                                           throws SQLException
Get descendant node PKs of a node

Parameters:
con - A connection to the database
nodePK - A NodePK
Returns:
A collection of NodePK
Throws:
SQLException
Since:
1.0
See Also:
NodePK

getDescendantDetails

public static List<NodeDetail> getDescendantDetails(Connection con,
                                                    NodePK nodePK)
                                             throws SQLException
Get descendant nodeDetails of a node

Parameters:
con - A connection to the database
nodePK - A NodePK
Returns:
A List of NodeDetail
Throws:
SQLException
Since:
1.6
See Also:
NodePK

getDescendantDetails

public static List<NodeDetail> getDescendantDetails(Connection con,
                                                    NodeDetail node)
                                             throws SQLException
Get descendant nodeDetails of a node

Parameters:
con - A connection to the database
node - A NodeDetail
Returns:
A List of NodeDetail
Throws:
SQLException
Since:
4.07

getHeadersByLevel

public static List<NodeDetail> getHeadersByLevel(Connection con,
                                                 NodePK nodePK,
                                                 int level)
                                          throws SQLException
Get nodeDetails by level.

Parameters:
con - A connection to the database
nodePK -
level -
Returns:
A collection of NodeDetail
Throws:
SQLException
Since:
1.6

getAllHeaders

public static List<NodeDetail> getAllHeaders(Connection con,
                                             NodePK nodePK)
                                      throws SQLException
Get all nodeDetails

Parameters:
con - A connection to the database
nodePK -
Returns:
A collection of NodeDetail
Throws:
SQLException
Since:
1.6

getAllHeaders

public static List<NodeDetail> getAllHeaders(Connection con,
                                             NodePK nodePK,
                                             String sorting)
                                      throws SQLException
Throws:
SQLException

getAllHeaders

public static List<NodeDetail> getAllHeaders(Connection con,
                                             NodePK nodePK,
                                             int level)
                                      throws SQLException
Throws:
SQLException

getAllHeaders

public static List<NodeDetail> getAllHeaders(Connection con,
                                             NodePK nodePK,
                                             String sorting,
                                             int level)
                                      throws SQLException
Get all nodeDetails

Parameters:
con - A connection to the database
nodePK -
sorting -
level -
Returns:
A collection of NodeDetail
Throws:
SQLException
Since:
1.6

getSubTree

public static List<NodeDetail> getSubTree(Connection con,
                                          NodePK nodePK,
                                          String status)
                                   throws SQLException
Throws:
SQLException

getAnotherPath

public static Collection<NodeDetail> getAnotherPath(Connection con,
                                                    NodePK nodePK)
                                             throws SQLException
Get the path from root to a node

Parameters:
con - A connection to the database
nodePK - A NodePK
Returns:
A collection of NodeDetail
Throws:
SQLException
Since:
1.0
See Also:
NodePK, NodeDetail

resultSet2NodeDetail

public static NodeDetail resultSet2NodeDetail(ResultSet rs,
                                              NodePK nodePK)
                                       throws SQLException
Create a NodeDetail from a ResultSet

Parameters:
rs - the ResultSet which contains data
nodePK -
Returns:
the NodeDetail
Throws:
SQLException
Since:
1.0
See Also:
NodeDetail

getAnotherHeader

public static NodeDetail getAnotherHeader(Connection con,
                                          NodePK nodePK)
                                   throws SQLException
Get the detail of another Node

Parameters:
con - A connection to the database
nodePK - the PK of the Node
Returns:
a NodeDetail
Throws:
SQLException
Since:
1.0
See Also:
NodeDetail

getChildrenDetails

public static Collection<NodeDetail> getChildrenDetails(Connection con,
                                                        NodePK nodePK)
                                                 throws SQLException
Get the header of each child of the node

Parameters:
con - A connection to the database
nodePK -
Returns:
a NodeDetail collection
Throws:
SQLException
Since:
1.0
See Also:
NodeDetail

getChildrenNumber

public static int getChildrenNumber(Connection con,
                                    NodePK nodePK)
                             throws SQLException
Get the children number of this node

Parameters:
con - A connection to the database
nodePK -
Returns:
a int
Throws:
SQLException
Since:
1.0

insertRow

public static NodePK insertRow(Connection con,
                               NodeDetail nd)
                        throws SQLException
Insert into the database the data of a node

Parameters:
con - A connection to the database
nd - the NodeDetail which contains data
Returns:
a NodePK which contains the new row id
Throws:
SQLException
Since:
1.0
See Also:
NodeDetail

deleteRow

public static 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 database
nodePK - the node PK to delete.
Throws:
SQLException
Since:
1.0
See Also:
NodeDetail

selectByPrimaryKey

public static NodePK 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 static NodePK selectByNameAndFatherId(Connection con,
                                             NodePK pk,
                                             String name,
                                             int nodeFatherId)
                                      throws SQLException
Throws:
SQLException

selectByFatherPrimaryKey

public static Collection<NodePK> selectByFatherPrimaryKey(Connection con,
                                                          NodePK pk)
                                                   throws SQLException
Method declaration

Parameters:
con -
pk -
Returns:
Throws:
SQLException
See Also:

loadRow

public static NodeDetail loadRow(Connection con,
                                 NodePK nodePK)
                          throws SQLException
Throws:
SQLException

loadRow

public static NodeDetail loadRow(Connection con,
                                 NodePK nodePK,
                                 boolean getTranslations)
                          throws SQLException
Load node attributes from database

Parameters:
con - a connection to the database
nodePK -
getTranslations -
Returns:
the loaded node details.
Throws:
SQLException
Since:
1.0

loadRow

public static NodeDetail loadRow(Connection con,
                                 NodePK nodePK,
                                 String name,
                                 int nodeFatherId)
                          throws SQLException
Throws:
SQLException

storeRow

public static void storeRow(Connection con,
                            NodeDetail nodeDetail)
                     throws SQLException
Store node attributes into database

Parameters:
con - a connection to the database
nodeDetail -
Throws:
SQLException
Since:
1.0

moveNode

public static void moveNode(Connection con,
                            NodeDetail nodeDetail)
                     throws SQLException
Throws:
SQLException

updateRightsDependency

public static void updateRightsDependency(Connection con,
                                          NodePK pk,
                                          int rightsDependsOn)
                                   throws SQLException
Throws:
SQLException

sortNodes

public static void sortNodes(Connection con,
                             List<NodePK> nodePKs)
                      throws SQLException
Throws:
SQLException


Copyright © 2016 Silverpeas. All Rights Reserved.