Class ImportEntryProcessor.ImportEntryProcessRunnable

  • All Implemented Interfaces:
    Runnable
    Direct Known Subclasses:
    VariantChDescUpdateProcessor.VariantChDescUpdateRunnable
    Enclosing class:
    ImportEntryProcessor

    public abstract static class ImportEntryProcessor.ImportEntryProcessRunnable
    extends Object
    implements Runnable
    The default implementation of the ImportEntryProcessRunnable. It performs the following actions:
    • able to get new ImportEntry records while the processing of other ImportEntry records happens.
    • processes the ImportEntry, creates a new OBContext based on the user data of the ImportEntry
    • makes sure that there is a VariablesSecureApp in the RequestContext.
    • OBContexts are temporary cached in a WeakHashMap
    • the process checks the ImportEntry status just before it is processed, it also prevents the same ImportEntry to be processed twice by one thread
    • each ImportEntry is processed in its own connection and transaction. Note that the class delegates into the implementing subclass the ability of handling the commit/rollback of the transaction. But in order to prevent possible connection leaks, this class closes all the opened connections (if any) before ending.
    • the process sets admin mode, before calling the subclass
    • an error which ends up in the main loop here is stored in the ImportEntry in the errorInfo property
    • subclasses implement the processEntry(ImportEntry) method.
    Author:
    mtaal
    • Constructor Detail

      • ImportEntryProcessRunnable

        public ImportEntryProcessRunnable()
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
      • doRunCycle

        protected void doRunCycle()
      • getImportEntryQueue

        protected Queue<org.openbravo.service.importprocess.ImportEntryProcessor.ImportEntryProcessRunnable.QueuedEntry> getImportEntryQueue()
      • setOBContext

        protected void setOBContext​(org.openbravo.service.importprocess.ImportEntryProcessor.ImportEntryProcessRunnable.QueuedEntry queuedEntry)
      • getProcessIdForAudit

        protected String getProcessIdForAudit()
        Returns the identifier to be set for this process for audit trail:
        • It can be, at most, 32 characters length
        • If an AD_Message entry with the same value exists, it will be used in UI
      • setVariablesSecureApp

        protected void setVariablesSecureApp​(OBContext obContext)
      • cleanUpThreadForNextCycle

        protected void cleanUpThreadForNextCycle()
      • processEntry

        protected abstract void processEntry​(ImportEntry importEntry)
                                      throws Exception
        Must be implemented by a subclass. Note subclass implementation must perform a commit and close (OBDal.commitAndClose()) at the end of the processEntry, before it returns. So that at the end of processing there should not an active Session anymore the implementor is responsible for correctly closing any open session/transaction. A warning will be logged if this is somehow forgotten.
        Throws:
        Exception
      • setImportEntryManager

        public void setImportEntryManager​(ImportEntryManager importEntryManager)
      • setKey

        public void setKey​(String key)
      • setImportEntryProcessor

        public void setImportEntryProcessor​(ImportEntryProcessor importEntryProcessor)
      • getKey

        public String getKey()