Package app.action

Source Code of app.action.Add3Action

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

Related Classes of app.action.Add3Action

TOP
Copyright © 2018 www.massapi.com. 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.