stefan 2004/07/07 09:06:29
Modified: proposals/jcrri/src/org/apache/slide/jcr/core/nodetype
EffectiveNodeType.java NodeTypeImpl.java
Log:
jcrri
Revision Changes Path
1.6 +28 -28
jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/EffectiveNodeType.java
Index: EffectiveNodeType.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/EffectiveNodeType.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EffectiveNodeType.java 30 Jun 2004 14:39:37 -0000 1.5
+++ EffectiveNodeType.java 7 Jul 2004 16:06:29 -0000 1.6
@@ -370,8 +370,8 @@
void checkAddNodeConstraints(QName name)
throws ConstraintViolationException {
- ItemDef id = (ItemDef) namedItemDefs.get(name);
- if (id == null) {
+ ItemDef def = (ItemDef) namedItemDefs.get(name);
+ if (def == null) {
// no item with that name defined;
// try residual node definitions
ChildNodeDef[] nda = getUnnamedNodeDefs();
@@ -403,8 +403,8 @@
return;
}
} else {
- if (id.definesNode()) {
- ChildNodeDef cnd = (ChildNodeDef) id;
+ if (def.definesNode()) {
+ ChildNodeDef cnd = (ChildNodeDef) def;
// node definition with that name exists
if (!cnd.isProtected() && !cnd.isAutoCreate()) {
if (cnd.getDefaultPrimaryType() == null) {
@@ -420,8 +420,8 @@
void checkAddNodeConstraints(QName name, QName nodeTypeName)
throws ConstraintViolationException, NoSuchNodeTypeException {
- ItemDef id = (ItemDef) namedItemDefs.get(name);
- if (id == null) {
+ ItemDef def = (ItemDef) namedItemDefs.get(name);
+ if (def == null) {
// no item with that name defined;
// try residual node definitions
ChildNodeDef[] nda = getUnnamedNodeDefs();
@@ -442,8 +442,8 @@
}
}
} else {
- if (id.definesNode()) {
- ChildNodeDef nd = (ChildNodeDef) id;
+ if (def.definesNode()) {
+ ChildNodeDef nd = (ChildNodeDef) def;
// node definition with that name exists
if (!nd.isProtected() && !nd.isAutoCreate()) {
// check node type constraints
@@ -456,12 +456,12 @@
}
void checkRemoveItemConstraints(QName name) throws ConstraintViolationException
{
- ItemDef id = getNamedItemDef(name);
- if (id != null) {
- if (id.isMandatory()) {
+ ItemDef def = getNamedItemDef(name);
+ if (def != null) {
+ if (def.isMandatory()) {
throw new ConstraintViolationException("can't remove mandatory item");
}
- if (id.isProtected()) {
+ if (def.isProtected()) {
throw new ConstraintViolationException("can't remove protected item");
}
}
@@ -536,29 +536,29 @@
}
// named item definitions
- ItemDef[] ida = other.getNamedItemDefs();
- for (int i = 0; i < ida.length; i++) {
- ItemDef id = ida[i];
- if (includesNodeType(id.getDeclaringNodeType())) {
+ ItemDef[] defs = other.getNamedItemDefs();
+ for (int i = 0; i < defs.length; i++) {
+ ItemDef def = defs[i];
+ if (includesNodeType(def.getDeclaringNodeType())) {
// ignore redundant definitions
continue;
}
- QName name = id.getName();
+ QName name = def.getName();
ItemDef existing = getNamedItemDef(name);
if (existing != null) {
// conflict
- String msg = "The item definition for '" + name + "' in node type '" +
id.getDeclaringNodeType() + "' conflicts with node type '" +
existing.getDeclaringNodeType() + "': name collision";
+ String msg = "The item definition for '" + name + "' in node type '" +
def.getDeclaringNodeType() + "' conflicts with node type '" +
existing.getDeclaringNodeType() + "': name collision";
log.error(msg);
throw new NodeTypeConflictException(msg);
}
- namedItemDefs.put(name, id);
+ namedItemDefs.put(name, def);
}
// residual item definitions
- ida = other.getUnnamedItemDefs();
- for (int i = 0; i < ida.length; i++) {
- ItemDef id = ida[i];
- if (includesNodeType(id.getDeclaringNodeType())) {
+ defs = other.getUnnamedItemDefs();
+ for (int i = 0; i < defs.length; i++) {
+ ItemDef def = defs[i];
+ if (includesNodeType(def.getDeclaringNodeType())) {
// ignore redundant definitions
continue;
}
@@ -566,15 +566,15 @@
while (iter.hasNext()) {
ItemDef existing = (ItemDef) iter.next();
// compare with existing definition
- if (id.definesNode() == existing.definesNode()) {
+ if (def.definesNode() == existing.definesNode()) {
// conflict
- String msg = "An item definition in node type '" +
id.getDeclaringNodeType() + "' conflicts with node type '" +
existing.getDeclaringNodeType() + "': ambiguos residual item definition";
+ String msg = "An item definition in node type '" +
def.getDeclaringNodeType() + "' conflicts with node type '" +
existing.getDeclaringNodeType() + "': ambiguos residual item definition";
log.error(msg);
throw new NodeTypeConflictException(msg);
}
}
// @todo check for ambiguous definitions & other conflicts
- unnamedItemDefs.add(id);
+ unnamedItemDefs.add(def);
}
// @todo implement further validations
1.4 +4 -4
jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeImpl.java
Index: NodeTypeImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NodeTypeImpl.java 22 Jun 2004 18:03:07 -0000 1.3
+++ NodeTypeImpl.java 7 Jul 2004 16:06:29 -0000 1.4
@@ -88,7 +88,7 @@
* @throws RepositoryException if no applicable child node definition
* could be found
*/
- public NodeDef getApplicableChildNodeDef(QName nodeName)
+ public NodeDefImpl getApplicableChildNodeDef(QName nodeName)
throws RepositoryException {
return getApplicableChildNodeDef(nodeName, null);
}
@@ -103,7 +103,7 @@
* @throws RepositoryException if no applicable child node definition
* could be found
*/
- public NodeDef getApplicableChildNodeDef(QName nodeName, QName nodeTypeName)
+ public NodeDefImpl getApplicableChildNodeDef(QName nodeName, QName nodeTypeName)
throws RepositoryException {
ChildNodeDef[] cnda = ent.getAllNodeDefs();
ChildNodeDef matching = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]