Skip to main content

Why does WriteableDatabaseService.moveDocument(doc,progList) not move my Document?

Comments

7 comments

  • Matthew Cheung

    Hi Stephan,

    Have the results documents you're creating already been added to the database? If not then they need to be added to it rather than moved.

    You can do this with the addDocumentCopy() method.

    If they're in the database already then can you tell me if you're getting an exception or if the move method is returning false?

    Cheers,
    Matthew

    0
  • Stephan Janosch

    I never knew that I need to add a document to a DB. Will try this.

     

    Thx,
    Stephan

    0
  • Matthew Cheung

    Hi Stephan,

    Just to clarify, Geneious core will handle the results from many of our plugin types and add them to the database for you.  You will only need to manually add them if you want to do something that is not currently supported by the API or if you are writing a type of plugin that does not normally have output.

    For example if you're writing a DocumentOperation then any documents you add to the OperationCallback or are returned in the result list are automatically added to the same folder as the input documents.

    If you need a subfolder you can use DocumentOperation.OperationCallback.setSubFolder(String name) and any results will be added to the subfolder.

    However if you want to do something more complex like saving documents to an unrelated folder then you will have to add them manually.

    Cheers,
    Matthew

    0
  • Stephan Janosch

    But according to the documentation I should not use performOperation.

    0
  • Geneious Team

     Hi Stephan,

    There are multiple variants of performOperation that have different signatures.  You should be able to use one of the other variants to achieve what you need.

    If you're implementing one of the variants that does not use the OperationCallback then you just need to return the document in the list.

    If you tell me what type of plugin/class you are implementing then I can probably help more.

    Cheers,
    Matthew

    P.S. The advice there is to not use it to avoid any problems in future versions of Geneious.  We'll remove that particular performOperation method in the next major version of the API (not the next version of Geneious).  Something to keep in mind is that our API has stayed on the same major version for the last 9 years.

    0
  • Stephan Janosch

    Case is closed! 

    A fresh start on Monday resolves some of strangest issues. 

    For other help seekers I document the solution below:

     @Override
    public void performOperation(AnnotatedPluginDocument[] annotatedDocuments, ProgressListener progressListener, Options options, SequenceSelection sequenceSelection, OperationCallback callback) throws DocumentOperationException
    {
    ....

    DocumentOperation primerOperation = PluginUtilities.getDocumentOperation("Operation_com.biomatters.plugins.primerDesign.DesignAnnotationGenerator");

    ...

    try {
    callback.setSubFolder("primed sequences");
    } catch (DatabaseServiceException e) {
    e.printStackTrace();
    }

    primerOperation.performOperation(new AnnotatedPluginDocument[]{document},ProgressListener.EMPTY,primerOperationOptions,sequenceSelection,callback);

    }


    Thanks for all the helpful comments Matthew!
    Stephan

    0
  • Matthew Cheung

    That's great!  Glad you got it working.

    0

Please sign in to leave a comment.