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 Summary
Modifier and TypeFieldDescriptionprotected static final ArgumentDescriptor
Argument descriptor.protected static final ArgumentDescriptor
Argument defining the XML fragment that will be inserted.protected static final ArgumentDescriptor
Argument defining if the fragment insertion is schema aware.protected static final ArgumentDescriptor
Argument defining the relative position to the node obtained from the XPath location.protected static final ArgumentDescriptor
Argument defining the location where the operation will be executed as an XPath expression.static final String
The fragment argument.static final String
Detect and position the caret inside the first edit location.static final String
true
to insert the fragment even if invalid.static final String
The insert position argument.static final String
The insert location argument.Fields inherited from interface ro.sync.ecss.extensions.api.AuthorOperation
NAMESPACE_ARGUMENT, NAMESPACE_ARGUMENT_DESCRIPTOR, SCHEMA_AWARE_ARGUMENT, SCHEMA_AWARE_ARGUMENT_DESCRIPTOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doOperation
(AuthorAccess authorAccess, ArgumentsMap args) Perform the actual operation.protected void
doOperationInternal
(AuthorAccess authorAccess, Object fragment, Object xpathLocation, Object relativeLocation, boolean goToFirstEditablePosition, Object schemaAwareArgumentValue) Performs the insert operation.protected void
doOperationInternal
(AuthorAccess authorAccess, Object fragment, Object xpathLocation, Object relativeLocation, boolean goToFirstEditablePosition, Object schemaAwareArgumentValue, boolean isInsertEvenIfInvalid) Performs the insert operation.
-
Field Details
-
ARGUMENT_FRAGMENT
The fragment argument. The value isfragment
.- See Also:
-
ARGUMENT_DESCRIPTOR_FRAGMENT
Argument defining the XML fragment that will be inserted. -
ARGUMENT_XPATH_LOCATION
The insert location argument. The value isinsertLocation
.- See Also:
-
ARGUMENT_DESCRIPTOR_XPATH_LOCATION
Argument defining the location where the operation will be executed as an XPath expression. -
ARGUMENT_RELATIVE_LOCATION
The insert position argument. The value isinsertPosition
.- See Also:
-
ARGUMENT_DESCRIPTOR_RELATIVE_LOCATION
Argument defining the relative position to the node obtained from the XPath location. -
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
Argument defining if the fragment insertion is schema aware. -
ARGUMENT_INSERT_FRAG_EVEN_IF_INVALID
true
to insert the fragment even if invalid.- See Also:
-
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 theWorkspace
you may use:AuthorAccess.getWorkspaceAccess()
.- Specified by:
doOperation
in interfaceAuthorOperation
- 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 methodAuthorOperation.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
- Specified by:
getArguments
in interfaceAuthorOperation
- Returns:
- An array of
ArgumentDescriptor
representing the arguments this operation uses. - See Also:
-
getDescription
- Specified by:
getDescription
in interfaceExtension
- Returns:
- The description of the extension.
- See Also:
-