Package com.avoka.fc.core.service.form
Class RandomFormVersionSelectorService
- java.lang.Object
-
- com.avoka.fc.core.service.form.RandomFormVersionSelectorService
-
- All Implemented Interfaces:
IFormVersionSelectorService
,IServiceDefinitionAware
public class RandomFormVersionSelectorService extends Object implements IFormVersionSelectorService
Provides a service that returns a random form version unless the request parameterParams.REQUEST_FORM_VERSION
is set and specifies a valid version number.- Since:
- 4.1.0
-
-
Constructor Summary
Constructors Constructor Description RandomFormVersionSelectorService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateVersion
getFormVersionToRender(Form form, HttpServletRequest request)
Select the form version that shall be used to fulfill a form render request.String
getIncludedFormVersions()
Return the set of form version numbers eligible for selection.ServiceDefinition
getServiceDefinition()
Return the service definition on which this service is based.boolean
isIgnoreFormVersionRequestParameter()
Return whether the service will ignore the request parameterParams.REQUEST_FORM_VERSION
.void
setIgnoreFormVersionRequestParameter(boolean ignoreFormVersionRequestParameter)
Determine whether the service will ignore the request parameterParams.REQUEST_FORM_VERSION
void
setIncludedFormVersions(String includedFormVersions)
Set the set of form version numbers eligible for selection.void
setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition on which this service is based.
-
-
-
Method Detail
-
getFormVersionToRender
public TemplateVersion getFormVersionToRender(Form form, HttpServletRequest request)
Select the form version that shall be used to fulfill a form render request. This service selects a random version.- Specified by:
getFormVersionToRender
in interfaceIFormVersionSelectorService
- Parameters:
form
- the form (required)request
- the HTTP servlet request (required)- Returns:
- the template version that shall be used when rendering the form
- See Also:
IFormVersionSelectorService.getFormVersionToRender(Form, HttpServletRequest)
-
isIgnoreFormVersionRequestParameter
public boolean isIgnoreFormVersionRequestParameter()
Return whether the service will ignore the request parameterParams.REQUEST_FORM_VERSION
. If set, the service will always return the current form version.- Returns:
- true if the service will ignore the request parameter
Params.REQUEST_FORM_VERSION
-
setIgnoreFormVersionRequestParameter
public void setIgnoreFormVersionRequestParameter(boolean ignoreFormVersionRequestParameter)
Determine whether the service will ignore the request parameterParams.REQUEST_FORM_VERSION
- Parameters:
ignoreFormVersionRequestParameter
- whether to ignore the service parameter request parameterParams.REQUEST_FORM_VERSION
-
getIncludedFormVersions
public String getIncludedFormVersions()
Return the set of form version numbers eligible for selection.- Returns:
- a comma-separated list of version numbers
-
setIncludedFormVersions
public void setIncludedFormVersions(String includedFormVersions)
Set the set of form version numbers eligible for selection.- Parameters:
includedFormVersions
- a comma-separated list of version numbers
-
getServiceDefinition
public ServiceDefinition getServiceDefinition()
Return the service definition on which this service is based.- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Returns:
- the service definition
-
setServiceDefinition
public void setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition on which this service is based.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Parameters:
serviceDefinition
- the service definition
-
-