psdi.archive.procclass

Class ConvertXML

  • All Implemented Interfaces:
    MosConstants


    public class ConvertXML
    extends MosDefinitionImpl
    XML outbound class to read the XML code and generate the Optim code
    • Constructor Detail

      • ConvertXML

        public ConvertXML()
                   throws MXException,
                          java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • readXML

        protected void readXML(byte[] serializedData)
                        throws MXException
        Reads the XML code and search for all the MAXRELATIONSHIP elements
        Parameters:
        serializedData - Gives the XML byte code
        Throws:
        MXException - Throws Maximo's Exceptions
      • createOptimCode

        protected void createOptimCode(java.util.List maxRelList,
                                       org.jdom2.Namespace nameSpace)
                                throws MXException
        Receives all the MAXRELATIONSHIP elements and the namespace to generate the Optim code
        Parameters:
        maxRelList - Gives all the MAXRELATIONSHIP elements
        nameSpace - Gives the respective namespace used by the XML code
        Throws:
        MXExceptions - Throws Maximo's Exceptions
        MXException
      • validateWhereclause

        protected boolean validateWhereclause(java.lang.String whereClause)
        Checks if the WHERECLAUSE element is valid to be converted
        Parameters:
        whereClause - Gives the WHERECLAUSE element
        Returns:
        true or false Returns true if the WHERECLAUSE element is invalid and false if it's valid
      • formatConstraint

        protected java.lang.String formatConstraint(java.lang.String constraint)
        Formats the constraint name to be shorter than 18 characters
        Parameters:
        constraint - Gives the constraint name
        Returns:
        constraint Returns the constraint shorter than 18 characters
      • formatWhereclause

        protected java.lang.String formatWhereclause(java.lang.String whereClause)
        Formats the WHERECLAUSE element Switches the order of the conditions: i.e: A=B,C=D to B=A,D=C Places double quotes in the constants
        Parameters:
        whereClause - Gives the WHERECLAUSE element
        Returns:
        newWhereClause Returns the WHERECLAUSE converted to Optim format
      • saveTxtFile

        protected void saveTxtFile(java.lang.String optimCode)
                            throws MXException
        Generates and saves the text file
        Parameters:
        optimCode - Gives the Optim code to be wrote in the text file
        Throws:
        MXException
      • getPath

        protected java.lang.String getPath()
        Gets the path specified in the "globaldir" Maximo's property and creates a folder called "Archive" if it doesn't exist
        Returns:
        fileDir Returns the path to save the text file
      • getFileName

        protected java.lang.String getFileName()
        Generates a name to the text file
        Returns:
        Returns the name to be used in the nomenclature of the text file
      • generateUniqueID

        protected java.lang.String generateUniqueID()
        Gets the current time in milliseconds and a random number in the 1000000 range and concatenates both numbers
        Returns:
        uniqueId Returns the random number generated