Update of /var/cvs/src/org/mmbase/datatypes
In directory james.mmbase.org:/tmp/cvs-serv2656
Modified Files:
BasicDataType.java
Log Message:
To fix MMB-1794 correctly, we need to know when which node is commited
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/datatypes
See also: http://www.mmbase.org/jira/browse/MMB-1794
Index: BasicDataType.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/datatypes/BasicDataType.java,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- BasicDataType.java 17 Mar 2009 14:42:02 -0000 1.104
+++ BasicDataType.java 23 Mar 2009 17:41:48 -0000 1.105
@@ -40,7 +40,7 @@
* @author Pierre van Rooden
* @author Michiel Meeuwissen
* @since MMBase-1.8
- * @version $Id: BasicDataType.java,v 1.104 2009/03/17 14:42:02 michiel Exp $
+ * @version $Id: BasicDataType.java,v 1.105 2009/03/23 17:41:48 michiel Exp $
*/
public class BasicDataType<C> extends AbstractDescriptor implements
DataType<C>, Comparable<DataType<C>>, Descriptor {
@@ -51,8 +51,8 @@
public static final String DATATYPE_BUNDLE =
"org.mmbase.datatypes.resources.datatypes";
private static final Logger log =
Logging.getLoggerInstance(BasicDataType.class);
- //private Collection<Restriction<?>> restrictions = new
ArrayList<Restriction<?>>();
- //private Collection<Restriction<?>> unmodifiableRestrictions =
Collections.unmodifiableCollection(restrictions);
+ private Collection<Restriction<?>> restrictions = new
ArrayList<Restriction<?>>();
+ private Collection<Restriction<?>> unmodifiableRestrictions =
Collections.unmodifiableCollection(restrictions);
protected RequiredRestriction requiredRestriction = new
RequiredRestriction(false);
protected UniqueRestriction uniqueRestriction = new
UniqueRestriction(false);
@@ -735,11 +735,9 @@
public Map<String, Handler> getHandlers() {
return handlers;
}
- /*
public Collection<Restriction<?>> getRestrictions() {
return unmodifiableRestrictions;
}
- */
public int compareTo(DataType<C> a) {
int compared = getName().compareTo(a.getName());
if (compared == 0) compared =
getTypeAsClass().getName().compareTo(a.getTypeAsClass().getName());
@@ -976,9 +974,9 @@
if (source.enforceStrength == DataType.ENFORCE_ABSOLUTE) {
enforceStrength = DataType.ENFORCE_ALWAYS;
}
- //if (parent != null && parent.restrictions != null) { // could
happen during deserialization
- //parent.restrictions.add(this);
- //}
+ if (parent != null && parent.restrictions != null) { // could
happen during deserialization
+ parent.restrictions.add(this);
+ }
}
@@ -986,9 +984,9 @@
this.name = name;
this.parent = parent;
this.value = value;
- //if (parent != null && parent.restrictions != null) { // could
happen during deserialization
- //parent.restrictions.add(this);
- //}
+ if (parent != null && parent.restrictions != null) { // could
happen during deserialization
+ parent.restrictions.add(this);
+ }
}
public String getName() {
@@ -1064,8 +1062,16 @@
case DataType.ENFORCE_ABSOLUTE:
case DataType.ENFORCE_ALWAYS: return true;
case DataType.ENFORCE_ONCHANGE: if (node == null || field == null
|| node.isChanged(field.getName())) return true;
- case DataType.ENFORCE_ONCREATE: if (node == null || node.isNew())
return true;
- case DataType.ENFORCE_ONVALIDATE: return true;
+ case DataType.ENFORCE_ONCREATE: return (node == null ||
node.isNew());
+ case DataType.ENFORCE_ONVALIDATE:
+ if (node == null) return true;
+ if (node != null) {
+ Object committing =
node.getCloud().getProperty(Node.CLOUD_COMMITNODE_KEY);
+ if (Integer.valueOf(node.getNumber()).equals(committing)) {
+ return false;
+ }
+ }
+ return true;
case DataType.ENFORCE_NEVER: return false;
default: return true;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs