Class FilteredFormProcessor<ItemType,PersistType>
java.lang.Object
org.alfresco.repo.forms.processor.AbstractFormProcessor
org.alfresco.repo.forms.processor.FilteredFormProcessor<ItemType,PersistType>
- All Implemented Interfaces:
FormProcessor
- Direct Known Subclasses:
ActionFormProcessor,ContentModelFormProcessor
Abstract base class for all FormProcessor implementations that wish to use the filter mechanism.
- Author:
- Gavin Cornwell, Nick Smith
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FieldProcessorRegistryprotected FilterRegistry<ItemType,PersistType> Fields inherited from class org.alfresco.repo.forms.processor.AbstractFormProcessor
active, DESTINATION, matchPattern, patternMatcher, processorRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a Form representation for an itemgenerateDefaultFields(FormCreationData data, List<String> fieldsToIgnore) Generates a list of default fields to add if no field names are specified.generateSelectedFields(List<String> fields, FormCreationData data) protected abstract StringgetItemType(ItemType item) Returns aStringdescribing the type fo the specified item.protected abstract StringgetItemURI(ItemType item) Returns the URI location of the specified item.protected abstract org.apache.commons.logging.LogRetrieves a logger instance to log to.protected abstract ItemTypegetTypedItem(Item item) Returns a typed Object representing the given item.protected voidinternalGenerate(ItemType item, List<String> fields, List<String> forcedFields, Form form, Map<String, Object> context) Generates the form.protected abstract PersistTypeinternalPersist(ItemType item, FormData data) Persists the form data.protected abstract ObjectmakeItemData(ItemType item) Persists the given form data for the given item, completed by calling each applicable registered handlerprotected voidpopulateForm(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.voidsetFieldProcessorRegistry(FieldProcessorRegistry fieldProcessorRegistry) Sets the field processor registry.voidsetFilterRegistry(FilterRegistry<ItemType, PersistType> filterRegistry) Sets the filter registryvoidsetIgnoredFields(List<String> ignoredFields) Methods inherited from class org.alfresco.repo.forms.processor.AbstractFormProcessor
isActive, isApplicable, register, setActive, setFormItemType, setFormItemUrl, setMatchPattern, setProcessorRegistry, toString
-
Field Details
-
filterRegistry
-
fieldProcessorRegistry
-
-
Constructor Details
-
FilteredFormProcessor
public FilteredFormProcessor()
-
-
Method Details
-
setFilterRegistry
Sets the filter registry- Parameters:
filterRegistry- The FilterRegistry instance
-
setIgnoredFields
- Parameters:
ignoredFields- the ignoredFields to set
-
generate
public Form generate(Item item, List<String> fields, List<String> forcedFields, Map<String, Object> context) Returns a Form representation for an item- Parameters:
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 form- Returns:
- The Form representation
-
persist
Persists the given form data for the given item, completed by calling each applicable registered handler- Parameters:
item- The item to save the form fordata- The object representing the form data- Returns:
- The object persisted
- See Also:
-
internalGenerate
protected void internalGenerate(ItemType item, List<String> fields, List<String> forcedFields, Form form, Map<String, Object> context) Generates the form.- Parameters:
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 form
-
populateForm
This method generates all the fields to be added and adds them to the Form, together with the associated field data.- Parameters:
form- TheFormto which the fields are added.fields- The names of all the fields to be added.data-FormCreationDataused to generate all the fields.
-
generateDefaultFields
Generates a list of default fields to add if no field names are specified. -
generateSelectedFields
-
setFieldProcessorRegistry
Sets the field processor registry.- Parameters:
fieldProcessorRegistry- TheFieldProcessorRegistryto use.
-
makeItemData
- Returns:
- Object
-
getTypedItem
Returns a typed Object representing the given 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.
- Parameters:
item- The item to get a typed object for- Returns:
- The typed object
-
getLogger
protected abstract org.apache.commons.logging.Log getLogger()Retrieves a logger instance to log to.- Returns:
- Log instance to log to.
-
getItemType
Returns aStringdescribing the type fo the specified item.- Parameters:
item- ItemType- Returns:
- String
-
getItemURI
Returns the URI location of the specified item.- Parameters:
item- ItemType- Returns:
- String
-
internalPersist
Persists the form data.- Parameters:
item- The object to persist the form fordata- The data to persist- Returns:
- The object that got created or modified
-
getDefaultIgnoredFields
When aFormis generated with no field names specifically set then a defaultFormis created. The defaultFormcontains all the properties and associations related to theItem, 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 propertyignoredFields.- Returns:
- the names of all the fields to be excluded from the default
Formif nodefaultFieldsproperty is explicitly set.
-