Class InsertFragmentOperation

java.lang.Object
ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation
All Implemented Interfaces:
AuthorOperation, Extension
Direct Known Subclasses:
InsertOrReplaceFragmentOperation

@API(type=INTERNAL, src=PUBLIC) public class InsertFragmentOperation extends Object implements AuthorOperation
An implementation of an insert operation for an argument of type fragment.
  • Field Details

    • ARGUMENT_FRAGMENT

      public static final String ARGUMENT_FRAGMENT
      The fragment argument. The value is fragment.
      See Also:
    • ARGUMENT_DESCRIPTOR_FRAGMENT

      protected static final ArgumentDescriptor ARGUMENT_DESCRIPTOR_FRAGMENT
      Argument defining the XML fragment that will be inserted.
    • ARGUMENT_XPATH_LOCATION

      public static final String ARGUMENT_XPATH_LOCATION
      The insert location argument. The value is insertLocation.
      See Also:
    • ARGUMENT_DESCRIPTOR_XPATH_LOCATION

      protected static final ArgumentDescriptor ARGUMENT_DESCRIPTOR_XPATH_LOCATION
      Argument defining the location where the operation will be executed as an XPath expression.
    • ARGUMENT_RELATIVE_LOCATION

      public static final String ARGUMENT_RELATIVE_LOCATION
      The insert position argument. The value is insertPosition.
      See Also:
    • ARGUMENT_DESCRIPTOR_RELATIVE_LOCATION

      protected static final ArgumentDescriptor ARGUMENT_DESCRIPTOR_RELATIVE_LOCATION
      Argument defining the relative position to the node obtained from the XPath location.
    • ARGUMENT_GO_TO_NEXT_EDITABLE_POSITION

      public static final String ARGUMENT_GO_TO_NEXT_EDITABLE_POSITION
      Detect and position the caret inside the first edit location. It can be either an offset inside the content or an in-place editor.
      See Also:
    • ARGUMENT_DESCRIPTOR_GO_TO_NEXT_EDITABLE_POSITION

      protected static final ArgumentDescriptor ARGUMENT_DESCRIPTOR_GO_TO_NEXT_EDITABLE_POSITION
      Argument defining if the fragment insertion is schema aware.
    • ARGUMENT_INSERT_FRAG_EVEN_IF_INVALID

      public static final String ARGUMENT_INSERT_FRAG_EVEN_IF_INVALID
      true to insert the fragment even if invalid.
      See Also:
    • ARGUMENT_DESCR_INSERT_FRAG_EVEN_IF_INVALID

      protected static final ArgumentDescriptor ARGUMENT_DESCR_INSERT_FRAG_EVEN_IF_INVALID
      Argument descriptor.
  • Constructor Details

    • InsertFragmentOperation

      public InsertFragmentOperation()
      Constructor.
  • Method Details

    • doOperation

      public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws AuthorOperationException
      Description copied from interface: AuthorOperation
      Perform the actual operation. You can check if the operation was invoked from the oXygen standalone application or from the oXygen plugin for Eclipse by using the method: ApplicationInformationAccess.getPlatform(). To get to the Workspace you may use: AuthorAccess.getWorkspaceAccess().
      Specified by:
      doOperation in interface AuthorOperation
      Parameters:
      authorAccess - The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility a.s.o.
      args - The map of arguments. All the arguments defined by method AuthorOperation.getArguments() must be present in the map of arguments.
      Throws:
      AuthorOperationException - Thrown when the operation fails.
      See Also:
    • doOperationInternal

      protected void doOperationInternal(AuthorAccess authorAccess, Object fragment, Object xpathLocation, Object relativeLocation, boolean goToFirstEditablePosition, Object schemaAwareArgumentValue) throws AuthorOperationException
      Performs the insert operation.
      Parameters:
      authorAccess - The author access used to access the document.
      fragment - The fragment to be inserted.
      xpathLocation - The XPath location where the insertion takes place. If null, insert at caret position.
      relativeLocation - The location of the insertion relative to the node selected by the XPath.
      goToFirstEditablePosition - true if we should go to the first editable position in the fragment after insertion.
      schemaAwareArgumentValue - true if the insertion should be schema aware.
      Throws:
      AuthorOperationException
    • doOperationInternal

      protected void doOperationInternal(AuthorAccess authorAccess, Object fragment, Object xpathLocation, Object relativeLocation, boolean goToFirstEditablePosition, Object schemaAwareArgumentValue, boolean isInsertEvenIfInvalid) throws AuthorOperationException
      Performs the insert operation.
      Parameters:
      authorAccess - The author access used to access the document.
      fragment - The fragment to be inserted.
      xpathLocation - The XPath location where the insertion takes place. If null, insert at caret position.
      relativeLocation - The location of the insertion relative to the node selected by the XPath.
      goToFirstEditablePosition - true if we should go to the first editable position in the fragment after insertion.
      schemaAwareArgumentValue - true if the insertion should be schema aware.
      isInsertEvenIfInvalid - true to insert the fragment even if it would make the document invalid.
      Throws:
      AuthorOperationException
    • getArguments

      public ArgumentDescriptor[] getArguments()
      Specified by:
      getArguments in interface AuthorOperation
      Returns:
      An array of ArgumentDescriptor representing the arguments this operation uses.
      See Also:
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface Extension
      Returns:
      The description of the extension.
      See Also: