Examples of Validators


Examples of com.blogger.tcuri.appserver.validator.Validators

    @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);
View Full Code Here

Examples of com.blogger.tcuri.appserver.validator.Validators

            // 初期表示
            message = new HashMap<String, String>();
            return new HtmlResolution("add", this);
        }
       
        Validators v = new Validators(this);
        Resolution resolution = new HtmlResolution("add", this);
       
        if (v.isError()) {
            message = v.getErrorMap();
            return resolution;
        }

        result = Integer.parseInt(arg1) + Integer.parseInt(arg2);
        return resolution;
View Full Code Here

Examples of com.blogger.tcuri.appserver.validator.Validators

    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);
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        }
        return redirect(basePath);
    }
   
    protected boolean validate() {
        Validators v = new Validators(request);
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        }
        return redirect(basePath);
    }
   
    protected boolean validate () {
        Validators v = new Validators (request);
        v.add(meta.email, v.required());
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        try {
            if (!validateInsertUser(uid)) {
                // 登録画面を表示
                return forward("/manager/regist.jsp");
            }
            Validators v = getValidator();
            v.add(
                "uid",
                v.required(),
                v.maxlength(VALID_MAX_UID),
                v.minlength(VALID_MIN_UID));
            if (v.validate()) {
                Transaction tx= Datastore.beginTransaction();
                User user =
                    service.put(tx, uid, name, mail, phone, zipcode, address);
                // ユーザ登録メール送信
                if (!sendConfirmationMail(user)) {
View Full Code Here

Examples of org.slim3.controller.validator.Validators

            @RequestParam("address") String address) {
        putEnteringLog();
        try {
            User tmp = service.get(uid);
            if (roleCheck(tmp)) {
                Validators v = getValidator();
                if (v.validate()) {
                    service.put(uid, name, mail, phone, zipcode, address);
                    return redirect("/user/" + uid);
                } else {
                    return forward("/manager/edit.jsp");
                }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

     * バリデータを取得する。
     *
     * @return バリデータ
     */
    private Validators getValidator() {
        Validators v = new Validators(request);
        v.add("name", v.required());
        v.add("mail", v.required(), v.regexp(VALID_PAT_MAILADDR));
        v.add("phone", v.required(), v.regexp("0\\d+[\\-]\\d+[\\-]\\d+"));
        v.add("zipcode", v.required(), v.regexp("\\d{3}-\\d{4}"));
        v.add("address", v.required());
        return v;
    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        try {
            logger.finest("uid : " + uid +"  password : " + oldPassword + " / " + newPassword + " / " + newPassword2);
            User user = service.get(uid);
            if (user != null && user.equals(getLoginUser())) {
                // 本人しか変更できない
                Validators v = new Validators(request);
                logger.finest("old password : " + user.getPassword());
                // パスワードが空なら古いパスワードのチェックはしない。
                if (null != oldPassword) {
                    v.add("oldPassword", new StringValidator(user.getPassword()));
                }
                v.add(
                    "newPassword",
                    v.required(),
                    v.minlength(VALID_MIN_PASSWD),
                    v.maxlength(VALID_MAX_PASSWD),
                    new StringValidator(oldPassword, true));
                v.add("newPassword2", v.required(), new StringValidator(
                    newPassword));

                if (v.validate()) {
                    // パスワード更新
                    service.savePassword(uid, newPassword);

                    // ログイン状態にする
                    setLoginUser(user);
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        request.setAttribute(
            "title",
            ApplicationMessage.get("title.admin.regist"));
        try {
            if (checkAdmin()) {
                Validators v = new Validators(request);
                v.add(
                    "uid",
                    v.required(),
                    v.maxlength(VALID_MAX_UID),
                    v.minlength(VALID_MIN_UID));
                v.add("name", v.required());
                v.add("mail", v.required(), v.regexp(VALID_PAT_MAILADDR));
                if (v.validate()) {
                    if (!validateInsertUser(uid)) {
                        // 登録画面を表示
                        return forward("/user/regist.jsp");
                    }
                    Transaction tx = Datastore.beginTransaction();
View Full Code Here
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.