psdi.configure

Class Validate

    • Field Detail

      • upgMessageFile

        protected java.lang.String upgMessageFile
        The input filename for the Upgrade Messages, MaxMessages.xliff.
      • inFileNameDefault

        protected java.lang.String inFileNameDefault
        The input filename for metadata and system data changes, MetaDoc.xml.
      • inputFile

        protected java.io.File inputFile
        The input file for metadata and system data changes (MetaDoc.xml).
      • xmlfile

        protected java.lang.String xmlfile
        The xml file for metadata and system data changes (MetaDoc.xml).
      • msgFile

        protected java.io.File msgFile
        The input file for metadata and system data changes (MetaDoc.xml).
      • inMetaFileNameDefault

        protected java.lang.String inMetaFileNameDefault
        The input filename for metadata structure changes, MetaFormat.sql.
      • inputMetaFile

        protected java.io.File inputMetaFile
        The fully qualified filename for metadata structure changes, MetaFormat.sql.
      • indexDir

        protected java.lang.String indexDir
        The directory containing the default Maximo index definition files.
      • promptDir

        protected java.lang.String promptDir
        Top-level directory for any user input files
    • Constructor Detail

      • Validate

        public Validate()
      • Validate

        public Validate(MXServer server)
        This constructor accepts parameter for MXServer and sets value for mxs. Used when invoked from the Config application.
    • Method Detail

      • getIntRepair

        public final boolean getIntRepair()
        Return true if running the Integrity Checker in Repair mode.
      • doSql

        public void doSql(java.util.AbstractList list)
                   throws java.sql.SQLException
        Traverse an array and execute each sql statement in sequence. The attempt is to save time by creating and closing only one Statement() instance.

        Parameters:
        list - List of SQL statements to execute.
        Throws:
        java.sql.SQLException -

        See Also:
        Validate.doSql(java.util.AbstractList)
      • doSqlCount

        public int doSqlCount(java.lang.String sql)
                       throws java.lang.Exception
        Executes the SQL statement and returns the number of records updated. Looks at params to determine whether the execute only, log only, or both execute and log.
        Parameters:
        sql - The Sql statement
        Returns:
        The number of records updated.
        Throws:
        java.lang.Exception
        See Also:
        CommonShell.doSql(java.util.List)
      • logWarning

        public void logWarning(java.lang.String msg,
                               java.util.AbstractList list)
        Display a warning message followed by a list of offending objects.

        Parameters:
        msg - The warning message to be displayed.
        list - The list of errant objects (Names of tables, columns, etc).

        See Also:
        Validate.logWarning(java.lang.String, java.lang.String)
      • logError

        public void logError(java.lang.String msg,
                             java.util.AbstractList list)
        Display an error message followed by a list of offending objects.

        Parameters:
        msg - The error message to be displayed.
        list - The list of errant objects (Names of tables, columns, etc).

        See Also:
        Validate.logError(java.lang.String, java.lang.String)
      • doSqlTruncate

        public void doSqlTruncate(java.lang.String tableName)
                           throws java.lang.Exception
        Delete all rows in a database table.

        Parameters:
        tableName - The name of the database table to truncate.
        Throws:
        java.lang.Exception
      • sameVersion

        public static boolean sameVersion(java.lang.String needVersion,
                                          java.lang.String haveVersion)
        Verify the version of the database is correct. The database vesrion, stored as maxvar MAXUPG, must match the database version specified in MetaDoc.xml. Database version and build/patch are numbers, so convert the string parameters to numbers and compare. This is the same method as sameVersion
        Parameters:
        needVersion - Version stamp in MetaDoc.xml
        haveVersion - Version stamp of this database
        Returns:
        true if the versions match numerically
      • errorsFound

        public boolean errorsFound()
        Identifies whether errors were found by the integrity and/or validation checker.

        Returns:
        true if any errors were detected.
      • warningsFound

        public boolean warningsFound()
        Identifies whether warnings were found by the integrity and/or validation checker.

        Returns:
        true if any warnings were generated.
      • setUpgradeCallout

        public void setUpgradeCallout(java.lang.String val)
        This is called from Upgrade so that upgradeCallout can determine which subdirectory contains the class files that indicate special processing for this upgrade. Sets value of calloutSubdir.
        Parameters:
        val - name of the subdirectory (ie, database version)
      • setRoot

        public void setRoot(org.jdom2.Element root)
                     throws java.lang.Exception
        Set the XML root to the passed value.
        Parameters:
        root - the root Element in the XML file.
        Throws:
        java.lang.Exception
      • validateCallout

        public void validateCallout(java.lang.String methodName,
                                    java.lang.String methodPlace,
                                    java.lang.String objectname)
                             throws java.lang.Exception
        Various points provide hooks for calling specialized methods to perform any version-specific validation checks or processing. Each of these hooks is identified by the method it is called from and the table name currently being processed (if any).

        The name of the class being called is "Valid" + methodName + methodPlace + tbname. For example, if this is called from method rebuildTable, place 01, table Item, then the name of this class would be:
        ValidRebuildTable01ITEM

        The subdirectory containing these classes is identified by calloutSubdir.

        The class should be extended from UpgTemplate. If the class is not found, there is no error. If the class needs to exit the validation process, it should throw an error.

        Parameters:
        methodName - The name of the method that is invoking this hook. Required.
        methodPlace - If the method provides more than one hook, each hook needs an identifier. If the method provides only one hook, this will be null.
        objectname - The object name currently being processed. If object name is not relevant to the calling method, this will be null.
        Throws:
        java.lang.Exception
        See Also:
        UpgTemplate
      • logWarning

        public final void logWarning(java.lang.String msg)
        Display a one-line warning message to the console and to the logfile.
        Parameters:
        msg - The warning message to be displayed.
      • endSetupInstance

        public void endSetupInstance(java.lang.String outdir,
                                     java.lang.String outfile,
                                     java.util.HashMap params)
                              throws java.lang.Exception
        Finish setup tasks specific to Validate. Overrides CommonShell method. Called from endSetup process -m, -n parameters, set values for inputFile, inputMetaFile.

        Overrides:
        endSetupInstance in class CommonShell
        Parameters:
        outdir - Directory from -d parameter, used when instantiating files inputFile and inputMetaFile.
        outfile - Output filename - not used
        params - HashMap of input parameters - not used (see class javadocs).
        Throws:
        java.lang.Exception
      • endProcessInstance

        public void endProcessInstance()
                                throws java.lang.Exception
        Called from endProcess for any additional end-process functionality. Close the lis output.
        Overrides:
        endProcessInstance in class CommonShell
        Throws:
        java.lang.Exception
      • setupInstance

        public void setupInstance(java.util.HashMap params)
                           throws java.lang.Exception
        Finish setup tasks specific to Validate. Overrides CommonShell method. Called from setupInstance Until we find a reason for execute mode off, force execute mode on
        Overrides:
        setupInstance in class CommonShell
        Parameters:
        params - HashMap of input parameters, where key = the parameter identifier (for example, -u) and value = the value of the parameter (for example, SMITH). If there is no value, it should equal the empty string "". See javadocs for the list of parameters for this class.
        Throws:
        java.lang.Exception
      • setup

        public void setup(java.util.HashMap params)
                   throws java.lang.Exception
        Overwrite CommonShell#setup. Necessary to set the correct path for properties directory.
        Overrides:
        setup in class CommonShell
        Parameters:
        HashMap - of parameters passed to the class.
        Throws:
        java.lang.Exception
        See Also:
        CommonShell.setup(java.util.HashMap)
      • getListStream

        public java.io.PrintStream getListStream()
                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setValidateLogger

        public void setValidateLogger(java.io.PrintStream os,
                                      java.io.PrintStream ls)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • endProcess

        public void endProcess(boolean errors)
                        throws java.lang.Exception
        Close the connection, deregister the driver.
        Overrides:
        endProcess in class CommonShell
        Parameters:
        errors - True if ended with errors
        Throws:
        java.lang.Exception
        See Also:
        Validate.endProcessInstance()
      • loadMessageCacheSub

        protected void loadMessageCacheSub(java.lang.String msggroup)
                                    throws java.lang.Exception
        Load {#messageCache messageCache} with messages from database using msggroup provided in the parameter. Override commonshell.
        Overrides:
        loadMessageCacheSub in class CommonShell
        Parameters:
        msggroup - The value to use for maxmessages.msggroup when reading from this table.
        Throws:
        java.lang.Exception
      • getDisplayMessage

        public java.lang.String getDisplayMessage(java.lang.String errorkey)
        Call getDisplayMessage with null second param. Error group is assumed to be "configdb".
        Overrides:
        getDisplayMessage in class CommonShell
        Parameters:
        errorkey -
        Returns:
        String of message.
      • report

        public void report(Report report)
                    throws java.lang.Exception
        Description copied from interface: ReportCollector
        Called when there is some issue to report.
        Specified by:
        report in interface ReportCollector
        Throws:
        java.lang.Exception