public static class DocumentOperation.OperationCallback extends Object
getResumableState(). When your
operation is first run, you should check whether getResumableState() returns a non-null value,
and use it to resume the operation.addDocument(com.biomatters.geneious.publicapi.documents.PluginDocument, boolean, ProgressListener)} or addDocument(com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument, boolean, ProgressListener).
These documents are treated as intermediate documents, so you should still return a list of the final documents (you may add
documents to the callback, and return them in the list)| Modifier and Type | Class and Description |
|---|---|
static class |
DocumentOperation.OperationCallback.Wrapper
Creates a wrapper OperationCallback that delegates all methods to another OperationCallback
|
| Constructor and Description |
|---|
DocumentOperation.OperationCallback() |
| Modifier and Type | Method and Description |
|---|---|
AnnotatedPluginDocument |
addDocument(AnnotatedPluginDocument doc,
boolean dontSelectDocumentWhenComplete,
ProgressListener progress)
returns a document from the operation while the operation is still in progress.
|
AnnotatedPluginDocument |
addDocument(PluginDocument doc,
boolean dontSelectDocumentWhenComplete,
ProgressListener progress)
returns a document from the operaiton while the operation is still in progress.
|
boolean |
canResume() |
org.jdom.Element |
getResumableState()
returns the persistent information that was set with the last call to
setResumableState(org.jdom.Element) (this call may have been before the operation was paused) |
boolean |
isInterestedInParentDescendants() |
void |
setMarkUnselectedDocumentsUnread(boolean markUnselectedDocumentsUnread)
Sets whether or not documents added to the callback that can't be immediately selected are marked as unread.
|
void |
setOptionsForActivelyLinkedDescendants(org.jdom.Element optionsElement,
List<AnnotatedPluginDocument> inputDocuments,
List<AnnotatedPluginDocument> additionalParentDocuments)
This method will only have an effect if
isInterestedInParentDescendants() returns true. |
void |
setRemoteJobId(GeneiousService service,
String jobId)
This method is only provided for core Geneious use when implementing a remote service such as a Geneious Server or a Green Button service.
|
void |
setResumableState(org.jdom.Element e)
Sets a resumable state for your operation.
|
void |
setSubFolder(String name)
Specify the name of a subfolder that the results of the operation should go in.
|
void |
stopCreatingOperationRecords()
Stops any
operation records from being created for subsequent documents added using addDocument. |
public void setResumableState(org.jdom.Element e)
AnnotatedPluginDocuments, Options or SequenceSelections passed in to your operation - the same ones will be passed in when your operation is resumed.e - all the information necessary to resume the operation, or null to set this operation to be non-resumable.public org.jdom.Element getResumableState()
setResumableState(org.jdom.Element) (this call may have been before the operation was paused)setResumableState(org.jdom.Element) (this call may have been before the operation was paused), or null if it was never called.public boolean canResume()
setResumableState(org.jdom.Element) has been called with a non-null argument.public void setSubFolder(String name) throws DatabaseServiceException
name - name of the subfolder or null to not put the results in a subfolder. Defaults to null.DatabaseServiceException - if failed to create subfolder, in which case the parent folder is used.
This exception may be ignored if that is acceptablepublic void setMarkUnselectedDocumentsUnread(boolean markUnselectedDocumentsUnread)
markUnselectedDocumentsUnread - public final AnnotatedPluginDocument addDocument(PluginDocument doc, boolean dontSelectDocumentWhenComplete, ProgressListener progress) throws DocumentOperationException
doc - a document to returndontSelectDocumentWhenComplete - should Geneious select the document when the operation is completeAnnotatedPluginDocument that contains the given PluginDocumentDocumentOperationException - if the document could not be added for some reason.public AnnotatedPluginDocument addDocument(AnnotatedPluginDocument doc, boolean dontSelectDocumentWhenComplete, ProgressListener progress) throws DocumentOperationException
doc - a document to returndontSelectDocumentWhenComplete - should Geneious select the document when the operation is completeAnnotatedPluginDocument or a copy if the document was added to the local database.DocumentOperationException - if the document could not be added for some reason.public void setRemoteJobId(GeneiousService service, String jobId)
service - The location the operation is running. Must not be null.jobId - A unique identifier for a running operation. This identifier must be unique across all jobs for the service.public void setOptionsForActivelyLinkedDescendants(org.jdom.Element optionsElement,
List<AnnotatedPluginDocument> inputDocuments,
List<AnnotatedPluginDocument> additionalParentDocuments)
throws DocumentOperationException
isInterestedInParentDescendants() returns true. If not, then this method won't do anything if you try and use it. Furthermore
if an operation modifies input documents as part of providing parent/descendant functionality (for example adding invisible annotations) then it must not do that if
isInterestedInParentDescendants() returns false.addDocument.
These documents can be recreated later using DocumentOperation.getOptions(org.jdom.Element, java.util.List, java.util.List) in conjunction with a performOperation call.
This method may be called multiple times for different sets of output from the operation. For example when batch creating results, each result may be produced as
an independent parent/descendant data set that can be recreated later independently of other results.optionsElement - an xml form of the options that, when deserialized, allows this operation to be rerun with exactly the same results as when it was first run in this (and any future) version of Geneious, using DocumentOperation.getOptions(org.jdom.Element, java.util.List, java.util.List).
If the options never change between versions of Geneious, and the operation ignores the Sequence Selection, then this is as simple as calling Options.valuesToXML(String) and using Options.valuesFromXML(org.jdom.Element) in DocumentOperation.getOptions(org.jdom.Element, java.util.List, java.util.List).
SequenceSelection if necessary, along with any other relevant information required to completely rerun the operation
exactly. For example, call Options.valuesToXML() and then call setAttribute("version","2.3")
inputDocuments - those parent documents that should be supplied to performOperation as parameters for future runs of the operation. Most of the time this should be the input documents to the operation, except when performing a batch operation.
additionalParentDocuments - those parent documents that shouldn't be supplied directly as parameters to performOperation, but that are supplied via some other mechanism (e.g. DocumentSelectionOption.DocumentChooser)).DocumentOperationException - if there is a problem writing to the databasepublic boolean isInterestedInParentDescendants()
setOptionsForActivelyLinkedDescendants.
You should diverge your code paths so that, for example, any additional work for parent/descendants you do such as creating invisible
annotations on parent documents doesn't get done unnecessarily. If this returns false, then they shouldn't do that or make any other sort of changes to the parent/input documentspublic void stopCreatingOperationRecords()
throws DocumentOperationException
operation records from being created for subsequent documents added using addDocument.
This can be undone for later documents you wish to add by calling setOptionsForActivelyLinkedDescendants(org.jdom.Element, java.util.List, java.util.List) - documents added subsequent to that call will then have records
created in the manner described in by that method.DocumentOperationException - if a problem occurs