Class AbstractMongoDbDocumentUpdate

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, MongoDbDocumentUpdate, Serializable
    Direct Known Subclasses:
    AbstractAppend, AppendStorage, PassThrough, Remove

    public abstract class AbstractMongoDbDocumentUpdate
    extends adams.core.option.AbstractOptionHandler
    implements MongoDbDocumentUpdate
    Ancestor for MongoDB document update schemes.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.flow.core.Actor m_FlowContext
      the context.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected String check​(com.mongodb.client.MongoCollection coll, org.bson.Document doc)
      Hook method for checking the document before updating it.
      protected abstract String doUpdate​(com.mongodb.client.MongoCollection coll, org.bson.Document doc)
      Updates the document.
      adams.flow.core.Actor getFlowContext()
      Returns the context.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      void setFlowContext​(adams.flow.core.Actor value)
      Sets the context.
      String update​(com.mongodb.client.MongoCollection coll, org.bson.Document doc)
      Updates the document.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, defineOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_FlowContext

        protected adams.flow.core.Actor m_FlowContext
        the context.
    • Constructor Detail

      • AbstractMongoDbDocumentUpdate

        public AbstractMongoDbDocumentUpdate()
    • Method Detail

      • setFlowContext

        public void setFlowContext​(adams.flow.core.Actor value)
        Sets the context.
        Specified by:
        setFlowContext in interface adams.flow.core.FlowContextHandler
        Parameters:
        value - the context
      • getFlowContext

        public adams.flow.core.Actor getFlowContext()
        Returns the context.
        Specified by:
        getFlowContext in interface adams.flow.core.FlowContextHandler
        Returns:
        the context, null if none set
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Default implementation returns null.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • check

        protected String check​(com.mongodb.client.MongoCollection coll,
                               org.bson.Document doc)
        Hook method for checking the document before updating it.
        Parameters:
        coll - the collection the document belongs to
        doc - the document to check
        Returns:
        null if successful, otherwise error message
      • doUpdate

        protected abstract String doUpdate​(com.mongodb.client.MongoCollection coll,
                                           org.bson.Document doc)
        Updates the document.
        Parameters:
        coll - the collection the document belongs to
        doc - the document to update
        Returns:
        null if successful, otherwise the error message
      • update

        public String update​(com.mongodb.client.MongoCollection coll,
                             org.bson.Document doc)
        Updates the document.
        Specified by:
        update in interface MongoDbDocumentUpdate
        Parameters:
        coll - the collection the document belongs to
        doc - the document to update
        Returns:
        null if successful, otherwise the error message