fr.paris.lutece.plugins.unittree.business.unit
Class UnitDAO

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

public class UnitDAO
extends java.lang.Object
implements IUnitDAO

UnitDAO


Constructor Summary
UnitDAO()
           
 
Method Summary
 void addUserToUnit(int nIdUnit, int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Add an user to an unit
 java.util.List<Unit> findBySectorId(long lIdSector)
          Return all the Unit of the Sector
 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, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Check if the user is in the unit
 Unit load(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the unit
 int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get new primary key
 void remove(int nIdUnit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove a unit
 void removeUserFromUnit(int nIdUser, 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
 java.util.List<Unit> selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Select all units
 java.util.List<java.lang.Integer> selectAllIdsUser(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Select all ids user
 java.util.List<Unit> selectByFilter(UnitFilter cmFilter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Select the units by filter
 Unit selectByIdUser(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load an unit by id user
 java.util.List<java.lang.Integer> 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitDAO

public UnitDAO()
Method Detail

newPrimaryKey

public int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get new primary key

Specified by:
newPrimaryKey in interface IUnitDAO
Parameters:
plugin - the plugin
Returns:
a new primary key

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 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:
an instance of Unit

selectAll

public java.util.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

removeUserFromUnit

public void removeUserFromUnit(int nIdUser,
                               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
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 java.util.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 java.util.List<java.lang.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 java.util.List<java.lang.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,
                            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
plugin - the plugin
Returns:
true if the user is in the unit, false otherwise

findBySectorId

public java.util.List<Unit> findBySectorId(long lIdSector)
Return all the Unit of the Sector

Specified by:
findBySectorId in interface IUnitDAO
Parameters:
lIdSector - id sector
Returns:
all the Unit of the Sector


Copyright © 2012 Mairie de Paris. All Rights Reserved.