AgileApps Support Wiki Pre Release

AccountPopupController.java

From AgileApps Support Wiki
Revision as of 17:46, 6 May 2011 by imported>Aeric
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
package com.platform.demo.samples;

import com.platform.api.*;

import java.util.HashMap;

public class AccountPopupController implements Controller
{
  // Controller execute method
  public ControllerResponse execute(HashMap params) throws Exception
  {
    String action = (String)params.get("action");

    if(action == null || action.equals(""))
    {
      action = "search"    ;
    }

    ControllerResponse cr = new ControllerResponse();

    AccountPopup account= new AccountPopup();

    Result result = null;

    boolean delete = false;

    if(action.equals("search"))
    {
      result = account.search(params);
      cr.setTargetPage("AccountPopup.jsp");
    }

    if(result == null)
    {

    }
    else if(result.getCode() < 0)
    {
      cr.setMessage(result.getMessage());
    }
    else
    {
      params.put("opResult", result);
      if(!delete)
          cr.setMessage(result.getMessage());
    }

    cr.setData(params);
    return cr;
  }
}