Class DemandTypeService
- java.lang.Object
-
- fr.paris.lutece.plugins.crm.service.demand.DemandTypeService
-
public class DemandTypeService extends Object
DemandTypeService
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckRoleForDemandType(DemandType demandType, javax.servlet.http.HttpServletRequest request)Check if the user has the role in order to view the demand typeintcreate(DemandType demandType)Create a new demand typevoiddoReorderDemandTypes()Reorder all demand typesvoiddoReorderDemandTypesGreaterOrder(int nCurrentOrder, int nOldOrder)Reorder the demand types that are greater or equal to thenCurrentOrder.voiddoReorderDemandTypesLowerOrder(int nCurrentOrder, int nOldOrder)Reorder the demand types that have a lower order than thenCurrentOrder.List<DemandType>findAll()Find all demand typesList<DemandType>findByFilter(DemandTypeFilter dtFilter)Find the demand types given a filterDemandTypefindByOrder(int nOrder)Find a demand type by its orderDemandTypefindByPrimaryKey(int nIdDemandType)Find a demand type by its primary keyfr.paris.lutece.util.ReferenceListfindDemandTypes()Find all demand types as aReferenceListMap<String,List<DemandType>>findForLuteceUser(javax.servlet.http.HttpServletRequest request)Find the list of demand types for the lutece user ordered by id categoryList<DemandType>findForLuteceUser(javax.servlet.http.HttpServletRequest request, int nIdCategory)Find the list of demand types for the lutece user and a categoryintfindMaxOrder()Find the max order + 1List<DemandType>findNoDateEndDemandTypes()Find the list of demand types that have not a date endfr.paris.lutece.util.ReferenceListgetOperatorsList()Get the list of operators as aReferenceListfr.paris.lutece.util.ReferenceListgetRolesList()Get the list of MyLutece role as aReferenceListstatic DemandTypeServicegetService()Get the instance ofDemandTypeServicefr.paris.lutece.util.ReferenceListgetTargetsList()Get the list of targets as aReferenceListstatic voidinit()Initialize the servicebooleanisWellOrdered()Check if the list of demand types are well orderedvoidremove(int nIdDemandType)Remove a demand typevoidupdate(DemandType demandType)Update a demand type
-
-
-
Method Detail
-
getService
public static DemandTypeService getService()
Get the instance ofDemandTypeService- Returns:
- the instance of
DemandTypeService
-
init
public static void init()
Initialize the service
-
create
public int create(DemandType demandType)
Create a new demand type- Parameters:
demandType- the demand type- Returns:
- the newly created demand type ID
-
update
public void update(DemandType demandType)
Update a demand type- Parameters:
demandType- the demand type
-
remove
public void remove(int nIdDemandType)
Remove a demand type- Parameters:
nIdDemandType- the ID demand type
-
findByPrimaryKey
public DemandType findByPrimaryKey(int nIdDemandType)
Find a demand type by its primary key- Parameters:
nIdDemandType- the id demand type- Returns:
- a
DemandType
-
findByOrder
public DemandType findByOrder(int nOrder)
Find a demand type by its order- Parameters:
nOrder- the order- Returns:
- a
DemandType
-
findAll
public List<DemandType> findAll()
Find all demand types- Returns:
- a list of
DemandType
-
findDemandTypes
public fr.paris.lutece.util.ReferenceList findDemandTypes()
Find all demand types as aReferenceList- Returns:
- a
ReferenceList
-
findMaxOrder
public int findMaxOrder()
Find the max order + 1- Returns:
- the max order + 1
-
findByFilter
public List<DemandType> findByFilter(DemandTypeFilter dtFilter)
Find the demand types given a filter- Parameters:
dtFilter- the filter- Returns:
- a list of
DemandType
-
findForLuteceUser
public List<DemandType> findForLuteceUser(javax.servlet.http.HttpServletRequest request, int nIdCategory)
Find the list of demand types for the lutece user and a category- Parameters:
request-HttpServletRequestnIdCategory- the category Id Selected- Returns:
- a list of demand Type
-
findForLuteceUser
public Map<String,List<DemandType>> findForLuteceUser(javax.servlet.http.HttpServletRequest request)
Find the list of demand types for the lutece user ordered by id category- Parameters:
request-HttpServletRequest- Returns:
- a map of (id_category, List<DemandType>)
-
findNoDateEndDemandTypes
public List<DemandType> findNoDateEndDemandTypes()
Find the list of demand types that have not a date end- Returns:
- a list of demand types
-
getRolesList
public fr.paris.lutece.util.ReferenceList getRolesList()
Get the list of MyLutece role as aReferenceList- Returns:
ReferenceList
-
getOperatorsList
public fr.paris.lutece.util.ReferenceList getOperatorsList()
Get the list of operators as aReferenceList- Returns:
- a
ReferenceList
-
getTargetsList
public fr.paris.lutece.util.ReferenceList getTargetsList()
Get the list of targets as aReferenceList- Returns:
- a
ReferenceList
-
doReorderDemandTypes
public void doReorderDemandTypes()
Reorder all demand types
-
doReorderDemandTypesGreaterOrder
public void doReorderDemandTypesGreaterOrder(int nCurrentOrder, int nOldOrder)Reorder the demand types that are greater or equal to thenCurrentOrder.
Those demand types orders are move up by 1.
ThenOldOrderis ignored in the process.- Parameters:
nCurrentOrder- the current ordernOldOrder- the order to ignore
-
doReorderDemandTypesLowerOrder
public void doReorderDemandTypesLowerOrder(int nCurrentOrder, int nOldOrder)Reorder the demand types that have a lower order than thenCurrentOrder.
ThenOldOrderis ignored in the process.- Parameters:
nCurrentOrder- the current ordernOldOrder- the order to ignore
-
checkRoleForDemandType
public boolean checkRoleForDemandType(DemandType demandType, javax.servlet.http.HttpServletRequest request)
Check if the user has the role in order to view the demand type- Parameters:
demandType- the demand typerequest-HttpServletRequest- Returns:
- true if the user has the role or the demand type does not require a role, false otherwise
-
isWellOrdered
public boolean isWellOrdered()
Check if the list of demand types are well ordered- Returns:
- true if it is well ordered, false otherwise
-
-