com.stratelia.webactiv.util.contact.control
Class ContactDAO

java.lang.Object
  extended by com.stratelia.webactiv.util.contact.control.ContactDAO

public class ContactDAO
extends Object

This is the Contact Data Access Object.

Author:
Nicolas Eysseric

Constructor Summary
ContactDAO()
          This class must not be instanciated
 
Method Summary
static void addFather(Connection con, ContactPK pubPK, NodePK fatherPK)
          Add a new father to this contact
static void deleteOrphanContactsByCreatorId(Connection con, ContactPK pubPK, String creatorId)
           
static void deleteRow(Connection con, ContactPK pk)
           
static Collection<NodePK> getAllFatherPK(Connection con, ContactPK pubPK)
          Delete links between contact and father when contacts are linked to a father which is a descendant of a node
static int getNbPubByFatherPath(Connection con, NodePK fatherPK, String fatherPath)
           
static int getNbPubInFatherPKs(Connection con, Collection<NodePK> fatherPKs)
           
static Collection<ContactDetail> getOrphanContacts(Connection con, ContactPK pubPK)
           
static Collection<ContactDetail> getUnavailableContactsByPublisherId(Connection con, ContactPK pubPK, String publisherId, String nodeId)
           
static List<CompleteContact> getVisibleContacts(Connection con, String instanceId)
          Gets all non transitive contacts from an component represented by the given identifier that are not in basket.
static void insertRow(Connection con, Contact detail)
           
static ContactDetail loadRow(Connection con, ContactPK pk)
           
static void removeAllFather(Connection con, ContactPK pubPK)
          Delete all fathers to this contact
static void removeAllIssue(Connection con, NodePK originPK, ContactPK pubPK)
          Delete links between contact and father when contacts are linked to a father which is a descendant of a node
static void removeFather(Connection con, ContactPK pubPK, NodePK fatherPK)
          Remove a father to this contact
static Collection<ContactDetail> selectByContactPKs(Connection con, Collection<ContactPK> contactPKs)
           
static Collection<ContactDetail> selectByFatherPK(Connection con, NodePK fatherPK)
           
static Collection<ContactFatherDetail> selectByFatherPKs(Connection con, Collection<NodePK> fatherPKs, ContactPK pubPK, NodePK nodePK)
           
static Collection<ContactDetail> selectByLastName(Connection con, ContactPK pk, String query)
           
static Collection<ContactDetail> selectByLastNameAndFirstName(Connection con, ContactPK pk, String lastName, String firstName)
           
static Collection<ContactDetail> selectByLastNameOrFirstName(Connection con, ContactPK pk, String query)
           
static ContactPK selectByPrimaryKey(Connection con, ContactPK primaryKey)
           
static void storeRow(Connection con, Contact detail)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContactDAO

public ContactDAO()
This class must not be instanciated

Since:
1.0
Method Detail

addFather

public static void addFather(Connection con,
                             ContactPK pubPK,
                             NodePK fatherPK)
                      throws SQLException
Add a new father to this contact

Parameters:
con - Connection to database
pubPK - the contact ContactPK
fatherPK - the father NodePK to add
Throws:
SQLException
Since:
1.0
See Also:
NodePK, ContactPK

removeFather

public static void removeFather(Connection con,
                                ContactPK pubPK,
                                NodePK fatherPK)
                         throws SQLException
Remove a father to this contact

Parameters:
con - Connection to database
pubPK - the contact ContactPK
fatherPK - the father NodePK to delete
Throws:
SQLException
Since:
1.0
See Also:
NodePK, ContactPK

removeAllFather

public static void removeAllFather(Connection con,
                                   ContactPK pubPK)
                            throws SQLException
Delete all fathers to this contact

Parameters:
con - Connection to database
pubPK - the contact ContactPK
Throws:
SQLException
Since:
1.0
See Also:
ContactPK

removeAllIssue

public static void removeAllIssue(Connection con,
                                  NodePK originPK,
                                  ContactPK pubPK)
                           throws SQLException
Delete links between contact and father when contacts are linked to a father which is a descendant of a node

Parameters:
con - Connection to database
pubPK - the contact ContactPK
originPK - the node which is deleted
Throws:
SQLException
Since:
1.0
See Also:
NodePK, ContactPK

getAllFatherPK

public static Collection<NodePK> getAllFatherPK(Connection con,
                                                ContactPK pubPK)
                                         throws SQLException
Delete links between contact and father when contacts are linked to a father which is a descendant of a node

Parameters:
con - Connection to database
pubPK - the contact ContactPK
Throws:
SQLException
Since:
1.0
See Also:
NodePK, ContactPK

getNbPubInFatherPKs

public static int getNbPubInFatherPKs(Connection con,
                                      Collection<NodePK> fatherPKs)
                               throws SQLException
Throws:
SQLException

getNbPubByFatherPath

public static int getNbPubByFatherPath(Connection con,
                                       NodePK fatherPK,
                                       String fatherPath)
                                throws SQLException
Throws:
SQLException

insertRow

public static void insertRow(Connection con,
                             Contact detail)
                      throws SQLException
Throws:
SQLException

deleteRow

public static void deleteRow(Connection con,
                             ContactPK pk)
                      throws SQLException
Throws:
SQLException

selectByPrimaryKey

public static ContactPK selectByPrimaryKey(Connection con,
                                           ContactPK primaryKey)
                                    throws SQLException,
                                           ParseException
Throws:
SQLException
ParseException

selectByLastName

public static Collection<ContactDetail> selectByLastName(Connection con,
                                                         ContactPK pk,
                                                         String query)
                                                  throws SQLException,
                                                         ParseException
Throws:
SQLException
ParseException

selectByLastNameOrFirstName

public static Collection<ContactDetail> selectByLastNameOrFirstName(Connection con,
                                                                    ContactPK pk,
                                                                    String query)
                                                             throws SQLException,
                                                                    ParseException
Throws:
SQLException
ParseException

selectByFatherPK

public static Collection<ContactDetail> selectByFatherPK(Connection con,
                                                         NodePK fatherPK)
                                                  throws SQLException,
                                                         ParseException
Throws:
SQLException
ParseException

selectByFatherPKs

public static Collection<ContactFatherDetail> selectByFatherPKs(Connection con,
                                                                Collection<NodePK> fatherPKs,
                                                                ContactPK pubPK,
                                                                NodePK nodePK)
                                                         throws SQLException,
                                                                ParseException
Throws:
SQLException
ParseException

selectByContactPKs

public static Collection<ContactDetail> selectByContactPKs(Connection con,
                                                           Collection<ContactPK> contactPKs)
                                                    throws SQLException,
                                                           ParseException
Throws:
SQLException
ParseException

getOrphanContacts

public static Collection<ContactDetail> getOrphanContacts(Connection con,
                                                          ContactPK pubPK)
                                                   throws SQLException,
                                                          ParseException
Throws:
SQLException
ParseException

deleteOrphanContactsByCreatorId

public static void deleteOrphanContactsByCreatorId(Connection con,
                                                   ContactPK pubPK,
                                                   String creatorId)
                                            throws SQLException
Throws:
SQLException

loadRow

public static ContactDetail loadRow(Connection con,
                                    ContactPK pk)
                             throws SQLException,
                                    ParseException
Throws:
SQLException
ParseException

storeRow

public static void storeRow(Connection con,
                            Contact detail)
                     throws SQLException
Throws:
SQLException

getUnavailableContactsByPublisherId

public static Collection<ContactDetail> getUnavailableContactsByPublisherId(Connection con,
                                                                            ContactPK pubPK,
                                                                            String publisherId,
                                                                            String nodeId)
                                                                     throws SQLException,
                                                                            ParseException
Throws:
SQLException
ParseException

selectByLastNameAndFirstName

public static Collection<ContactDetail> selectByLastNameAndFirstName(Connection con,
                                                                     ContactPK pk,
                                                                     String lastName,
                                                                     String firstName)
                                                              throws SQLException,
                                                                     ParseException
Throws:
SQLException
ParseException

getVisibleContacts

public static List<CompleteContact> getVisibleContacts(Connection con,
                                                       String instanceId)
                                                throws SQLException,
                                                       ParseException
Gets all non transitive contacts from an component represented by the given identifier that are not in basket. A transitive contact is a contact of user type linked directly by a group.

Parameters:
con - the database connection.
instanceId - the identifier of the component instance into which contact are retrieved.
Returns:
the list of complete contact data. Empty list if none.
Throws:
SQLException
ParseException


Copyright © 2016 Silverpeas. All Rights Reserved.