Package org.slim3.controller

Examples of org.slim3.controller.Controller


            @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


     * バリデータを取得する。
     *
     * @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

        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

        }

        @Override
        public void visitDeclaredType(DeclaredType declaredType) {
            TypeDeclaration typeDeclaration = toTypeDeclaration(declaredType);
            String className = typeDeclaration.getQualifiedName();
            dataType = getCoreReferenceType(className, declaredType);
            if (dataType != null) {
                return;
            }
            dataType = getModelRefType(className, declaredType);
View Full Code Here

         *            the element data type
         * @return a collection data type
         */
        protected CollectionType createCollectionType(String className,
                DeclaredType declaredType, DataType elementType) {
            String typeName = declaredType.toString();
            if (List.equals(className)) {
                return new ListType(className, typeName, elementType);
            }
            if (ArrayList.equals(className)) {
                return new ArrayListType(className, typeName, elementType);
View Full Code Here

                    "    throw new IllegalStateException(\"The version property of the model(%1$s) is not defined.\");",
                    modelMetaDesc.getModelClassName());
        } else {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

        final AttributeMetaDesc attr =
            modelMetaDesc.getVersionAttributeMetaDesc();
        if (attr != null) {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

            if (value != null && value.length() > 0) {
                name = value;
            }
        }
        DataTypeFactory dataTypeFactory = creaetDataTypeFactory();
        DataType dataType =
            dataTypeFactory.createDataType(fieldDeclaration, fieldDeclaration
                .getType());
        AttributeMetaDesc attributeMetaDesc =
            new AttributeMetaDesc(name, attributeName, dataType);
        handleField(
View Full Code Here

            attribute,
            AnnotationConstants.persistent) == Boolean.FALSE) {
            handleNotPersistent(attributeMetaDesc, fieldDeclaration);
        }
        if (attributeMetaDesc.isPersistent()) {
            DataType dataType = attributeMetaDesc.getDataType();
            if (dataType instanceof InverseModelRefType) {
                if (classDeclaration
                    .equals(fieldDeclaration.getDeclaringType())) {
                    throw new ValidationException(
                        MessageCode.SLIM3GEN1035,
View Full Code Here

                fieldDeclaration,
                attribute,
                AnnotationConstants.lob,
                AnnotationConstants.unindexed + " = false");
        }
        DataType dataType = attributeMetaDesc.getDataType();
        if (dataType instanceof CoreReferenceType
            && !ClassConstants.String.equals(dataType.getClassName())) {
            throwExceptionForLobUnsupportedType(
                classDeclaration,
                fieldDeclaration,
                attribute);
        }
View Full Code Here

TOP

Related Classes of org.slim3.controller.Controller

Copyright © 2018 www.massapicom. 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.