Package de.xima.fc.form.request
Class FormRequestContext
- java.lang.Object
-
- de.xima.fc.form.request.FormRequestContext
-
- All Implemented Interfaces:
IFormRequestContext
,Serializable
- Direct Known Subclasses:
ExtendedFormRequestContext
public class FormRequestContext extends Object implements IFormRequestContext
Context of an form-request with all data for working with further contexts likeIFormRenderContext
,IFormPersistContext
orIFormProcessContext
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
FormRequestContext(EFormRequestType requestType, UserContext uc)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.form.IFormRequestContext
getBenutzerGruppen, getBenutzerPostfaecher, getCurrentBenutzer, getRequestContext, setBenutzerGruppen, setBenutzerPostfaecher, setCurrentBenutzer, setRequestContest, setRequestContext
-
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
xfcSession
protected XfcSession xfcSession
-
frqSession
protected FRQSession frqSession
-
sessionId
protected String sessionId
-
baseUrl
protected String baseUrl
-
fullRequestUrl
protected String fullRequestUrl
-
locale
protected Locale locale
-
mandant
protected Mandant mandant
-
formVersion
protected FormVersion formVersion
-
workflowVersion
protected WorkflowVersion workflowVersion
-
vorgang
protected Vorgang vorgang
-
formRecordLockContext
protected IFormRecordLockContext formRecordLockContext
-
projekt
protected Projekt projekt
-
doubleOptInData
protected ProjectDOIData doubleOptInData
-
identityCheckData
protected ProjectIdentityCheckData identityCheckData
-
user
protected Benutzer user
-
userProfile
protected org.pac4j.core.profile.CommonProfile userProfile
-
userGroups
protected List<BenutzerGruppe> userGroups
-
frontendServer
protected FrontendServer frontendServer
-
formData
protected IFormDataAdapter formData
-
uc
protected UserContext uc
-
parameterWrapper
protected ParameterWrapper parameterWrapper
-
requestType
protected EFormRequestType requestType
-
sessionAttributes
protected Map<String,Serializable> sessionAttributes
-
sessionTimeout
protected Duration sessionTimeout
-
isSaveOnly
protected boolean isSaveOnly
-
isResubmit
protected boolean isResubmit
-
isPreview
protected boolean isPreview
-
isReview
protected boolean isReview
-
isOldVersion
protected boolean isOldVersion
-
previewWithoutSave
protected boolean previewWithoutSave
-
isRunWorkflow
protected boolean isRunWorkflow
-
isCheckForm
protected boolean isCheckForm
-
isUseCurrentFv
protected boolean isUseCurrentFv
-
isFrontendServerAllowed
protected boolean isFrontendServerAllowed
-
isBenutzerZugriffAllowed
protected boolean isBenutzerZugriffAllowed
-
isContinueProcessing
protected boolean isContinueProcessing
-
skipSubmitButtonValidation
protected boolean skipSubmitButtonValidation
-
-
Constructor Detail
-
FormRequestContext
protected FormRequestContext(EFormRequestType requestType, UserContext uc) throws ContextBuilderException
- Throws:
ContextBuilderException
-
-
Method Detail
-
getFormData
public IFormDataAdapter getFormData()
- Specified by:
getFormData
in interfaceIFormRequestContext
- Returns:
- An
IFormDataAdapter
that can be used to access the current form data, ie. the submitted or already present values for each form field.
-
setFormData
public void setFormData(IFormDataAdapter formData)
- Specified by:
setFormData
in interfaceIFormRequestContext
- Parameters:
formData
- AnIFormDataAdapter
that can be used to access the current form data, ie. the submitted or already present values for each form field.
-
getFormVersion
public FormVersion getFormVersion()
- Specified by:
getFormVersion
in interfaceIFormRequestContext
- Returns:
- The current
FormVersion
that was requested.
-
getWorkflowVersion
public WorkflowVersion getWorkflowVersion()
- Specified by:
getWorkflowVersion
in interfaceIFormRequestContext
- Returns:
- The current
WorkflowVersion
that was requested.
-
setFrontendServer
public void setFrontendServer(FrontendServer frontendServer)
- Specified by:
setFrontendServer
in interfaceIFormRequestContext
- Parameters:
frontendServer
- When the form request is made to aFrontendServer
, that frontend server. Otherwise, when the form request is made directly to the master server, this returnnull
.
-
getFrontendServer
public FrontendServer getFrontendServer()
- Specified by:
getFrontendServer
in interfaceIFormRequestContext
- Returns:
- When the form request is made to a
FrontendServer
, that frontend server. Otherwise, when the form request is made directly to the master server, this returnnull
.
-
getFRQSession
public FRQSession getFRQSession()
- Specified by:
getFRQSession
in interfaceIFormRequestContext
- Returns:
- The current form request session. A form request session is opened each time a form is requested. A single
IFormRequestContext.getSession()
may contain multipleFRQSession
s.
-
getLocale
public Locale getLocale()
- Specified by:
getLocale
in interfaceIFormRequestContext
- Returns:
- The current locale that is to be used for locale-dependent operations.
-
getMandant
public Mandant getMandant()
- Specified by:
getMandant
in interfaceIFormRequestContext
- Returns:
- The
Mandant
to which the current form belongs to.
-
getParameterWrapper
public ParameterWrapper getParameterWrapper()
Description copied from interface:IFormRequestContext
!READ-ONLY model of the parsed request parameters. To initialize data userIFormRequestContext.initFormData(ParameterWrapper)
orIFormRequestContext.getFormData()
andIFormDataAdapter.init(Map)
orIFormRequestContext.setFormData(IFormDataAdapter)
- Specified by:
getParameterWrapper
in interfaceIFormRequestContext
- Returns:
ParameterWrapper
-
getProjekt
public Projekt getProjekt()
- Specified by:
getProjekt
in interfaceIFormRequestContext
- Returns:
- The
Projekt
which contains the form that was requested.
-
getBaseUrl
public String getBaseUrl()
- Specified by:
getBaseUrl
in interfaceIFormRequestContext
- Returns:
- The base URL for this application, may not include the host.
-
setBaseUrl
public void setBaseUrl(String baseUrl)
- Specified by:
setBaseUrl
in interfaceIFormRequestContext
- Parameters:
baseUrl
- The base URL for this application, may not include the host.
-
getFullRequestUrl
public String getFullRequestUrl()
- Specified by:
getFullRequestUrl
in interfaceIFormRequestContext
- Returns:
- The full URL that was used to request the form, including all query params.
-
setFullRequestUrl
public void setFullRequestUrl(String fullRequestUrl)
- Specified by:
setFullRequestUrl
in interfaceIFormRequestContext
- Parameters:
fullRequestUrl
- The full URL that was used to request the form, including all query params.
-
getRequestType
public EFormRequestType getRequestType()
- Specified by:
getRequestType
in interfaceIFormRequestContext
- Returns:
- The type of request that was made, eg. whether a new form was requested or a form was submitted.
-
getSession
public XfcSession getSession()
- Specified by:
getSession
in interfaceIFormRequestContext
- Returns:
- The current FORMCYCLE session that contains additional information not contained in the
HttpSession
.
-
getSessionID
public String getSessionID()
- Specified by:
getSessionID
in interfaceIFormRequestContext
- Returns:
- The current
HttpSession
ID.
-
getUseCurrentFv
public Boolean getUseCurrentFv()
- Specified by:
getUseCurrentFv
in interfaceIFormRequestContext
-
getUserContext
public UserContext getUserContext()
- Specified by:
getUserContext
in interfaceIFormRequestContext
- Returns:
- The current user context that contains information about the user that is currently logged in. This context is also used when you would like to open a connection to the database.
-
setUserContext
public void setUserContext(UserContext uc)
- Specified by:
setUserContext
in interfaceIFormRequestContext
- Parameters:
uc
- The current user context that contains information about the user that is currently logged in. This context is also used when you would like to open a connection to the database.
-
getVorgang
public Vorgang getVorgang()
- Specified by:
getVorgang
in interfaceIFormRequestContext
- Returns:
- The current
Vorgang
when the form was submitted; ornull
when a new empty form was just requested. Note that this may not represent the current state of the form record: for example, when submitting a form and the workflow is run, the workflow might modify some data of the form record, this will not be reflected here.
-
getFormRecordLockContext
public IFormRecordLockContext getFormRecordLockContext()
- Specified by:
getFormRecordLockContext
in interfaceIFormRequestContext
- Returns:
- the form record locking context that is locking the form record of this request context
-
setFormRecordLockContext
public void setFormRecordLockContext(IFormRecordLockContext formRecordLockContext)
- Specified by:
setFormRecordLockContext
in interfaceIFormRequestContext
- Parameters:
formRecordLockContext
- the form record locking context that is locking the form record of this request context
-
isBenutzerZugriffAllowed
public boolean isBenutzerZugriffAllowed()
- Specified by:
isBenutzerZugriffAllowed
in interfaceIFormRequestContext
- Returns:
true
to indicate that the currentBenutzer
is allowed access to the request form, orfalse
otherwise.
-
setBenutzerZugriffAllowed
public void setBenutzerZugriffAllowed(boolean isBenutzerZugriffAllowed)
- Specified by:
setBenutzerZugriffAllowed
in interfaceIFormRequestContext
- Parameters:
isBenutzerZugriffAllowed
-true
to indicate that the currentBenutzer
is allowed access to the request form, orfalse
otherwise.
-
isFrontendServerAllowed
public boolean isFrontendServerAllowed()
- Specified by:
isFrontendServerAllowed
in interfaceIFormRequestContext
- Returns:
true
if the requested form may be served by theIFormRequestContext.getFrontendServer()
, orfalse
otherwise.
-
setFrontenServerAllowed
public void setFrontenServerAllowed(boolean isFrontendServerAllowed)
- Specified by:
setFrontenServerAllowed
in interfaceIFormRequestContext
- Parameters:
isFrontendServerAllowed
-true
if the requested form may be served by theIFormRequestContext.getFrontendServer()
, orfalse
otherwise.
-
getUserInboxes
public List<Postfach> getUserInboxes()
- Specified by:
getUserInboxes
in interfaceIFormRequestContext
- Returns:
- A
List
ofPostfach
s which the currentBenutzer
can access.
-
setUserInboxes
public void setUserInboxes(List<Postfach> userInboxes)
- Specified by:
setUserInboxes
in interfaceIFormRequestContext
- Parameters:
userInboxes
- AList
ofPostfach
s which the currentBenutzer
can access.
-
getUserGroups
public List<BenutzerGruppe> getUserGroups()
- Specified by:
getUserGroups
in interfaceIFormRequestContext
- Returns:
- A
List
ofBenutzerGruppe
s to which the currentBenutzer
belongs to.
-
setUserGroups
public void setUserGroups(List<BenutzerGruppe> userGroups)
- Specified by:
setUserGroups
in interfaceIFormRequestContext
- Parameters:
userGroups
- AList
ofBenutzerGruppe
s to which the currentBenutzer
belongs to.
-
createUserDataJSON
public com.alibaba.fastjson.JSONObject createUserDataJSON()
- Specified by:
createUserDataJSON
in interfaceIFormRequestContext
-
initFormData
public void initFormData(ParameterWrapper rp)
- Specified by:
initFormData
in interfaceIFormRequestContext
-
isAnonymize
public boolean isAnonymize()
- Specified by:
isAnonymize
in interfaceIFormRequestContext
- Returns:
true
to indicate the form submission should be made anonymously, orfalse
otherwise. When the form is anonymized, no meta data is saved regarding the user who submitted the form.
-
isCheckForm
public boolean isCheckForm()
- Specified by:
isCheckForm
in interfaceIFormRequestContext
- Returns:
true
to indicate the form should be validated on the server, orfalse
otherwise.
-
isContinueProcessing
public boolean isContinueProcessing()
- Specified by:
isContinueProcessing
in interfaceIFormRequestContext
- Returns:
true
if this form request should be processed further, orfalse
to indicate that processing should be aborted.
-
isOldVersion
public boolean isOldVersion()
- Specified by:
isOldVersion
in interfaceIFormRequestContext
- Returns:
true
if an old version was requested, orfalse
otherwise.
-
isResubmit
public boolean isResubmit()
- Specified by:
isResubmit
in interfaceIFormRequestContext
- Returns:
true
when the form was not submitted for the first time and aVorgang
exists already,false
otherwise.
-
isReview
public boolean isReview()
- Specified by:
isReview
in interfaceIFormRequestContext
- Returns:
true
if a review was requested (when opening a form in the inbox), orfalse
otherwise.
-
isSaveOnly
public boolean isSaveOnly()
- Specified by:
isSaveOnly
in interfaceIFormRequestContext
- Returns:
true
if a save button was used to submit the form. For the old workflow engine, this only saves the form data to the database and does not trigger the workflow. For the new workflow engine, the workflow is still processed, but thesaved flag
is set on the form record.
-
setSaveOnly
public void setSaveOnly(boolean saveOnly)
- Specified by:
setSaveOnly
in interfaceIFormRequestContext
- Parameters:
saveOnly
-true
if a save button was used to submit the form. For the old workflow engine, this only saves the form data to the database and does not trigger the workflow. For the new workflow engine, the workflow is still processed, but thesaved flag
is set on the form record.
-
isUseCurrentFv
public boolean isUseCurrentFv()
- Specified by:
isUseCurrentFv
in interfaceIFormRequestContext
- Returns:
true
if the latest version of the form is to be used,false
if a specific form version was requested.
-
isSkipSubmitButtonValidation
public boolean isSkipSubmitButtonValidation()
- Specified by:
isSkipSubmitButtonValidation
in interfaceIFormRequestContext
- Returns:
- When
true
, the xf-action is not checked for whether it represents a valid submit button.
-
setAnonymize
public void setAnonymize(boolean anonymize)
- Specified by:
setAnonymize
in interfaceIFormRequestContext
- Parameters:
anonymize
-true
to indicate the form submission should be made anonymously, orfalse
otherwise. When the form is anonymized, no meta data is saved regarding the user who submitted the form.
-
setCheckForm
public void setCheckForm(boolean checkForm)
- Specified by:
setCheckForm
in interfaceIFormRequestContext
- Parameters:
checkForm
- Whentrue
, the xf-action is not checked for whether it represents a valid submit button.
-
setContinueProcessing
public void setContinueProcessing(boolean isContinueProcessing)
- Specified by:
setContinueProcessing
in interfaceIFormRequestContext
- Parameters:
isContinueProcessing
-true
if this form request should be processed further, orfalse
to indicate that processing should be aborted.
-
getUser
public Benutzer getUser()
- Specified by:
getUser
in interfaceIFormRequestContext
- Returns:
- The user who is currently logged in and requested the form. In case the user is not logged in, this will be an anonymous user.
-
setUser
public void setUser(Benutzer user)
- Specified by:
setUser
in interfaceIFormRequestContext
- Parameters:
user
- The user who is currently logged in and requested the form. In case the user is not logged in, this will be an anonymous user.
-
setUserProfile
public void setUserProfile(org.pac4j.core.profile.CommonProfile userData)
- Specified by:
setUserProfile
in interfaceIFormRequestContext
-
getUserProfile
public org.pac4j.core.profile.CommonProfile getUserProfile()
- Specified by:
getUserProfile
in interfaceIFormRequestContext
-
setFormVersion
public void setFormVersion(FormVersion formVersion)
- Specified by:
setFormVersion
in interfaceIFormRequestContext
- Parameters:
formVersion
- The currentFormVersion
that was requested.
-
setWorkflowVersion
public void setWorkflowVersion(WorkflowVersion workflowVersion)
- Specified by:
setWorkflowVersion
in interfaceIFormRequestContext
- Parameters:
workflowVersion
- The currentWorkflowVersion
that was requested.
-
setFRQSession
public void setFRQSession(FRQSession frqSession)
- Specified by:
setFRQSession
in interfaceIFormRequestContext
- Parameters:
frqSession
- The current form request session. A form request session is opened each time a form is requested. A singleIFormRequestContext.getSession()
may contain multipleFRQSession
s.
-
setLocale
public void setLocale(Locale locale)
- Specified by:
setLocale
in interfaceIFormRequestContext
- Parameters:
locale
- The current locale that is to be used for locale-dependent operations.
-
setMandant
public void setMandant(Mandant mandant)
- Specified by:
setMandant
in interfaceIFormRequestContext
- Parameters:
mandant
- TheMandant
to which the current form belongs to.
-
setOldVersion
public void setOldVersion(boolean isOldVersion)
- Specified by:
setOldVersion
in interfaceIFormRequestContext
- Parameters:
isOldVersion
-true
if an old version was requested, orfalse
otherwise.
-
setProjekt
public void setProjekt(Projekt projekt)
- Specified by:
setProjekt
in interfaceIFormRequestContext
- Parameters:
projekt
- TheProjekt
which contains the form that was requested.
-
setRequestType
public void setRequestType(EFormRequestType requestType)
- Specified by:
setRequestType
in interfaceIFormRequestContext
- Parameters:
requestType
- The type of request that was made, eg. whether a new form was requested or a form was submitted.F
-
setResubmit
public void setResubmit(boolean isResubmit)
- Specified by:
setResubmit
in interfaceIFormRequestContext
- Parameters:
isResubmit
-true
when the form was not submitted for the first time and aVorgang
exists already,false
otherwise.
-
setReview
public void setReview(boolean isReview)
- Specified by:
setReview
in interfaceIFormRequestContext
- Parameters:
isReview
-true
if a review was requested (when opening a form in the inbox), orfalse
otherwise.
-
isPreview
public boolean isPreview()
- Specified by:
isPreview
in interfaceIFormRequestContext
- Returns:
true
if a preview was requested,false
otherwise.
-
setPreview
public void setPreview(boolean isPreview)
- Specified by:
setPreview
in interfaceIFormRequestContext
- Parameters:
isPreview
-true
if a preview was requested,false
otherwise.
-
setSessionID
public void setSessionID(String sessionID)
- Specified by:
setSessionID
in interfaceIFormRequestContext
- Parameters:
sessionID
- The currentHttpSession
ID.
-
setSkipSubmitButtonValidation
public void setSkipSubmitButtonValidation(boolean skipSubmitButtonValidation)
- Specified by:
setSkipSubmitButtonValidation
in interfaceIFormRequestContext
- Parameters:
skipSubmitButtonValidation
- Whentrue
, the xf-action is not checked for whether it represents a valid submit button.
-
setUseCurrentFv
public void setUseCurrentFv(boolean isUseCurrentFv)
- Specified by:
setUseCurrentFv
in interfaceIFormRequestContext
- Parameters:
isUseCurrentFv
-true
if the latest version of the form is to be used,false
if a specific form version was requested.
-
getValueParameters
public ValueParameters getValueParameters()
- Specified by:
getValueParameters
in interfaceIFormRequestContext
- Returns:
- All values that were submitted with this form request, ie. the values of the individual form elements. This
excludes uploaded files, see
IFormRequestContext.getUploadParameters()
.
-
setVorgang
public void setVorgang(Vorgang vorgang)
- Specified by:
setVorgang
in interfaceIFormRequestContext
- Parameters:
vorgang
- The currentVorgang
when the form was submitted; ornull
when a new empty form was just requested.
-
setSession
public void setSession(XfcSession xfcSession)
- Specified by:
setSession
in interfaceIFormRequestContext
- Parameters:
xfcSession
- The current FORMCYCLE session that contains additional information not contained in theHttpSession
.
-
getUploadParameters
public UploadParameters getUploadParameters()
- Specified by:
getUploadParameters
in interfaceIFormRequestContext
- Returns:
- All files that were uploaded with this form request, usually via upload form elements.
-
isPreviewWithoutSave
public boolean isPreviewWithoutSave()
- Specified by:
isPreviewWithoutSave
in interfaceIFormRequestContext
- Returns:
true
if the workflow should be processed, but the form data should not be saved. Used e.g. for generating a PDF preview.
-
setPreviewWithoutSave
public void setPreviewWithoutSave(boolean previewWithoutSave)
- Specified by:
setPreviewWithoutSave
in interfaceIFormRequestContext
- Parameters:
previewWithoutSave
-true
if the workflow should be processed, but the form data should not be saved. Used e.g. for generating a PDF preview.
-
getSessionAttributeMap
public Map<String,Serializable> getSessionAttributeMap()
- Specified by:
getSessionAttributeMap
in interfaceIFormRequestContext
- Returns:
- A
Map
of all key-value pairs in the currentHttpSession
. Please note that changes to this map will not affect theHttpSession
.
-
setSessionAttributeMap
public void setSessionAttributeMap(Map<String,Serializable> sessionAttributes)
- Specified by:
setSessionAttributeMap
in interfaceIFormRequestContext
- Parameters:
sessionAttributes
- AMap
of all key-value pairs in the currentHttpSession
. Please note that changes to this map will not affect theHttpSession
.
-
getSessionTimeout
public Duration getSessionTimeout()
- Specified by:
getSessionTimeout
in interfaceIFormRequestContext
- Returns:
- The time it takes for an HTTP session on the server to timeout. This relates to the server which provided the form, the timeout may be different depending on the server.
-
setSessionTimeout
public void setSessionTimeout(Duration sessionTimeout)
- Specified by:
setSessionTimeout
in interfaceIFormRequestContext
- Parameters:
sessionTimeout
- The time it takes for an HTTP session on the server to timeout. This relates to the server which provided the form, the timeout may be different depending on the server.
-
loadUserData
public void loadUserData(FormUserRequestData userData)
- Specified by:
loadUserData
in interfaceIFormRequestContext
-
getDoubleOptInData
public ProjectDOIData getDoubleOptInData()
- Specified by:
getDoubleOptInData
in interfaceIFormRequestContext
- Returns:
- The double opt-in settings for the current form.
-
setDoubleOptInData
public void setDoubleOptInData(ProjectDOIData doubleOptInData)
- Specified by:
setDoubleOptInData
in interfaceIFormRequestContext
- Parameters:
doubleOptInData
- The double opt-in settings for the current form.
-
getIdentityCheckData
public ProjectIdentityCheckData getIdentityCheckData()
- Specified by:
getIdentityCheckData
in interfaceIFormRequestContext
- Returns:
- The identity check settings for the current form.
-
setIdentityCheckData
public void setIdentityCheckData(ProjectIdentityCheckData identityCheckData)
- Specified by:
setIdentityCheckData
in interfaceIFormRequestContext
- Parameters:
identityCheckData
- The identity check settings for the current form.
-
setParameterWrapper
@Deprecated public void setParameterWrapper(ParameterWrapper parameterWrapper)
Deprecated.- Specified by:
setParameterWrapper
in interfaceIFormRequestContext
-
getSessionAttributes
@Deprecated public SessionAttributes getSessionAttributes()
Deprecated.- Specified by:
getSessionAttributes
in interfaceIFormRequestContext
-
setSessionAttributes
@Deprecated public void setSessionAttributes(SessionAttributes sessionAttributes)
Deprecated.- Specified by:
setSessionAttributes
in interfaceIFormRequestContext
-
-