Package org.apache.empire.struts2.websample.db

Examples of org.apache.empire.struts2.websample.db.SampleDB$Employees


     * The method is called from the ActionBasicsInterceptor
     */
    public String handleException(Throwable exception, String method)
    {
        // Uncaught exception
        ActionError excetionError = new ActionError(exception);
        // Check if there already is an error
        if (actionError!=null && actionError.hasError())
        {   // War replace
            log.warn("An uncaught exception occurred after an error has already been set!");
            log.warn("Replacing error of " + actionError.getErrorMessage() + " with " + excetionError.getErrorMessage());
        }
        else
        {   log.warn("An uncaught exception occurred. Message is " + excetionError.getErrorMessage());
        }
        // uncaught exception
        setActionError(excetionError);
        // retrun error mapping
        return null; // Default Exception Handling
View Full Code Here


        */
        // We have an error
        if (error instanceof ActionError)
            actionError = ((ActionError)error);
        else
            actionError = new ActionError(error);
        // put Error on session
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }
View Full Code Here

        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }

    protected final void setActionError(ErrorType errType)
    {
        setActionError(new ActionError(errType));
    }
View Full Code Here

        setActionError(new ActionError(errType));
    }

    protected final void setActionError(ErrorType errType, String param)
    {
        setActionError(new ActionError(errType, param));
    }
View Full Code Here

    }

    @Override
    public final void setActionError(Exception exception)
    {
        setActionError(new ActionError(exception));
    }
View Full Code Here

        // Get Message
        String msgKey = error.getErrorType().getKey();
        String[] args = ObjectUtils.toStringArray(error.getErrorParams(), "Null");
        String msg = getText(msgKey, args);
        // Get full Message
        addItemError(item, new ActionError(errorType, new String[] { title, msg }));
    }
View Full Code Here

    public void initKeyColumns()
    {
        // Action parameters
        Object[] keyValues = getActionParamKey();
        if (isValid()==false || keyValues==null)
            throw new InvalidFormDataException();
        // Check Record
        if (record==null || !record.isValid())
            throw new ObjectNotValidException(record);
        // Check Key Length
        Column[] keyColumns = record.getKeyColumns();
        if (keyValues.length!=keyColumns.length)
            throw new InvalidFormDataException();
        // Copy values
        for (int i=0; i<keyColumns.length; i++)
        {  
            record.setValue(keyColumns[i], keyValues[i]);
        }
View Full Code Here

        if (persistence==SessionPersistence.Data)
        {   // Get the record from the session
            Record rec = getRecordFromSession();
            if (rec==null || (rec instanceof DBRecord)==false)
            {   // Record restored
                throw new InvalidFormDataException();
            }
            // Record not found
            record = (DBRecord)rec;
        }
        // Check Record State
        if (record.isValid())
        {   // Is this the record we require?
            Object[] currentKey = record.getKeyValues();
            if (compareKey(currentKey, keyValues)==false)
            {   // Keys don't match
                throw new InvalidFormDataException();
            }
            // We have a valid record
            return;
        }
        // Insert
View Full Code Here

        {   // No Errors, nothing to render
            return;
        }
       
        // Render error list
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlTag list = w.startTag(dic.ErrorListTag());
        addStandardAttributes(list, dic.ErrorListClass());
        list.beginBody();
   
        // Are there field errors to render?
        if (hasFieldErrors)
        {   // Render all field errors
            Collection<ErrorInfo> errors = fieldErrors.values();
            String fieldErrClass = str(fieldErrorClass, dic.ErrorItemEntryClass());
            for (ErrorInfo e : errors)
            {
                String msg = provider.getLocalizedErrorMessage(e);
                renderError(w, fieldErrClass, msg);
            }
        }
       
        // Render last action error
        if (hasActionError)
        {   // Render action error
            String actionErrClass = str(actionErrorClass, dic.ErrorActionEntryClass());
            String msg = provider.getLocalizedErrorMessage(lastActionError);
            renderError(w, actionErrClass, msg);
        }

        // done
View Full Code Here

        list.endTag();
    }

    private void renderError(HtmlWriter w, String cssClassName, String msg)
    {
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlTag tag = w.startTag(dic.ErrorEntryTag());
        // Check whether additional wrapper is desired
        String wrapTag = dic.ErrorEntryWrapperTag();
        if (wrapTag!=null && wrapTag.length()>0)
        {   tag.beginBody();
            // Item wrapper tag
            HtmlTag wrap = w.startTag(wrapTag);
            wrap.addAttribute("class", cssClassName);
View Full Code Here

TOP

Related Classes of org.apache.empire.struts2.websample.db.SampleDB$Employees

Copyright © 2018 www.massapicom. 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.