R
- type of ResponseManager.Response
F
- type of DynamicFormManager.DynamicForm
public abstract class ResponseManager<R extends ResponseManager.Response<F>,F extends DynamicFormManager.DynamicForm> extends DataObjectFactory<R> implements ServeDataProducer
DynamicFormManager.DynamicForm
s.
This class is abstract because much of the behaviour (specifically how responses are created and the rules for who can
edit a response) are very specific to the surrounding logic.
ResponseManagers implement ServeDataProducer
allowing any userModifier and Type | Class and Description |
---|---|
static class |
ResponseManager.Response<D extends DynamicFormManager.DynamicForm>
This represents a response to a
DynamicFormManager.DynamicForm
The logic for how a response is generated (and how the form we are responding to is selected)
is up to the sub-class. |
DataObjectFactory.AbstractDataObjectInput, DataObjectFactory.AbstractFinder<X>, DataObjectFactory.DataObjectAcceptFilter, DataObjectFactory.DataObjectInput, DataObjectFactory.DataObjectIntegerInput, DataObjectFactory.DestAcceptFilter<T extends DataObject>, DataObjectFactory.FilterAdapter, DataObjectFactory.FilterCounter, DataObjectFactory.FilterExists, DataObjectFactory.FilterIterator, DataObjectFactory.FilterSelector, DataObjectFactory.FilterSet, DataObjectFactory.Finder, DataObjectFactory.MakeRemoteFilterVisitor<R extends DataObject>, DataObjectFactory.MatchFilter, DataObjectFactory.ReferencedAdapter<I extends Indexed>, DataObjectFactory.ReferenceIterator<I extends Indexed>, DataObjectFactory.SortingDataObjectInput, DataObjectFactory.TimeAcceptFilter<T extends DataObject>, DataObjectFactory.TimeFilter
AUTO_CREATE_TABLES_FEATURE, COMPOSITES_SUFFIX, REJECT_MULTIPLE_RESULT_FEATURE, res
DEFAULT_SERVE_DATA_TAG
Constructor and Description |
---|
ResponseManager(DynamicFormManager<F> manager,
java.lang.String tag) |
Modifier and Type | Method and Description |
---|---|
<T> T |
getData(QuestionManager.Question q,
R response)
get the data from a Question from a response
|
MimeStreamData |
getData(SessionService user,
java.util.List<java.lang.String> path)
Get a MimeStreamData corresponding to the data to be served
This method also implements access control and returns null if access is denied.
|
protected ResponseDataManager<?,R,F> |
getDataManager(QuestionManager.Question q)
get the
ResponseDataManager that handles the data generated by
a question. |
protected TableSpecification |
getDefaultTableSpecification(AppContext c,
java.lang.String table)
Get the default table specification if the table is to be created.
|
java.lang.String |
getDownloadName(SessionService user,
java.util.List<java.lang.String> path)
get a download file-name to be added to a download link.
|
SQLFilter<R> |
getFormFilter(F form)
get a filter for all responses to a particular form.
|
DynamicFormManager<F> |
getManager()
Get the
DynamicFormManager corresponding to this response |
<T> ServeDataResult |
getServeResult(ResponseDataManager.ResponseData<T,R,F> wrapper)
get a
ServeDataResult (for a download link) from a ResponseDataManager.ResponseData |
<T> ResponseDataManager.ResponseData<T,R,F> |
getWrapper(QuestionManager.Question q,
R response)
get the
ResponseDataManager.ResponseData object. |
<T> void |
setData(QuestionManager.Question q,
R response,
T data)
set the data for a question and response
|
all, allowPreSelect, canCreate, canUpdate, checkComposite, convertToDestinationFilter, customiseForm, equals, exists, find, find, find, find, find, getAllIterator, getComposite, getComposites, getComposites, getConfigTag, getContext, getCount, getDefaultRelationshipFilter, getDefaults, getDestFilter, getExcludeFilter, getFieldConstraints, getFieldHelp, getFilter, getFilter, getFilter, getFinalSelectFilter, getFinalTableSpecification, getFindFilter, getFormCreator, getFormUpdate, getID, getIndex, getInput, getInput, getInput, getLogger, getMaxIdentifierLength, getNullable, getOptional, getOrder, getProperty, getReferenced, getReferenceFieldType, getReferenceFieldType, getRemoteFilter, getRemoteSQLFilter, getResult, getResult, getSelectFilter, getSelector, getSelector, getSelectors, getSupress, getTableSpecification, getTableStructureContributers, getTag, getTarget, getTranslations, getUniqueIdName, hasComposite, hashCode, isMine, isMine, isMyReference, isValid, makeBDO, makeBDO, makeObject, makeRecord, makeReference, makeReference, matches, narrowSelector, narrowSelector, observeComposite, OrderBy, postCreateTableSetup, postSetContext, release, restrictDefaultInput, setComposites, setContext, setContext, setContextWithMake, setProperty, toString, updateTable
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getContext
public ResponseManager(DynamicFormManager<F> manager, java.lang.String tag)
public DynamicFormManager<F> getManager()
DynamicFormManager
corresponding to this responsepublic <T> T getData(QuestionManager.Question q, R response) throws java.lang.Exception
q
- response
- java.lang.Exception
public <T> ResponseDataManager.ResponseData<T,R,F> getWrapper(QuestionManager.Question q, R response) throws java.lang.Exception, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, DataException
ResponseDataManager.ResponseData
object.q
- response
- ResponseDataManager.ResponseData
or null;java.lang.Exception
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
DataException
public <T> void setData(QuestionManager.Question q, R response, T data) throws java.lang.Exception
q
- response
- data
- java.lang.Exception
protected ResponseDataManager<?,R,F> getDataManager(QuestionManager.Question q) throws java.lang.Exception, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
ResponseDataManager
that handles the data generated by
a question. Questions with the same type of response data can share a ResponseDataManager
.q
- the QuestionManager.Question
java.lang.Exception
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
protected TableSpecification getDefaultTableSpecification(AppContext c, java.lang.String table)
DataObjectFactory
getDefaultTableSpecification
in class DataObjectFactory<R extends ResponseManager.Response<F>>
c
- AppContexttable
- String table name.public SQLFilter<R> getFormFilter(F form)
form
- public <T> ServeDataResult getServeResult(ResponseDataManager.ResponseData<T,R,F> wrapper) throws DataException
ServeDataResult
(for a download link) from a ResponseDataManager.ResponseData
wrapper
- DataException
public MimeStreamData getData(SessionService user, java.util.List<java.lang.String> path) throws java.lang.Exception
ServeDataProducer
SessionService
may not have a current person set so you have to check for
null SessionService
and null AppUser
as well as the users permissions.getData
in interface ServeDataProducer
java.lang.Exception
public java.lang.String getDownloadName(SessionService user, java.util.List<java.lang.String> path) throws java.lang.Exception
ServeDataProducer
MimeStreamData.getName()
if ServeDataProducer.getData(SessionService, List)
returns a non-null value.
However this method may be called by display content generation code so if the result is generated on the fly it might be possible to generate the download name in
a more lightweight fashion. It should also work to always return null thought he browser will use the last part of the selection path as the downloadgetDownloadName
in interface ServeDataProducer
java.lang.Exception