Class DemandTypeService


  • public class DemandTypeService
    extends Object
    DemandTypeService
    • Method Detail

      • 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
      • 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
      • 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 - HttpServletRequest
        nIdCategory - 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 a ReferenceList
        Returns:
        ReferenceList
      • getOperatorsList

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

        public fr.paris.lutece.util.ReferenceList getTargetsList()
        Get the list of targets as a ReferenceList
        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 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
      • 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
      • isWellOrdered

        public boolean isWellOrdered()
        Check if the list of demand types are well ordered
        Returns:
        true if it is well ordered, false otherwise