psdi.app.recontask.engine

Class ReconCompResult

  • java.lang.Object
    • psdi.app.recontask.engine.ReconCompResult


  • public class ReconCompResult
    extends java.lang.Object
    ReconCompResult hold result information such as Fail/Success code, attribute names and root values for both dataset1 and dataset2. This class provide the utility to merge the results in case of multiple AND/OR clause.
    • Field Detail

      • MAIN_ATTRIBUTE_NAME

        public static final java.lang.String MAIN_ATTRIBUTE_NAME
        See Also:
        Constant Field Values
      • MAIN_ATTRIBUTE_VALUE

        public static final java.lang.String MAIN_ATTRIBUTE_VALUE
        See Also:
        Constant Field Values
      • MAIN_ATTRIBUTE_DATETIME_VALUE

        public static final java.lang.String MAIN_ATTRIBUTE_DATETIME_VALUE
        See Also:
        Constant Field Values
      • MAIN_ATTRIBUTE_MEASURE_UNIT

        public static final java.lang.String MAIN_ATTRIBUTE_MEASURE_UNIT
        See Also:
        Constant Field Values
      • successful

        protected boolean successful
        does the object refer to a successful or to a failed condition?
      • isVoid

        protected boolean isVoid
      • resultType

        protected int resultType
      • ruleName

        protected java.lang.String ruleName
      • code

        protected java.lang.String code
      • rootValue1

        protected java.util.Map rootValue1
      • rootValue2

        protected java.util.Map rootValue2
      • dataSet1Attributes

        protected java.util.HashMap dataSet1Attributes
      • dataSet2Attributes

        protected java.util.HashMap dataSet2Attributes
    • Constructor Detail

      • ReconCompResult

        public ReconCompResult(ReconInfo reconInfo,
                               java.lang.String dataSet1ObjectName,
                               java.lang.String dataSet2ObjectName)
      • ReconCompResult

        public ReconCompResult(ReconInfo reconInfo,
                               java.lang.String dataSet1ObjectName,
                               java.lang.String dataSet2ObjectName,
                               int resultType)
      • ReconCompResult

        public ReconCompResult(ReconInfo reconInfo,
                               java.lang.String objectName,
                               int resultType)
                        throws java.security.InvalidParameterException
        Throws:
        java.security.InvalidParameterException
    • Method Detail

      • init

        protected void init(java.lang.String dataSet1ObjectName,
                            java.lang.String dataSet2ObjectName,
                            int resultType)
      • getResultType

        public int getResultType()
        Returns:
        Returns the resultType.
      • getCode

        public java.lang.String getCode()
        Returns:
        Returns the code.
      • setCode

        public void setCode(java.lang.String code)
        Parameters:
        code - The code to set.
      • getRuleName

        public java.lang.String getRuleName()
        Returns:
        Returns the ruleName.
      • setRuleName

        public void setRuleName(java.lang.String ruleName)
        Parameters:
        ruleName - The ruleName to set.
      • isSuccessful

        public boolean isSuccessful()
        Returns:
        Returns the successful.
      • setSuccessful

        public void setSuccessful(boolean successful)
        Parameters:
        successful - The successful to set.
      • addDataSet1Attribute

        public void addDataSet1Attribute(java.lang.String attributeName,
                                         java.lang.Object attributeValue)
      • getDataSet1Attribute

        public java.lang.Object getDataSet1Attribute(java.lang.String attributeName)
      • addDataSet2Attribute

        public void addDataSet2Attribute(java.lang.String attributeName,
                                         java.lang.Object attributeValue)
      • getDataSet2Attribute

        public java.lang.Object getDataSet2Attribute(java.lang.String attributeName)
      • resolveResult

        protected static ReconCompResult resolveResult(ReconCompResult r1,
                                                       ReconCompResult r2,
                                                       boolean success)
        Decides how to construct the output - if both inputs are successful or failed at the same time, join them. If only one is successful, use it (success beats failure)
        Parameters:
        r1 -
        r2 -
        Returns:
        r1 or r2 if it is the only successful result, otherwise joinResults(r1, r2)
      • resolveItem

        public static java.lang.Object resolveItem(java.lang.Object item1,
                                                   java.lang.Object item2)
        Compare Items and return the first item if both are equal otherwise return null
        Parameters:
        item1 -
        item2 -
        Returns:
        pick the first item only if both object are equal; null otherwise
      • joinResults

        protected static ReconCompResult joinResults(ReconCompResult r1,
                                                     ReconCompResult r2)
        Join Result First to find which result is superseded the other result then return the super result. Otherwise if both results failed and weight equally then return the first result. If both result are success, merge the results. In the case of multiple clauses, and all success, each clause has different attributes, then the attribute will be left blank.
        Parameters:
        r1 -
        r2 - Assumes r1.resultType is equal to r2.resultType
        Returns:
        joined result
      • joinAttribute

        protected static void joinAttribute(ReconCompResult res,
                                            ReconCompResult res1,
                                            ReconCompResult res2,
                                            java.lang.String attributeName,
                                            boolean isDataSet1)
        Utility method - Join attributes
        Parameters:
        res - - return join result
        res1 - - first result
        res2 - - second result
        attributeName - - attribute name that is going to join
        isDataSet1 - - is this attribute in dataset1?
      • prepare

        public void prepare(java.util.Map linkValue1,
                            java.util.Map linkValue2)
                     throws MXException,
                            java.rmi.RemoteException
        Prepare - set Root Information for the result and their ID and keys.
        Parameters:
        linkValue1 - - link value1
        linkValue2 - - link value2
        Throws:
        MXException
        java.rmi.RemoteException
      • setIDAndKeys

        public void setIDAndKeys(java.util.Map idKey1,
                                 java.util.Map idKey2,
                                 boolean isRoot)
                          throws MXException,
                                 java.rmi.RemoteException
        setID And Keys for the result
        Parameters:
        idKey1 - - dataset1 key
        idKey2 - - dataset2 key
        isRoot - - set ID and Keys for root?
        Throws:
        MXException
        java.rmi.RemoteException
      • setIDAndKeys

        public void setIDAndKeys(ResultTableAttributes attributes,
                                 java.util.Map idKey,
                                 boolean isRoot,
                                 boolean isDataSet1)
                          throws MXException,
                                 java.rmi.RemoteException
        setID And Keys for the result
        Parameters:
        attributes - - attributes
        idKey2 - - keys
        isRoot - - is Root
        Throws:
        MXException
        java.rmi.RemoteException
      • setVoid

        public void setVoid(boolean isVoid)
      • isVoid

        public boolean isVoid()
      • getRootValue1

        public java.util.Map getRootValue1()
      • setRootValue1

        public void setRootValue1(java.util.Map rootValue1)
      • getRootValue2

        public java.util.Map getRootValue2()
      • setRootValue2

        public void setRootValue2(java.util.Map rootValue2)
      • isSameAs

        public boolean isSameAs(ReconCompResult anotherResult)
        Compare if the current result is the same as another result. This assumes that the 2 results are from the same comparison off of the same root, thus the rule info and the root info are already the same
        Parameters:
        anotherResult - - another Result
        Returns:
        true if this result is the same as another result.
      • sameValue

        public boolean sameValue(java.lang.Object o1,
                                 java.lang.Object o2)
        Compare two objects if they are the same. If object1 and object2 is null then they are the same.
        Parameters:
        o1 - - Object1
        o2 - - Object2
        Returns:
        true if the current object1 is the same as object2.
      • isSupersede

        public boolean isSupersede(ReconCompResult anotherResult)
        Error Code C6 (attribute equal comparison has failed) supersedes the following error codes: C7 (No Asset object for attribute equality comparison) C8 (No Deployed Asset object for attribute equality comparison) C9 (No Asset and Deployed Asset object for attribute equality comparison)
        Parameters:
        anotherResult - - another result
        Returns:
        true if the current object is supersede the passed in result.