Class UnitHome
java.lang.Object
fr.paris.lutece.plugins.unittree.business.unit.UnitHome
UnitHome
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddUserToUnit(int nIdUnit, int nIdUser) Add the user to the unitstatic intInsert a new unitfindAll()Select all unitsFind all ids usersstatic UnitfindByCode(String strCode) Load the unitfindByFilter(UnitFilter uFilter) Find the units by filterfindByIdUser(int nIdUser) Load an unit by id userstatic UnitfindByPrimaryKey(int nIdUnit) Load the unitfindIdsUser(int nIdUnit) Find the ids usergetAllSubUnitsId(int nIdUnit) Retrieve Set of all children units idgetDirectSubUnits(int nIdUnit) Retrieve list of direct children unitsReturn all the Unit with no children (level 0)static booleanhasSubUnits(int nIdUnit) Check if the given id unit has sub unitsstatic booleanisUserInUnit(int nIdUser, int nIdUnit) Check if the user is in a given unitstatic voidremove(int nIdUnit) Remove a unitstatic voidremoveUserFromUnit(int nIdUser, int nIdUnit) Remove a user from a unitstatic voidremoveUsersFromUnit(int nIdUnit) Remove an unit from a given id unitstatic voidUpdate a unitstatic voidupdateParent(int nIdUnitToMove, int nIdNewParent) Update the parent of a unit
-
Method Details
-
findByPrimaryKey
Load the unit- Parameters:
nIdUnit- the id unit- Returns:
- an instance of
Unit
-
findByCode
Load the unit- Parameters:
strCode- the code- Returns:
- an instance of
Unit
-
findByIdUser
Load an unit by id user- Parameters:
nIdUser- the id user- Returns:
- an instance of
Unit
-
findByFilter
Find the units by filter- Parameters:
uFilter- the filter- Returns:
- a list of
Unit
-
findAll
Select all units- Returns:
- a list of
Unit
-
findAllIdsUsers
Find all ids users- Returns:
- a list of ids user
-
findIdsUser
Find the ids user- Parameters:
nIdUnit- the id unit- Returns:
- the list of ids user
-
create
Insert a new unit- Parameters:
unit- the unit- Returns:
- the new primary key
-
remove
public static void remove(int nIdUnit) Remove a unit- Parameters:
nIdUnit- the id unit
-
hasSubUnits
public static boolean hasSubUnits(int nIdUnit) Check if the given id unit has sub units- Parameters:
nIdUnit- the id unit- Returns:
- true if it has sub units, false otherwise
-
getDirectSubUnits
Retrieve list of direct children units- Parameters:
nIdUnit- the id unit- Returns:
- List of children units
-
getAllSubUnitsId
Retrieve Set of all children units id- Parameters:
nIdUnit- the id unit- Returns:
- Set of all children unit id
-
removeUserFromUnit
public static void removeUserFromUnit(int nIdUser, int nIdUnit) Remove a user from a unit- Parameters:
nIdUser- the id usernIdUnit- The id of the unit
-
removeUsersFromUnit
public static void removeUsersFromUnit(int nIdUnit) Remove an unit from a given id unit- Parameters:
nIdUnit- the id unit
-
update
Update a unit- Parameters:
unit- the unit
-
addUserToUnit
public static void addUserToUnit(int nIdUnit, int nIdUser) Add the user to the unit- Parameters:
nIdUnit- the id unitnIdUser- the id user
-
isUserInUnit
public static boolean isUserInUnit(int nIdUser, int nIdUnit) Check if the user is in a given unit- Parameters:
nIdUser- the id usernIdUnit- The id of the unit- Returns:
- true if the user is in the unit, false otherwise
-
getUnitWithNoChildren
Return all the Unit with no children (level 0)- Returns:
- all the Unit with no children (level 0)
-
updateParent
public static void updateParent(int nIdUnitToMove, int nIdNewParent) Update the parent of a unit- Parameters:
nIdUnitToMove- The id of the unit to change the parent of.nIdNewParent- The id of the new parent of the unit.
-