You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2010/07/01 18:38:24 UTC
svn commit: r959716 -
/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
Author: adrianc
Date: Thu Jul 1 16:38:24 2010
New Revision: 959716
URL: http://svn.apache.org/viewvc?rev=959716&view=rev
Log:
Removed validators from ModelFieldType.java.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=959716&r1=959715&r2=959716&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Thu Jul 1 16:38:24 2010
@@ -19,14 +19,10 @@
package org.ofbiz.entity.model;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.jdbc.JdbcValueHandler;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
/**
* Generic Entity - FieldType model class
@@ -53,9 +49,6 @@ public class ModelFieldType implements S
/** The sql-type-alias of the Field, this is optional */
protected String sqlTypeAlias = null;
- /** validators to be called when an update is done */
- protected List<ModelFieldValidator> validators = new ArrayList<ModelFieldValidator>();
-
/** Default Constructor */
public ModelFieldType() {}
@@ -65,16 +58,6 @@ public class ModelFieldType implements S
this.javaType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("java-type")).intern();
this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type")).intern();
this.sqlTypeAlias = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type-alias")).intern();
- NodeList validateList = fieldTypeElement.getElementsByTagName("validate");
- for (int i = 0; i < validateList.getLength(); i++) {
- Element element = (Element) validateList.item(i);
- String methodName = element.getAttribute("method");
- String className = element.getAttribute("class");
- if (methodName != null) {
- this.validators.add(new ModelFieldValidator(className.intern(), methodName.intern()));
- }
- }
- ((ArrayList<ModelFieldValidator>)this.validators).trimToSize();
this.jdbcValueHandler = JdbcValueHandler.getInstance(this.javaType, this.sqlType);
}
@@ -103,11 +86,6 @@ public class ModelFieldType implements S
return this.sqlTypeAlias;
}
- /** validators to be called when an update is done */
- public List<ModelFieldValidator> getValidators() {
- return this.validators;
- }
-
/** A simple function to derive the max length of a String created from the field value, based on the sql-type
* @return max length of a String representing the Field value
*/
@@ -134,29 +112,4 @@ public class ModelFieldType implements S
}
return 20;
}
-
- class ModelFieldValidator implements Serializable {
-
- protected String validatorClass = null;
- protected String validatorMethod = null;
-
- public ModelFieldValidator(String className, String methodName) {
- this.validatorClass = className;
- this.validatorMethod = methodName;
- }
-
- public String getClassName() {
- if (UtilValidate.isNotEmpty(validatorClass) && UtilValidate.isNotEmpty(validatorMethod)) {
- return validatorClass;
- }
- return null;
- }
-
- public String getMethodName() {
- if (UtilValidate.isNotEmpty(validatorClass) && UtilValidate.isNotEmpty(validatorMethod)) {
- return validatorMethod;
- }
- return null;
- }
- }
}