psdi.mbo

Class MboQbe

  • java.lang.Object
    • psdi.mbo.MboQbe
  • All Implemented Interfaces:
    FixedLoggerNames, FixedLoggers
    Direct Known Subclasses:
    ComputerSystemQbe


    public class MboQbe
    extends java.lang.Object
    implements FixedLoggers
    QBE stands for "Query by Example". QBE provides a way for the user define the records they want to look at. Generally the user enters a value in a field which is used to create a where clause which is used in turn to fetch records from the database.

    Last Updated: Wednesday, January 10, 2001

    • Constructor Detail

      • MboQbe

        public MboQbe(MboSetInfo ms,
                      boolean processML,
                      UserInfo userInfo)
        Construct the Query, attached to a certain MboSet with default Locale
      • MboQbe

        public MboQbe(MboSetInfo ms,
                      java.util.Locale l,
                      java.util.TimeZone tz,
                      boolean ml,
                      UserInfo userInfo)
        Construct the Query, attached to a certain MboSet with specified Locale
    • Method Detail

      • addSubQbe

        public void addSubQbe(java.lang.String name,
                              java.lang.String[] attributes,
                              java.lang.String op,
                              boolean exactMatch)
        Add a child QBE object to this QBE. The where clause constructed for the QBEs of the specified attribute will follow the properties of the child QBE. The operator and whether it is exact match can be different than the the parent QBE. You only need to create a child QBE if the exact match or operator is different than the parent QBE.
        Parameters:
        name - The name of the child QBE. It is used to identify the sub qbe within this QBE.
        attributes - An array of attributes when setQbe is called, the control of constructing the where clause will be passed down to the child QBE.
        operator - The AND or OR operator of the child QBE.
        exactMatch - Whether the child QBE is exact match or not.
      • addSubQbe

        public void addSubQbe(java.lang.String name,
                              java.lang.String[] attributes,
                              java.lang.String operator)
        Add a child QBE object to this QBE. The where clause constructed for the QBEs of the specified attribute will follow the properties of the child QBE. The operator can be different than the the parent QBE. Everything else will be the same as the parent QBE.
        Parameters:
        name - The name of the child QBE. It is used to identify the sub qbe within this QBE.
        attributes - An array of attributes when setQbe is called, the control of constructing the where clause will be passed down to the child QBE.
        operator - The AND or OR operator of the child QBE.
      • addAttributeInSubQbe

        protected void addAttributeInSubQbe(MboQbe subQbe,
                                            java.lang.String attribute)
        Convenient internal method to register attributes to be controlled by a child QBE.
        Parameters:
        subQbe -
        attribute -
      • setCaseSensitive

        public void setCaseSensitive(boolean state)
        Set QBE to be case sensitive or not. Default is to be case sensitive
      • isCaseSensitive

        public boolean isCaseSensitive()
        Is the query case sensitive ?
      • setOperatorOr

        public void setOperatorOr()
        Sets the operator to "OR".
      • setOperatorAnd

        public void setOperatorAnd()
        Sets the operator to "AND".
      • getOperator

        public java.lang.String getOperator()
        Returns the operator.
      • setExactMatch

        public void setExactMatch(boolean state)
        Should there be an exact match when Querying ? Default is NO.
      • isExactMatch

        public boolean isExactMatch()
        Does the query look for exact matches ?
      • ignoreQbeExactMatchSet

        public void ignoreQbeExactMatchSet(boolean flag)
        method needed for UI to ignore QBE exact match set
      • isIgnoreQbeExactMatchSet

        public boolean isIgnoreQbeExactMatchSet()
        is flag set to ignore QBE exact match set
      • setLocale

        public void setLocale(java.util.Locale l,
                              java.util.TimeZone t)
        Set the locale and Timezone to use when parsing dates from the user. The default locale is ALWAYS used for building the SQL Date/Time expressions.
      • setQbe

        public void setQbe(java.lang.String[] attr,
                           java.lang.String exp)
        Sets a bunch of QBEs at the same time. All expressions are ORed together and if an expression cannot be applied to one of the columns, it is ignored. This method is used for a keyword type search.
      • setQbe

        public void setQbe(java.lang.String[] attr,
                           java.lang.String[] exp)
        Sets a bunch of QBEs at the same time. Sets the attributename and the corresponding value.
      • setQbe

        public void setQbe(java.lang.String attr,
                           java.lang.String[] exp)
                    throws MXException
        Throws:
        MXException
      • setQbe

        public void setQbe(java.lang.String attr,
                           java.lang.String expr)
                    throws MXException
        Set the QBE expression for the specified attribute. If there is already a QBE for this field, it is replaced ! If the expr parameter is null or empty, the QBE removed for that attribute.
        Parameters:
        attribute - The attribute to set the QBE on.
        expr - The expression to use, i.e. "= 'BOILER'"
        Throws:
        MXSystemException - Group "System", key "noattribute" if attribute is not found in the MboSet.
        MXException
      • setWhereQbe

        public void setWhereQbe(java.lang.String attrStr,
                                java.lang.String value,
                                java.lang.String clause)
                         throws MXException
        Sets the where clause for the QBE.
        Parameters:
        attrStr -
        original - Value
        where - clause replaced for the original value.
        Throws:
        MXException
      • getAllQbeKeys

        public java.util.Enumeration getAllQbeKeys()
        Get all the qbe field
        Returns:
      • getQbe

        public java.lang.String getQbe(java.lang.String attrStr)
                                throws MXException
        Get the Qbe for a certain attrbiute. Will return the empty string if there is no associated Qbe for the specified attribute.
        Throws:
        MXException
      • getQbe

        public java.lang.String[][] getQbe()
        Get array of Qbe for a attrbiutes. Will return the null if there is no associated Qbe.
      • resetQbe

        public void resetQbe()
        Reset the QBE and start again.
      • getWhere

        public java.lang.String getWhere()
                                  throws MXException
        Get the SQL where clause associated with the Qbe.
        Throws:
        MXException
      • getWhere

        public java.lang.String getWhere(java.lang.String alias)
                                  throws MXException
        Get the SQL where clause associated with the Qbe.
        Parameters:
        alias - The table alias to prefix to the attribute name
        Throws:
        MXException