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 java.lang.Object implements AuthorOperation
An implementation of an insert operation for an argument of type fragment.
-
-
Field Summary
Fields Modifier and Type Field Description protected static ArgumentDescriptor
ARGUMENT_DESCR_INSERT_FRAG_EVEN_IF_INVALID
Argument descriptor.protected static ArgumentDescriptor
ARGUMENT_DESCRIPTOR_FRAGMENT
Argument defining the XML fragment that will be inserted.protected static ArgumentDescriptor
ARGUMENT_DESCRIPTOR_GO_TO_NEXT_EDITABLE_POSITION
Argument defining if the fragment insertion is schema aware.protected static ArgumentDescriptor
ARGUMENT_DESCRIPTOR_RELATIVE_LOCATION
Argument defining the relative position to the node obtained from the XPath location.protected static ArgumentDescriptor
ARGUMENT_DESCRIPTOR_XPATH_LOCATION
Argument defining the location where the operation will be executed as an XPath expression.static java.lang.String
ARGUMENT_FRAGMENT
The fragment argument.static java.lang.String
ARGUMENT_GO_TO_NEXT_EDITABLE_POSITION
Detect and position the caret inside the first edit location.static java.lang.String
ARGUMENT_INSERT_FRAG_EVEN_IF_INVALID
true
to insert the fragment even if invalid.static java.lang.String
ARGUMENT_RELATIVE_LOCATION
The insert position argument.static java.lang.String
ARGUMENT_XPATH_LOCATION
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
Constructors Constructor Description InsertFragmentOperation()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doOperation(AuthorAccess authorAccess, ArgumentsMap args)
Perform the actual operation.protected void
doOperationInternal(AuthorAccess authorAccess, java.lang.Object fragment, java.lang.Object xpathLocation, java.lang.Object relativeLocation, boolean goToFirstEditablePosition, java.lang.Object schemaAwareArgumentValue)
Performs the insert operation.protected void
doOperationInternal(AuthorAccess authorAccess, java.lang.Object fragment, java.lang.Object xpathLocation, java.lang.Object relativeLocation, boolean goToFirstEditablePosition, java.lang.Object schemaAwareArgumentValue, boolean isInsertEvenIfInvalid)
Performs the insert operation.ArgumentDescriptor[]
getArguments()
java.lang.String
getDescription()
-
-
-
Field Detail
-
ARGUMENT_FRAGMENT
public static final java.lang.String ARGUMENT_FRAGMENT
The fragment argument. The value isfragment
.- See Also:
- Constant Field Values
-
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 java.lang.String ARGUMENT_XPATH_LOCATION
The insert location argument. The value isinsertLocation
.- See Also:
- Constant Field Values
-
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 java.lang.String ARGUMENT_RELATIVE_LOCATION
The insert position argument. The value isinsertPosition
.- See Also:
- Constant Field Values
-
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 java.lang.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:
- Constant Field Values
-
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 java.lang.String ARGUMENT_INSERT_FRAG_EVEN_IF_INVALID
true
to insert the fragment even if invalid.- See Also:
- Constant Field Values
-
ARGUMENT_DESCR_INSERT_FRAG_EVEN_IF_INVALID
protected static final ArgumentDescriptor ARGUMENT_DESCR_INSERT_FRAG_EVEN_IF_INVALID
Argument descriptor.
-
-
Method Detail
-
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:
AuthorOperation.doOperation(AuthorAccess, ArgumentsMap)
-
doOperationInternal
protected void doOperationInternal(AuthorAccess authorAccess, java.lang.Object fragment, java.lang.Object xpathLocation, java.lang.Object relativeLocation, boolean goToFirstEditablePosition, java.lang.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, java.lang.Object fragment, java.lang.Object xpathLocation, java.lang.Object relativeLocation, boolean goToFirstEditablePosition, java.lang.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 interfaceAuthorOperation
- Returns:
- An array of
ArgumentDescriptor
representing the arguments this operation uses. - See Also:
AuthorOperation.getArguments()
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceExtension
- Returns:
- The description of the extension.
- See Also:
Extension.getDescription()
-
-