public abstract class FilteredFormProcessor<ItemType,PersistType> extends AbstractFormProcessor
Modifier and Type | Field and Description |
---|---|
protected FieldProcessorRegistry |
fieldProcessorRegistry |
protected FilterRegistry<ItemType,PersistType> |
filterRegistry |
active, DESTINATION, matchPattern, patternMatcher, processorRegistry
Constructor and Description |
---|
FilteredFormProcessor() |
Modifier and Type | Method and Description |
---|---|
Form |
generate(Item item,
List<String> fields,
List<String> forcedFields,
Map<String,Object> context)
Returns a Form representation for an item
|
protected List<Field> |
generateDefaultFields(FormCreationData data,
List<String> fieldsToIgnore)
Generates a list of default fields to add if no field names are specified.
|
protected List<Field> |
generateSelectedFields(List<String> fields,
FormCreationData data) |
protected abstract List<String> |
getDefaultIgnoredFields()
|
protected abstract String |
getItemType(ItemType item)
Returns a
String describing the type fo the specified item. |
protected abstract String |
getItemURI(ItemType item)
Returns the URI location of the specified item.
|
protected abstract org.apache.commons.logging.Log |
getLogger()
Retrieves a logger instance to log to.
|
protected abstract ItemType |
getTypedItem(Item item)
Returns a typed Object representing the given item.
|
protected void |
internalGenerate(ItemType item,
List<String> fields,
List<String> forcedFields,
Form form,
Map<String,Object> context)
Generates the form.
|
protected abstract PersistType |
internalPersist(ItemType item,
FormData data)
Persists the form data.
|
protected abstract Object |
makeItemData(ItemType item)
|
Object |
persist(Item item,
FormData data)
Persists the given form data for the given item, completed by calling
each applicable registered handler
|
protected void |
populateForm(Form form,
List<String> fields,
FormCreationData data)
This method generates all the fields to be added and adds them to the Form, together with the associated field data.
|
void |
setFieldProcessorRegistry(FieldProcessorRegistry fieldProcessorRegistry)
Sets the field processor registry.
|
void |
setFilterRegistry(FilterRegistry<ItemType,PersistType> filterRegistry)
Sets the filter registry
|
void |
setIgnoredFields(List<String> ignoredFields) |
isActive, isApplicable, register, setActive, setFormItemType, setFormItemUrl, setMatchPattern, setProcessorRegistry, toString
protected FilterRegistry<ItemType,PersistType> filterRegistry
protected FieldProcessorRegistry fieldProcessorRegistry
public void setFilterRegistry(FilterRegistry<ItemType,PersistType> filterRegistry)
filterRegistry
- The FilterRegistry instancepublic void setIgnoredFields(List<String> ignoredFields)
ignoredFields
- the ignoredFields to setpublic Form generate(Item item, List<String> fields, List<String> forcedFields, Map<String,Object> context)
item
- The item to generate a Form object forfields
- Restricted list of fields to include, null
indicates all possible fields for the item
should be includedforcedFields
- List of field names from 'fields' list
that should be forcibly included, it is
up to the form processor implementation
to determine how to enforce thiscontext
- Map representing optional context that
can be used during retrieval of the formpublic Object persist(Item item, FormData data)
item
- The item to save the form fordata
- The object representing the form dataFormProcessor.persist(org.alfresco.repo.forms.Item,
org.alfresco.repo.forms.FormData)
protected void internalGenerate(ItemType item, List<String> fields, List<String> forcedFields, Form form, Map<String,Object> context)
item
- The object to generate a form forfields
- Restricted list of fields to includeforcedFields
- List of fields to forcibly includeform
- The form object being generatedcontext
- Map representing optional context that can be used during
retrieval of the formprotected void populateForm(Form form, List<String> fields, FormCreationData data)
form
- The Form
to which the fields are added.fields
- The names of all the fields to be added.data
- FormCreationData
used to generate all the fields.protected List<Field> generateDefaultFields(FormCreationData data, List<String> fieldsToIgnore)
protected List<Field> generateSelectedFields(List<String> fields, FormCreationData data)
public void setFieldProcessorRegistry(FieldProcessorRegistry fieldProcessorRegistry)
fieldProcessorRegistry
- The FieldProcessorRegistry
to use.protected abstract ItemType getTypedItem(Item item)
Subclasses that represent a form type will return a typed object that is then passed to each of it's handlers, the handlers can therefore safely cast the Object to the type they expect.
item
- The item to get a typed object forprotected abstract org.apache.commons.logging.Log getLogger()
protected abstract String getItemType(ItemType item)
String
describing the type fo the specified item.item
- ItemTypeprotected abstract String getItemURI(ItemType item)
item
- ItemTypeprotected abstract PersistType internalPersist(ItemType item, FormData data)
item
- The object to persist the form fordata
- The data to persistprotected abstract List<String> getDefaultIgnoredFields()
Form
is generated with no field names specifically set then a default Form
is created.
The default Form
contains all the properties and associations related to the Item
, excluding a
blacklist of ignored fields which defaults to the return value of this method.
The default ignored values can be overridden by setting the property ignoredFields
.Form
if no defaultFields
property is explicitly set.Copyright © 2005–2017 Alfresco Software. All rights reserved.