Class 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
    • Method Detail

      • execute

        public void execute​(Map transientVars,
                            Map args,
                            com.opensymphony.module.propertyset.PropertySet ps)
                     throws com.opensymphony.workflow.WorkflowException
        Specified by:
        execute in interface com.opensymphony.workflow.FunctionProvider
        Throws:
        com.opensymphony.workflow.WorkflowException
      • _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 modified
        transientVars - 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 parameters
        rawValues - The raw values of the form
        content - 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
      • _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 metadataset
        rawValues - the raw values of the form
        rawComments - the raw comments of the form
        user - 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 form
        rawComments - the raw comments of the form
        parentMetadataDefinition - 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 relation
        externalAndLocalMetadata - 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.
      • _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 value
        metadataDefinition - 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 form
        form - The forms
        metadataDefinition - 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 content
        metadataName - the metadata name
        metadataSetElement - the metadata set element
        metadataPath - the metadata path from the content.
        rawValue - the submitted values.
        rawValues - The raw values of the form
        rawComments - The raw comments of the form
        externalAndLocalMetadata - 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 form
        rawComments - the raw comments of the form
        repeaterDefinition - 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 content
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindDateField

        protected SimpleField<Date_bindDateField​(String[] values,
                                                   String metadataPath,
                                                   AllErrors allErrors)
        Bind a date field from form values
        Parameters:
        values - the form values
        metadataPath - The path of metadata
        allErrors - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindDateTimeField

        protected SimpleField<Date_bindDateTimeField​(String[] values,
                                                       String metadataPath,
                                                       AllErrors allErrors)
        Bind a date time field from form values
        Parameters:
        values - the form values
        metadataPath - The path of metadata
        allErrors - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindLongField

        protected SimpleField<Long_bindLongField​(String[] values,
                                                   String metadataPath,
                                                   AllErrors allErrors)
        Bind a long field from form values
        Parameters:
        values - the form values
        metadataPath - The path of metadata
        allErrors - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindDoubleField

        protected SimpleField<Double_bindDoubleField​(String[] values,
                                                       String metadataPath,
                                                       AllErrors allErrors)
        Bind a double field from form values
        Parameters:
        values - the form values
        metadataPath - The path of metadata
        allErrors - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindBooleanField

        protected SimpleField<Boolean_bindBooleanField​(String[] values,
                                                         String metadataPath,
                                                         AllErrors allErrors)
        Bind a boolean field from form values
        Parameters:
        values - the form values
        metadataPath - The path of metadata
        allErrors - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindBinaryField

        protected BinaryField _bindBinaryField​(String[] values,
                                               String metadataParamsPrefix,
                                               Map<String,​Object> rawValues)
        Bind a binary field from form values
        Parameters:
        values - the form values
        metadataParamsPrefix - the prefix for metadata
        rawValues - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _bindRichTextField

        protected RichTextField _bindRichTextField​(String[] values,
                                                   String metadataParamsPrefix,
                                                   Map<String,​Object> rawValues)
        Bind a richtext field from form values
        Parameters:
        values - the form values
        metadataParamsPrefix - the prefix for metadata
        rawValues - 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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 content
        metadataDefinition - the metadata definition.
        metadataPath - the metadata path from the content.
        rawValue - the submitted value.
        rawValues - the raw values of the form
        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.
      • _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 values
        cTypeId - The id of content type
        validContentTypes - The valid content types
        metadataPath - The path of metadata
        allErrors - 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 metadata
        metadataPath - 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 content
        metadataDefinition - 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.
      • _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 content
        metadataDefinition - 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 relation
        externalAndLocalMetadata - The paths of local and externam metadata
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs.
      • _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 relation
        externalAndLocalMetadata - 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 values
        form - the form
        allErrors - the list of errors
        repeaterDefinition - the definition of the repeater
        metadataPath - 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.
      • _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.
      • _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.
      • _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.
      • _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.
      • _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 metadata
        metadataName - The metadata name
        externalizable - 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.
      • _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.
      • _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.
      • _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.
      • _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 relation
        externalizable - true if the metadata is externalizable (local and external value)
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs.
      • _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 content
        metadata - 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 create
        cTypes - Content types array of the subcontent to create
        language - 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 content
        refContentTypeId - The content type
        invertRelationPath - The path of invert relationship
        currentContentId - 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.
      • _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 action
        refContent - the referenced content to edit
        forceInvert - Force the invert edition regardless of the user's rights
        currentMetadataPath - the path of the metadata responsible for the invert relation
        user - the current user
        allErrors - 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.
      • _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.