Class FormsResponseUtils
- java.lang.Object
-
- fr.paris.lutece.plugins.forms.util.FormsResponseUtils
-
public class FormsResponseUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildFileUrl(int nIdFormQuestionResponse, int nIdFile)Build FormsResponse file url.static FormResponseDatabuildFormResponseData(FormResponse formResponse, java.util.Optional<Form> form)Build FormResponseDatastatic java.lang.StringbuildFormsResponseFOUrl(int nIdFormResponse)Build FormsResponse FO url.static java.util.List<java.lang.String>buildStepsHtml(javax.servlet.http.HttpServletRequest request, java.util.List<Step> listStep, FormResponseManager formResponseManager, boolean frontOffice)Builds the HTML for the specified list of stepsstatic booleancheckIfUserResponseForm(Form form, java.lang.String strGuid)check if user can answer the form againstatic booleancheckNumberMaxResponseForm(Form form)check if form is reached the number max of responsestatic voidfillResponseManagerWithResponses(javax.servlet.http.HttpServletRequest request, boolean bValidateQuestionStep, FormResponseManager formResponseManager, java.util.List<Question> listQuestionStep, boolean displayInBO)static java.util.List<FormResponse>filterFormResponseForLuteceUser(java.util.List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user)Filter formResponse by access rights for LuteceUserstatic java.util.List<FormResponseData>filterFormResponseListForLuteceUser(java.util.List<FormResponse> formResponseList, fr.paris.lutece.portal.service.security.LuteceUser user)Filter and build formResponseData by access rights for LuteceUserstatic java.util.List<FormResponse>getFormResponseListByRoleAndGuid(fr.paris.lutece.portal.service.security.LuteceUser user)Get FormResponse list By Role And Guidstatic java.util.LocalegetLocaleFO(javax.servlet.http.HttpServletRequest request)static java.lang.ObjectgetLockOnForm(Form form)static StepgetNextStep(int nIdCurrentStep, java.util.List<java.lang.String> errorMessageList, FormResponseManager formResponseManager)Build next Step objectstatic java.lang.StringgetRootUrl()Return 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 voidpopulateFormWithLogoAndNumberResponse(Form form)Populate form with Physical File logo and number of response
-
-
-
Method Detail
-
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 java.util.List<FormResponse> filterFormResponseForLuteceUser(java.util.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 java.util.List<FormResponseData> filterFormResponseListForLuteceUser(java.util.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 java.util.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, java.util.Optional<Form> form)
Build FormResponseData- Parameters:
formResponse- the from responseform- the form- Returns:
- the FormResponseData builded
-
getNextStep
public static Step getNextStep(int nIdCurrentStep, java.util.List<java.lang.String> errorMessageList, FormResponseManager formResponseManager)
Build next Step object- Parameters:
nIdCurrentStep- the id current steperrorMessageList- the error message listformResponseManager- the formResponseManager- Returns:
- Step object
-
populateFormWithLogoAndNumberResponse
public static void populateFormWithLogoAndNumberResponse(Form form)
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, java.util.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
public static java.lang.Object getLockOnForm(Form form)
-
increaseNumberResponse
public static void increaseNumberResponse(Form form)
Increase the number of response of the Form- Parameters:
form-
-
checkNumberMaxResponseForm
public static boolean checkNumberMaxResponseForm(Form form)
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
public static boolean checkIfUserResponseForm(Form form, java.lang.String strGuid)
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 java.util.List<java.lang.String> buildStepsHtml(javax.servlet.http.HttpServletRequest request, java.util.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
public static java.util.Locale getLocaleFO(javax.servlet.http.HttpServletRequest request)
-
buildFileUrl
public static java.lang.String buildFileUrl(int nIdFormQuestionResponse, int nIdFile)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
public static java.lang.String buildFormsResponseFOUrl(int nIdFormResponse)
Build FormsResponse FO url.- Parameters:
nIdFormQuestionResponse- the forms question responsenIdFile- the file id- Returns:
- the url builded
-
getRootUrl
public static java.lang.String getRootUrl()
Return the url of the Root of the webapp- Returns:
- strBase the webapp url
-
-