psdi.app.recontask.engine.write

Class ReconResultWriter

  • All Implemented Interfaces:
    ResultWriter


    public final class ReconResultWriter
    extends AbstractResultWriter
    Class provides functionality to write out results of linking/recon to the reconresult table of the MAXIMO application's database schema.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected java.lang.String buildCacheQuery(java.lang.String resultTypeExt)
      Builds a SELECT statement to retrieve existing data from table reconresult based on values for recontaskid, resulttype, rulename, ancestorassetnum
      protected SqlFormat buildUpdateQuery(java.lang.Object reconResultId)
      Constructs the SQL UPDATE statement to update an existing row in table reconresult for the given unique recon result identifier.
      protected void cacheExistingReconResults(DBShortcut dbShortcut, java.lang.String resultTypeExt)
      Retrieves and caches existing reconciliation results for comparison rules
      int getDataType(java.lang.String tableName, java.lang.String columnName)
      Returns the datatype of the column name present in table.
      protected java.lang.Number getReconResultId(DBShortcut dbShortcut)
      Retrieves the reconresultid column value from the database based on the values from the execution of the recontask
      protected java.util.Map getReconResultsFromCache()
      Retrieves existing reconciliation results from cache based on the values generated from this cron task execution
      java.lang.String getTableName()
      Returns the name of the recon result table.
      java.lang.String getUIDColumnname()
      Returns the unique identifier of the unique id column.
      protected boolean isTypeComparison(java.lang.String resultType)
      Tests if the given reconciliation type is comparison.
      protected java.lang.String prepareWhereClause(java.lang.String attribute, java.lang.String value, int index)
      Builds a WHERE clause based on whether or not the attribute contains a nullable value
      void setValue(java.lang.String attributeName, java.lang.Object attributeValue)
      Sets the value for an attribute to be written out to the table.
      void write(DBShortcut dbShortcut)
      Writes out the values to the reconresult table.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReconResultWriter

        public ReconResultWriter()
    • Method Detail

      • getTableName

        public java.lang.String getTableName()
        Returns the name of the recon result table.
        Specified by:
        getTableName in class AbstractResultWriter
        Returns:
        the name of the table.
      • getUIDColumnname

        public java.lang.String getUIDColumnname()
        Returns the unique identifier of the unique id column.
        Specified by:
        getUIDColumnname in class AbstractResultWriter
      • getReconResultId

        protected java.lang.Number getReconResultId(DBShortcut dbShortcut)
                                             throws MXException,
                                                    java.rmi.RemoteException
        Retrieves the reconresultid column value from the database based on the values from the execution of the recontask
        Parameters:
        dbShortcut -
        Returns:
        Number The reconciliation result ID
        Throws:
        MXException
        java.rmi.RemoteException
      • isTypeComparison

        protected boolean isTypeComparison(java.lang.String resultType)
        Tests if the given reconciliation type is comparison.
        Parameters:
        resultType - The type of reconciliation result
        Returns:
        boolean True if the reconciliation result is a comparison; false otherwise
      • getReconResultsFromCache

        protected java.util.Map getReconResultsFromCache()
        Retrieves existing reconciliation results from cache based on the values generated from this cron task execution
        Returns:
        Map Reconciliation results (attributes and values) if found in cache; otherwise null
      • cacheExistingReconResults

        protected void cacheExistingReconResults(DBShortcut dbShortcut,
                                                 java.lang.String resultTypeExt)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Retrieves and caches existing reconciliation results for comparison rules
        Parameters:
        dbShortcut -
        Throws:
        MXException
        java.rmi.RemoteException
      • buildCacheQuery

        protected java.lang.String buildCacheQuery(java.lang.String resultTypeExt)
                                            throws MXException,
                                                   java.rmi.RemoteException
        Builds a SELECT statement to retrieve existing data from table reconresult based on values for recontaskid, resulttype, rulename, ancestorassetnum
        Parameters:
        resultTypeExt - The translated resulttype
        Returns:
        String SQL SELECT statement
        Throws:
        MXException
        java.rmi.RemoteException
      • prepareWhereClause

        protected java.lang.String prepareWhereClause(java.lang.String attribute,
                                                      java.lang.String value,
                                                      int index)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Builds a WHERE clause based on whether or not the attribute contains a nullable value
        Parameters:
        attribute - Name of the reconciliation result attribute
        value - The value associated with the attribute
        index - The index of the attribute name within the map of all reconciliation result attributes
        Returns:
        String The SQL WHERE clause
        Throws:
        MXException
        java.rmi.RemoteException
      • setValue

        public void setValue(java.lang.String attributeName,
                             java.lang.Object attributeValue)
                      throws MXException,
                             java.rmi.RemoteException
        Sets the value for an attribute to be written out to the table.
        Specified by:
        setValue in interface ResultWriter
        Overrides:
        setValue in class AbstractResultWriter
        Parameters:
        attributeName - - the name of the attribute.
        attributeValue - - the value that goes with the attribute name.
        Throws:
        MXException - - throws by the method.
        java.rmi.RemoteException - - thrown by the method.
      • write

        public void write(DBShortcut dbShortcut)
                   throws java.rmi.RemoteException,
                          MXException
        Writes out the values to the reconresult table.
        Specified by:
        write in interface ResultWriter
        Overrides:
        write in class AbstractResultWriter
        Parameters:
        dbShortcut - - the db connection provider.
        Throws:
        java.rmi.RemoteException - - thrown by the method.
        MXException - - thrown by the method.
      • buildUpdateQuery

        protected SqlFormat buildUpdateQuery(java.lang.Object reconResultId)
                                      throws MXException,
                                             java.rmi.RemoteException
        Constructs the SQL UPDATE statement to update an existing row in table reconresult for the given unique recon result identifier. The columns to be updated are changedby and changedate.
        Parameters:
        reconResultId - Unique identifier for table reconresult
        Returns:
        SqlFormat Object that can be executed
        Throws:
        MXException
        java.rmi.RemoteException