|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.forms.processor.AbstractFormProcessor
org.alfresco.repo.forms.processor.FilteredFormProcessor
org.alfresco.repo.forms.processor.node.ContentModelFormProcessor
public abstract class ContentModelFormProcessor
Abstract FormProcessor implementation that provides common functionality for form processors that deal with Alfresco content models i.e. types and nodes.
Field Summary | |
---|---|
static java.lang.String |
ASSOC
|
static java.lang.String |
ASSOC_DATA_ADDED_SUFFIX
|
static java.lang.String |
ASSOC_DATA_PREFIX
|
static java.lang.String |
ASSOC_DATA_REMOVED_SUFFIX
|
protected java.util.regex.Pattern |
associationNamePattern
A regular expression which can be used to match association names. |
protected ContentService |
contentService
|
static java.lang.String |
DATA_KEY_SEPARATOR
|
protected static java.lang.String |
DEFAULT_CONTENT_MIMETYPE
Protected constants |
protected DictionaryService |
dictionaryService
|
protected FileFolderService |
fileFolderService
|
protected static java.lang.String |
MSG_ENCODING_DESC
|
protected static java.lang.String |
MSG_ENCODING_LABEL
|
protected static java.lang.String |
MSG_MIMETYPE_DESC
|
protected static java.lang.String |
MSG_MIMETYPE_LABEL
|
protected static java.lang.String |
MSG_SIZE_DESC
|
protected static java.lang.String |
MSG_SIZE_LABEL
|
protected NamespaceService |
namespaceService
|
protected NodeService |
nodeService
Services |
static java.lang.String |
ON
Public constants |
static java.lang.String |
PROP
|
static java.lang.String |
PROP_DATA_PREFIX
|
protected java.util.regex.Pattern |
propertyNamePattern
A regular expression which can be used to match property names. |
static java.lang.String |
TRANSIENT_ENCODING
|
static java.lang.String |
TRANSIENT_MIMETYPE
|
static java.lang.String |
TRANSIENT_SIZE
|
protected java.util.regex.Pattern |
transientPropertyPattern
A regular expression which can be used to match tranisent property names. |
Fields inherited from class org.alfresco.repo.forms.processor.FilteredFormProcessor |
---|
filterRegistry |
Fields inherited from class org.alfresco.repo.forms.processor.AbstractFormProcessor |
---|
active, matchPattern, patternMatcher, processorRegistry |
Constructor Summary | |
---|---|
ContentModelFormProcessor()
|
Method Summary | |
---|---|
protected java.lang.String |
determineDefaultMimetype(FormData data)
Looks through the form data for the 'mimetype' transient field and returns it's value if found, otherwise the default 'text/plain' is returned |
static void |
generateAssociationField(AssociationDefinition assocDef,
Form form,
java.util.List assocValues,
FieldGroup group,
NamespaceService namespaceService)
Sets up a field definition for the given association. |
static void |
generateAssociationField(AssociationDefinition assocDef,
Form form,
java.util.List assocValues,
NamespaceService namespaceService)
Sets up a field definition for the given association. |
static void |
generateAssociationField(AssociationDefinition assocDef,
Form form,
NamespaceService namespaceService)
Sets up a field definition for the given association. |
protected void |
generateEncodingPropertyField(ContentData content,
Form form)
Generates the field definition for the transient encoding property |
protected void |
generateForcedField(java.lang.String fieldName,
Form form)
Generates a field definition for the given field that is being forced to show. |
protected void |
generateMimetypePropertyField(ContentData content,
Form form)
Generates the field definition for the transient mimetype property |
static void |
generatePropertyField(PropertyDefinition propDef,
Form form,
NamespaceService namespaceService)
Sets up a field definition for the given property. |
static void |
generatePropertyField(PropertyDefinition propDef,
Form form,
java.io.Serializable propValue,
FieldGroup group,
NamespaceService namespaceService)
Sets up a field definition for the given property. |
static void |
generatePropertyField(PropertyDefinition propDef,
Form form,
java.io.Serializable propValue,
NamespaceService namespaceService)
Sets up a field definition for the given property. |
protected void |
generateSelectedFields(NodeRef nodeRef,
TypeDefinition typeDef,
java.util.List fields,
java.util.List forcedFields,
Form form)
Sets up the field definitions for all the requested fields. |
protected void |
generateSizePropertyField(ContentData content,
Form form)
Generates the field definition for the transient size property |
protected abstract org.apache.commons.logging.Log |
getLogger()
Retrieves a logger instance to log to. |
protected void |
persistNode(NodeRef nodeRef,
FormData data)
Persists the given FormData on the given NodeRef |
protected void |
processAssociationPersist(NodeRef nodeRef,
java.util.Map assocDefs,
java.util.Map childAssocDefs,
FormData.FieldData fieldData,
java.util.List assocCommands)
Processes the given field data for persistence as an association. |
protected void |
processContentPropertyPersist(NodeRef nodeRef,
FormData.FieldData fieldData,
java.util.Map propsToPersist,
FormData data)
Persists the given field data as the content |
protected void |
processEncodingPropertyPersist(NodeRef nodeRef,
FormData.FieldData fieldData,
java.util.Map propsToPersist)
Persists the given field data as the encoding property |
protected void |
processMimetypePropertyPersist(NodeRef nodeRef,
FormData.FieldData fieldData,
java.util.Map propsToPersist)
Persists the given field data as the mimetype property |
protected void |
processNamePropertyPersist(NodeRef nodeRef,
FormData.FieldData fieldData)
Persists the given field data as the name property |
protected void |
processPropertyPersist(NodeRef nodeRef,
java.util.Map propDefs,
FormData.FieldData fieldData,
java.util.Map propsToPersist,
FormData data)
Processes the given field data for persistence as a property. |
protected void |
processWorkingCopy(NodeRef nodeRef,
Form form)
Determines whether the given node represents a working copy, if it does the name field is searched for and set to protected as the name field should not be edited for a working copy. |
protected java.util.List |
retrieveAssociationValues(NodeRef nodeRef,
AssociationDefinition assocDef)
Retrieves the values of the given association definition on the given node. |
void |
setContentService(ContentService contentService)
Sets the content service |
void |
setDictionaryService(DictionaryService dictionaryService)
Sets the data dictionary service |
void |
setFileFolderService(FileFolderService fileFolderService)
Sets the file folder service |
void |
setNamespaceService(NamespaceService namespaceService)
Sets the namespace service |
void |
setNodeService(NodeService nodeService)
Sets the node service |
Methods inherited from class org.alfresco.repo.forms.processor.FilteredFormProcessor |
---|
generate, getTypedItem, internalGenerate, internalPersist, persist, setFilterRegistry |
Methods inherited from class org.alfresco.repo.forms.processor.AbstractFormProcessor |
---|
isActive, isApplicable, register, setActive, setFormItemType, setFormItemUrl, setMatchPattern, setProcessorRegistry, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ON
public static final java.lang.String PROP
public static final java.lang.String ASSOC
public static final java.lang.String DATA_KEY_SEPARATOR
public static final java.lang.String PROP_DATA_PREFIX
public static final java.lang.String ASSOC_DATA_PREFIX
public static final java.lang.String ASSOC_DATA_ADDED_SUFFIX
public static final java.lang.String ASSOC_DATA_REMOVED_SUFFIX
public static final java.lang.String TRANSIENT_MIMETYPE
public static final java.lang.String TRANSIENT_SIZE
public static final java.lang.String TRANSIENT_ENCODING
protected static final java.lang.String DEFAULT_CONTENT_MIMETYPE
protected static final java.lang.String MSG_MIMETYPE_LABEL
protected static final java.lang.String MSG_MIMETYPE_DESC
protected static final java.lang.String MSG_ENCODING_LABEL
protected static final java.lang.String MSG_ENCODING_DESC
protected static final java.lang.String MSG_SIZE_LABEL
protected static final java.lang.String MSG_SIZE_DESC
protected NodeService nodeService
protected FileFolderService fileFolderService
protected DictionaryService dictionaryService
protected NamespaceService namespaceService
protected ContentService contentService
protected java.util.regex.Pattern propertyNamePattern
"prop_cm_name"
. The pattern can also be
used to extract the "cm" and the "name" parts.
protected java.util.regex.Pattern transientPropertyPattern
"prop_name"
. The pattern can also
be used to extract the "name" part.
protected java.util.regex.Pattern associationNamePattern
"assoc_cm_references_added"
. The
pattern can also be used to extract the "cm", the "name" and the suffix
parts.
Constructor Detail |
---|
public ContentModelFormProcessor()
Method Detail |
---|
public void setNodeService(NodeService nodeService)
nodeService
- The NodeService instancepublic void setFileFolderService(FileFolderService fileFolderService)
fileFolderService
- The FileFolderService instancepublic void setDictionaryService(DictionaryService dictionaryService)
dictionaryService
- The DictionaryService instancepublic void setNamespaceService(NamespaceService namespaceService)
namespaceService
- The NamespaceService instancepublic void setContentService(ContentService contentService)
contentService
- The ContentService instancepublic static void generatePropertyField(PropertyDefinition propDef, Form form, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional property fields is likely to be a common extension.
propDef
- The PropertyDefinition of the field to generateform
- The Form instance to populatenamespaceService
- NamespaceService instancepublic static void generatePropertyField(PropertyDefinition propDef, Form form, java.io.Serializable propValue, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional property fields is likely to be a common extension.
propDef
- The PropertyDefinition of the field to generateform
- The Form instance to populatepropValue
- The value of the property fieldnamespaceService
- NamespaceService instancepublic static void generatePropertyField(PropertyDefinition propDef, Form form, java.io.Serializable propValue, FieldGroup group, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional property fields is likely to be a common extension.
propDef
- The PropertyDefinition of the field to generateform
- The Form instance to populatepropValue
- The value of the property fieldgroup
- The FieldGroup the property field belongs to, can be nullnamespaceService
- NamespaceService instancepublic static void generateAssociationField(AssociationDefinition assocDef, Form form, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional association fields is likely to be a common extension.
assocDef
- The AssociationDefinition of the field to generateform
- The Form instance to populatenamespaceService
- NamespaceService instancepublic static void generateAssociationField(AssociationDefinition assocDef, Form form, java.util.List assocValues, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional association fields is likely to be a common extension.
assocDef
- The AssociationDefinition of the field to generateform
- The Form instance to populateassocValues
- The values of the association field, can be nullnamespaceService
- NamespaceService instancepublic static void generateAssociationField(AssociationDefinition assocDef, Form form, java.util.List assocValues, FieldGroup group, NamespaceService namespaceService)
NOTE: This method is static so that it can serve as a helper method for FormFilter implementations as adding additional association fields is likely to be a common extension.
assocDef
- The AssociationDefinition of the field to generateform
- The Form instance to populateassocValues
- The values of the association field, can be nullgroup
- The FieldGroup the association field belongs to, can be nullnamespaceService
- NamespaceService instanceprotected abstract org.apache.commons.logging.Log getLogger()
protected void generateSelectedFields(NodeRef nodeRef, TypeDefinition typeDef, java.util.List fields, java.util.List forcedFields, Form form)
A NodeRef or TypeDefinition can be provided, however, if a NodeRef is provided all type information will be derived from the NodeRef and the TypeDefinition will be ignored.
If any of the requested fields are not present on the type and they appear in the forcedFields list an attempt to find a model definition for those fields is made so they can be included.
nodeRef
- The NodeRef of the item being generatedtypeDef
- The TypeDefiniton of the item being generatedfields
- Restricted list of fields to includeforcedFields
- List of field names that should be included even if
the field is not currently presentform
- The Form instance to populateprotected void generateForcedField(java.lang.String fieldName, Form form)
fieldName
- Name of the field to forceform
- The Form instance to populatedprotected void generateMimetypePropertyField(ContentData content, Form form)
content
- The ContentData object to generate the field fromform
- The Form instance to populateprotected void generateEncodingPropertyField(ContentData content, Form form)
content
- The ContentData object to generate the field fromform
- The Form instance to populateprotected void generateSizePropertyField(ContentData content, Form form)
content
- The ContentData object to generate the field fromform
- The Form instance to populateprotected void processWorkingCopy(NodeRef nodeRef, Form form)
nodeRef
- NodeRef of node to check and potentially processform
- The generated formprotected java.util.List retrieveAssociationValues(NodeRef nodeRef, AssociationDefinition assocDef)
nodeRef
- The node to get the association values forassocDef
- The association definition to look for values for
protected void persistNode(NodeRef nodeRef, FormData data)
nodeRef
- The NodeRef to persist the form data ondata
- The FormData to persistprotected void processPropertyPersist(NodeRef nodeRef, java.util.Map propDefs, FormData.FieldData fieldData, java.util.Map propsToPersist, FormData data)
nodeRef
- The NodeRef to persist the properties onpropDefs
- Map of PropertyDefinition's for the node being persistedfieldData
- Data to persist for the propertypropsToPersist
- Map of properties to be persisteddata
- The FormData to persistprotected void processAssociationPersist(NodeRef nodeRef, java.util.Map assocDefs, java.util.Map childAssocDefs, FormData.FieldData fieldData, java.util.List assocCommands)
nodeRef
- The NodeRef to persist the associations onfieldData
- Data to persist for the associationsassocCommands
- List of associations to be persistedprotected void processNamePropertyPersist(NodeRef nodeRef, FormData.FieldData fieldData)
nodeRef
- The NodeRef to update the name forfieldData
- The data representing the new name valueprotected void processMimetypePropertyPersist(NodeRef nodeRef, FormData.FieldData fieldData, java.util.Map propsToPersist)
nodeRef
- The NodeRef to update the mimetype forfieldData
- The data representing the new mimetype valuepropsToPersist
- Map of properties to be persistedprotected void processEncodingPropertyPersist(NodeRef nodeRef, FormData.FieldData fieldData, java.util.Map propsToPersist)
nodeRef
- The NodeRef to update the encoding forfieldData
- The data representing the new encoding valuepropsToPersist
- Map of properties to be persistedprotected void processContentPropertyPersist(NodeRef nodeRef, FormData.FieldData fieldData, java.util.Map propsToPersist, FormData data)
nodeRef
- The NodeRef to update the content forfieldData
- The data representing the new contentpropsToPersist
- Map of properties to be persisteddata
- The form data being persistedprotected java.lang.String determineDefaultMimetype(FormData data)
data
- Form data being persisted
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |