java.lang.Object
fr.paris.lutece.plugins.unittree.business.unit.UnitDAO
All Implemented Interfaces:
IUnitDAO

@ApplicationScoped public class UnitDAO extends Object implements IUnitDAO
UnitDAO
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addUserToUnit(int nIdUnit, int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Add an user to an unit
    findByCode(String strCode, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load the unit by code
    getAllSubUnitsId(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Retrieve Set of all children units id
    getSubUnits(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Retrieve list of direct children units
    getUnitWithNoChildren(fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Return all the Unit with no children (level 0)
    boolean
    hasSubUnits(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Check if the given id unit has sub units or not
    int
    insert(Unit unit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Insert a new unit
    boolean
    isUserInUnit(int nIdUser, int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Check if the user is in the unit
    load(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load the unit
    void
    remove(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Remove a unit
    void
    removeUserFromUnit(int nIdUser, int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Remove a given user from the unit
    void
    removeUsersFromUnit(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Remove users from a given id unit
    selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Select all units
    selectAllIdsUser(fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Select all ids user
    selectByFilter(UnitFilter cmFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Select the units by filter
    selectByIdUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Load an unit by id user
    selectIdsUser(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Select the ids user from a given id unit
    void
    update(Unit unit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Update a unit
    void
    updateParent(int nIdUnitToMove, int nIdNewParent, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Update the parent of a unit

    Methods inherited from class java.lang.Object

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

    • UnitDAO

      public UnitDAO()
  • Method Details

    • insert

      public int insert(Unit unit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Insert a new unit
      Specified by:
      insert in interface IUnitDAO
      Parameters:
      unit - the unit
      plugin - the plugin
      Returns:
      the new primary key
    • load

      public Unit load(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Load the unit
      Specified by:
      load in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
      Returns:
      an instance of Unit
    • selectByIdUser

      public List<Unit> selectByIdUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Load an unit by id user
      Specified by:
      selectByIdUser in interface IUnitDAO
      Parameters:
      nIdUser - the id user
      plugin - the plugin
      Returns:
      a list of Unit
    • selectAll

      public List<Unit> selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Select all units
      Specified by:
      selectAll in interface IUnitDAO
      Parameters:
      plugin - the plugin
      Returns:
      a list of Unit
    • remove

      public void remove(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Remove a unit
      Specified by:
      remove in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
    • hasSubUnits

      public boolean hasSubUnits(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Check if the given id unit has sub units or not
      Specified by:
      hasSubUnits in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
      Returns:
      true if the unit has sub units, false otherwise
    • getSubUnits

      public List<Unit> getSubUnits(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Retrieve list of direct children units
      Specified by:
      getSubUnits in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
      Returns:
      List of children units
    • getAllSubUnitsId

      public Set<Integer> getAllSubUnitsId(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Retrieve Set of all children units id
      Specified by:
      getAllSubUnitsId in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
      Returns:
      Set of all children unit id
    • removeUserFromUnit

      public void removeUserFromUnit(int nIdUser, int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Remove a given user from the unit
      Specified by:
      removeUserFromUnit in interface IUnitDAO
      Parameters:
      nIdUser - the id user
      nIdUnit - The id of the unit
      plugin - the plugin
    • removeUsersFromUnit

      public void removeUsersFromUnit(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Remove users from a given id unit
      Specified by:
      removeUsersFromUnit in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
    • update

      public void update(Unit unit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Update a unit
      Specified by:
      update in interface IUnitDAO
      Parameters:
      unit - the unit
      plugin - the plugin
    • selectByFilter

      public List<Unit> selectByFilter(UnitFilter cmFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Select the units by filter
      Specified by:
      selectByFilter in interface IUnitDAO
      Parameters:
      cmFilter - the filter
      plugin - the plugin
      Returns:
      a list of Unit
    • selectAllIdsUser

      public List<Integer> selectAllIdsUser(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Select all ids user
      Specified by:
      selectAllIdsUser in interface IUnitDAO
      Parameters:
      plugin - the plugin
      Returns:
      a list of ids user
    • selectIdsUser

      public List<Integer> selectIdsUser(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Select the ids user from a given id unit
      Specified by:
      selectIdsUser in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      plugin - the plugin
      Returns:
      a list of ids user
    • addUserToUnit

      public void addUserToUnit(int nIdUnit, int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Add an user to an unit
      Specified by:
      addUserToUnit in interface IUnitDAO
      Parameters:
      nIdUnit - the id unit
      nIdUser - the id user
      plugin - the plugin
    • isUserInUnit

      public boolean isUserInUnit(int nIdUser, int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Check if the user is in the unit
      Specified by:
      isUserInUnit in interface IUnitDAO
      Parameters:
      nIdUser - the id user
      nIdUnit - The id of the unit
      plugin - the plugin
      Returns:
      true if the user is in the unit, false otherwise
    • getUnitWithNoChildren

      public List<Unit> getUnitWithNoChildren(fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Return all the Unit with no children (level 0)
      Specified by:
      getUnitWithNoChildren in interface IUnitDAO
      Parameters:
      plugin - the plugin
      Returns:
      all the Unit with no children (level 0)
    • updateParent

      public void updateParent(int nIdUnitToMove, int nIdNewParent, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Update the parent of a unit
      Specified by:
      updateParent in interface IUnitDAO
      Parameters:
      nIdUnitToMove - The id of the unit to change the parent of.
      nIdNewParent - The id of the new parent of the unit.
      plugin - The plugin
    • findByCode

      public Unit findByCode(String strCode, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Description copied from interface: IUnitDAO
      Load the unit by code
      Specified by:
      findByCode in interface IUnitDAO
      Parameters:
      strCode - the unit code
      plugin - the plugin
      Returns:
      an instance of Unit