Package org.apache.cayenne.validation

Examples of org.apache.cayenne.validation.BeanValidationFailure


                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " bytes): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
                else if (value instanceof CharSequence) {
                    int len = ((CharSequence) value).length();
                    if (len > dbAttribute.getMaxLength()) {
                        String message = "\""
                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " chars): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
View Full Code Here


                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " bytes): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
                else if (value instanceof CharSequence) {
                    int len = ((CharSequence) value).length();
                    if (len > dbAttribute.getMaxLength()) {
                        String message = "\""
                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " chars): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
View Full Code Here

        };
    }

    public void validateEntity(ValidationResult validationBuffer, ObjEntity entity) {
        if (!entity.isClientAllowed()) {
            validationBuffer.addFailure(new BeanValidationFailure(
                    entity.getName(),
                    "clientAllowed",
                    "Not a client entity"));
        }
        else {
View Full Code Here

                targetEntity = targetEntity.getClientEntity();
            }

            if (targetEntity == null) {

                return new BeanValidationFailure(
                        name,
                        "relationship.targetEntity",
                        "No target entity");
            }
            else if (!targetEntity.isGeneric()) {
View Full Code Here

            return emptyFailure;
        }

        char c = identifier.charAt(0);
        if (!Character.isJavaIdentifierStart(c)) {
            return new BeanValidationFailure(bean, attribute, validationMessage(
                    attribute,
                    " starts with invalid character: " + c));
        }

        for (int i = 1; i < identifier.length(); i++) {
            c = identifier.charAt(i);
            if (!Character.isJavaIdentifierPart(c)) {
                return new BeanValidationFailure(bean, attribute, validationMessage(
                        attribute,
                        " contains invalid character: " + c));
            }

        }
View Full Code Here

        assertTrue(result.hasFailures(exhibit));

        List<ValidationFailure> failures = result.getFailures();
        assertEquals(1, failures.size());

        BeanValidationFailure failure = (BeanValidationFailure) failures.get(0);
        assertEquals(Exhibit.TO_GALLERY_PROPERTY, failure.getProperty());

        // fix the problem and see if it goes away
        Gallery gallery = context.newObject(Gallery.class);
        exhibit.setToGallery(gallery);
        result = new ValidationResult();
View Full Code Here

        assertTrue(result.hasFailures(artist));

        List<ValidationFailure> failures = result.getFailures();
        assertEquals(1, failures.size());

        BeanValidationFailure failure = (BeanValidationFailure) failures.get(0);
        assertEquals(Artist.ARTIST_NAME_PROPERTY, failure.getProperty());

        // fix the problem and see if it goes away
        artist.setArtistName("aa");
        result = new ValidationResult();
        artist.validateForSave(result);
View Full Code Here

        assertTrue(result.hasFailures(artist));

        List<ValidationFailure> failures = result.getFailures();
        assertEquals(1, failures.size());

        BeanValidationFailure failure = (BeanValidationFailure) failures.get(0);
        assertEquals(Artist.ARTIST_NAME_PROPERTY, failure.getProperty());

        // fix the problem and see if it goes away
        artist.setArtistName("aa");
        result = new ValidationResult();
        artist.validateForSave(result);
View Full Code Here

                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " bytes): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
                else if (value instanceof CharSequence) {
                    int len = ((CharSequence) value).length();
                    if (len > dbAttribute.getMaxLength()) {
                        String message = "\""
                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " chars): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
View Full Code Here

                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " bytes): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
                else if (value instanceof CharSequence) {
                    int len = ((CharSequence) value).length();
                    if (len > dbAttribute.getMaxLength()) {
                        String message = "\""
                                + objAttribute.getName()
                                + "\" exceeds maximum allowed length ("
                                + dbAttribute.getMaxLength()
                                + " chars): "
                                + len;
                        validationResult.addFailure(new BeanValidationFailure(
                                this,
                                objAttribute.getName(),
                                message));
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.validation.BeanValidationFailure

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.