Class ContactListDAO

java.lang.Object
fr.paris.lutece.plugins.contact.business.ContactListDAO
All Implemented Interfaces:
IContactListDAO

@ApplicationScoped public final class ContactListDAO extends Object implements IContactListDAO
This class provides Data Access methods for Contact objects
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    assign(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Inserts 2 keys in association table
    int
    countContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    counts how many contacts are associated to the specified list
    int
    countListsForContact(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    counts how many lists the contact is associated to
    void
    delete(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Delete a record from the table
    void
    insert(ContactList contactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Insert a new record in the table.
    boolean
    isAssigned(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    returns true if a contact is assigned to a list
    boolean
    listExists(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Returns true if the contactList exists
    load(int nContactListId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load the data of Contact from the table
    int
    maxOrderContact(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Calculate the new max order in a list
    int
    maxOrderContactList(fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Calculate the new max order in a list
    selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load the list of contactsList
    selectAssignedListsFor(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Selects assigned lists for a contact
    selectByRoleKey(String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Selects lists for a role key
    int
    selectContactListIdByOrder(int nContactListOrder, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Returns a contact identifier in a distinct order
    int
    selectContactListOrderById(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Returns the order of a contactList
    selectContactListsByIds(List<Integer> listIds, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load the data of all the contactlist objects and returns them as a list
    selectContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Selects all contacts associated to a specified list
    selectNotAssignedContactsFor(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Selects the list of all contacts that are not assigned to the specified list
    selectNotAssignedListsFor(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    selects all lists, the contact is not associated to
    void
    store(ContactList contactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Update the record in the table
    void
    storeContactListOrder(int nNewOrder, int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Modify the order of a contact
    void
    unAssign(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Unassigns a contact of a list, or a list of a contact
    void
    unassignContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Unassigns all contacts for a specified list
    void
    unassignListsForContact(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Unassigns all lists, the specified contact is assigned to

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContactListDAO

      public ContactListDAO()
  • Method Details

    • insert

      public void insert(ContactList contactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Insert a new record in the table.
      Specified by:
      insert in interface IContactListDAO
      Parameters:
      contactList - the instance of contactList to insert into DB
      plugin - the plugin contact
    • load

      public ContactList load(int nContactListId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Load the data of Contact from the table
      Specified by:
      load in interface IContactListDAO
      Parameters:
      nContactListId - the Id of the contactList to load
      plugin - the plugin contact
      Returns:
      the instance of contactList object loaded
    • selectAll

      public Collection<ContactList> selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Load the list of contactsList
      Specified by:
      selectAll in interface IContactListDAO
      Parameters:
      plugin - The plugin
      Returns:
      The Collection of the Contacts
    • selectByRoleKey

      public Collection<ContactList> selectByRoleKey(String strRoleKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Selects lists for a role key
      Specified by:
      selectByRoleKey in interface IContactListDAO
      Parameters:
      strRoleKey - The role key
      plugin - the plugin contact
      Returns:
      collection of lists
    • countContactsForList

      public int countContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      counts how many contacts are associated to the specified list
      Specified by:
      countContactsForList in interface IContactListDAO
      Parameters:
      nIdContactList - the Id of contactList
      plugin - the plugin contact
      Returns:
      the number of contacts for the list
    • countListsForContact

      public int countListsForContact(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      counts how many lists the contact is associated to
      Specified by:
      countListsForContact in interface IContactListDAO
      Parameters:
      nIdContact - the Id of concerned contact
      plugin - the plugin contact
      Returns:
      the number of counted lists
    • listExists

      public boolean listExists(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns true if the contactList exists
      Specified by:
      listExists in interface IContactListDAO
      Parameters:
      nIdContactList - The if of contactList
      plugin - The Plugin object
      Returns:
      boolean the existance of the list
    • selectContactsForList

      public Collection<Contact> selectContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Selects all contacts associated to a specified list
      Specified by:
      selectContactsForList in interface IContactListDAO
      Parameters:
      nIdContactList - the id of contactList
      plugin - the plugin contact
      Returns:
      list of contacts
    • isAssigned

      public boolean isAssigned(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      returns true if a contact is assigned to a list
      Specified by:
      isAssigned in interface IContactListDAO
      Parameters:
      nIdContact - The id of the contact
      nIdContactList - The id of the contactList
      plugin - the plugin contact
      Returns:
      boolean: true if is assigned, false if not
    • assign

      public void assign(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Inserts 2 keys in association table
      Specified by:
      assign in interface IContactListDAO
      Parameters:
      nIdContact - The id of the contact
      nIdContactList - The contact List that will be associated
      plugin - The plugin
    • unAssign

      public void unAssign(int nIdContact, int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Unassigns a contact of a list, or a list of a contact
      Specified by:
      unAssign in interface IContactListDAO
      Parameters:
      nIdContact - the id of the contact
      nIdContactList - the id of the contactList
      plugin - The plugin
    • selectNotAssignedContactsFor

      public Collection<Contact> selectNotAssignedContactsFor(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Selects the list of all contacts that are not assigned to the specified list
      Specified by:
      selectNotAssignedContactsFor in interface IContactListDAO
      Parameters:
      nIdContactList - the id of the contact List
      plugin - the plugin contact
      Returns:
      list of not assigned contacts
    • selectAssignedListsFor

      public Collection<ContactList> selectAssignedListsFor(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Selects assigned lists for a contact
      Specified by:
      selectAssignedListsFor in interface IContactListDAO
      Parameters:
      nIdContact - the id of the contact
      plugin - the plugin contact
      Returns:
      collection of lists, the contact is associated to
    • selectNotAssignedListsFor

      public Collection<ContactList> selectNotAssignedListsFor(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      selects all lists, the contact is not associated to
      Specified by:
      selectNotAssignedListsFor in interface IContactListDAO
      Parameters:
      nIdContact - the id of the contact
      plugin - the plugin contact
      Returns:
      collection of contactLists
    • delete

      public void delete(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Delete a record from the table
      Specified by:
      delete in interface IContactListDAO
      Parameters:
      nIdContactList - the id of contactlist to delete
      plugin - The plugin
    • unassignContactsForList

      public void unassignContactsForList(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Unassigns all contacts for a specified list
      Specified by:
      unassignContactsForList in interface IContactListDAO
      Parameters:
      nIdContactList - the id of contactlist
      plugin - the plugin contact
    • unassignListsForContact

      public void unassignListsForContact(int nIdContact, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Unassigns all lists, the specified contact is assigned to
      Specified by:
      unassignListsForContact in interface IContactListDAO
      Parameters:
      nIdContact - the Id of the contact
      plugin - the plugin contact
    • store

      public void store(ContactList contactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Update the record in the table
      Specified by:
      store in interface IContactListDAO
      Parameters:
      contactList - The reference of contactList
      plugin - The plugin
    • storeContactListOrder

      public void storeContactListOrder(int nNewOrder, int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Modify the order of a contact
      Specified by:
      storeContactListOrder in interface IContactListDAO
      Parameters:
      nNewOrder - The order number
      nId - The contactList identifier
      plugin - The plugin
    • selectContactListIdByOrder

      public int selectContactListIdByOrder(int nContactListOrder, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns a contact identifier in a distinct order
      Specified by:
      selectContactListIdByOrder in interface IContactListDAO
      Parameters:
      nContactListOrder - The order number
      plugin - The plugin
      Returns:
      The order of the ContactList
    • selectContactListOrderById

      public int selectContactListOrderById(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Returns the order of a contactList
      Specified by:
      selectContactListOrderById in interface IContactListDAO
      Parameters:
      nIdContactList - the id of contactList
      plugin - the plugin contact
      Returns:
      the order of the contactList
    • maxOrderContactList

      public int maxOrderContactList(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Calculate the new max order in a list
      Specified by:
      maxOrderContactList in interface IContactListDAO
      Parameters:
      plugin - The plugin
      Returns:
      the max order of contact
    • maxOrderContact

      public int maxOrderContact(int nIdContactList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Calculate the new max order in a list
      Specified by:
      maxOrderContact in interface IContactListDAO
      Parameters:
      nIdContactList - the id of the contact list
      plugin - The plugin
      Returns:
      the max order of contact
    • selectContactListsByIds

      public List<ContactList> selectContactListsByIds(List<Integer> listIds, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Description copied from interface: IContactListDAO
      Load the data of all the contactlist objects and returns them as a list
      Specified by:
      selectContactListsByIds in interface IContactListDAO
      Parameters:
      listIds - list of ids
      plugin - The plugin
      Returns:
      The list which contains the data of all the contactlist objects