package app.action;
import java.util.HashMap;
import java.util.Map;
import com.blogger.tcuri.appserver.Action;
import com.blogger.tcuri.appserver.ActionContext;
import com.blogger.tcuri.appserver.koi.JsonResolution;
import com.blogger.tcuri.appserver.resolution.Resolution;
import com.blogger.tcuri.appserver.validator.Validators;
public class Add3Action extends Action {
@Override
public Resolution execute(ActionContext context) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
Validators v = new Validators();
v.add("arg1", v.required(), v.integer());
v.add("arg2", v.required(), v.integer());
if (v.isError()) {
map.put("message", v.getErrorMap());
return new JsonResolution(map);
}
map.put("result", context.intParam("arg1") + context.intParam("arg2"));
return new JsonResolution(map);
}
}