package app.action;
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;
import com.blogger.tcuri.appserver.validator.annotation.IntegerType;
import com.blogger.tcuri.appserver.validator.annotation.Required;
public class AddAction extends Action {
@Required
@IntegerType
public String arg1;
@Required
@IntegerType
public String arg2;
public Integer result;
public Map<String, String> message;
@Override
public Resolution execute(ActionContext context) throws Exception {
Validators v = new Validators(this);
if (v.isError()) {
message = v.getErrorMap();
return new JsonResolution(this);
}
result = Integer.parseInt(arg1) + Integer.parseInt(arg2);
return new JsonResolution(this);
}
}