Package org.ametys.cms.workflow
Class EditContentFunction
- java.lang.Object
-
- org.ametys.plugins.workflow.AbstractWorkflowComponent
-
- org.ametys.cms.workflow.AbstractContentWorkflowComponent
-
- org.ametys.cms.workflow.EditContentFunction
-
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider
,Initializable
,LogEnabled
,Serviceable
public class EditContentFunction extends AbstractContentWorkflowComponent implements com.opensymphony.workflow.FunctionProvider, Initializable
OSWorkflow function to edit a content. The required transient variables: - AbstractContentWorkflowComponent.RESULT_MAP_KEY - Map<String, Object> The map containing the results of the function. - AbstractContentWorkflowComponent.RESULT_MAP_KEY.result - String "true" when everything goes fine. Missing in other case. - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath> - Errors Each error during edition will be set here. Key will be the metadata path (with '.' separator). Value will be the error message. - AbstractContentWorkflowComponent.CONTENT_KEY - WorkflowAwareContent The content that will be edited. Should have the lock token. - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY - Map<String, Object> Contains the following parameters: - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY.QUIT - boolean True to specify edition mode will be quit, this imply to unlock the content. - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY.METADATA_SET_PARAM The name of the edition metadata set to use and to check metadata. If missing a metadataset will be created. - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY.FORM_RAW_VALUES - Map<String, Object> The values of the submitted form : - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY.FORM_RAW_VALUES.<MetadataPath> Object Key is the path of the metadata ('.' separated) prefixed by FORM_ELEMENTS_PREFIX. Value is a depending on the type of metadata. Sometimes types require additional information. In that case : Key is a metadata path ('.' separated) prefixed by INTERNAL_FORM_ELEMENTS_PREFIX and suffixed by '.' + an additional information name. - AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY.FORM_RAW_COMMENTS - Map<String, List<Map<String, String>>> The comments of the metadata of the submitted form : - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath> - List<Map<String, String>> Key is the path of the metadata ('.' separated) prefixed by FORM_ELEMENTS_PREFIX. Value is the list of comments. - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath>.<X> - <Map<String, String> A comment with the following parameters - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath>.<X>.author String The login of the author of the comment - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath>.<X>.text String The text of the comment - AbstractContentWorkflowComponent.RESULT_MAP_KEY.<MetadataPath>.<X>.date String The date of the comment using the ISODateTimeFormat (See DateUtils.parse) Where <MetadataPath> is the path of a metadata (using a '.' separator). In some cases it is prefixed by FORM_ELEMENTS_PREFIX. A metadata path with in a repeater include the number of the repeated instance (1 based). Where <X> Is an element of the parent list. Here is the list of required information and values depending on the type of the metadata: - MetadataType.STRING When simple, the value is a String containing the value. Ex: "content.input.abstract": "Sample of abstract" When multiple, the value is a String[] containing the values. Ex: "content.input.abstract": ["value 1", "value 2"]. An additional information can be provided: "mode" that can be "replace" (default value) or "insert". When "replace", the given String[] will replace the existing value. When "insert"; the given String[] will be appended. Ex: "_content.input.abstract.mode": "insert". - MetadataType.DATE Same as MetadataType.STRING where values are String encoded at ISODateTimeFormat (See DateUtils.parse). Ex: "content.input.date": "2014-03-12T00:00:00.000+01:00". - MetadataType.DATETIME See MetadataType.DATE. - MetadataType.LONG Same as MetadataType.STRING where values are String that can be parsed as Long. - MetadataType.DOUBLE Same as MetadataType.STRING where values are String that can be parsed as Double. - MetadataType.BOOLEAN Same as MetadataType.STRING where values are String that can be parsed as Boolean. - MetadataType.GEOCODE A single String that is are a map encoded with 2 keys 'latitude' and 'longitude' and double values. Ex: "content.input.address.gps": "{\"latitude\":1.574576,\"longitude\":103.79255799999999}" - MetadataType.COMPOSITE A composite metadata does not have values itself. The values are sub metadata. A repeater (sort of multiple composite) does not have value either, but do have additional information: "size" in a String representing a Long with the number of elements submitted. Ex: "_content.input.attachments.size": "2". This information is crucial since this function only handle repeated values going from 1 to size. Ex: "content.input.attachments.1.*" and "content.input.attachments.2.*". "mode" as for MetadataType.STRING, mode can be "replace" (default value) to remove all current entries before adding new one, or "insert" to add only the new values (see "position" under to see where to insert). Each instance in the repeater does also have additional information. "previous-position" As explained above, a metadatapath inside a repeater include the current position of the element. This value is a String encoding a Long with the position of the repeater instance BEFORE this edition: this allow to move the repeater instance, instead of removing it and add it again (specially with FILE or BINARY metadata). Ex: "_content.input.attachments.1.previous-position": "1". Will be "-1" when it is a new instance. "position" In "insert" mode, we do not want to use the value set in the metadata path as a "current position". The position given by path is wrong as it always start at 1 and finish at size. Values >= 1 are positions. Ex: "_content.input.attachments.1.position": "20", means that all values "content.input.attachments.1.*" will be added to an instance at the position "20" (and not "1" as it will be in "replace" mode). Values < 1 are positions indexed by the end. 0 means to add it to the end. -1 to add it just before the last one. In "insert" mode, elements are insersected at the given positions and do not replace those elements. Inserting 5 elements at "position" "1", will insert 5 elements at position 1, 2, 3, 4 and 5. - MetadataType.BINARY TODO - MetadataType.RICH_TEXT TODO - MetadataType.USER A single String that is a map encoded with 2 keys 'login' and 'populationId' and string values. Ex: "content.input.user": "{\"login\":"alogin",\"populationId\":"apopulation"}" - MetadataType.REFERENCE When simple, a single String that is a map encoded with 2 keys 'value' and 'type', both are string. 'type' is the type of the reference (ex: external-url), and 'value' its value. When multiple, an Array of String. Where each string is formatted the same way as done in the simple case. - MetadataType.CONTENT TODO - MetadataType.SUB_CONTENT TODO - MetadataType.FILE TODO TODO talk about UNTOUCHED_BINARY UNTOUCHED_FILE METADATA_FILE EXPLORER_FILE
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint
_contentTypeExtensionPoint
Content type extension point.protected ContentTypesHelper
_contentTypesHelper
Helper for content typesprotected ExternalizableMetadataProviderExtensionPoint
_externalizableMetadataProviderEP
Provider for externalizable metadataprotected JSONUtils
_jsonUtils
The JSON conversion utilities.protected Set<String>
_lockAlreadyChecked
Set of already checked nodeprotected ObservationManager
_observationManager
Observation manager available to subclasses.protected OutgoingReferencesExtractor
_outgoingReferencesExtractor
The outgoing references extractorprotected AmetysObjectResolver
_resolver
The AmetysObject resolver.protected UploadManager
_uploadManager
Upload manager.protected UserHelper
_userHelper
The user helperprotected UserManager
_userManager
The user managerprotected ContentWorkflowHelper
_workflowHelper
The content workflow helper.protected WorkflowProvider
_workflowProvider
The workflow providerstatic String
EDIT_MUTUAL_RELATIONSHIP
Constant for storing the action id for editing revert relations.static String
EXPLORER_FILE
Constant for shared file metadata.static String
FALLBACK_METADATA_SET_PARAM
Prefix for the fallback metadata set name request parameter.static String
FORM_ELEMENTS_PREFIX
Prefix for HTML form elements.static String
FORM_RAW_COMMENTS
Request parameter key for the field comments.static String
FORM_RAW_VALUES
Request parameter key for the field values.static String
GLOBAL_ERROR_KEY
The key for global errorsstatic String
INTERNAL_FORM_ELEMENTS_PREFIX
Prefix for internal HTML form elements.static int
INVERT_EDIT_ACTION_ID
Default action id of editing revert relations.static String
INVERT_RELATION_EDIT_WORKFLOW_ACTION_ID
Constant for storing the action id for editing revert relations.static String
METADATA_FILE
Constant for local file metadata.static String
METADATA_SET_PARAM
Prefix for the metadata set name request parameter.static String
QUIT
Prefix for the quit edition mode request parameter.static String
UNTOUCHED_BINARY
Constant for untouched binary metadata.static String
UNTOUCHED_FILE
Constant for untouched file metadata.-
Fields inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
_contentHelper, CONTENT_KEY
-
Fields inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY
-
-
Constructor Summary
Constructors Constructor Description EditContentFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_addMetadataDefRef(AbstractMetadataSetElement metadataSetElement, String metadataName)
protected void
_bindAndValidateBinaryMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a binary metadata.protected void
_bindAndValidateBooleanMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a boolean metadata.protected void
_bindAndValidateCompositeMetadata(AllErrors allErrors, Form form, Content content, String metadataName, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, Set<String> externalAndLocalMetadata)
Bind and validate a composite metadata.protected void
_bindAndValidateContent(ModifiableContent content, AllErrors allErrors, MetadataSet metadataSet, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, UserIdentity user, int invertEditActionId, Set<String> externalAndLocalMetadata)
Bind and validate a form.protected void
_bindAndValidateContentReferenceMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a content reference metadata.protected void
_bindAndValidateDateMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a date metadata.protected void
_bindAndValidateDateTimeMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a date time metadata.protected void
_bindAndValidateDoubleMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a double metadata.protected void
_bindAndValidateFileMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a file metadata.protected void
_bindAndValidateGeocodeMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a geocode metadata.protected void
_bindAndValidateLongMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a long metadata.protected void
_bindAndValidateMetadata(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, MetadataDefinition metadataDefinition, String metadataPath, Set<String> externalAndLocalMetadata)
Bind and validate a form.protected void
_bindAndValidateMetadataSetElement(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, MetadataDefinition parentMetadataDefinition, String parentMetadataPath, Set<String> externalAndLocalMetadata)
Bind and validate a metadata set element.protected void
_bindAndValidateMultilingualStringMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a multilingual string metadata.protected void
_bindAndValidateReferenceMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a reference metadata.protected void
_bindAndValidateRepeater(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, RepeaterDefinition repeaterDefinition, String metadataPath, Set<String> externalAndLocalMetadata)
Bind and validate a repeater.protected void
_bindAndValidateRichText(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a rich text metadata.protected void
_bindAndValidateStringMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a string metadata.protected void
_bindAndValidateSubContentMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a content metadata.protected void
_bindAndValidateUserMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable)
Bind and validate a user metadata.protected BinaryField
_bindBinaryField(String[] values, String metadataParamsPrefix, Map<String,Object> rawValues)
Bind a binary field from form valuesprotected SimpleField<Boolean>
_bindBooleanField(String[] values, String metadataPath, AllErrors allErrors)
Bind a boolean field from form valuesprotected void
_bindComments(Map<String,List<Map<String,String>>> rawComments, Form form, MetadataDefinition metadataDefinition, String metadataPath)
Bind the comments of a field to the formprotected SimpleField<Content>
_bindContentField(String[] values, String cTypeId, Collection<String> validContentTypes, String metadataPath, AllErrors allErrors)
Bind a content field from form valuesprotected SimpleField<Date>
_bindDateField(String[] values, String metadataPath, AllErrors allErrors)
Bind a date field from form valuesprotected SimpleField<Date>
_bindDateTimeField(String[] values, String metadataPath, AllErrors allErrors)
Bind a date time field from form valuesprotected SimpleField<Double>
_bindDoubleField(String[] values, String metadataPath, AllErrors allErrors)
Bind a double field from form valuesprotected SimpleField<Double>
_bindGeoCodeField(String[] values)
Bind a geocode field from form valuesprotected SimpleField<Long>
_bindLongField(String[] values, String metadataPath, AllErrors allErrors)
Bind a long field from form valuesprotected SimpleField<MultilingualString>
_bindMultilingualField(String[] values)
Bind a multilingual field from form valuesprotected ReferenceField
_bindReferenceField(String[] values)
Bind a reference field from form valuesprotected RichTextField
_bindRichTextField(String[] values, String metadataParamsPrefix, Map<String,Object> rawValues)
Bind a richtext field from form valuesprotected SubContentField
_bindSubContentField(String[] values, MetadataDefinition metadataDef, String metadataPath, Map<String,Object> rawValues)
Bind a sub-content field from form valuesprotected SimpleField<UserIdentity>
_bindUserField(String[] values)
Bind a user field from form valuesprotected void
_checkLock(Node node)
Check the lock status of the nodeprotected void
_checkRepeaterSize(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, RepeaterDefinition repeaterDefinition, String metadataPath)
Check the repeater size will be correctprivate int
_computeRepeaterEntryPosition(ModifiableCompositeMetadata repeaterMetadata, RepeaterField.RepeaterEntry repeaterEntry)
protected void
_copyRichText(RichTextField field, ModifiableRichText richText, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors)
Set a rich text metadata from an existing rich text metadata.private MetadataSet
_createMetadataSet(Map<String,Object> rawValues)
protected void
_extractOutgoingReferences(ModifiableContent content)
Analyze the content to extract outgoing references and store themprotected List<Content>
_getContentValues(CompositeMetadata compositeMetadata, String metadataPath)
Get the content valuesprotected RepeaterField.RepeaterEntry
_getCurrentEntry(List<RepeaterField.RepeaterEntry> entries, String entryName)
Retrieves a repeater entry corresponding to an entry name.protected RepeaterField.RepeaterEntry
_getEntry(List<RepeaterField.RepeaterEntry> entries, String entryName)
Retrieves a repeater entry corresponding to an entry name.private ModifiableCompositeMetadata
_getEntryHolder(ModifiableContent refContent, ModifiableCompositeMetadata repeaterMeta, RepeaterDefinition repeaterDef, String[] pathElements, String searchContentId, boolean create)
On a repeater metadata, search the entry referencing the content being modified.private ExternalizableMetadataProvider.ExternalizableMetadataStatus
_getExternalizableStatus(String rawValue)
private String[]
_getExternalValues(String rawValue, MetadataDefinition metadataDefinition)
protected Map<String,Object>
_getInputsForSubContentCreation(Content content, ModifiableCompositeMetadata metadata, Form form, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, String name, String[] cTypes, String language)
Provide the inputs to use for the creation of a subcontent.protected int
_getInvertEditActionId(Map transientVars)
Get the identifier of the invert edit actionprivate String[]
_getLocalValues(String rawValue, MetadataDefinition metadataDefinition)
protected MetadataDefinition
_getMetadataDefinition(Content content, MetadataDefinition parentMetadataDefinition, String metadataName)
Retrieves a sub metadata definition from a content type or a parent metadata definition.protected ModifiableCompositeMetadata
_getMetadataHolder(ModifiableCompositeMetadata parentMetadata, String metadataPath)
Get the composite metadata holding the metadata given by its pathprotected String[]
_getMetadataValues(Object rawValue, MetadataDefinition metadataDefinition)
Get a metadata values from raw valueprotected String[]
_getMetadataValues(Map<String,Object> rawValues, Form form, MetadataDefinition metadataDefinition, String metadataPath)
Get a metadata values from the request.protected ModifiableCompositeMetadata
_getRelationMetaHolder(ModifiableContent refContent, ContentType refContentType, String metadataPath, String searchContentId, boolean create)
Get the metadata holder of the mutual relation.private void
_handleErrors(Map transientVars, ModifiableContent modifiableContent, AllErrors errors)
protected boolean
_invertRelationEnabled()
Template method to indicates if invert relation should be taken into account during the whole edition.protected boolean
_isEditRefContentAvailable(int editActionId, Content refContent, boolean forceInvert, String currentMetadataPath, UserIdentity user, AllErrors allErrors)
Checks if the "edit content" workflow action is available on a referenced contentprivate void
_lockNewReferencedContent(Content content, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String[] newValues)
private void
_lockOldReferencedContent(ModifiableCompositeMetadata metadata, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String metadataName)
private void
_lockOldReferencedThatWillBeRemovedContent(AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String[] toRemove)
protected void
_moveRepeaterEntry(CompositeMetadata metadata, String fromName, String toName)
Move a repeater entry.protected boolean
_needTriggerEditWorkflowAction(ModifiableContent refContent, String refContentTypeId, String invertRelationPath, String currentContentId)
Determines if the edit workflow action will be trigger on this referenced contentprotected void
_notifyContentModified(Content content, Map transientVars)
Notify observers that the content has been modifiedprotected void
_prepareSynchronizeCompositeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int editActionId)
Synchronize a composite-typed metadata with a a composite metadata.protected void
_prepareSynchronizeContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId)
Prepare to synchronize a content reference metadata from a field.protected void
_prepareSynchronizeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId)
Prepare to synchronize a metadata with a composite metadata.protected void
_prepareSynchronizeMetadataSetElement(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition parentMetadataDefinition, String metadataPath, int invertEditActionId)
Synchronize to synchronize a metadata set element with a composite metadata.protected void
_prepareSynchronizeRepeater(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int invertActionId)
Synchronize a repeater with a composite metadata.protected void
_removeInvertRelation(String currentContentId, MetadataDefinition metaDef, String metaPath, String refContentId, int editActionId, AllErrors allErrors)
Remove a mutual relation.protected void
_removeInvertRelations(String currentContentId, MetadataDefinition metaDef, String metaPath, String[] refContentIds, int editActionId, AllErrors allErrors)
Remove a mutual relation.protected void
_removeMetadataIfExists(ModifiableCompositeMetadata metadata, String metadataName, boolean externalizable)
Remove a metadata if exists.protected void
_setInvertRelation(Content content, String currentMetadataPath, Content refContent, String refContentTypeId, String invertRelationPath, int editActionId, AllErrors allErrors)
Set a mutual relation.private void
_setMetadata(ModifiableCompositeMetadata metadata, String metadataName, Form form, Object value, boolean externalizable)
protected void
_synchronizeBinaryMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable)
Synchronize a binary metadata from a field.protected void
_synchronizeBooleanMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a boolean metadata from a field.protected void
_synchronizeCompositeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata)
Synchronize a composite-typed metadata with a a composite metadata.protected void
_synchronizeContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, boolean externalizable)
Synchronize a content reference metadata from a field.protected void
_synchronizeDateMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a date metadata from a field.protected void
_synchronizeDoubleMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a double metadata from a field.protected void
_synchronizeFileMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable)
Synchronize a file metadata from a field.protected void
_synchronizeGeocodeMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a geocode metadata from a field.protected void
_synchronizeLongMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a long metadata from a field.protected void
_synchronizeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, Set<String> externalAndLocalMetadata)
Synchronize a metadata with a composite metadata.protected void
_synchronizeMetadataComments(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition)
Synchronize the comments of a field.protected void
_synchronizeMetadataRemoval(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition parentMetadataDefinition, String metadataPath, int editActionId)
Do additional processing to remove entry sub-metadatas.protected void
_synchronizeMetadataSetElement(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition parentMetadataDefinition, String metadataPath, int invertEditActionId, Set<String> externalAndLocalMetadata)
Synchronize a metadata set element with a composite metadata.protected void
_synchronizeMultilingualStringMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a string metadata from a field.private void
_synchronizeMultipleBooleanMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Boolean> field)
private void
_synchronizeMultipleContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable)
private void
_synchronizeMultipleDateMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Date> field)
private void
_synchronizeMultipleDoubleMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Double> field)
private void
_synchronizeMultipleLongMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Long> field)
private void
_synchronizeMultipleStringMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<String> field)
private void
_synchronizeMultipleUserMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<UserIdentity> field)
protected void
_synchronizeReferenceMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a sub-content metadata from a field.private void
_synchronizeRelationOfMultipleContentReferenceMetadata(Content content, Form form, AllErrors allErrors, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable, String metadataName, Content[] values, String[] oldValues, String[] newValues)
private void
_synchronizeRelationOfSingleContentReferenceMetadata(Content content, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, String oldValue, Content refContent, boolean invertRequired)
protected void
_synchronizeRepeater(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata)
Synchronize a repeater with a composite metadata.protected void
_synchronizeRepeaterInInsertMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata)
Synchronize a repeater with a composite metadata, when the values has to be added to existing ones.protected void
_synchronizeRepeaterInRemoveMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath)
Synchronize a repeater with a composite metadata, when the values has to removed from existing ones.protected void
_synchronizeRepeaterInReplaceMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata)
Synchronize a repeater with a composite metadata, when the values has to replace existing ones.protected void
_synchronizeRichTextMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable)
Synchronize a rich text metadata from a field.private void
_synchronizeSingleContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable)
protected void
_synchronizeStringMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a string metadata from a field.protected void
_synchronizeSubContentMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable)
Synchronize a sub-content metadata from a field.protected void
_synchronizeUserMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a user metadata from a field.protected void
_transformRichText(RichTextField field, ModifiableRichText richText, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors)
Set the rich text metadata from a source that is not docbook.protected void
_triggerEditWorkflowAction(Content content, int actionId)
Trigger a 'edit content' workflow action (if the content is workflow-aware).protected void
_updateCommonMetadata(ModifiableContent content, UserIdentity user)
Updates common metadata (last contributor, last modification date, ...).protected void
_validateForm(Content content, Form form, MetadataSet metadataSet, AllErrors allErrors)
Validates the form.protected boolean
_validateMetadata(Content content, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors, Object value)
Validate a metadata value.void
execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps)
protected MetadataSet
getMetadataSet(Map<String,Object> jsParameters, Map<String,Object> rawValues, Content content)
Get the metadata set for the contentvoid
initialize()
-
Methods inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
getContent, service
-
Methods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser
-
-
-
-
Field Detail
-
INVERT_RELATION_EDIT_WORKFLOW_ACTION_ID
public static final String INVERT_RELATION_EDIT_WORKFLOW_ACTION_ID
Constant for storing the action id for editing revert relations.
-
EDIT_MUTUAL_RELATIONSHIP
public static final String EDIT_MUTUAL_RELATIONSHIP
Constant for storing the action id for editing revert relations.
-
FORM_ELEMENTS_PREFIX
public static final String FORM_ELEMENTS_PREFIX
Prefix for HTML form elements.- See Also:
- Constant Field Values
-
GLOBAL_ERROR_KEY
public static final String GLOBAL_ERROR_KEY
The key for global errors- See Also:
- Constant Field Values
-
INTERNAL_FORM_ELEMENTS_PREFIX
public static final String INTERNAL_FORM_ELEMENTS_PREFIX
Prefix for internal HTML form elements.- See Also:
- Constant Field Values
-
FORM_RAW_VALUES
public static final String FORM_RAW_VALUES
Request parameter key for the field values.- See Also:
- Constant Field Values
-
FORM_RAW_COMMENTS
public static final String FORM_RAW_COMMENTS
Request parameter key for the field comments.- See Also:
- Constant Field Values
-
METADATA_SET_PARAM
public static final String METADATA_SET_PARAM
Prefix for the metadata set name request parameter.- See Also:
- Constant Field Values
-
FALLBACK_METADATA_SET_PARAM
public static final String FALLBACK_METADATA_SET_PARAM
Prefix for the fallback metadata set name request parameter.- See Also:
- Constant Field Values
-
QUIT
public static final String QUIT
Prefix for the quit edition mode request parameter.- See Also:
- Constant Field Values
-
UNTOUCHED_BINARY
public static final String UNTOUCHED_BINARY
Constant for untouched binary metadata.- See Also:
- Constant Field Values
-
UNTOUCHED_FILE
public static final String UNTOUCHED_FILE
Constant for untouched file metadata.- See Also:
- Constant Field Values
-
METADATA_FILE
public static final String METADATA_FILE
Constant for local file metadata.- See Also:
- Constant Field Values
-
EXPLORER_FILE
public static final String EXPLORER_FILE
Constant for shared file metadata.- See Also:
- Constant Field Values
-
INVERT_EDIT_ACTION_ID
public static final int INVERT_EDIT_ACTION_ID
Default action id of editing revert relations.- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The AmetysObject resolver.
-
_contentTypeExtensionPoint
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
Content type extension point.
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
Helper for content types
-
_uploadManager
protected UploadManager _uploadManager
Upload manager.
-
_observationManager
protected ObservationManager _observationManager
Observation manager available to subclasses.
-
_jsonUtils
protected JSONUtils _jsonUtils
The JSON conversion utilities.
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_workflowHelper
protected ContentWorkflowHelper _workflowHelper
The content workflow helper.
-
_outgoingReferencesExtractor
protected OutgoingReferencesExtractor _outgoingReferencesExtractor
The outgoing references extractor
-
_userManager
protected UserManager _userManager
The user manager
-
_userHelper
protected UserHelper _userHelper
The user helper
-
_externalizableMetadataProviderEP
protected ExternalizableMetadataProviderExtensionPoint _externalizableMetadataProviderEP
Provider for externalizable metadata
-
_lockAlreadyChecked
protected Set<String> _lockAlreadyChecked
Set of already checked node
-
-
Constructor Detail
-
EditContentFunction
public EditContentFunction()
-
-
Method Detail
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
execute
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
- Specified by:
execute
in interfacecom.opensymphony.workflow.FunctionProvider
- Throws:
com.opensymphony.workflow.WorkflowException
-
_handleErrors
private void _handleErrors(Map transientVars, ModifiableContent modifiableContent, AllErrors errors) throws com.opensymphony.workflow.WorkflowException, InvalidInputWorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
InvalidInputWorkflowException
-
_getInvertEditActionId
protected int _getInvertEditActionId(Map transientVars)
Get the identifier of the invert edit action- Parameters:
transientVars
- The workflow vars- Returns:
- the identifier of the invert edit action
-
_notifyContentModified
protected void _notifyContentModified(Content content, Map transientVars) throws com.opensymphony.workflow.WorkflowException
Notify observers that the content has been modified- Parameters:
content
- The content modifiedtransientVars
- The workflow vars- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred
-
getMetadataSet
protected MetadataSet getMetadataSet(Map<String,Object> jsParameters, Map<String,Object> rawValues, Content content) throws com.opensymphony.workflow.WorkflowException
Get the metadata set for the content- Parameters:
jsParameters
- The request parametersrawValues
- The raw values of the formcontent
- The content- Returns:
- The metadata set asked in the request or a built-in metadataset
- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred while getting the metadata set
-
_createMetadataSet
private MetadataSet _createMetadataSet(Map<String,Object> rawValues)
-
_addMetadataDefRef
private void _addMetadataDefRef(AbstractMetadataSetElement metadataSetElement, String metadataName)
-
_extractOutgoingReferences
protected void _extractOutgoingReferences(ModifiableContent content)
Analyze the content to extract outgoing references and store them- Parameters:
content
- The content to analyze
-
_invertRelationEnabled
protected boolean _invertRelationEnabled()
Template method to indicates if invert relation should be taken into account during the whole edition. Override and return false to disabled invert relation management.- Returns:
- true if invert relation are enabled
-
_bindAndValidateContent
protected void _bindAndValidateContent(ModifiableContent content, AllErrors allErrors, MetadataSet metadataSet, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, UserIdentity user, int invertEditActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Bind and validate a form.- Parameters:
content
- the content.allErrors
- the errors.metadataSet
- the metadatasetrawValues
- the raw values of the formrawComments
- the raw comments of the formuser
- the user.invertEditActionId
- The current 'edit content' action ID.externalAndLocalMetadata
- The paths of externalizable metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindAndValidateMetadataSetElement
protected void _bindAndValidateMetadataSetElement(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, MetadataDefinition parentMetadataDefinition, String parentMetadataPath, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Bind and validate a metadata set element.- Parameters:
content
- the content.form
- the form.allErrors
- the errors.metadataSetElement
- the metadata set element for this metadata.rawValues
- the raw values of the formrawComments
- the raw comments of the formparentMetadataDefinition
- the metadata definition.parentMetadataPath
- the metadata path.externalAndLocalMetadata
- The paths of externalizable metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_validateForm
protected void _validateForm(Content content, Form form, MetadataSet metadataSet, AllErrors allErrors)
Validates the form.- Parameters:
content
- the content.form
- the form.metadataSet
- the metadata set.allErrors
- the errors.
-
_synchronizeMetadataSetElement
protected void _synchronizeMetadataSetElement(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition parentMetadataDefinition, String metadataPath, int invertEditActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a metadata set element with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.parentMetadataDefinition
- the metadata definition.metadataPath
- the metadata path.invertEditActionId
- The action id for editing invert relationexternalAndLocalMetadata
- The paths of externalizable metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_prepareSynchronizeMetadataSetElement
protected void _prepareSynchronizeMetadataSetElement(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition parentMetadataDefinition, String metadataPath, int invertEditActionId) throws com.opensymphony.workflow.WorkflowException, AmetysRepositoryException
Synchronize to synchronize a metadata set element with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.parentMetadataDefinition
- the metadata definition.metadataPath
- the metadata path.invertEditActionId
- The action id for editing invert relation- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.AmetysRepositoryException
- if an error occurred
-
_updateCommonMetadata
protected void _updateCommonMetadata(ModifiableContent content, UserIdentity user) throws com.opensymphony.workflow.WorkflowException
Updates common metadata (last contributor, last modification date, ...).- Parameters:
content
- the content.user
- the user.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_getMetadataDefinition
protected MetadataDefinition _getMetadataDefinition(Content content, MetadataDefinition parentMetadataDefinition, String metadataName)
Retrieves a sub metadata definition from a content type or a parent metadata definition.- Parameters:
content
- the content.parentMetadataDefinition
- the parent metadata definition.metadataName
- the metadata name.- Returns:
- the metadata definition found or
null
otherwise.
-
_bindAndValidateMetadata
protected void _bindAndValidateMetadata(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, MetadataDefinition metadataDefinition, String metadataPath, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Bind and validate a form.- Parameters:
content
- the content.form
- the form.allErrors
- the errors.metadataSetElement
- the metadata set element for this metadata.rawValues
- the raw values.rawComments
- the raw comments.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.externalAndLocalMetadata
- The paths of externalizable metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_getLocalValues
private String[] _getLocalValues(String rawValue, MetadataDefinition metadataDefinition)
-
_getExternalValues
private String[] _getExternalValues(String rawValue, MetadataDefinition metadataDefinition)
-
_getMetadataValues
protected String[] _getMetadataValues(Map<String,Object> rawValues, Form form, MetadataDefinition metadataDefinition, String metadataPath)
Get a metadata values from the request.- Parameters:
rawValues
- the raw values.form
- the form.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.- Returns:
- the metadata values as a String array.
-
_getMetadataValues
protected String[] _getMetadataValues(Object rawValue, MetadataDefinition metadataDefinition)
Get a metadata values from raw value- Parameters:
rawValue
- The raw valuemetadataDefinition
- the metadata definition.- Returns:
- the metadata values as a String array.
-
_bindComments
protected void _bindComments(Map<String,List<Map<String,String>>> rawComments, Form form, MetadataDefinition metadataDefinition, String metadataPath)
Bind the comments of a field to the form- Parameters:
rawComments
- The raw comments of the formform
- The formsmetadataDefinition
- the metadata definition.metadataPath
- the metadata path.
-
_bindAndValidateCompositeMetadata
protected void _bindAndValidateCompositeMetadata(AllErrors allErrors, Form form, Content content, String metadataName, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, Set<String> externalAndLocalMetadata) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a composite metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.metadataDefinition
- the metadata definition.content
- the current contentmetadataName
- the metadata namemetadataSetElement
- the metadata set elementmetadataPath
- the metadata path from the content.rawValue
- the submitted values.rawValues
- The raw values of the formrawComments
- The raw comments of the formexternalAndLocalMetadata
- The paths of externalizable metadata- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindAndValidateRepeater
protected void _bindAndValidateRepeater(Content content, Form form, AllErrors allErrors, AbstractMetadataSetElement metadataSetElement, Map<String,Object> rawValues, Map<String,List<Map<String,String>>> rawComments, RepeaterDefinition repeaterDefinition, String metadataPath, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Bind and validate a repeater.- Parameters:
content
- the content.form
- the form.allErrors
- the errors.metadataSetElement
- the metadata set element for this metadata.rawValues
- the raw values of the formrawComments
- the raw comments of the formrepeaterDefinition
- the repeater definition.metadataPath
- the metadata path.externalAndLocalMetadata
- The paths of externalizable metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindAndValidateStringMetadata
protected void _bindAndValidateStringMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a string metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.metadataDefinition
- the metadata definition.content
- the contentmetadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindAndValidateMultilingualStringMetadata
protected void _bindAndValidateMultilingualStringMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a multilingual string metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.metadataDefinition
- the metadata definition.content
- the contentmetadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindMultilingualField
protected SimpleField<MultilingualString> _bindMultilingualField(String[] values)
Bind a multilingual field from form values- Parameters:
values
- the form values- Returns:
- The multilingual field
-
_bindAndValidateUserMetadata
protected void _bindAndValidateUserMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a user metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindUserField
protected SimpleField<UserIdentity> _bindUserField(String[] values)
Bind a user field from form values- Parameters:
values
- the form values- Returns:
- The user field
-
_bindAndValidateDateMetadata
protected void _bindAndValidateDateMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a date metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindDateField
protected SimpleField<Date> _bindDateField(String[] values, String metadataPath, AllErrors allErrors)
Bind a date field from form values- Parameters:
values
- the form valuesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The date field
-
_bindAndValidateDateTimeMetadata
protected void _bindAndValidateDateTimeMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a date time metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindDateTimeField
protected SimpleField<Date> _bindDateTimeField(String[] values, String metadataPath, AllErrors allErrors)
Bind a date time field from form values- Parameters:
values
- the form valuesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The date field
-
_bindAndValidateLongMetadata
protected void _bindAndValidateLongMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a long metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindLongField
protected SimpleField<Long> _bindLongField(String[] values, String metadataPath, AllErrors allErrors)
Bind a long field from form values- Parameters:
values
- the form valuesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The long field
-
_bindAndValidateGeocodeMetadata
protected void _bindAndValidateGeocodeMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a geocode metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindGeoCodeField
protected SimpleField<Double> _bindGeoCodeField(String[] values)
Bind a geocode field from form values- Parameters:
values
- the form values- Returns:
- The geocode field
-
_bindAndValidateDoubleMetadata
protected void _bindAndValidateDoubleMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a double metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindDoubleField
protected SimpleField<Double> _bindDoubleField(String[] values, String metadataPath, AllErrors allErrors)
Bind a double field from form values- Parameters:
values
- the form valuesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The double field
-
_bindAndValidateBooleanMetadata
protected void _bindAndValidateBooleanMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a boolean metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindBooleanField
protected SimpleField<Boolean> _bindBooleanField(String[] values, String metadataPath, AllErrors allErrors)
Bind a boolean field from form values- Parameters:
values
- the form valuesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The boolean field
-
_bindAndValidateBinaryMetadata
protected void _bindAndValidateBinaryMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a binary metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindBinaryField
protected BinaryField _bindBinaryField(String[] values, String metadataParamsPrefix, Map<String,Object> rawValues)
Bind a binary field from form values- Parameters:
values
- the form valuesmetadataParamsPrefix
- the prefix for metadatarawValues
- The raw values- Returns:
- The binary field
-
_bindAndValidateFileMetadata
protected void _bindAndValidateFileMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a file metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindAndValidateRichText
protected void _bindAndValidateRichText(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a rich text metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindRichTextField
protected RichTextField _bindRichTextField(String[] values, String metadataParamsPrefix, Map<String,Object> rawValues)
Bind a richtext field from form values- Parameters:
values
- the form valuesmetadataParamsPrefix
- the prefix for metadatarawValues
- The raw values- Returns:
- The richtext field
-
_bindAndValidateReferenceMetadata
protected void _bindAndValidateReferenceMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a reference metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindReferenceField
protected ReferenceField _bindReferenceField(String[] values)
Bind a reference field from form values- Parameters:
values
- the form values- Returns:
- The reference field
-
_bindAndValidateContentReferenceMetadata
protected void _bindAndValidateContentReferenceMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a content reference metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values of the formexternalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindContentField
protected SimpleField<Content> _bindContentField(String[] values, String cTypeId, Collection<String> validContentTypes, String metadataPath, AllErrors allErrors)
Bind a content field from form values- Parameters:
values
- the form valuescTypeId
- The id of content typevalidContentTypes
- The valid content typesmetadataPath
- The path of metadataallErrors
- for storing validation errors.- Returns:
- The content field
-
_getContentValues
protected List<Content> _getContentValues(CompositeMetadata compositeMetadata, String metadataPath)
Get the content values- Parameters:
compositeMetadata
- The composite metadatametadataPath
- The path of metadata- Returns:
- the list of content values
-
_bindAndValidateSubContentMetadata
protected void _bindAndValidateSubContentMetadata(AllErrors allErrors, Form form, Content content, MetadataDefinition metadataDefinition, String metadataPath, Object rawValue, Map<String,Object> rawValues, boolean externalizable) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Bind and validate a content metadata.- Parameters:
allErrors
- for storing validation errors.form
- the form.content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path from the content.rawValue
- the submitted value.rawValues
- the raw values.externalizable
-true
true if the metadata is an externalizable metadata (local and external value)- Throws:
AmetysRepositoryException
- if an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_bindSubContentField
protected SubContentField _bindSubContentField(String[] values, MetadataDefinition metadataDef, String metadataPath, Map<String,Object> rawValues)
Bind a sub-content field from form values- Parameters:
values
- the form valuesmetadataDef
- The metadata definitionmetadataPath
- The path of metadatarawValues
- The raw values- Returns:
- The sub-content field
-
_validateMetadata
protected boolean _validateMetadata(Content content, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors, Object value) throws com.opensymphony.workflow.WorkflowException
Validate a metadata value.- Parameters:
content
- the contentmetadataDefinition
- the metadata definition.metadataPath
- the metadata path.allErrors
- the errors.value
- the value.- Returns:
true
if the validation is successful,false
otherwise.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_prepareSynchronizeMetadata
protected void _prepareSynchronizeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId) throws com.opensymphony.workflow.WorkflowException, AmetysRepositoryException
Prepare to synchronize a metadata with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.invertEditActionId
- The action id for editing invert relation- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.AmetysRepositoryException
- If an error occurred
-
_synchronizeMetadata
protected void _synchronizeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a metadata with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.invertEditActionId
- The action id for editing invert relationexternalAndLocalMetadata
- The paths of local and externam metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMetadataComments
protected void _synchronizeMetadataComments(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition)
Synchronize the comments of a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.
-
_prepareSynchronizeCompositeMetadata
protected void _prepareSynchronizeCompositeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int editActionId) throws com.opensymphony.workflow.WorkflowException
Synchronize a composite-typed metadata with a a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.editActionId
- The action id for editing invert relation- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeCompositeMetadata
protected void _synchronizeCompositeMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, MetadataDefinition metadataDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a composite-typed metadata with a a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.editActionId
- The action id for editing invert relationexternalAndLocalMetadata
- The paths of local and externam metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_prepareSynchronizeRepeater
protected void _prepareSynchronizeRepeater(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int invertActionId) throws com.opensymphony.workflow.WorkflowException
Synchronize a repeater with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.repeaterDefinition
- the repeater definition.metadataPath
- the metadata path.invertActionId
- The current 'edit content' action ID.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeRepeater
protected void _synchronizeRepeater(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a repeater with a composite metadata.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.repeaterDefinition
- the repeater definition.metadataPath
- the metadata path.editActionId
- The current 'edit content' action ID.externalAndLocalMetadata
- The paths of local and externam metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_checkRepeaterSize
protected void _checkRepeaterSize(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, RepeaterDefinition repeaterDefinition, String metadataPath)
Check the repeater size will be correct- Parameters:
metadata
- The metadata valuesform
- the formallErrors
- the list of errorsrepeaterDefinition
- the definition of the repeatermetadataPath
- The path of the metadata
-
_synchronizeRepeaterInInsertMode
protected void _synchronizeRepeaterInInsertMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a repeater with a composite metadata, when the values has to be added to existing ones.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.repeaterDefinition
- the repeater definition.metadataPath
- the metadata path.editActionId
- The current 'edit content' action ID.externalAndLocalMetadata
- The paths of local and externam metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeRepeaterInRemoveMode
protected void _synchronizeRepeaterInRemoveMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath) throws com.opensymphony.workflow.WorkflowException
Synchronize a repeater with a composite metadata, when the values has to removed from existing ones.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.repeaterDefinition
- the repeater definition.metadataPath
- the metadata path.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_computeRepeaterEntryPosition
private int _computeRepeaterEntryPosition(ModifiableCompositeMetadata repeaterMetadata, RepeaterField.RepeaterEntry repeaterEntry)
-
_synchronizeRepeaterInReplaceMode
protected void _synchronizeRepeaterInReplaceMode(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, AbstractMetadataSetElement metadataSetElement, RepeaterDefinition repeaterDefinition, String metadataPath, int editActionId, Set<String> externalAndLocalMetadata) throws com.opensymphony.workflow.WorkflowException
Synchronize a repeater with a composite metadata, when the values has to replace existing ones.- Parameters:
content
- the content.metadata
- the composite metadata to synchronize.form
- the form.allErrors
- the errors.user
- the user.metadataSetElement
- the metadata set element for this metadata.repeaterDefinition
- the repeater definition.metadataPath
- the metadata path.editActionId
- The current 'edit content' action ID.externalAndLocalMetadata
- The paths of local and externam metadata- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMetadataRemoval
protected void _synchronizeMetadataRemoval(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition parentMetadataDefinition, String metadataPath, int editActionId) throws com.opensymphony.workflow.WorkflowException
Do additional processing to remove entry sub-metadatas.- Parameters:
content
- the processed content.metadata
- the composite metadata being removed.form
- the form.allErrors
- the errors.user
- the user.parentMetadataDefinition
- the parent metadata definition.metadataPath
- the metadata path.editActionId
- The current 'edit content' action ID.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_moveRepeaterEntry
protected void _moveRepeaterEntry(CompositeMetadata metadata, String fromName, String toName) throws com.opensymphony.workflow.WorkflowException
Move a repeater entry.- Parameters:
metadata
- the parent composite metadata.fromName
- the current entry name.toName
- the new entry name.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_getEntry
protected RepeaterField.RepeaterEntry _getEntry(List<RepeaterField.RepeaterEntry> entries, String entryName)
Retrieves a repeater entry corresponding to an entry name.- Parameters:
entries
- the entries.entryName
- the entry name.- Returns:
- the entry found or
null
otherwise.
-
_getCurrentEntry
protected RepeaterField.RepeaterEntry _getCurrentEntry(List<RepeaterField.RepeaterEntry> entries, String entryName)
Retrieves a repeater entry corresponding to an entry name.- Parameters:
entries
- the entries.entryName
- the entry name.- Returns:
- the entry found or
null
otherwise.
-
_synchronizeStringMetadata
protected void _synchronizeStringMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a string metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleStringMetadata
private void _synchronizeMultipleStringMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<String> field)
-
_synchronizeMultilingualStringMetadata
protected void _synchronizeMultilingualStringMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a string metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeUserMetadata
protected void _synchronizeUserMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a user metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleUserMetadata
private void _synchronizeMultipleUserMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<UserIdentity> field)
-
_synchronizeDateMetadata
protected void _synchronizeDateMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a date metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleDateMetadata
private void _synchronizeMultipleDateMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Date> field)
-
_removeMetadataIfExists
protected void _removeMetadataIfExists(ModifiableCompositeMetadata metadata, String metadataName, boolean externalizable)
Remove a metadata if exists. Be careful ! If externalizable, this method have to be called after setting the current status.- Parameters:
metadata
- The parent composite metadatametadataName
- The metadata nameexternalizable
-true
if externalizable
-
_synchronizeLongMetadata
protected void _synchronizeLongMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a long metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleLongMetadata
private void _synchronizeMultipleLongMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Long> field)
-
_synchronizeGeocodeMetadata
protected void _synchronizeGeocodeMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a geocode metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeDoubleMetadata
protected void _synchronizeDoubleMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a double metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleDoubleMetadata
private void _synchronizeMultipleDoubleMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Double> field)
-
_synchronizeBooleanMetadata
protected void _synchronizeBooleanMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a boolean metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleBooleanMetadata
private void _synchronizeMultipleBooleanMetadata(ModifiableCompositeMetadata metadata, Form form, boolean externalizable, String metadataName, SimpleField<Boolean> field)
-
_synchronizeBinaryMetadata
protected void _synchronizeBinaryMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a binary metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeFileMetadata
protected void _synchronizeFileMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a file metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_prepareSynchronizeContentReferenceMetadata
protected void _prepareSynchronizeContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Prepare to synchronize a content reference metadata from a field.- Parameters:
content
- the content.metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.invertEditActionId
- The action id for editing invert relation- Throws:
AmetysRepositoryException
- If an error occurs.com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_lockNewReferencedContent
private void _lockNewReferencedContent(Content content, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String[] newValues) throws RepositoryException
- Throws:
RepositoryException
-
_lockOldReferencedThatWillBeRemovedContent
private void _lockOldReferencedThatWillBeRemovedContent(AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String[] toRemove)
-
_lockOldReferencedContent
private void _lockOldReferencedContent(ModifiableCompositeMetadata metadata, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String metadataName)
-
_synchronizeContentReferenceMetadata
protected void _synchronizeContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a content reference metadata from a field.- Parameters:
content
- the content.metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.invertEditActionId
- The action id for editing invert relationexternalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_synchronizeMultipleContentReferenceMetadata
private void _synchronizeMultipleContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
-
_synchronizeRelationOfMultipleContentReferenceMetadata
private void _synchronizeRelationOfMultipleContentReferenceMetadata(Content content, Form form, AllErrors allErrors, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable, String metadataName, Content[] values, String[] oldValues, String[] newValues) throws com.opensymphony.workflow.WorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
-
_synchronizeSingleContentReferenceMetadata
private void _synchronizeSingleContentReferenceMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
-
_synchronizeRelationOfSingleContentReferenceMetadata
private void _synchronizeRelationOfSingleContentReferenceMetadata(Content content, AllErrors allErrors, SimpleField<Content> field, MetadataDefinition metadataDefinition, String metadataPath, int invertEditActionId, String contentTypeId, String invert, String oldValue, Content refContent, boolean invertRequired) throws com.opensymphony.workflow.WorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
-
_synchronizeSubContentMetadata
protected void _synchronizeSubContentMetadata(Content content, ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a sub-content metadata from a field.- Parameters:
content
- The Content.metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_getInputsForSubContentCreation
protected Map<String,Object> _getInputsForSubContentCreation(Content content, ModifiableCompositeMetadata metadata, Form form, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, String name, String[] cTypes, String language)
Provide the inputs to use for the creation of a subcontent.- Parameters:
content
- The parent contentmetadata
- the metadata.form
- the form containing the field.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.name
- The name of the subcontent to createcTypes
- Content types array of the subcontent to createlanguage
- The language of the subcontent to create- Returns:
- the map of inputs
-
_synchronizeReferenceMetadata
protected void _synchronizeReferenceMetadata(ModifiableCompositeMetadata metadata, Form form, MetadataDefinition metadataDefinition, boolean externalizable)
Synchronize a sub-content metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.metadataDefinition
- the metadata definition.externalizable
-true
if the metadata is externalizable (local and external value)
-
_synchronizeRichTextMetadata
protected void _synchronizeRichTextMetadata(ModifiableCompositeMetadata metadata, Form form, AllErrors allErrors, UserIdentity user, MetadataDefinition metadataDefinition, String metadataPath, boolean externalizable) throws com.opensymphony.workflow.WorkflowException
Synchronize a rich text metadata from a field.- Parameters:
metadata
- the metadata.form
- the form containing the field.allErrors
- the errors.user
- the user.metadataDefinition
- the metadata definition.metadataPath
- the current metadata path.externalizable
-true
if the metadata is externalizable (local and external value)- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_transformRichText
protected void _transformRichText(RichTextField field, ModifiableRichText richText, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors)
Set the rich text metadata from a source that is not docbook.- Parameters:
field
- the RichText form field.richText
- the rich text metadata to populate.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.allErrors
- the error list.
-
_copyRichText
protected void _copyRichText(RichTextField field, ModifiableRichText richText, MetadataDefinition metadataDefinition, String metadataPath, AllErrors allErrors)
Set a rich text metadata from an existing rich text metadata.- Parameters:
field
- the RichText form field.richText
- the rich text metadata to populate.metadataDefinition
- the metadata definition.metadataPath
- the metadata path.allErrors
- the error list.
-
_needTriggerEditWorkflowAction
protected boolean _needTriggerEditWorkflowAction(ModifiableContent refContent, String refContentTypeId, String invertRelationPath, String currentContentId) throws RepositoryException
Determines if the edit workflow action will be trigger on this referenced content- Parameters:
refContent
- The referenced contentrefContentTypeId
- The content typeinvertRelationPath
- The path of invert relationshipcurrentContentId
- The content being editing- Returns:
- true if the edit workflow action will occur
- Throws:
RepositoryException
- if an error occurred
-
_setInvertRelation
protected void _setInvertRelation(Content content, String currentMetadataPath, Content refContent, String refContentTypeId, String invertRelationPath, int editActionId, AllErrors allErrors) throws com.opensymphony.workflow.WorkflowException
Set a mutual relation.- Parameters:
content
- the content being modified.currentMetadataPath
- the metadata path on the content being modified.refContent
- the content being referenced.refContentTypeId
- the content type of the content being referenced.invertRelationPath
- the path of the metadata to set on the content being referenced, separated by '/'editActionId
- The current 'edit content' action ID.allErrors
- the errors.- Throws:
com.opensymphony.workflow.WorkflowException
- if a fatal error occurs.
-
_checkLock
protected void _checkLock(Node node) throws RepositoryException
Check the lock status of the node- Parameters:
node
- The node- Throws:
RepositoryException
- If an error occurred while manipulating the node
-
_isEditRefContentAvailable
protected boolean _isEditRefContentAvailable(int editActionId, Content refContent, boolean forceInvert, String currentMetadataPath, UserIdentity user, AllErrors allErrors)
Checks if the "edit content" workflow action is available on a referenced content- Parameters:
editActionId
- The id of edit workflow actionrefContent
- the referenced content to editforceInvert
- Force the invert edition regardless of the user's rightscurrentMetadataPath
- the path of the metadata responsible for the invert relationuser
- the current userallErrors
- the errors- Returns:
true
if the edit action is avalailable
-
_removeInvertRelation
protected void _removeInvertRelation(String currentContentId, MetadataDefinition metaDef, String metaPath, String refContentId, int editActionId, AllErrors allErrors) throws com.opensymphony.workflow.WorkflowException
Remove a mutual relation.- Parameters:
currentContentId
- the ID of the content being modified.metaDef
- the metadata definition.metaPath
- the metadata path.refContentId
- the ID of the content being referenced.editActionId
- The current 'edit content' action ID.allErrors
- the errors.- Throws:
com.opensymphony.workflow.WorkflowException
- if a fatal error occurs.
-
_removeInvertRelations
protected void _removeInvertRelations(String currentContentId, MetadataDefinition metaDef, String metaPath, String[] refContentIds, int editActionId, AllErrors allErrors) throws com.opensymphony.workflow.WorkflowException
Remove a mutual relation.- Parameters:
currentContentId
- the ID of the content being modified.metaDef
- the metadata definition.metaPath
- the metadata path.refContentIds
- the ID of the contents being referenced.editActionId
- The current 'edit content' action ID.allErrors
- the errors.- Throws:
com.opensymphony.workflow.WorkflowException
- if a fatal error occurs.
-
_getRelationMetaHolder
protected ModifiableCompositeMetadata _getRelationMetaHolder(ModifiableContent refContent, ContentType refContentType, String metadataPath, String searchContentId, boolean create) throws RepositoryException
Get the metadata holder of the mutual relation.- Parameters:
refContent
- the content being referenced.refContentType
- the content type of the content being referenced.metadataPath
- the metadata path on the content being referenced, separated by '/'searchContentId
- the ID of the content being modified.create
- true to create non-existing composites and repeater entries.- Returns:
- The metadata holder of the relation, on the content being referenced.
Can be null if create is false and the metadata doesn't exist yet. - Throws:
RepositoryException
- if an error occurs.
-
_getEntryHolder
private ModifiableCompositeMetadata _getEntryHolder(ModifiableContent refContent, ModifiableCompositeMetadata repeaterMeta, RepeaterDefinition repeaterDef, String[] pathElements, String searchContentId, boolean create) throws RepositoryException
On a repeater metadata, search the entry referencing the content being modified.- Parameters:
refContent
- the content being referenced.repeaterMeta
- the repeater metadata.repeaterDef
- the repeater definition.pathElements
- the path of the mutual relation from the repeater, as a String array.searchContentId
- the ID of the content being modified.create
- true to create non-existing composites and repeater entries.- Returns:
- The metadata holder of the relation, on the content being referenced.
Can be null if create is false and the metadata doesn't exist yet. - Throws:
RepositoryException
- if an error occurs.
-
_getMetadataHolder
protected ModifiableCompositeMetadata _getMetadataHolder(ModifiableCompositeMetadata parentMetadata, String metadataPath)
Get the composite metadata holding the metadata given by its path- Parameters:
parentMetadata
- The parent composite metadatametadataPath
- The metadata path (with /)- Returns:
- The direct parent metadata
-
_triggerEditWorkflowAction
protected void _triggerEditWorkflowAction(Content content, int actionId) throws com.opensymphony.workflow.WorkflowException
Trigger a 'edit content' workflow action (if the content is workflow-aware).- Parameters:
content
- The content.actionId
- The current 'edit content' action ID.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_getExternalizableStatus
private ExternalizableMetadataProvider.ExternalizableMetadataStatus _getExternalizableStatus(String rawValue)
-
_setMetadata
private void _setMetadata(ModifiableCompositeMetadata metadata, String metadataName, Form form, Object value, boolean externalizable)
-
-