Update of /var/cvs/src/org/mmbase/bridge/util
In directory james.mmbase.org:/tmp/cvs-serv32649
Modified Files:
Tag: MMBase-1_8
AbstractNode.java
Log Message:
ported implementation of validate from HEAD to 1.8, otherwise fix for
MMB-1794 doesn't work (and I need it for EO)
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/util
See also: http://www.mmbase.org/jira/browse/MMB-1794
Index: AbstractNode.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/AbstractNode.java,v
retrieving revision 1.14.2.4
retrieving revision 1.14.2.5
diff -u -b -r1.14.2.4 -r1.14.2.5
--- AbstractNode.java 16 Oct 2008 13:56:59 -0000 1.14.2.4
+++ AbstractNode.java 23 Mar 2009 16:02:08 -0000 1.14.2.5
@@ -31,7 +31,7 @@
* here, to minimalize the implementation effort of fully implemented Nodes.
*
* @author Michiel Meeuwissen
- * @version $Id: AbstractNode.java,v 1.14.2.4 2008/10/16 13:56:59 michiel Exp $
+ * @version $Id: AbstractNode.java,v 1.14.2.5 2009/03/23 16:02:08 michiel Exp $
* @see org.mmbase.bridge.Node
* @since MMBase-1.8
*/
@@ -471,7 +471,8 @@
FieldIterator fi = getNodeManager().getFields().fieldIterator();
while (fi.hasNext()) {
Field field = fi.nextField();
- field.getDataType().getCommitProcessor().commit(this, field);
+ org.mmbase.datatypes.processors.CommitProcessor cp =
field.getDataType().getCommitProcessor();
+ cp.commit(this, field);
}
}
@@ -481,7 +482,12 @@
Locale locale = getCloud().getLocale();
while (fi.hasNext()) {
Field field = fi.nextField();
- if (! field.isReadOnly() && !field.isVirtual() && (isNew() ||
isChanged(field.getName()))) {
+ if (! field.isReadOnly() && !field.isVirtual()) {
+ DataType dataType = field.getDataType();
+ int enforceStrength = dataType.getEnforceStrength();
+ if ((enforceStrength > DataType.ENFORCE_ONCHANGE) ||
+ (isChanged(field.getName()) && (enforceStrength >=
DataType.ENFORCE_ONCREATE)) ||
+ (isNew() && (enforceStrength >= DataType.ENFORCE_NEVER))) {
// don't validate read-only fields. Users cannot have edited
those. Most noticably,
// the _number_ field must not be validated, because for new
nodes it does not yet
// point to an existing node... I think the number field
should not be a NODE field...
@@ -495,6 +501,7 @@
}
}
}
+ }
return errors;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs