public class UnitService extends Object implements IUnitService
BEAN_UNIT_SERVICE
Constructor and Description |
---|
UnitService() |
Modifier and Type | Method and Description |
---|---|
boolean |
canCreateSubUnit(int nIdUnit)
Check if the given id unit, we can create sub unit.
|
int |
createUnit(Unit unit,
javax.servlet.http.HttpServletRequest request)
Create a unit
|
List<Unit> |
findBySectorId(int nIdSector)
Find by sector id
|
List<Unit> |
getAllSubUnits(Unit unit,
boolean bGetAdditionalInfos)
Get all the sub units in the unit tree from the specified unit
|
List<Unit> |
getAllUnits(boolean bGetAdditionalInfos)
Get all units
|
List<IAction> |
getListActions(String strActionType,
Locale locale,
Unit unit,
fr.paris.lutece.portal.business.user.AdminUser user,
UnittreeRBACRecursiveType recursiveType)
Get the list of actions
|
List<Unit> |
getListParentUnits(Unit givenUnit)
Get the unit parent list, from a given unit.
|
Unit |
getRootUnit(boolean bGetAdditionalInfos)
Get the root unit
|
List<Unit> |
getSubUnits(int nIdUnit,
boolean bGetAdditionalInfos)
Get the direct sub units from a given id unit
|
fr.paris.lutece.util.ReferenceList |
getSubUnitsAsReferenceList(int nIdUnit,
Locale locale)
Get the direct sub units as a
ReferenceList |
Source |
getTreeXsl()
Get the XSL of the tree
|
Unit |
getUnit(int nIdUnit,
boolean bGetAdditionalInfos)
Get the unit
|
List<Unit> |
getUnitsByIdUser(int nIdUser,
boolean bGetAdditionalInfos)
Get the unit by id user
|
List<Unit> |
getUnitsFirstLevel(boolean bGetAdditionalInfos)
Get the units first level
|
List<Unit> |
getUnitWithNoChildren()
Return all the Unit with no children (level 0)
|
String |
getXMLUnits(fr.paris.lutece.portal.business.user.AdminUser user)
Get the XML units
|
boolean |
hasSubUnits(int nIdUnit)
Check if the given id unit has sub units
|
boolean |
isAuthorized(String strIdUnit,
String strPermission,
fr.paris.lutece.portal.business.user.AdminUser user,
UnittreeRBACRecursiveType recursiveType)
See
#isAuthorized(Unit, String, AdminUser) |
boolean |
isAuthorized(Unit unit,
String strPermission,
fr.paris.lutece.portal.business.user.AdminUser user,
UnittreeRBACRecursiveType recursiveType)
Check if the given user is authorized to do the action for a given unit.
|
boolean |
isParent(Unit unitParent,
Unit unitRef)
Check if the first unit in parameter is parent of the second unit in parameter
|
boolean |
isUnitInList(Unit unitToCheck,
Collection<Unit> listUnits)
Check if an unit is in a given list of unit
|
boolean |
moveSubTree(Unit unitToMove,
Unit newUnitParent)
Change the parent of a unit.
|
void |
removeUnit(int nIdUnit,
javax.servlet.http.HttpServletRequest request)
Remove the unit only if the unit does not have sub units
|
void |
updateUnit(Unit unit,
javax.servlet.http.HttpServletRequest request)
Update the unit
|
public Unit getUnit(int nIdUnit, boolean bGetAdditionalInfos)
getUnit
in interface IUnitService
nIdUnit
- the id unitbGetAdditionalInfos
- true if it must get the additional infosUnit
public Unit getRootUnit(boolean bGetAdditionalInfos)
getRootUnit
in interface IUnitService
bGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<Unit> getUnitsByIdUser(int nIdUser, boolean bGetAdditionalInfos)
getUnitsByIdUser
in interface IUnitService
nIdUser
- the id userbGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<Unit> getAllUnits(boolean bGetAdditionalInfos)
getAllUnits
in interface IUnitService
bGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<Unit> getUnitsFirstLevel(boolean bGetAdditionalInfos)
getUnitsFirstLevel
in interface IUnitService
bGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<Unit> getSubUnits(int nIdUnit, boolean bGetAdditionalInfos)
getSubUnits
in interface IUnitService
nIdUnit
- the id unitbGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<Unit> getAllSubUnits(Unit unit, boolean bGetAdditionalInfos)
getAllSubUnits
in interface IUnitService
unit
- the unitbGetAdditionalInfos
- true if it must get the ids sectorUnit
public List<IAction> getListActions(String strActionType, Locale locale, Unit unit, fr.paris.lutece.portal.business.user.AdminUser user, UnittreeRBACRecursiveType recursiveType)
getListActions
in interface IUnitService
strActionType
- the action typelocale
- the localeunit
- the unituser
- the userrecursiveType
- the recursive typeIAction
public fr.paris.lutece.util.ReferenceList getSubUnitsAsReferenceList(int nIdUnit, Locale locale)
ReferenceList
getSubUnitsAsReferenceList
in interface IUnitService
nIdUnit
- the id unitlocale
- the localeReferenceList
public String getXMLUnits(fr.paris.lutece.portal.business.user.AdminUser user)
getXMLUnits
in interface IUnitService
user
- the admin userpublic Source getTreeXsl()
getTreeXsl
in interface IUnitService
public List<Unit> findBySectorId(int nIdSector)
findBySectorId
in interface IUnitService
nIdSector
- id sectorpublic List<Unit> getUnitWithNoChildren()
getUnitWithNoChildren
in interface IUnitService
public boolean hasSubUnits(int nIdUnit)
hasSubUnits
in interface IUnitService
nIdUnit
- the id unitpublic boolean isParent(Unit unitParent, Unit unitRef)
isParent
in interface IUnitService
unitParent
- the parent unitunitRef
- the unit to checkpublic boolean canCreateSubUnit(int nIdUnit)
canCreateSubUnit
in interface IUnitService
nIdUnit
- the id unitpublic boolean isAuthorized(Unit unit, String strPermission, fr.paris.lutece.portal.business.user.AdminUser user, UnittreeRBACRecursiveType recursiveType)
isAuthorized
in interface IUnitService
unit
- the unitstrPermission
- the permissionuser
- the userrecursiveType
- the recursive type of RBACpublic boolean isAuthorized(String strIdUnit, String strPermission, fr.paris.lutece.portal.business.user.AdminUser user, UnittreeRBACRecursiveType recursiveType)
#isAuthorized(Unit, String, AdminUser)
isAuthorized
in interface IUnitService
strIdUnit
- the id resourcestrPermission
- the permissionuser
- the userrecursiveType
- the recursive type of RBAC@Transactional(value="unittree.transactionManager") public int createUnit(Unit unit, javax.servlet.http.HttpServletRequest request) throws UnitErrorException
createUnit
in interface IUnitService
unit
- the unitrequest
- the HTTP requestUnitErrorException
- exception if there is an application error@Transactional(value="unittree.transactionManager") public void removeUnit(int nIdUnit, javax.servlet.http.HttpServletRequest request)
removeUnit
in interface IUnitService
nIdUnit
- the id unitrequest
- the HTTP request@Transactional(value="unittree.transactionManager") public void updateUnit(Unit unit, javax.servlet.http.HttpServletRequest request) throws UnitErrorException
updateUnit
in interface IUnitService
unit
- the unitrequest
- the HTTP requestUnitErrorException
- exception if there is an application error@Transactional(value="unittree.transactionManager") public boolean moveSubTree(Unit unitToMove, Unit newUnitParent)
moveSubTree
in interface IUnitService
unitToMove
- The unit to change the parent of.newUnitParent
- The new parent of the unitpublic List<Unit> getListParentUnits(Unit givenUnit)
getListParentUnits
in interface IUnitService
givenUnit
- the unitpublic boolean isUnitInList(Unit unitToCheck, Collection<Unit> listUnits)
isUnitInList
in interface IUnitService
unitToCheck
- the unit to checklistUnits
- the list of unitsCopyright © 2019 City of Paris. All rights reserved.