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

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


  @Override
  public void preRenderViewAction() {
    if (employeeRecord == null) {
      employeeRecord = new EmployeeRecord();
      SampleDB sampleDB = FacesUtils.getDatabase();
      String id = FacesUtils.getHttpRequest().getParameter("id");
      if (id != null) {
        try {
          employeeRecord.read(sampleDB.T_EMPLOYEES,
              new String[] { id }, FacesUtils.getConnection());
View Full Code Here


  public EmployeeListPage() {
  }

  @Override
  public void preRenderViewAction() {
    SampleDB sampleDB = FacesUtils.getDatabase();

    DBColumnExpr C_FULL_NAME = sampleDB.T_EMPLOYEES.C_LAST_NAME.append(", ")
        .append(sampleDB.T_EMPLOYEES.C_FIRST_NAME).as("NAME");
    DBColumnExpr C_DEPARTMENT = sampleDB.T_DEPARTMENTS.C_NAME
        .as("DEPARTMENT");
    // lade Liste aus der Datenbank

    SampleDB.Employees EMP = sampleDB.T_EMPLOYEES;
    SampleDB.Departments DEP = sampleDB.T_DEPARTMENTS;

    DBCommand cmd = sampleDB.createCommand();
    cmd.select(EMP.C_EMPLOYEE_ID);
    cmd.select(C_FULL_NAME, EMP.C_GENDER, EMP.C_DATE_OF_BIRTH);
    cmd.select(C_DEPARTMENT);
    cmd.join(DEP.C_DEPARTMENT_ID, EMP.C_DEPARTMENT_ID);
View Full Code Here

   
    @Override
    public Options getFieldOptions(DBColumn column)
    {
        if (column.equals(T.C_DEPARTMENT_ID)) {
            SampleDB db = (SampleDB)getDatabase();
            DBCommand cmd = db.createCommand();
            cmd.select(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
            cmd.select(db.T_DEPARTMENTS.C_NAME);
            return db.queryOptionList(cmd.getSelect(), FacesUtils.getConnection());
        }
        // base class implementation
        return super.getFieldOptions(column);
    }
View Full Code Here

    // ------- render helpers -------
   
    private void renderAllErrors(HtmlWriter w, ActionErrorProvider provider)
    {
        // Get errors
        ErrorInfo lastActionError = provider.getLastActionError(true);
        Map<String, ErrorInfo> fieldErrors = provider.getItemErrors();
       
        boolean hasActionError = (lastActionError!=null); //  && lastActionError.hasError());
        boolean hasFieldErrors = (fieldErrors!=null && fieldErrors.size()>0);
View Full Code Here

     * 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

            actionError = null;
            return;
        }
        if (error.hasError()==false)
        {   log.warn("setActionError: No error information supplied.");
            error = new ActionError(Errors.Internal, "No error information available!");
        }
        // 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, Object param)
    {
        setActionError(new ActionError(errType, param));
    }
View Full Code Here

        setActionError(new ActionError(errType, param));
    }

    protected 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

TOP

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

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.