psdi.app.recontask.engine

Class ReconLinkProcessor

  • java.lang.Object
    • psdi.app.recontask.engine.ReconLinkProcessor
  • All Implemented Interfaces:
    ReconLinkerI


    public class ReconLinkProcessor
    extends java.lang.Object
    implements ReconLinkerI
    Processes a recon link operation.
    • Field Detail

      • reconInfo

        protected ReconInfo reconInfo
        Contains reference to the recon info class.
      • taskFilter

        protected TaskFilter taskFilter
        Reconciliation task filter if one exists
      • dataSet1ValueSet

        protected ReconValueSet dataSet1ValueSet
        input: the data set 1
      • dataSet2ValueSet

        protected ReconValueSet dataSet2ValueSet
        input: the data set 2
      • cascadingRules

        protected java.util.List cascadingRules
        input: the cascading link rules
      • attributeToIndex1

        protected java.util.Map attributeToIndex1
      • attributeToIndex2

        protected java.util.Map attributeToIndex2
      • unlinkedLeadingDataSetItems

        protected java.util.List unlinkedLeadingDataSetItems
        leading data items that failed to link
      • KEYS_IN_LIST

        protected static final int KEYS_IN_LIST
        numbers of database keys to be grouped for the in() clause of a delete statement
        See Also:
        Constant Field Values
      • saveResult

        protected boolean saveResult
    • Method Detail

      • buildAttributeToIndexMap

        protected java.util.Map buildAttributeToIndexMap(DataSet ds,
                                                         ReconValueSet dsValueSet)
                                                  throws java.rmi.RemoteException,
                                                         MXException
        Method returns a HashMap containing linking between an attribute name and the original attribute name.
        Parameters:
        ds -
        dsValueSet -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • loadTaskFilter

        protected void loadTaskFilter()
                               throws MXException,
                                      java.rmi.RemoteException
        Loads the attributes from the specified task filter.
        Throws:
        MXException
        java.rmi.RemoteException
      • loadData

        protected void loadData()
                         throws MXException,
                                java.rmi.RemoteException,
                                java.sql.SQLException
        Loads data for the linking from the database.
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
      • link

        public java.util.Map[][] link()
                               throws MXException,
                                      java.rmi.RemoteException,
                                      java.sql.SQLException
        Links data from one data set to the data of another data set.
        Specified by:
        link in interface ReconLinkerI
        Returns:
        UIDAndKeys[][] - link results.
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
      • deleteListedKeys

        protected void deleteListedKeys(DBShortcut dbShortcut,
                                        java.lang.String partialDeleteStatement,
                                        java.util.List keyGroup)
                                 throws MXException,
                                        java.sql.SQLException,
                                        java.rmi.RemoteException
        Appends key values to a partial delete statement and executes it. That statement must use only one field name in the where clause and end so that when "=[value]" or "in (value1,value2,...)" are be added to it it becomes valid
        Parameters:
        deleteStatement - - the part of the delete statement to which keys are appended
        keyGroup - - list of key values as String objects
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • deleteFromReconlink

        protected void deleteFromReconlink(DBShortcut dbShortcut,
                                           java.util.Iterator keys)
                                    throws MXException,
                                           java.sql.SQLException,
                                           java.rmi.RemoteException
        Deletes from table reconlink old results.
        Parameters:
        keys - An iterator to a container that contains ReconValue objects - each of them has one key value to be deleted from the reconlink table. The method will figure out whether to use ASSETID or NODEID based on the type of the first element returned by the iterator
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • deleteFromReconMultilink

        protected void deleteFromReconMultilink(DBShortcut dbShortcut,
                                                java.util.Iterator keys)
                                         throws MXException,
                                                java.sql.SQLException,
                                                java.rmi.RemoteException
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • deleteFromLinkTable

        protected void deleteFromLinkTable(java.lang.String tableName,
                                           DBShortcut dbShortcut,
                                           java.util.Iterator keys)
                                    throws MXException,
                                           java.sql.SQLException,
                                           java.rmi.RemoteException
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • getAssetidFieldName

        protected java.lang.String getAssetidFieldName(DataSet dataset)
                                                throws MXException,
                                                       java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • writeLinkSuccessPairs

        protected void writeLinkSuccessPairs(DBShortcut dbShortcut,
                                             java.util.List successfulLinks,
                                             java.util.Map[][] ret)
                                      throws MXException,
                                             java.sql.SQLException,
                                             java.rmi.RemoteException
        Writes out the successfully linked items.
        Parameters:
        dbShortcut - - db connection.
        leadingSet - - the leading set of data.
        ret - - the set of linked items.
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • findAttributeIndex

        protected int findAttributeIndex(java.lang.String attributeName,
                                         boolean forLeadingDataSet)
        Finds the index of an attribute by name.
        Parameters:
        attributeName - - the name of the attribute.
        forLeadingDataSet - - is it for leading or subordinate data set?
        Returns:
        int the index.
      • extractMatchingAttributes

        protected java.util.Set extractMatchingAttributes(java.util.Map matchingAttributeNameByExpression,
                                                          boolean forLeadingDataSet)
        Extracts matching attributes.
        Parameters:
        matchingAttributeNameByExpression -
        Returns:
      • writeLeadingSetErrors

        protected void writeLeadingSetErrors(java.util.List failedLinks,
                                             DBShortcut dbShortcut)
                                      throws MXException,
                                             java.sql.SQLException,
                                             java.rmi.RemoteException
        Writes out the errors from linking the data from the leading set.
        Parameters:
        dbShortcut - - db connection.
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • writeSubordinateSetErrors

        protected void writeSubordinateSetErrors(DBShortcut dbShortcut,
                                                 java.util.List failedLinks)
                                          throws MXException,
                                                 java.sql.SQLException,
                                                 java.rmi.RemoteException
        Writes out the errors from linking data from the subordinate data set.
        Parameters:
        dbShortcut - - db connection.
        Throws:
        MXException
        java.sql.SQLException
        java.rmi.RemoteException
      • writeLinkPhaseOutputs

        protected java.util.Map[][] writeLinkPhaseOutputs(ReconValueSet leadingSet)
                                                   throws MXApplicationException,
                                                          java.rmi.RemoteException
        Writes the outputs of the linking phase.
        Parameters:
        leadingSet - - the leading set of data to link.
        Returns:
        UIAndKeys object array of arrays containing linking results.
        Throws:
        MXApplicationException
        java.rmi.RemoteException
      • processLeadingSet

        protected void processLeadingSet(ReconValueSet leadingSet,
                                         SubordinateSetAttribute[] subordinateSetAttributes)
                                  throws MXException
        Does the actual linking of leading set and subordinate set.
        Parameters:
        leadingSet - - the leading set of the data to link.
        subordinateSetAttributes - - the set of attributes for the subordinate set.
        Throws:
        MXException
      • registerMultilinkedData

        protected void registerMultilinkedData(java.util.Map multilinkedSet,
                                               ReconValue multilinkedObject,
                                               ReconLinkExpression cascadingRule)
        Registers data which got multiple linkings.
        Parameters:
        multilinkedSet - - data multilinked.
        multilinkedObject - - a multilinked object.
        cascadingRule - - a cascading rule.
      • extractSubordinateSetAttributes

        protected SubordinateSetAttribute[] extractSubordinateSetAttributes(ReconValueSet subordinateDataSet)
        Builds an array of attribute sets - one element for every separate attribute. Does not modify the subordinate set itself.
        Parameters:
        subordinateDataSet -
        Returns:
        See Also:
        psdi.app.recontask.engine.ValueSet.preprocessAttributes
      • isSaveResult

        public boolean isSaveResult()
      • setSaveResult

        public void setSaveResult(boolean saveResult)
      • getLinkResult

        public LinkResult getLinkResult()
      • getUnlinked

        public java.util.List getUnlinked()