fr.paris.lutece.plugins.crm.service.demand
Class DemandTypeService

java.lang.Object
  extended by fr.paris.lutece.plugins.crm.service.demand.DemandTypeService

public class DemandTypeService
extends java.lang.Object

DemandTypeService


Constructor Summary
protected DemandTypeService()
          Constructor
 
Method Summary
 boolean checkRoleForDemandType(DemandType demandType, javax.servlet.http.HttpServletRequest request)
          Check if the user has the role in order to view the demand type
 int create(DemandType demandType)
          Create a new demand type
 void doReorderDemandTypes()
          Reorder all demand types
 void doReorderDemandTypesGreaterOrder(int nCurrentOrder, int nOldOrder)
          Reorder the demand types that are greater or equal to the nCurrentOrder.
 void doReorderDemandTypesLowerOrder(int nCurrentOrder, int nOldOrder)
          Reorder the demand types that have a lower order than the nCurrentOrder .
 java.util.List<DemandType> findAll()
          Find all demand types
 java.util.List<DemandType> findByFilter(DemandTypeFilter dtFilter)
          Find the demand types given a filter
 DemandType findByOrder(int nOrder)
          Find a demand type by its order
 DemandType findByPrimaryKey(int nIdDemandType)
          Find a demand type by its primary key
 fr.paris.lutece.util.ReferenceList findDemandTypes()
          Find all demand types as a ReferenceList
 java.util.Map<java.lang.String,java.util.List<DemandType>> findForLuteceUser(javax.servlet.http.HttpServletRequest request)
          Find the list of demand types for the lutece user ordered by id category
 int findMaxOrder()
          Find the max order + 1
 fr.paris.lutece.util.ReferenceList getOperatorsList()
          Get the list of operators as a ReferenceList
 fr.paris.lutece.util.ReferenceList getRolesList()
          Get the list of MyLutece role as a ReferenceList
static DemandTypeService getService()
          Get the instance of DemandTypeService
static void init()
          Initialize the service
 boolean isWellOrdered()
          Check if the list of demand types are well ordered
 void remove(int nIdDemandType)
          Remove a demand type
 void update(DemandType demandType)
          Update a demand type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DemandTypeService

protected DemandTypeService()
Constructor

Method Detail

getService

public static DemandTypeService getService()
Get the instance of DemandTypeService

Returns:
the instance of DemandTypeService

init

public static void init()
Initialize the service


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

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

findAll

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

Returns:
a ReferenceList

findMaxOrder

public int findMaxOrder()
Find the max order + 1

Returns:
the max order + 1

findByFilter

public java.util.List<DemandType> findByFilter(DemandTypeFilter dtFilter)
Find the demand types given a filter

Parameters:
dtFilter - the filter
Returns:
a list of DemandType

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 the nCurrentOrder.
Those demand types orders are move up by 1.
The nOldOrder is ignored in the process.

Parameters:
nCurrentOrder - the current order
nOldOrder - the order to ignore

doReorderDemandTypesLowerOrder

public void doReorderDemandTypesLowerOrder(int nCurrentOrder,
                                           int nOldOrder)
Reorder the demand types that have a lower order than the nCurrentOrder .
The nOldOrder is ignored in the process.

Parameters:
nCurrentOrder - the current order
nOldOrder - the order to ignore

findForLuteceUser

public java.util.Map<java.lang.String,java.util.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>)

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 type
request - HttpServletRequest
Returns:
true if the user has the role or the demand type does not require a role, false otherwise

getRolesList

public fr.paris.lutece.util.ReferenceList getRolesList()
Get the list of MyLutece role as a ReferenceList

Returns:
ReferenceList

isWellOrdered

public boolean isWellOrdered()
Check if the list of demand types are well ordered

Returns:
true if it is well ordered, false otherwise

getOperatorsList

public fr.paris.lutece.util.ReferenceList getOperatorsList()
Get the list of operators as a ReferenceList

Returns:
a ReferenceList


Copyright © 2011 Mairie de Paris. All Rights Reserved.