AccountPopupController.java

From AgileApps Support Wiki
<syntaxhighlight lang="java" enclose="div">

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;
 }

} </syntaxhighlight>