Package org.apache.cayenne.validation

Examples of org.apache.cayenne.validation.SimpleValidationFailure


        catch (SQLException ex) {
            if (this.failures == null) {
                this.failures = new ValidationResult();
            }

            failures.addFailure(new SimpleValidationFailure(sql, ex.getMessage()));
            QueryLogger.logQueryError(ex);
            return false;
        }
        finally {
            statement.close();
View Full Code Here


            }
            else {
                String path = descriptor.getManagedClass().getName()
                        + "."
                        + property.getName();
                context.recordConflict(new SimpleValidationFailure(
                        property.getMember(),
                        "Undefined property persistence status: " + path));
            }
        }
View Full Code Here

            JpaEntityMap map = (JpaEntityMap) path.firstInstanceOf(JpaEntityMap.class);
            JpaEntity target = map.entityForClass(relationship.getTargetEntityName());

            if (target == null) {
                context.recordConflict(new SimpleValidationFailure(
                        relationship,
                        "Invalid relationship target "
                                + relationship.getTargetEntityName()));
            }
            else if (target.getAttributes() == null
                    || target.getAttributes().getIds().isEmpty()) {
                context.recordConflict(new SimpleValidationFailure(
                        target,
                        "Relationship target has no PK defined: "
                                + relationship.getTargetEntityName()));
            }
            else if (target.getAttributes().getIds().size() > 1) {
                // TODO: andrus, 4/30/2006 implement this; note that instead of
                // checking for "attribute.getJoinColumns().isEmpty()" above,
                // we'll have to match individual columns
                context.recordConflict(new SimpleValidationFailure(
                        relationship,
                        "Defaults for compound FK are not implemented."));
            }
            else {
                JpaId id = target.getAttributes().getIds().iterator().next();
View Full Code Here

                JpaPropertyDescriptor property = srcDescriptor.getProperty(name);

                Class targetEntityType = property.getTargetEntityType();

                if (targetEntityType == null) {
                    context.recordConflict(new SimpleValidationFailure(property
                            .getMember(), "Undefined target entity type: " + name));
                    return false;
                }
                else {
                    relationship.setTargetEntityName(targetEntityType.getName());
View Full Code Here

                    .currentThread()
                    .getContextClassLoader());
            return (DbAdapter) dbAdapterClass.newInstance();
        }
        catch (Exception e) {
            context.recordConflict(new SimpleValidationFailure(
                    info,
                    "Failed to load adapter '"
                            + adapterClass
                            + "', message: "
                            + e.getLocalizedMessage()));
View Full Code Here

        TraversalUtil.traverse(context.getEntityMap(), visitor);
        return dataMap;
    }

    protected void recordConflict(ProjectPath path, String message) {
        context.recordConflict(new SimpleValidationFailure(path.getObject(), message));
    }
View Full Code Here

    public void validateForDelete(ValidationResult validationResult) {
        validatedForDelete = true;
       
        if(blow) {
            validationResult.addFailure(new SimpleValidationFailure(this, "test error"));
        }
    }
View Full Code Here

    public void validateForInsert(ValidationResult validationResult) {
        validatedForInsert = true;
       
        if(blow) {
            validationResult.addFailure(new SimpleValidationFailure(this, "test error"));
        }
    }
View Full Code Here

    public void validateForUpdate(ValidationResult validationResult) {
        validatedForUpdate = true;
       
        if(blow) {
            validationResult.addFailure(new SimpleValidationFailure(this, "test error"));
        }
    }
View Full Code Here

        catch (SQLException ex) {
            if (this.failures == null) {
                this.failures = new ValidationResult();
            }

            failures.addFailure(new SimpleValidationFailure(sql, ex.getMessage()));
            jdbcEventLogger.logQueryError(ex);
            return false;
        }
        finally {
            statement.close();
View Full Code Here

TOP

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

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.