Class PredemandeCodeUtils


  • public class PredemandeCodeUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String constructRedirectionUrl​(javax.servlet.http.HttpServletRequest request, java.lang.String xPageName, java.lang.String viewName, RequestParameters reqParams)
      Build the URL used to redirect user, with specific parameters
      static int getAmountPredemandeCodesInSession​(javax.servlet.http.HttpSession session, java.lang.String codeValuesSeparator)
      Get the total amount of predemande codes entered by the user
      static java.util.List<java.lang.String> getPredemandeCodeList​(javax.servlet.http.HttpServletRequest request, java.lang.String prefixPredemandeCode, int totalNumberPersons)
      Get a List of all the predemande codes entered by the user
      static boolean hasUniqueValues​(java.util.List<java.lang.String> list)
      Check if the elements from a List of Strings are unique / distinct
      static void insertPredemandeCodesInSession​(javax.servlet.http.HttpSession session, java.util.List<java.lang.String> predemandeCodeValueList, java.lang.String codeValuesSeparator, java.lang.String sessionAttributeName)
      Add the predemande codes in a session's attributes.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getPredemandeCodeList

        public static java.util.List<java.lang.String> getPredemandeCodeList​(javax.servlet.http.HttpServletRequest request,
                                                                             java.lang.String prefixPredemandeCode,
                                                                             int totalNumberPersons)
        Get a List of all the predemande codes entered by the user
        Parameters:
        request - Current HTTP Request
        prefixPredemandeCode - The prefix used in the request's parameters to identify a predemande code
        totalNumberPersons - Number of people attending the appointment
        Returns:
        The predemande codes as a List of Strings
      • constructRedirectionUrl

        public static java.lang.String constructRedirectionUrl​(javax.servlet.http.HttpServletRequest request,
                                                               java.lang.String xPageName,
                                                               java.lang.String viewName,
                                                               RequestParameters reqParams)
        Build the URL used to redirect user, with specific parameters
        Parameters:
        request - Current HTTP Request
        xPageName - Name of the XPage to display
        viewName - Name of the view to display in the XPage
        reqParams - request parameters used in the URL
        Returns:
        The redirection URL as a String
      • insertPredemandeCodesInSession

        public static void insertPredemandeCodesInSession​(javax.servlet.http.HttpSession session,
                                                          java.util.List<java.lang.String> predemandeCodeValueList,
                                                          java.lang.String codeValuesSeparator,
                                                          java.lang.String sessionAttributeName)
        Add the predemande codes in a session's attributes. The codes will be put together as a single String, where their values are separated by a specific symbol.
        Parameters:
        session - HttpSession where the codes will be added
        predemandeCodeValueList - List of all the predemande codes
        codeValuesSeparator - String used to separate each code value
      • getAmountPredemandeCodesInSession

        public static int getAmountPredemandeCodesInSession​(javax.servlet.http.HttpSession session,
                                                            java.lang.String codeValuesSeparator)
        Get the total amount of predemande codes entered by the user
        Parameters:
        session - HttpSession where the codes are saved
        codeValuesSeparator - String used to separate each code value
        Returns:
        The amount of predemande codes
      • hasUniqueValues

        public static boolean hasUniqueValues​(java.util.List<java.lang.String> list)
        Check if the elements from a List of Strings are unique / distinct
        Parameters:
        list - The list to check
        Returns:
        True if the list's elements are unique, returns false otherwise