Package org.apache.cayenne.validation

Examples of org.apache.cayenne.validation.ValidationResult


            statement.execute(sql);
            return true;
        }
        catch (SQLException ex) {
            if (this.failures == null) {
                this.failures = new ValidationResult();
            }

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


        synchronized (graphManager) {

            if (graphManager.hasChanges()) {

                ValidationResult result = new ValidationResult();
                Iterator it = graphManager.dirtyNodes().iterator();
                while (it.hasNext()) {
                    Persistent p = (Persistent) it.next();
                    if (p instanceof Validating) {
                        switch (p.getPersistenceState()) {
                            case PersistenceState.NEW:
                                ((Validating) p).validateForInsert(result);
                                break;
                            case PersistenceState.MODIFIED:
                                ((Validating) p).validateForUpdate(result);
                                break;
                            case PersistenceState.DELETED:
                                ((Validating) p).validateForDelete(result);
                                break;
                        }
                    }
                }

                if (result.hasFailures()) {
                    throw new ValidationException(result);
                }

                graphManager.graphCommitStarted();
View Full Code Here

            }

            long t1 = System.currentTimeMillis();

            // report conflicts...
            ValidationResult conflicts = loader.getContext().getConflicts();
            if (conflicts.hasFailures()) {
                for (Object failure : conflicts.getFailures()) {
                    logger.info("*** mapping conflict: " + failure);
                }
            }

            if (logger.isDebugEnabled()) {
View Full Code Here

    class ValidationVisitor implements ConfigurationNodeVisitor<ValidationResult> {

        private ValidationResult validationResult;

        ValidationVisitor() {
            validationResult = new ValidationResult();
        }
View Full Code Here

            statement.execute(sql);
            return true;
        }
        catch (SQLException ex) {
            if (this.failures == null) {
                this.failures = new ValidationResult();
            }

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

                        .getFrameController()
                        .getProjectController();
                projectController.setDirty(true);
            }

            ValidationResult failures = mergerContext.getValidationResult();

            if (failures == null || !failures.hasFailures()) {
                JOptionPane.showMessageDialog(getView(), "Migration Complete.");
            }
            else {
                new ValidationResultBrowser(this).startupAction(
                        "Migration Complete",
View Full Code Here

        Project project = getApplication().getProject();

        ProjectValidator projectValidator = getApplication().getInjector().getInstance(
                ProjectValidator.class);
        ValidationResult validationResult = projectValidator.validate(project
                .getRootNode());

        if (validationResult.getFailures().size() > 0) {

            for (ValidationFailure nextProblem : validationResult.getFailures()) {
                DbEntity failedEntity = null;

                if (nextProblem.getSource() instanceof DbAttribute) {
                    DbAttribute failedAttribute = (DbAttribute) nextProblem.getSource();
                    failedEntity = (DbEntity) failedAttribute.getEntity();
View Full Code Here

           
            DataSource dataSource = connectionInfo.makeDataSource(getApplication()
                    .getClassLoadingService());
            generator.runGenerator(dataSource);

            ValidationResult failures = generator.getFailures();

            if (failures == null || !failures.hasFailures()) {
                JOptionPane.showMessageDialog(getView(), "Schema Generation Complete.");
            }
            else {
                new ValidationResultBrowser(this)
                        .startupAction(
View Full Code Here

    public synchronized void performAction(int warningLevel) {

        ProjectValidator projectValidator = getApplication().getInjector().getInstance(
                ProjectValidator.class);
        ValidationResult validationResult = projectValidator.validate(getCurrentProject()
                .getRootNode());

        try {
            if (!saveAll()) {
                return;
            }
        }
        catch (Exception ex) {
            throw new CayenneRuntimeException("Error on save", ex);
        }

        getApplication().getFrameController().projectSavedAction();

        // If there were errors or warnings at validation, display them
        if (validationResult.getFailures().size() > 0) {
            ValidatorDialog.showDialog(Application.getFrame(), validationResult
                    .getFailures());
        }
    }
View Full Code Here

            allFailures.addAll(loadFailures);
        }

        ProjectValidator projectValidator = getApplication().getInjector().getInstance(
                ProjectValidator.class);
        ValidationResult validationResult = projectValidator.validate(project
                .getRootNode());
        allFailures.addAll(validationResult.getFailures());

        if (!allFailures.isEmpty()) {
            ValidatorDialog.showDialog(frame, validationResult.getFailures());
        }
    }
View Full Code Here

TOP

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

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.