Package app.action

Source Code of app.action.AddAction

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

Related Classes of app.action.AddAction

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.