Class FormsResponseUtils
java.lang.Object
fr.paris.lutece.plugins.forms.util.FormsResponseUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildFileUrl(int nIdFormQuestionResponse, int nIdFile) Build FormsResponse file url.static FormResponseDatabuildFormResponseData(FormResponse formResponse, Optional<Form> form) Build FormResponseDatastatic StringbuildFormsResponseFOUrl(int nIdFormResponse) Build FormsResponse FO url.buildStepsHtml(javax.servlet.http.HttpServletRequest request, List<Step> listStep, FormResponseManager formResponseManager, boolean frontOffice) Builds the HTML for the specified list of stepsstatic booleancheckIfUserResponseForm(Form form, String strGuid) check if user can answer the form againstatic booleancheck if form is reached the number max of responsestatic voidfillResponseManagerWithResponses(javax.servlet.http.HttpServletRequest request, boolean bValidateQuestionStep, FormResponseManager formResponseManager, List<Question> listQuestionStep, boolean displayInBO) static List<FormResponse>filterFormResponseForLuteceUser(List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user) Filter formResponse by access rights for LuteceUserstatic List<FormResponseData>filterFormResponseListForLuteceUser(List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user) Filter and build formResponseData by access rights for LuteceUserstatic List<FormResponse>getFormResponseListByRoleAndGuid(fr.paris.lutece.portal.service.security.LuteceUser user) Get FormResponse list By Role And Guidstatic LocalegetLocaleFO(javax.servlet.http.HttpServletRequest request) static ObjectgetLockOnForm(Form form) static StepgetNextStep(int nIdCurrentStep, List<String> errorMessageList, FormResponseManager formResponseManager, Locale locale) Build next Step objectstatic StringReturn the url of the Root of the webappstatic voidincreaseNumberResponse(Form form) Increase the number of response of the Formstatic booleanisAuthorized(FormResponse formResponse, fr.paris.lutece.portal.service.security.LuteceUser user) Check that a given user is allowed to access for manage the formResponsestatic booleanisAuthorized(FormResponse formResponse, fr.paris.lutece.portal.service.security.LuteceUser user, Form form) Check that a given user is allowed to access for manage the formResponsestatic voidPopulate form with Physical File logo and number of response
-
Method Details
-
isAuthorized
public static boolean isAuthorized(FormResponse formResponse, fr.paris.lutece.portal.service.security.LuteceUser user) Check that a given user is allowed to access for manage the formResponse- Parameters:
formResponse- the formsResponseuser- the user trying to access the resource- Returns:
- true if the user can access for manage the given resource, false otherwise
-
isAuthorized
public static boolean isAuthorized(FormResponse formResponse, fr.paris.lutece.portal.service.security.LuteceUser user, Form form) Check that a given user is allowed to access for manage the formResponse- Parameters:
formResponse- the formsResponseuser- the user trying to access the resourceform- the form- Returns:
- true if the user can access for manage the given resource, false otherwise
-
filterFormResponseForLuteceUser
public static List<FormResponse> filterFormResponseForLuteceUser(List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user) Filter formResponse by access rights for LuteceUser- Parameters:
formResponseList- the list of fromResponse objectsuser- the luteceUser- Returns:
- list of FormResponse objects filtered
-
filterFormResponseListForLuteceUser
public static List<FormResponseData> filterFormResponseListForLuteceUser(List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user) Filter and build formResponseData by access rights for LuteceUser- Parameters:
formResponseList- the list of fromResponse objectsuser- the luteceUser- Returns:
- list of FormResponseData objects builded
-
getFormResponseListByRoleAndGuid
public static List<FormResponse> getFormResponseListByRoleAndGuid(fr.paris.lutece.portal.service.security.LuteceUser user) Get FormResponse list By Role And Guid- Parameters:
user- the LuteceUser- Returns:
- FormResponse objects list
-
buildFormResponseData
public static FormResponseData buildFormResponseData(FormResponse formResponse, Optional<Form> form) Build FormResponseData- Parameters:
formResponse- the from responseform- the form- Returns:
- the FormResponseData builded
-
getNextStep
public static Step getNextStep(int nIdCurrentStep, List<String> errorMessageList, FormResponseManager formResponseManager, Locale locale) Build next Step object- Parameters:
nIdCurrentStep- the id current steperrorMessageList- the error message listformResponseManager- the formResponseManager- Returns:
- Step object
-
populateFormWithLogoAndNumberResponse
Populate form with Physical File logo and number of response- Parameters:
form- the form object
-
fillResponseManagerWithResponses
public static void fillResponseManagerWithResponses(javax.servlet.http.HttpServletRequest request, boolean bValidateQuestionStep, FormResponseManager formResponseManager, List<Question> listQuestionStep, boolean displayInBO) throws QuestionValidationException - Parameters:
request- The Http requestbValidateQuestionStep- valid question ton next step- Throws:
QuestionValidationException- if there is at least one question not valid
-
getLockOnForm
-
increaseNumberResponse
Increase the number of response of the Form- Parameters:
form-
-
checkNumberMaxResponseForm
check if form is reached the number max of response- Parameters:
form- the formrequest- the request- Throws:
fr.paris.lutece.portal.service.message.SiteMessageException- the exception
-
checkIfUserResponseForm
check if user can answer the form again- Parameters:
form- the formrequest- the request- Throws:
fr.paris.lutece.portal.service.message.SiteMessageException
-
buildStepsHtml
public static List<String> buildStepsHtml(javax.servlet.http.HttpServletRequest request, List<Step> listStep, FormResponseManager formResponseManager, boolean frontOffice) Builds the HTML for the specified list of steps- Parameters:
request- The requestlistStep- The list of steps- Returns:
- the list of HTML
-
getLocaleFO
-
buildFileUrl
Build FormsResponse file url. This url is only used for FO- Parameters:
nIdFormQuestionResponse- the forms question responsenIdFile- the file id- Returns:
- the url builded
-
buildFormsResponseFOUrl
Build FormsResponse FO url.- Parameters:
nIdFormQuestionResponse- the forms question responsenIdFile- the file id- Returns:
- the url builded
-
getRootUrl
Return the url of the Root of the webapp- Returns:
- strBase the webapp url
-