Package Express.services

Source Code of Express.services.Error

/*
Copyright (c) 2003-2009 ITerative Consulting Pty Ltd. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

o Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
 
o Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
   
o This jcTOOL Helper Class software, whether in binary or source form may not be used within,
or to derive, any other product without the specific prior written permission of the copyright holder

 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


*/
package Express.services;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;

import DisplayProject.binding.beans.ExtendedPropertyChangeSupport;
import DisplayProject.binding.beans.Observable;
import Framework.Constants;
import Framework.DataValue;
import Framework.ErrorMgr;
import Framework.FrameworkUtils;
import Framework.GenericException;
import Framework.ImplementationException;
import Framework.LogMgr;
import Framework.MsgCatalog;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;

/**
* This class appears in the project, but is for internal use only and is not documented.
* <p>
* @author ITerative Consulting
* @since  26-Feb-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@SuppressWarnings({ "serial", "deprecation" })
public class Error
        implements Serializable, Observable
{

    // ---------
    // Constants
    // ---------
    public static final int B_CANT_DELETE = 4;
    public static final int B_CANT_UPDATE = 6;
    public static final int B_ILLEGAL_ATTR = 5;
    public static final int B_INCONSISTENT_STATE = 7;
    public static final int BC_CANNOT_REVERT = 16;
    public static final int BC_CANNOT_SAVE = 26;
    public static final int BC_HAS_MGR = 10;
    public static final int BC_NIL_SOURCE = 11;
    public static final int BC_NOT_REVERTABLE = 12;
    public static final int BC_TOO_LATE_TO_SAVEFORREVERT = 28;
    public static final int BM_CANT_CHANGE_DB = 14;
    public static final int BM_CANT_UPDATE = 18;
    public static final int BM_ILLEGAL_ATTR_IN_KEY = 308;
    public static final int BM_NEED_FOREIGN_KEY = 13;
    public static final int BM_NO_UPDATE = 315;
    public static final int BM_TOO_MANY_ROWS = 317;
    public static final int BQ_ATTR_NOT_FOREIGN = 19;
    public static final int BQ_ATTR_NOT_SIMPLE = 15;
    public static final int BQ_CANT_RESET = 22;
    public static final int BQ_CANT_RESET_OP = 20;
    public static final int BQ_CONS_CANT_USE_DATE_WITH_IN = 21;
    public static final int BQ_CONS_DUP_ORDERBY_ATTR = 23;
    public static final int BQ_CONS_ILLEGAL = 29;
    public static final int BQ_CONS_ILLEGAL_OP = 51;
    public static final int BQ_CONS_ONLYNOT = 25;
    public static final int BQ_CONS_OP_NEEDS_VALUE = 27;
    public static final int BQ_CONS_OP_PROHIBITS_VALUE = 53;
    public static final int BQ_ILLEGAL_ACTION_FOR_OP = 24;
    public static final int BQ_ILLEGAL_ATTR = 57;
    public static final int BQ_ILLEGAL_FOREIGN_OP = 31;
    public static final int BQ_ILLEGAL_OPERATION = 35;
    public static final int BQ_ILLEGAL_TABLE_INDEX = 33;
    public static final int BQ_INCONSISTENT_OP = 34;
    public static final int BQ_NEED_QUERY = 17;
    public static final int BQ_PARENT_ATTR_NOT_SET = 36;
    public static final int BQ_SETOP_NEED_KEY_FOR_UPDATE = 37;
    public static final int BQ_SETOP_NO_KEY_ON_INSERT = 39;
    public static final int BQ_SETOP_NO_KEY_ON_SELECT = 41;
    public static final int BQ_WRONG_ENTITY = 45;
    public static final int BS_ILLEGAL_BM = 59;
    public static final int BS_UNKNOWN_BM = 314;
    public static final int CC_CACHE_ILLEGAL = 43;
    public static final int CC_HAS_MGR = 42;
    public static final int CC_ILLEGAL_CLIENTID = 40;
    public static final int CC_ILLEGAL_TRANS_MODE = 49;
    public static final int CC_NEEDS_MGR = 44;
    public static final int CM_AGGREGATE_CHANGED = 38;
    public static final int CM_AGGREGATES_INSERTED = 50;
    public static final int CM_CANNOT_CHANGE_MODE = 303;
    public static final int CM_CLASS_CHANGED = 46;
    public static final int CM_DROPPING_LOCKED_KEY = 307;
    public static final int CM_ILLEGAL_CACHE_MODE = 301;
    public static final int CM_ILLEGAL_CLIENT_ID = 304;
    public static final int CM_ILLEGAL_CONCURRENCY_MODE = 302;
    public static final int CM_KEY_NOT_UNIQUE = 54;
    public static final int CM_NEGATIVE_REF_COUNT = 306;
    public static final int CM_NO_ORIGINAL = 52;
    public static final int CM_NO_TRANSACTION = 30;
    public static final int CM_TRANSACTION_IN_PROGRESS = 32;
    public static final int GEN_NIL_PARAMETER = 61;
    public static final int GEN_UNIMPLEMENTED = 1;
    public static final int LAST_ERROR = 81;
    public static final int NIL_PARAMETER = 48;
    public static final int QC_CONSTRAINT_STACK_EMPTY = 310;
    public static final int QC_CUSTOM_AND_DB_ATTR = 305;
    public static final int QC_ILLEGAL_CONSTRAINT_NODE = 309;
    public static final int QC_ILLEGAL_TABLE_INDEX = 318;
    public static final int QC_NEED_ATTR_NODE = 311;
    public static final int QC_NEED_OPERATION_NODE = 316;
    public static final int QC_NEED_SQLDATA_NODE = 313;
    public static final int QC_NEED_VALUE_NODE = 312;
    public static final int SQL_ILLEGAL_CONSTRAINT_OPERATOR = 65;
    public static final int SQL_ILLEGAL_FOR_OPERATION = 56;
    public static final int SQL_NEED_VALUE = 55;
    public static final int SQL_OPERATION_UNINITIALIZED = 66;
    public static final int SS_CACHE_IN_USE = 74;
    public static final int SVC_MSGSET_ID = 3;

    // ----------
    // Attributes
    // ----------
    public PropertyChangeSupport qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
    private int error;
    private String methodName;
    private Object originator;
    private Object param1;
    private Object param2;
    private int msgSetID;
    private MsgCatalog _Catalog;

    // ------------
    // Constructors
    // ------------
    public Error() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.error = 0;
        this.methodName = null;
        this.originator = null;
        this.param1 = null;
        this.param2 = null;
        this.msgSetID = 0;
        this._Catalog = null;
    }

    public static class qq_Resolver {
      public static final int cERROR_METHODNAME_ORIGINATOR = 1;
        public static final int cERROR_METHODNAME_ORIGINATOR_PARAM1 = 2;
        public static final int cERROR_METHODNAME_ORIGINATOR_PARAM2 = 3;
        public static final int cERROR_METHODNAME_ORIGINATOR_PARAM1_PARAM2 = 4;
        public static final int cEND = 5;
    };

    public Error(int pError, String pMethodName, Object pOriginator) {
        this();
        this.setError( pError );
        this.setMethodName( pMethodName );
        this.setOriginator( pOriginator );
    }

    public Error(int pError, String pMethodName, Object pOriginator, int pResolver) {
        this();
        if (pResolver == Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR) {
          this.setError( pError );
          this.setMethodName( pMethodName );
          this.setOriginator( pOriginator );
        }
    }

    public Error(int pParam1, String pParam2, Object pParam3, Object pParam4, int pResolver) {
        this();
        if (pResolver == Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1) {
            this.setError( pParam1 );
            this.setMethodName( pParam2 );
            this.setOriginator( pParam3 );
            this.setParam1( pParam4 );
        }
        else if (pResolver == Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM2) {
            this.setError( pParam1 );
            this.setMethodName( pParam2 );
            this.setOriginator( pParam3 );
            this.setParam2( pParam4 );
        }
    }

    public Error(int pError, String pMethodName, Object pOriginator, Object pParam1, Object pParam2) {
        this();
        this.setError( pError );
        this.setMethodName( pMethodName );
        this.setOriginator( pOriginator );
        this.setParam1( pParam1 );
        this.setParam2( pParam2 );
    }

    public Error(int pError, String pMethodName, Object pOriginator,
        Object pParam1, Object pParam2,
      int pResolver) {
    this();
    if (pResolver == Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1_PARAM2) {
         this.setError( pError );
            this.setMethodName( pMethodName );
            this.setOriginator( pOriginator );
            this.setParam1( pParam1 );
            this.setParam2( pParam2 );
           
    }
    }

  // ----------------------
    // Accessors and Mutators
    // ----------------------
    public void setError(int error) {
        int oldValue = this.error;
        this.error = error;
        this.qq_Listeners.firePropertyChange("error", oldValue, this.error);
    }

    public int getError() {
        return this.error;
    }

    public void setMethodName(String methodName) {
        String oldValue = this.methodName;
        this.methodName = methodName;
        this.qq_Listeners.firePropertyChange("methodName", oldValue, this.methodName);
    }

    public String getMethodName() {
        return this.methodName;
    }

    public void setOriginator(Object originator) {
        Object oldValue = this.originator;
        this.originator = originator;
        this.qq_Listeners.firePropertyChange("originator", oldValue, this.originator);
    }

    public Object getOriginator() {
        return this.originator;
    }

    public void setParam1(Object param1) {
        Object oldValue = this.param1;
        this.param1 = param1;
        this.qq_Listeners.firePropertyChange("param1", oldValue, this.param1);
    }

    public Object getParam1() {
        return this.param1;
    }

    public void setParam2(Object param2) {
        Object oldValue = this.param2;
        this.param2 = param2;
        this.qq_Listeners.firePropertyChange("param2", oldValue, this.param2);
    }

    public Object getParam2() {
        return this.param2;
    }

    public void setMsgSetID(int msgSetID) {
        int oldValue = this.msgSetID;
        this.msgSetID = msgSetID;
        this.qq_Listeners.firePropertyChange("msgSetID", oldValue, this.msgSetID);
    }

    public int getMsgSetID() {
        return this.msgSetID;
    }

    // ------------------
    // Virtual attributes
    // ------------------
    // -------------------------------------------------
    // (Virtual) Attribute Catalog
    // -------------------------------------------------
    public MsgCatalog getCatalog() {
        return this.qq_getCatalog();
    }

    // -------
    // Methods
    // -------
    public void addPropertyChangeListener(String property, PropertyChangeListener listener) {
        qq_Listeners.addPropertyChangeListener(property, listener);
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        qq_Listeners.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(String property, PropertyChangeListener listener) {
        qq_Listeners.removePropertyChangeListener(property, listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        qq_Listeners.removePropertyChangeListener(listener);
    }

    /**
     * qq_getCatalog<p>
     * Method renamed by jcTOOL from GetCatalog to qq_getCatalog
     * because it conflicted with an attribute<p>
     * <p>
     * @return MsgCatalog
     */
    public MsgCatalog qq_getCatalog() {
        if (this._Catalog == null) {
            this._Catalog = MsgCatalog.getInstance("exmsg");
        }

        return this._Catalog;
    }

    /**
     * getCatalogMessage<p>
     * <p>
     * @param error Type: int
     * @return String
     */
    public String getCatalogMessage(int error) {
        String message = this.getCatalog().getString(this.getMsgSetID(), error, "qqUNKNOWN_MSG");

        if ("qqUNKNOWN_MSG".equals(message)) {
            message = this.getMessage(error);
        }

        return message;
    }

    /**
     * getException<p>
     * GetException<br>
     *     The GetException method returns an exception based upon the attributes<br>
     *     of the Error class.<br>
     * <p>
     *     Attribute  Use<br>
     *     ---------  ---<br>
     *     Error    A unique index which specifies details about the error to<br>
     *           be raised like the text of the error message, exception<br>
     *           class, etc.  Error > 300 are given the reasonCode<br>
     *           SP_ER_UNKNOWN.  Odd errors < 300 are given the reasonCode<br>
     *           SP_ER_PARAMETERERROR.  Even errors < 300 are given the<br>
     *           reasonCode SP_ER_INVALIDSTATE<br>
     *     MethodName  The name of the method raising the error.<br>
     *     Originator  The object raising the error.<br>
     *     Param1    A parameter to be substituted into the text of the error<br>
     *           message.<br>
     *     Param2    Another parameter to be substituted into the text of the<br>
     *           error message.<br>
     * <p>
     *     Returns<br>
     *       The exception instantiated.<br>
     * <p>
     *   Unused codes:<br>
     *    58, 60, 61, 62, 63, 64, 67, 68, 69, 70, 71, 72, 73<br>
     * <p>
     * @return GenericException
     */
    public GenericException getException() {
        GenericException e = null;
        int severity = Constants.SP_ER_ERROR;
        int reasonCode = 0;
        String message = null;
        TextData key = null, status = null;
        DataValue p1 = null, p2 = null;

        if (this.getMsgSetID() == 0) {
            this.setMsgSetID(Error.SVC_MSGSET_ID);
        }

        if (this.getParam1() != null && this.getParam1() instanceof DataValue) {
            p1 = (DataValue)this.getParam1();
        }

        if (this.getParam2() != null && this.getParam2() instanceof DataValue) {
            p2 = (DataValue)this.getParam2();
        }

        if (this.getOriginator() != null && this.getOriginator() instanceof BusinessClass) {
            status = ((BusinessClass)this.getOriginator()).statusAsTextData();
            if (((BusinessClass)this.getOriginator()).getInstanceKey() != null) {
                key = ((BusinessClass)this.getOriginator()).getInstanceKey().asTextData();
            }
        }
        else if (this.getParam1() != null && this.getParam1() instanceof BusinessClass) {
            status = ((BusinessClass)this.getParam1()).statusAsTextData();
            if (((BusinessClass)this.getParam1()).getInstanceKey() != null) {
                key = ((BusinessClass)this.getParam1()).getInstanceKey().asTextData();
            }
        }

        reasonCode = Constants.SP_ER_INVALIDSTATE;
        if (this.getError() > 300) {
            reasonCode = 0;
        }
        else if ((this.getError()&1) > 0) {
            reasonCode = Constants.SP_ER_PARAMETERERROR;
        }

        message = this.getCatalogMessage(this.getError());

        if (message == null) {
            e = new UsageException();
            if (this.getParam2() != null) {
                message = this.getCatalog().getString(this.getMsgSetID(), 75, this.getMessage(75));
            }
            else if (this.getParam1() != null) {
                message = this.getCatalog().getString(this.getMsgSetID(), 76, this.getMessage(76));
            }
            else {
                message = this.getCatalog().getString(this.getMsgSetID(), 77, this.getMessage(77));
            }
        }

        if (this.getMsgSetID() == Error.SVC_MSGSET_ID) {
            switch (this.getError()) {

                case Error.GEN_UNIMPLEMENTED: {
                    e = new ImplementationException();
                    if (this.getParam1() != null) {
                        this.setParam2(this.getParam1());
                        message = this.getCatalog().getString(this.getMsgSetID(), 2, this.getMessage(2));
                    }
                    if (this.getMethodName() == null) {
                        p1 = new TextData(this.getCatalog().getString(this.getMsgSetID(), 3, this.getMessage(3)));
                    }
                    else {
                        p1 = new TextData(this.getMethodName());
                    }

                    break;
                }
                case Error.B_CANT_DELETE: {
                    p1 = key;
                    p2 = status;

                    break;
                }
                case Error.B_CANT_UPDATE: {
                    p1 = key;
                    p2 = status;

                    break;
                }
                case Error.B_ILLEGAL_ATTR: {
                    p1 = key;

                    break;
                }
                case Error.B_INCONSISTENT_STATE: {
                    e = new ImplementationException();
                    p1 = key;
                    p2 = status;
                    if (this.getOriginator() != null && this.getOriginator() instanceof BusinessClass) {
                        if (((BusinessClass)this.getOriginator()).getUpdateQuery() == null) {
                            message = this.getCatalog().getString(this.getMsgSetID(), 8, this.getMessage(8));
                        }
                        else {
                            message = this.getCatalog().getString(this.getMsgSetID(), 9, this.getMessage(9));
                        }
                    }

                    break;
                }
                case Error.BC_NOT_REVERTABLE: {
                    this.setParam1(this.getOriginator());

                    break;
                }
                case Error.BC_CANNOT_REVERT: {
                    this.setParam1(this.getOriginator());

                    break;
                }
                case Error.BC_CANNOT_SAVE: {
                    p1 = key;
                    p2 = status;

                    break;
                }
                case Error.BC_TOO_LATE_TO_SAVEFORREVERT: {
                    p1 = key;
                    p2 = status;

                    break;
                }
                case Error.BM_NO_UPDATE: {
                    if (this.getParam1() != null && this.getParam1() instanceof BusinessKey) {
                        p1 = ((BusinessKey)this.getParam1()).asTextData();
                    }
                    if (this.getParam2() == null) {
                        p2 = new TextData();
                    }

                    break;
                }
                case Error.BS_UNKNOWN_BM: {
                    p2 = new TextData(this.getOriginator().getClass().getSimpleName());

                    break;
                }
                case Error.CM_CLASS_CHANGED: {
                    e = new ExpressConcurrencyException(reasonCode);
                    if (this.getParam1() != null && this.getParam1() instanceof BusinessKey) {
                        p1 = ((BusinessKey)this.getParam1()).asTextData();
                    }
                    if (this.getParam2() == null) {
                        p2 = new TextData();
                    }

                    break;
                }
                case Error.CM_AGGREGATE_CHANGED: {
                    if (key != null) {
                        p1 = key;
                    }
                    else {
                        p1 = this.getCatalog().getTextData(this.getMsgSetID(), Error.NIL_PARAMETER, new TextData(this.getMessage(Error.NIL_PARAMETER)));
                    }

                    break;
                }
                case Error.CM_NO_ORIGINAL: {
                    if (this.getParam1() != null && this.getParam1() instanceof BusinessQuery && ((BusinessQuery)this.getParam1()).getKey() != null) {
                        p1 = ((BusinessQuery)this.getParam1()).getKey().asTextData();
                    }
                    else {
                        p1 = this.getCatalog().getTextData(this.getMsgSetID(), Error.NIL_PARAMETER, new TextData(this.getMessage(Error.NIL_PARAMETER)));
                    }

                    break;
                }
                case Error.CM_KEY_NOT_UNIQUE: {
                    if (this.getParam1() != null && this.getParam1() instanceof BusinessKey) {
                        p1 = ((BusinessKey)this.getParam1()).asTextData();
                    }
                    else {
                        p1 = this.getCatalog().getTextData(this.getMsgSetID(), Error.NIL_PARAMETER, new TextData(this.getMessage(Error.NIL_PARAMETER)));
                    }

                    break;
                }
                case Error.CM_NEGATIVE_REF_COUNT: {
                    if (this.getParam2() != null && this.getParam2() instanceof BusinessKey) {
                        p2 = ((BusinessKey)this.getParam2()).asTextData();
                    }
                    else {
                        p2 = this.getCatalog().getTextData(this.getMsgSetID(), Error.NIL_PARAMETER, new TextData(this.getMessage(Error.NIL_PARAMETER)));
                    }

                    break;
                }
                case Error.CM_DROPPING_LOCKED_KEY: {
                    if (this.getParam2() != null && this.getParam2() instanceof BusinessKey) {
                        p2 = ((BusinessKey)this.getParam2()).asTextData();
                    }
                    else {
                        p2 = this.getCatalog().getTextData(this.getMsgSetID(), Error.NIL_PARAMETER, new TextData(this.getMessage(Error.NIL_PARAMETER)));
                    }

                    break;
                }
            }
        }

        if (e == null) {
            e = new UsageException(reasonCode, UsageException.qq_Resolver.cREASONCODE);
        }

        if (p1 == null && this.getParam1() != null) {
            if (this.getParam1() instanceof DataValue) {
                p1 = (DataValue)this.getParam1();
            }
            else {
                p1 = new TextData(this.getParam1().getClass().getSimpleName());
            }
        }

        if (p2 == null && this.getParam2() != null) {
            if (this.getParam2() instanceof DataValue) {
                p2 = (DataValue)this.getParam2();
            }
            else {
                p2 = new TextData(this.getParam2().getClass().getSimpleName());
            }
        }

        e.setWithParams(severity, new TextData(message), p1, p2);

        TextData detectingMethod = new TextData();
        if (this.getOriginator() != null) {
            detectingMethod.concat(this.getOriginator().getClass().getSimpleName());
            detectingMethod.concat(this.getCatalog().getString(this.getMsgSetID(), 78, this.getMessage(78)));
        }
        else {
            detectingMethod.concat(this.getCatalog().getString(this.getMsgSetID(), 79, this.getMessage(79)));
        }
        if (this.getMethodName() != null) {
            detectingMethod.concat(this.getMethodName());
        }
        else {
            detectingMethod.concat(this.getCatalog().getString(this.getMsgSetID(), 80, this.getMessage(80)));
        }
        e.setDetectingMethod(detectingMethod.toString());

        if (LogMgr.getInstance().test(Constants.SP_MT_CONFIGURATION, Constants.SP_ST_EX, Trace.CFG_ADDSTACKTRACE, 1) && !(LogMgr.getInstance().test(Constants.SP_MT_CONFIGURATION, 2, 1, 1))) {
            e.getMessageText().concat(FrameworkUtils.traceBack());
        }

        ErrorMgr.addError(e);

        return e;
    }

    /**
     * getMessage<p>
     * <p>
     * @param error Type: int
     * @return String
     */
    public String getMessage(int error) {
        switch (error) {

            case Error.GEN_UNIMPLEMENTED: {
                return "The method %1 is unimplemented.  It should be implemented in a generated class.";

            }
            case 2: {
                return "The method %1 with parameters (%2) is unimplemented.  It should be implemented in a generated class.";

            }
            case 3: {
                return "<unknown>";

            }
            case Error.B_CANT_DELETE: {
                return "A BusinessClass with Key = %1 has Status = %2 and cannot be deleted.";

            }
            case Error.B_ILLEGAL_ATTR: {
                return "The attribute %2 is illegal for BusinessClass with Key = %1";

            }
            case Error.B_CANT_UPDATE: {
                return "A BusinessClass with Key = %1 has Status = %2 and cannot be updated.";

            }
            case Error.B_INCONSISTENT_STATE: {
                return "A BusinessClass with Key = %1 is in an inconsistent state.  Status = %2.";

            }
            case 8: {
                return "A BusinessClass with Key = %1 is in an inconsistent state.  Status = %2 but it should be ST_EMPTY, ST_READONLY, or ST_READWRITE.";

            }
            case 9: {
                return "A BusinessClass with Key = %1 is in an inconsistent state.  Status = %2 but it should be ST_INSERT, ST_UPDATE, or ST_DELETE.";

            }
            case Error.BC_HAS_MGR: {
                return "SetMgr can only be invoked once.  This should be done automatically by the BusinessClient.  Check to make sure that you are using a BusinessClient.";

            }
            case Error.BC_NIL_SOURCE: {
                return "The source parameter is NIL.  It should contain a BusinessClass.";

            }
            case Error.BC_NOT_REVERTABLE: {
                return "%1 is not revertable.  The Revert method cannot be used unless the Revertable attribute is set and it must be set before you attempt to modify a BusinessClass using the LogAttr or Delete methods.";

            }
            case Error.BM_NEED_FOREIGN_KEY: {
                return "Your query referenced the foreign attribute %1, but did not request all the attributes which comprise the foreign key for that foreign attribute.  Attribute %2 must be added to your query (e.g. query.AddAttr(attr=%2)).";

            }
            case Error.BM_CANT_CHANGE_DB: {
                return "Once a BusinessMgr has been assigned a DB Session it can't be changed.";

            }
            case Error.BQ_ATTR_NOT_SIMPLE: {
                return "The attribute index %1 is not for a simple attribute.  A foreign attribute may not be used in this context.";

            }
            case Error.BC_CANNOT_REVERT: {
                return "%1 cannot revert an element of the source array.  %1 probably did not have the Revertable attribute set when the element was modified.  Revertable must be set before you attempt to modify a BusinessClass using the LogAttr or Delete methods.";

            }
            case Error.BQ_NEED_QUERY: {
                return "You must speicfy a query parameter for the foreign attribute %1.";

            }
            case Error.BM_CANT_UPDATE: {
                return "Foreign classes cannot be updated.";

            }
            case Error.BQ_ATTR_NOT_FOREIGN: {
                return "The attribute index %1 is not for a foreign attribute.  A foreign attribute must be used in this context.";

            }
            case Error.BQ_CANT_RESET_OP: {
                return "SetOperation can only be invoked once.  The operation is already set to %1 and cannot be set to %2.";

            }
            case Error.BQ_CONS_CANT_USE_DATE_WITH_IN: {
                return "Cannot use dates with the \"in\" operator.";

            }
            case Error.BQ_CANT_RESET: {
                return "Only querries for Select can be reset.";

            }
            case Error.BQ_CONS_DUP_ORDERBY_ATTR: {
                return "The attribute index %1 being added as an \"order by\" constraint has already been added.";

            }
            case Error.BQ_ILLEGAL_ACTION_FOR_OP: {
                return "The method being invoked is not allowed on BusinessQuery's of type %1.";

            }
            case Error.BQ_CONS_ONLYNOT: {
                return "The constraint \"%1\" ends in \"not\".  \"not\" must be followed by a value.";

            }
            case Error.BC_CANNOT_SAVE: {
                return "Cannot use SaveForRevert on the BusinessClass with key %1 because it is in the %2 state.";

            }
            case Error.BQ_CONS_OP_NEEDS_VALUE: {
                return "The operator specified (%1) for attribute %2 requires a value.  Only ConstraintOperation values: OP_ORDERBY, OP_ORDERBY_DESC, OP_NULL, and OP_NOTNULL can be specified without a value.";

            }
            case Error.BC_TOO_LATE_TO_SAVEFORREVERT: {
                return "It is too late to use SaveForRevert on the BusinessClass with key %1 because it is in the %2 state.  You must use SaveForRevert before the class has been modified.";

            }
            case Error.BQ_CONS_ILLEGAL: {
                return "Illegal or unparsable constraint text \"%1\".";

            }
            case Error.CM_NO_TRANSACTION: {
                return "Client with clientID %1 attempted an operation while no transaction was active.";

            }
            case Error.BQ_ILLEGAL_FOREIGN_OP: {
                return "The value of the operation attribute of the query given is %1 which is illegal for a foreign query.  It must be OP_SELECT.";

            }
            case Error.CM_TRANSACTION_IN_PROGRESS: {
                return "Client with clientID %1 is attemping to start a transaction when one is already in progress.";

            }
            case Error.BQ_ILLEGAL_TABLE_INDEX: {
                return "The table index specified is %1 which is illegal.  It must be between 1 and %2.";

            }
            case Error.BQ_INCONSISTENT_OP: {
                return "The operation specified for the query being added is %1 which is inconsistent with the operation %2.";

            }
            case Error.BQ_ILLEGAL_OPERATION: {
                return "Illegal value for the operation parameter.  It must be one of OP_SELECT, OP_INSERT, OP_UPDATE, or OP_DELETE.";

            }
            case Error.BQ_PARENT_ATTR_NOT_SET: {
                return "ParentAttr not set in foreign entity query.";

            }
            case Error.BQ_SETOP_NEED_KEY_FOR_UPDATE: {
                return "You must speicfy a key parameter for the OP_DELETE or OP_UPDATE operations.";

            }
            case Error.CM_AGGREGATE_CHANGED: {
                return "The aggregate BusinessClass %2 with Key = %1 in the select list has been updated since it was selected.  You will have to restart your transaction before you can update it.";

            }
            case Error.BQ_SETOP_NO_KEY_ON_INSERT: {
                return "The key parameter cannot be used for the OP_INSERT operation -- specify the values to be inserted as constraints.";

            }
            case Error.CC_ILLEGAL_CLIENTID: {
                return "The clientID specified, %1, is illegal for the concurrency mode in use.";

            }
            case Error.BQ_SETOP_NO_KEY_ON_SELECT: {
                return "The key parameter cannot be used for the OP_SELECT operation.  If you want to constrain the query by the key constraints for all its attributes.";

            }
            case Error.CC_HAS_MGR: {
                return "SetConcurrency can only be invoked once.";

            }
            case Error.CC_CACHE_ILLEGAL: {
                return "Caching requires the CO_EXPRESS concurrency mode.";

            }
            case Error.CC_NEEDS_MGR: {
                return "The concurrency mode specified, %1, requires a ConcurrencyMgr object but none was provided.";

            }
            case Error.BQ_WRONG_ENTITY: {
                return "The entity passed is not for this BusinessQuery object.";

            }
            case Error.CM_CLASS_CHANGED: {
                return "The BusinessClass %2 with Key = %1 in the select list has been updated since it was selected.  You will have to restart your transaction before you can update it.";

            }
            case Error.NIL_PARAMETER: {
                return "<NIL>";

            }
            case Error.CC_ILLEGAL_TRANS_MODE: {
                return "The transactionMode specified %1 is illegal";

            }
            case Error.CM_AGGREGATES_INSERTED: {
                return "%1 class which are aggregates of class %2 have been inserted or deleted since this transaction started.  You will have to restart your transaction before you can update it.";

            }
            case Error.BQ_CONS_ILLEGAL_OP: {
                return "The operator \"%2\" in the constraint \"%1\" is illegal.";

            }
            case Error.CM_NO_ORIGINAL: {
                return "The BusinessClass %2 with Key = %1 in an update request has no before-update copy associated with it which the concurrency mode you have chosen requires.";

            }
            case Error.BQ_CONS_OP_PROHIBITS_VALUE: {
                return "The operator specified (%1) for attribute %2 does not take a value.  Only ConstraintOperation values: OP_ORDERBY, OP_ORDERBY_DESC, OP_NULL, and OP_NOTNULL can be specified without a value.";

            }
            case Error.CM_KEY_NOT_UNIQUE: {
                return "More than one record with Key = %1 for BusinessClass %2 exists in the database.  Express applications will not work if the primary key is not unique.  Correct your database schema.";

            }
            case Error.SQL_NEED_VALUE: {
                return "The value parameter is NIL.";

            }
            case Error.SQL_ILLEGAL_FOR_OPERATION: {
                return "This form of this method cannot be used when the Operation = %1.";

            }
            case Error.BQ_ILLEGAL_ATTR: {
                return "The attribute index %1 is illegal.";

            }
            case Error.BS_ILLEGAL_BM: {
                return "The BusinessMgr for the BusinessQuery %1 is not available.  It is probably a manager for an aggregate BusinessClass.  BusinessQueries for aggregate BusinessClasses cannot be given directly to the BusinessClient.  A modification to an aggregate class must be done as part of a modification to the parent class.";

            }
            case Error.GEN_NIL_PARAMETER: {
                return "The %1 parameter is NIL.";

            }
            case Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR: {
                return "The constraint operator %1 used for this query is not supported.";

            }
            case Error.SQL_OPERATION_UNINITIALIZED: {
                return "An object of the class SqlQuery was used before its Operation attribute was set.";

            }
            case Error.SS_CACHE_IN_USE: {
                return "The SqlStatmentCache is in use and cannot be re-setup.";

            }
            case 75: {
                return "Unknown error has parameters: %1, %2";

            }
            case 76: {
                return "Unknown error has parameters: %1.";

            }
            case 77: {
                return "Unknown error";

            }
            case 78: {
                return ".";

            }
            case 79: {
                return "<unknown class>.";

            }
            case 80: {
                return "<unknown method>";

            }
            case 81: {
                return "\n\tStacktrace:";

            }
            case Error.CM_ILLEGAL_CACHE_MODE: {
                return "The Cache mode %1 is illegal.  It must be CA_NONE or CA_WRITETHRU.";

            }
            case Error.CM_ILLEGAL_CONCURRENCY_MODE: {
                return "The Concurrency mode %1 is illegal.  It must be CO_NONE, CO_DB_NATIVE, CO_DB_EXPLICIT, CO_OPT_VERIFY or CO_OPT_EXPRESS.";

            }
            case Error.CM_CANNOT_CHANGE_MODE: {
                return "The Concurrency mode has already been set to %1 and cannot be changed to %2.";

            }
            case Error.CM_ILLEGAL_CLIENT_ID: {
                return "The clientID %1 is illegal.";

            }
            case Error.QC_CUSTOM_AND_DB_ATTR: {
                return "The expression \"%1\" referenced both a custom and a database attribute which is illegal.";

            }
            case Error.CM_NEGATIVE_REF_COUNT: {
                return "Client with clientID %1 caused negative reference count for BusinessClass with key %2.";

            }
            case Error.CM_DROPPING_LOCKED_KEY: {
                return "Client with clientID %1 removing locked BusinessClass with key %2.";

            }
            case Error.BM_ILLEGAL_ATTR_IN_KEY: {
                return "A NewKey operation was attempted but the class contains an attribute of type %1 which is not a sub-class of the types:  IntegerData, TextData, NumericData, or BooleanData.";

            }
            case Error.QC_ILLEGAL_CONSTRAINT_NODE: {
                return "Illegal constraint node in QueryConstraint stack.";

            }
            case Error.QC_CONSTRAINT_STACK_EMPTY: {
                return "The constraint stack is empty  not enough values for the number of operators.";

            }
            case Error.QC_NEED_ATTR_NODE: {
                return "Error in the constraint stack.  An attribute description is expected.";

            }
            case Error.QC_NEED_VALUE_NODE: {
                return "Error in the constraint stack.  A value is expected.";

            }
            case Error.QC_NEED_SQLDATA_NODE: {
                return "Error in the constraint stack.  A SqlData node is expected.";

            }
            case Error.BS_UNKNOWN_BM: {
                return "The BusinessMgr for the BusinessQuery %1 is not known by the BusinessService %2.  You may be using the wrong BusinessClient.";

            }
            case Error.BM_NO_UPDATE: {
                return "The BusinessClass %2 with Key = %1 was not updated.";

            }
            case Error.QC_NEED_OPERATION_NODE: {
                return "Error in the constraint stack.  An operation is expected.";

            }
            case Error.BM_TOO_MANY_ROWS: {
                return "The one-to-one or optional association whose attributeID is %2 from the business class %1 produced more than one row.";

            }
            case Error.QC_ILLEGAL_TABLE_INDEX: {
                return "The table index specified is %1 which is illegal.  It must be between 1 and %2.";

            }

            default: {
                return null;

            }
        }
    }
// end class Error
// c Pass 2 Conversion Time: 1985 milliseconds
TOP

Related Classes of Express.services.Error

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.