1 56 package org.objectstyle.cayenne.project.validator; 57 58 import org.objectstyle.cayenne.dba.TypesMapping; 59 import org.objectstyle.cayenne.map.ProcedureParameter; 60 import org.objectstyle.cayenne.project.ProjectPath; 61 import org.objectstyle.cayenne.util.Util; 62 63 68 public class ProcedureParameterValidator extends TreeNodeValidator { 69 70 public void validateObject(ProjectPath treeNodePath, Validator validator) { 71 ProcedureParameter parameter = (ProcedureParameter) treeNodePath.getObject(); 72 73 if (Util.isEmptyString(parameter.getName())) { 75 validator.registerError("Unnamed ProcedureParameter.", treeNodePath); 76 } 77 78 if (parameter.getType() == TypesMapping.NOT_DEFINED) { 80 validator.registerWarning("ProcedureParameter has no type.", treeNodePath); 81 } 82 83 if (parameter.getMaxLength() < 0 85 && (parameter.getType() == java.sql.Types.VARCHAR 86 || parameter.getType() == java.sql.Types.CHAR)) { 87 88 validator.registerWarning( 89 "Character procedure parameter doesn't have max length.", 90 treeNodePath); 91 } 92 93 if (parameter.getDirection() <= 0) { 95 validator.registerWarning( 96 "ProcedureParameter has no direction.", 97 treeNodePath); 98 } 99 100 } 101 } | Popular Tags |