Class PredemandeCodeUtils
java.lang.Object
fr.paris.lutece.plugins.appointment.modules.ants.utils.PredemandeCodeUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringconstructRedirectionUrl(jakarta.servlet.http.HttpServletRequest request, String xPageName, String viewName, RequestParameters reqParams) Build the URL used to redirect user, with specific parametersstatic intgetAmountPredemandeCodesInSession(jakarta.servlet.http.HttpSession session, String codeValuesSeparator) Get the total amount of predemande codes entered by the usergetPredemandeCodeList(jakarta.servlet.http.HttpServletRequest request, String prefixPredemandeCode, int totalNumberPersons) Get a List of all the predemande codes entered by the userstatic booleanhasUniqueValues(List<String> list) Check if the elements from a List of Strings are unique / distinctstatic voidinsertPredemandeCodesInSession(jakarta.servlet.http.HttpSession session, List<String> predemandeCodeValueList, String codeValuesSeparator, String sessionAttributeName) Add the predemande codes in a session's attributes.static booleanisValidCode(String strCode) Check that a pre-demand code has the ANTS format: ten digits or uppercase letters.
-
Method Details
-
getPredemandeCodeList
public static List<String> getPredemandeCodeList(jakarta.servlet.http.HttpServletRequest request, String prefixPredemandeCode, int totalNumberPersons) Get a List of all the predemande codes entered by the user- Parameters:
request- Current HTTP RequestprefixPredemandeCode- The prefix used in the request's parameters to identify a predemande codetotalNumberPersons- Number of people attending the appointment- Returns:
- The predemande codes as a List of Strings
-
constructRedirectionUrl
public static String constructRedirectionUrl(jakarta.servlet.http.HttpServletRequest request, String xPageName, String viewName, RequestParameters reqParams) Build the URL used to redirect user, with specific parameters- Parameters:
request- Current HTTP RequestxPageName- Name of the XPage to displayviewName- Name of the view to display in the XPagereqParams- request parameters used in the URL- Returns:
- The redirection URL as a String
-
insertPredemandeCodesInSession
public static void insertPredemandeCodesInSession(jakarta.servlet.http.HttpSession session, List<String> predemandeCodeValueList, String codeValuesSeparator, 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 addedpredemandeCodeValueList- List of all the predemande codescodeValuesSeparator- String used to separate each code value
-
getAmountPredemandeCodesInSession
public static int getAmountPredemandeCodesInSession(jakarta.servlet.http.HttpSession session, String codeValuesSeparator) Get the total amount of predemande codes entered by the user- Parameters:
session- HttpSession where the codes are savedcodeValuesSeparator- String used to separate each code value- Returns:
- The amount of predemande codes
-
isValidCode
Check that a pre-demand code has the ANTS format: ten digits or uppercase letters.- Parameters:
strCode- The code to check- Returns:
- True if the code has the ANTS format
-
hasUniqueValues
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
-