psdi.app.recontask.engine.dataset

Class CommonDataSet

  • java.lang.Object
    • psdi.app.recontask.engine.dataset.CommonDataSet
  • All Implemented Interfaces:
    DataSet
    Direct Known Subclasses:
    ActualCIDataSet, AssetDataSet, CIDataSet, DPADataSet


    public abstract class CommonDataSet
    extends java.lang.Object
    implements DataSet
    This class provides implementation of some common functions for the DataSet interface. It's designed to be extended by data set providers for convenience. This is an abstract class. Not all methods defined in the DataSet interface are implemented.
    • Field Detail

      • datasetName

        protected java.lang.String datasetName
      • objectSpecPairs

        protected java.lang.String[][] objectSpecPairs
      • rootClassStructureId

        protected java.lang.String rootClassStructureId
      • filterClause

        protected java.lang.String filterClause
    • Constructor Detail

      • CommonDataSet

        public CommonDataSet()
    • Method Detail

      • setContext

        public void setContext(DataSetContext context)
        Saves the ReconContext object passed in to a protected data member context to be used by sub-classes.
        Specified by:
        setContext in interface DataSet
        Parameters:
        context - The ReconContext passed in from recon engine.
        See Also:
        DataSet.setContext
      • getDataSetName

        public java.lang.String getDataSetName()
        Description copied from interface: DataSet
        Returns the data set name that's assign to the data set by the engine through setDataSetName().
        There is no need to implement this method if the data set class extends CommonDataSet.
        Specified by:
        getDataSetName in interface DataSet
        Returns:
        The data set name that's assign to the data set by the engine.
        See Also:
        DataSet.getDataSetName
      • setDataSetName

        public void setDataSetName(java.lang.String datasetName)
        Saves the ReconContext object passed in to a protected data member datasetName.
        Specified by:
        setDataSetName in interface DataSet
        Parameters:
        datasetName - The name that's assigned to this data set.
        See Also:
        DataSet.setDataSetName
      • getMainObjectPrimaryKeys

        public java.lang.String[] getMainObjectPrimaryKeys()
                                                    throws MXException,
                                                           java.rmi.RemoteException
        Retrieves the primary key attributes of the main object from Maximo meta data.
        Specified by:
        getMainObjectPrimaryKeys in interface DataSet
        Returns:
        The primary key names in a String array.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        DataSet.getMainObjectPrimaryKeys
      • getMainObjectUID

        public java.lang.String getMainObjectUID()
                                          throws java.rmi.RemoteException
        Retrieves the unique ID of the main object from Maximo meta data.
        Specified by:
        getMainObjectUID in interface DataSet
        Returns:
        The unique ID.
        Throws:
        java.rmi.RemoteException
        See Also:
        DataSet.getMainObjectUID
      • getObjectUID

        public java.lang.String getObjectUID(java.lang.String objectName)
                                      throws MXException,
                                             java.rmi.RemoteException
        Retrieves the unique ID of a given object from Maximo meta data. getMainObjectUID() is called if the object name passed in is the same as the main object name.
        Specified by:
        getObjectUID in interface DataSet
        Parameters:
        objectName - The object name whose unique ID is to be obtained
        Returns:
        The unique ID of the object
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        DataSet.getObjectUID
      • getUID

        protected java.lang.String getUID(java.lang.String objectName)
                                   throws java.rmi.RemoteException
        Helper function to retrieve unique ID of a given object from Maximo meta data.
        Parameters:
        objectName - The name of the object whose UID is to be retrieved
        Returns:
        The unique of the object
        Throws:
        java.rmi.RemoteException
      • getMasterForSpec

        public java.lang.String getMasterForSpec(java.lang.String objectname)
        Implementation that searches the object-spec pairs obtained from getObjectSpecPairs() and returns the master object name for the matching spec name.
        Specified by:
        getMasterForSpec in interface DataSet
        Parameters:
        objectname - The name of the spec object whose master object name is to be obtained
        Returns:
        The master object name, or null if the name passed in as parameter is not a spec object.
        See Also:
        DataSet.getMasterForSpec
      • getSpecForMaster

        public java.lang.String getSpecForMaster(java.lang.String objectname)
        Implementation that searches the object-spec pairs obtained from getObjectSpecPairs() and returns the spec name for the matching master object name.
        Specified by:
        getSpecForMaster in interface DataSet
        Parameters:
        objectname - The name of the master object whose spec object name is to be obtained
        Returns:
        The spec object name, or null if the name passed in as parameter is not a master object.
        See Also:
        DataSet.getSpecForMaster
      • getFixedTaskFilterWhereClause

        public java.lang.String getFixedTaskFilterWhereClause()
                                                       throws MXException,
                                                              java.rmi.RemoteException,
                                                              java.sql.SQLException
        Returns the where clause for filtering the main object to ensure that it's classtructureid, if there is one, is a decendant of the root classtructureid as defined in a maxvar. The data set providers that extend this class should and the return of this class with the one it generates itself.
        Specified by:
        getFixedTaskFilterWhereClause in interface DataSet
        Returns:
        The global where clause for filtering in link, or null if none is to be defined.
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
        See Also:
        DataSet.getFixedTaskFilterWhereClause
      • buildClassStructureFilteringWhere

        protected java.lang.String buildClassStructureFilteringWhere(java.lang.String objectName)
                                                              throws MXException,
                                                                     java.rmi.RemoteException,
                                                                     java.sql.SQLException
        Build the where clause for filtering the object to ensure that it's classtructureid, if there is one, is a decendant of the root classtructureid as defined in a maxvar.
        Parameters:
        objectName -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
      • getRootClassstructureID

        public java.lang.String getRootClassstructureID(java.lang.String objectName)
                                                 throws MXException,
                                                        java.rmi.RemoteException
        Helpers function that retrieves the root class structure id for a given object, using the maxvar that's defined for it.
        Specified by:
        getRootClassstructureID in interface DataSet
        Parameters:
        objectName - The name of the object whose root class structure id is to be retrieved
        Returns:
        The root class structure id
        Throws:
        MXException
        java.rmi.RemoteException
      • readMaxVar

        public java.lang.String readMaxVar(java.lang.String varName,
                                           boolean hasDefaultValue)
                                    throws MXException,
                                           java.rmi.RemoteException
        Get value of maxvar from database. This presumes there is no orgid or siteid constraint.
        Parameters:
        varname - Name of the maxvar.
        getDefault - If True, gets default value of maxvar from maxvartype table. If False, gets value of maxvar from maxvars table, with orgid and siteid both null.
        Returns:
        The value of the maxvar.
        Throws:
        MXException
        java.rmi.RemoteException
      • getRootSpecMaxVar

        public abstract java.lang.String getRootSpecMaxVar(java.lang.String objectname)
        In many cases the root classstructure id for class specs of a data set is defined in a maxvar. If so the classs can make use of the implementation of the getRootClassstructureID in CommonDataSet. Data set classes that extends the CommonDataSet will only need to implement this method to provide the name of the maxvar. It won't have to implement the getRootClassstructureID method itself.
        Parameters:
        objectName - The name of the object whose root class structure id is to be retrieved
        Returns:
        The name of the maxvar which defines the root class structure id
      • getTableJoinWhereClauseForComparison

        public java.lang.String getTableJoinWhereClauseForComparison(java.lang.String tableName,
                                                                     java.util.Map uidKeys)
                                                              throws MXException,
                                                                     java.rmi.RemoteException,
                                                                     java.sql.SQLException
        Throws IllegalArgumentException exception
        Specified by:
        getTableJoinWhereClauseForComparison in interface DataSet
        Parameters:
        tableName - The name of the table from which data is to be retrieved.
        uidKeys - The key values of the main table. this should at least include the unique IDs and primary key values. This parameter maps attribute names to attribute values.
        Returns:
        The where clause that joins the table and the main object table.
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
        See Also:
        DataSet.getTableJoinWhereClauseForComparison
      • getTableNameForTaskFilter

        public java.lang.String getTableNameForTaskFilter(java.lang.String attributeName)
        Returns main object name.
        Specified by:
        getTableNameForTaskFilter in interface DataSet
        Parameters:
        attributeName - The attribute name whose table name is inquired
        Returns:
        The true table column of the attribute, which may or may not be the same as main table name.
        See Also:
        DataSet.getTableNameForTaskFilter
      • getTableColumnNameForTaskFilter

        public java.lang.String getTableColumnNameForTaskFilter(java.lang.String attributeName)
        Sinmply returns the attributeName itself.
        Specified by:
        getTableColumnNameForTaskFilter in interface DataSet
        Parameters:
        attributeName - The attribute name whose table column name is inquired
        Returns:
        The true table column of the attribute, which may or may not be the same as the attribute itself.
        See Also:
        DataSet.getTableColumnNameForTaskFilter
      • getExtraTableNamesForComparison

        public java.lang.String[] getExtraTableNamesForComparison(java.lang.String tableName)
        Returns null.
        Specified by:
        getExtraTableNamesForComparison in interface DataSet
        Parameters:
        tableName - The name of the table from which data is to be retrieved.
        Returns:
        The list of names of extra tables that might be involved, or null if none is needed.
        See Also:
        DataSet.getExtraTableNamesForComparison
      • getTableJoinWhereClauseForTaskFilter

        public java.lang.String getTableJoinWhereClauseForTaskFilter(java.lang.String tableName)
        Returns null.
        Specified by:
        getTableJoinWhereClauseForTaskFilter in interface DataSet
        Parameters:
        tableName - The name of the table that needs to be joined with the main table.
        Returns:
        The SQL where clause that joins the table in the parameter and the main table. Return null if the table name is the same as the main table.
        See Also:
        DataSet.getTableJoinWhereClauseForTaskFilter
      • getRecordCount

        public int getRecordCount(java.util.Map uidKeys,
                                  java.lang.String objectName,
                                  java.lang.String classStructureID)
                           throws MXException,
                                  java.rmi.RemoteException,
                                  java.sql.SQLException
        Returns -1.
        Specified by:
        getRecordCount in interface DataSet
        Parameters:
        uidKeys - The top level main object key values for this comparison.
        objectName - The name of the table to be counted.
        classStructureID - The class structure ID if the table involved is a spec object
        Returns:
        record count of the given table, or -1 if the data set doesn't provide a special counting method.
        Throws:
        MXException
        java.rmi.RemoteException
        java.sql.SQLException
        See Also:
        DataSet.getRecordCount
      • isUnitOfMeasureAllowed

        public boolean isUnitOfMeasureAllowed(java.lang.String objectName)
        Determines whether the dataset allows use of the "Unit of Measure" attribute for all or part of its subtypes.
        Specified by:
        isUnitOfMeasureAllowed in interface DataSet
        Parameters:
        objectName - The name of a subset.
        Returns:
        boolean Whether or not the use of the "Unit of Measure" attribute is allowed.
      • getTheOtherDataSet

        protected DataSet getTheOtherDataSet()
      • getTaskFilterClause

        public java.lang.String getTaskFilterClause()
        Description copied from interface: DataSet
        Set a where clause to add to the task filter
        Specified by:
        getTaskFilterClause in interface DataSet
      • setTaskFilterClause

        public void setTaskFilterClause(java.lang.String filterClause)
        Specified by:
        setTaskFilterClause in interface DataSet
      • getReconLinker

        public ReconLinkerI getReconLinker()
        Description copied from interface: DataSet
        whether the data set wants to handle linking...
        Specified by:
        getReconLinker in interface DataSet
        Returns: