Package org.apache.cayenne.validation

Examples of org.apache.cayenne.validation.ValidationException


            return;
        }

        // validate...
        if (newName == null) {
            throw new ValidationException("Empty DataNode Name");
        }

        ProjectController parent = (ProjectController) getParent();
        DataNodeDefaults oldPref = parent.getDataNodePreferences();
        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) getApplication()
                .getProject()
                .getRootNode();

        Collection<DataNodeDescriptor> matchingNode = dataChannelDescriptor
                .getNodeDescriptors();

        Iterator<DataNodeDescriptor> it = matchingNode.iterator();
        while (it.hasNext()) {
            DataNodeDescriptor node = it.next();
            if (node.getName().equals(newName)) {
                // there is an entity with the same name
                throw new ValidationException("There is another DataNode named '"
                        + newName
                        + "'. Use a different name.");
            }
        }
View Full Code Here


        if (text != null && text.trim().length() > 0) {
            try {
                cacheSize = Integer.parseInt(text);
            }
            catch (NumberFormatException nfex) {
                throw new ValidationException("Invalid number");
            }
        }

        DbKeyGenerator generator = mediator.getCurrentDbEntity().getPrimaryKeyGenerator();
        if (!Util.nullSafeEquals(generator.getKeyCacheSize(), new Integer(cacheSize))) {
View Full Code Here

        if (entity == null || Util.nullSafeEquals(newName, entity.getName())) {
            return;
        }

        if (newName == null) {
            throw new ValidationException("Entity name is required.");
        }
        else if (entity.getDataMap().getDbEntity(newName) == null) {
            // completely new name, set new name for entity
            EntityEvent e = new EntityEvent(this, entity, entity.getName());
            entity.setName(newName);
            // ProjectUtil.setDbEntityName(entity, newName);
            mediator.fireDbEntityEvent(e);
        }
        else {
            // there is an entity with the same name
            throw new ValidationException("There is another entity with name '"
                    + newName
                    + "'.");
        }
    }
View Full Code Here

                    mediator.fireDbEntityEvent(new EntityEvent(this, ent));
                }
            }
            catch (IllegalArgumentException ex) {
                // unparsable qualifier
                throw new ValidationException(ex.getMessage());
            }
           
        }
    }
View Full Code Here

TOP

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

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.