exo-jcr SVN: r4363 - jcr/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-11 03:15:42 -0400 (Wed, 11 May 2011)
New Revision: 4363
Modified:
jcr/trunk/pom.xml
Log:
EXOJCR-1189: upgrade to Tomcat 6.0.32
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2011-05-11 07:15:04 UTC (rev 4362)
+++ jcr/trunk/pom.xml 2011-05-11 07:15:42 UTC (rev 4363)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.jcr</groupId>
14 years, 11 months
exo-jcr SVN: r4362 - ws/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-11 03:15:04 -0400 (Wed, 11 May 2011)
New Revision: 4362
Modified:
ws/trunk/pom.xml
Log:
EXOJCR-1189: upgrade to Tomcat 6.0.32
Modified: ws/trunk/pom.xml
===================================================================
--- ws/trunk/pom.xml 2011-05-11 07:14:39 UTC (rev 4361)
+++ ws/trunk/pom.xml 2011-05-11 07:15:04 UTC (rev 4362)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.ws</groupId>
14 years, 11 months
exo-jcr SVN: r4361 - core/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-11 03:14:39 -0400 (Wed, 11 May 2011)
New Revision: 4361
Modified:
core/trunk/pom.xml
Log:
EXOJCR-1189: upgrade to Tomcat 6.0.32
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2011-05-11 07:14:18 UTC (rev 4360)
+++ core/trunk/pom.xml 2011-05-11 07:14:39 UTC (rev 4361)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.core</groupId>
14 years, 11 months
exo-jcr SVN: r4360 - kernel/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-11 03:14:18 -0400 (Wed, 11 May 2011)
New Revision: 4360
Modified:
kernel/trunk/pom.xml
Log:
EXOJCR-1189: upgrade to Tomcat 6.0.32
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2011-05-11 07:13:55 UTC (rev 4359)
+++ kernel/trunk/pom.xml 2011-05-11 07:14:18 UTC (rev 4360)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>8</version>
+ <version>9-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.kernel</groupId>
14 years, 11 months
exo-jcr SVN: r4359 - parent/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-11 03:13:55 -0400 (Wed, 11 May 2011)
New Revision: 4359
Modified:
parent/trunk/pom.xml
Log:
EXOJCR-1189: upgrade to Tomcat 6.0.32
Modified: parent/trunk/pom.xml
===================================================================
--- parent/trunk/pom.xml 2011-05-10 13:03:07 UTC (rev 4358)
+++ parent/trunk/pom.xml 2011-05-11 07:13:55 UTC (rev 4359)
@@ -108,7 +108,7 @@
<exo.projects.app.mvn.repo>${exo.projects.directory.dependencies}/repository</exo.projects.app.mvn.repo>
- <exo.projects.app.tomcat.version>tomcat-6.0.24</exo.projects.app.tomcat.version>
+ <exo.projects.app.tomcat.version>tomcat-6.0.32</exo.projects.app.tomcat.version>
<exo.projects.app.jboss.version>jboss-5.1.0.GA</exo.projects.app.jboss.version>
<exo.projects.app.jonas.version>JONAS_4_8_5</exo.projects.app.jonas.version>
14 years, 11 months
exo-jcr SVN: r4358 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-10 09:03:07 -0400 (Tue, 10 May 2011)
New Revision: 4358
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java
Log:
EXOJCR-1250: FUNCTIONAL testing: on configuration multi, cache is turned off there're tests in error and in failure
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java 2011-05-10 13:02:49 UTC (rev 4357)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java 2011-05-10 13:03:07 UTC (rev 4358)
@@ -266,15 +266,17 @@
assertTrue(vhPicture.isNodeType("nt:versionedChild"));
PlainChangesLog changesLogDelete = new PlainChangesLogImpl();
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
+ .getProperty("jcr:childVersionHistory")).getData()));
changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture.getProperty("jcr:primaryType"))
.getData()));
- changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
- .getProperty("jcr:childVersionHistory")).getData()));
- for (ItemState itemState : changesLogDelete.getAllStates())
- {
- dataManager.delete(itemState.getData(), itemState.getAncestorToSave());
- }
- session.save();
+ changesLogDelete.add(ItemState.createDeletedState((vhPicture.getData())));
+
+ picture = wc1.getNode("medias").getNode("picture");
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)picture.getProperty("jcr:mixinTypes"))
+ .getData()));
+
+ dataManager.getTransactManager().save(changesLogDelete);
}
}
@@ -1039,13 +1041,13 @@
.getData()));
changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
.getProperty("jcr:childVersionHistory")).getData()));
+ changesLogDelete.add(ItemState.createDeletedState((vhPicture.getData())));
- for (ItemState itemState : changesLogDelete.getAllStates())
- {
- dataManager.delete(itemState.getData(), itemState.getAncestorToSave());
- }
+ picture = wc1.getNode("medias").getNode("picture");
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)picture.getProperty("jcr:mixinTypes"))
+ .getData()));
- session.save();
+ dataManager.getTransactManager().save(changesLogDelete);
}
}
14 years, 11 months
exo-jcr SVN: r4357 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core and 5 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-10 09:02:49 -0400 (Tue, 10 May 2011)
New Revision: 4357
Added:
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/NodeTypeDataManager.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataCopyIgnoredVisitor.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml
Log:
JCR-1616
What is the problem to fix?
To reproduce the problem:
Create/Open an Article node
Click on Manage Actions and add a new action.
Try to edit this node.
-> The node could not be edited .
Problem analysis
Problem of getting node definition.
How is the problem fixed?
Determinate more suitable node definition based on node type.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/NodeTypeDataManager.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/NodeTypeDataManager.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/NodeTypeDataManager.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -100,6 +100,19 @@
InternalQName[] mixinTypes) throws RepositoryException;
/**
+ * Found node definition based on node name and node type. In case when
+ * suitable node definition not found first occurred residual definition will
+ * be returned.
+ *
+ * @param nodeName
+ * @param parentNodeType
+ * @param parentMixinTypes
+ * @return
+ */
+ NodeDefinitionData getChildNodeDefinition(InternalQName nodeName, InternalQName nodeType,
+ InternalQName parentNodeType, InternalQName[] parentMixinTypes) throws RepositoryException;
+
+ /**
* Returns the <i>direct</i> subtypes of this node type in the node type
* inheritance hierarchy, that is, those which actually declared this node
* type in their list of supertypes.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -275,7 +275,7 @@
primaryTypeName = nodeDef.getDefaultPrimaryType();
// try to make new node
- return doAddNode(parent, name, primaryTypeName);
+ return doAddNode(parent, name, primaryTypeName, nodeDef);
}
@@ -313,7 +313,7 @@
InternalQName ptName = locationFactory.parseJCRName(nodeTypeName).getInternalName();
// try to make new node
- return doAddNode(parent, name, ptName);
+ return doAddNode(parent, name, ptName, null);
}
/**
@@ -835,8 +835,8 @@
NodeData parent = (NodeData)dataManager.getItemData(getParentIdentifier());
this.definition =
- nodeTypesHolder.getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(),
- parent.getMixinTypeNames());
+ nodeTypesHolder.getChildNodeDefinition(getInternalName(), nodeData().getPrimaryTypeName(),
+ parent.getPrimaryTypeName(), parent.getMixinTypeNames());
if (definition == null)
{
@@ -1516,8 +1516,11 @@
}
this.definition =
- session.getWorkspace().getNodeTypesHolder()
- .getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(), parent.getMixinTypeNames());
+ session
+ .getWorkspace()
+ .getNodeTypesHolder()
+ .getChildNodeDefinition(getInternalName(), nodeData().getPrimaryTypeName(), parent.getPrimaryTypeName(),
+ parent.getMixinTypeNames());
if (definition == null)
{
@@ -2374,8 +2377,12 @@
}
// Check if node is not protected
NodeDefinitionData childNodeDefinition =
- session.getWorkspace().getNodeTypesHolder()
- .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());
+ session
+ .getWorkspace()
+ .getNodeTypesHolder()
+ .getChildNodeDefinition(name, primaryTypeName, nodeData().getPrimaryTypeName(),
+ nodeData().getMixinTypeNames());
+
if (childNodeDefinition == null)
throw new ConstraintViolationException("Can't find child node definition for "
+ sysLocFactory.createJCRName(name).getAsString() + " in " + getPath());
@@ -2825,14 +2832,23 @@
return dataManager.getChildNodesCount(nodeData());
}
- private int getNextChildIndex(InternalQName nameToAdd, NodeData parentNode) throws RepositoryException,
- ItemExistsException
+ /**
+ * Calculates next child node index. Is used existed node definition, if no - get one based on node name
+ * and node type.
+ */
+ private int getNextChildIndex(InternalQName nameToAdd, InternalQName primaryTypeName, NodeData parentNode,
+ NodeDefinitionData def) throws RepositoryException, ItemExistsException
{
+ if (def == null)
+ {
+ def =
+ session
+ .getWorkspace()
+ .getNodeTypesHolder()
+ .getChildNodeDefinition(nameToAdd, primaryTypeName, parentNode.getPrimaryTypeName(),
+ parentNode.getMixinTypeNames());
+ }
- NodeDefinitionData def =
- session.getWorkspace().getNodeTypesHolder()
- .getChildNodeDefinition(nameToAdd, parentNode.getPrimaryTypeName(), parentNode.getMixinTypeNames());
-
boolean allowSns = def.isAllowsSameNameSiblings();
int ind = 1;
@@ -2853,27 +2869,16 @@
};
return ind;
-
- // int ind = 0;
- // for (NodeData sibling : siblings)
- // {
- // if (sibling.getQPath().getName().equals(nameToAdd))
- // {
- // if (allowSns)
- // ind++;
- // else
- // throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
- // + " and same name sibling is not allowed ");
- // }
- // }
- // return ind + 1;
-
}
- private NodeImpl doAddNode(NodeImpl parentNode, InternalQName name, InternalQName primaryTypeName)
- throws ItemExistsException, RepositoryException, ConstraintViolationException, VersionException, LockException
+ /**
+ * Do add node internally. If nodeDef not null it is used in getNextChildIndex() method to
+ * avoid double calculation.
+ */
+ private NodeImpl doAddNode(NodeImpl parentNode, InternalQName name, InternalQName primaryTypeName,
+ NodeDefinitionData nodeDef) throws ItemExistsException, RepositoryException, ConstraintViolationException,
+ VersionException, LockException
{
-
validateChildNode(name, primaryTypeName);
// Initialize data
@@ -2881,7 +2886,7 @@
String identifier = IdGenerator.generate();
int orderNum = parentNode.getNextChildOrderNum();
- int index = parentNode.getNextChildIndex(name, parentNode.nodeData());
+ int index = parentNode.getNextChildIndex(name, primaryTypeName, parentNode.nodeData(), nodeDef);
QPath path = QPath.makeChildPath(parentNode.getInternalPath(), name, index);
@@ -2905,7 +2910,6 @@
{
dataManager.updateItemState(autoCreatedState);
}
- // addAutoCreatedItems(node.nodeData(), primaryTypeName);
if (LOG.isDebugEnabled())
LOG.debug("new node : " + node.getPath() + " name: " + " primaryType: " + node.getPrimaryNodeType().getName()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -184,7 +184,6 @@
* @throws RepositoryException
*/
public NodeDefinitionData[] getAllChildNodeDefinitions(final InternalQName... nodeTypeNames)
-
{
final Collection<NodeDefinitionData> defsAny = new ArrayList<NodeDefinitionData>();
final HashMap<InternalQName, NodeDefinitionData> defs = new HashMap<InternalQName, NodeDefinitionData>();
@@ -224,6 +223,7 @@
defsAny.addAll(defs.values());
return defsAny.toArray(new NodeDefinitionData[defsAny.size()]);
+
}
/**
@@ -299,16 +299,7 @@
public NodeDefinitionData getChildNodeDefinition(final InternalQName nodeName, final InternalQName... nodeTypeNames)
throws RepositoryException
{
-
- NodeDefinitionData ndResidual = this.nodeTypeRepository.getDefaultChildNodeDefinition(nodeName, nodeTypeNames);
-
- if (ndResidual == null && !Constants.JCR_ANY_NAME.equals(nodeName))
- {
- ndResidual = getChildNodeDefinition(Constants.JCR_ANY_NAME, nodeTypeNames);
- }
-
- return ndResidual;
-
+ return this.nodeTypeRepository.getDefaultChildNodeDefinition(nodeName, nodeTypeNames);
}
/**
@@ -318,19 +309,53 @@
public NodeDefinitionData getChildNodeDefinition(final InternalQName nodeName, final InternalQName primaryNodeType,
final InternalQName[] mixinTypes) throws RepositoryException
{
+ return getChildNodeDefinition(nodeName, getNodeTypeNames(primaryNodeType, mixinTypes));
+ }
- if (mixinTypes != null)
+ /**
+ * {@inheritDoc}
+ */
+ public NodeDefinitionData getChildNodeDefinition(InternalQName nodeName, InternalQName nodeType,
+ InternalQName parentNodeType, InternalQName[] parentMixinTypes) throws RepositoryException
+ {
+ NodeDefinitionData[] defs = getAllChildNodeDefinitions(getNodeTypeNames(parentNodeType, parentMixinTypes));
+
+ NodeDefinitionData residualDef = null;
+ NodeDefinitionData firstResidualDef = null;
+
+ outer : for (NodeDefinitionData nodeDef : defs)
{
- final InternalQName[] nts = new InternalQName[mixinTypes.length + 1];
- nts[0] = primaryNodeType;
- for (int i = 0; i < mixinTypes.length; i++)
+ if (nodeDef.getName().equals(nodeName))
{
- nts[i + 1] = mixinTypes[i];
+ return nodeDef;
}
- return getChildNodeDefinition(nodeName, nts);
+ else if (nodeDef.isResidualSet())
+ {
+ // store first residual definition to be able to return
+ if (firstResidualDef == null)
+ {
+ firstResidualDef = nodeDef;
+ }
+
+ // check required primary types
+ for (InternalQName requiredPrimaryType : nodeDef.getRequiredPrimaryTypes())
+ {
+ if (!isNodeType(requiredPrimaryType, nodeType))
+ {
+ continue outer;
+ }
+ }
+
+ // when there are several suitable definitions take the most older
+ if (residualDef == null
+ || isNodeType(residualDef.getRequiredPrimaryTypes()[0], nodeDef.getRequiredPrimaryTypes()[0]))
+ {
+ residualDef = nodeDef;
+ }
+ }
}
- return getChildNodeDefinition(nodeName, primaryNodeType);
+ return residualDef != null ? residualDef : firstResidualDef;
}
/**
@@ -1009,4 +1034,18 @@
return changesLog;
}
+
+ private InternalQName[] getNodeTypeNames(final InternalQName primaryNodeType, final InternalQName[] mixinTypes)
+ throws RepositoryException
+ {
+ InternalQName[] ntn = new InternalQName[1 + (mixinTypes == null ? 0 : mixinTypes.length)];
+ ntn[0] = primaryNodeType;
+
+ if (mixinTypes != null)
+ {
+ System.arraycopy(mixinTypes, 0, ntn, 1, mixinTypes.length);
+ }
+
+ return ntn;
+ }
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -228,7 +228,8 @@
NodeData parent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
NodeDefinitionData ndef =
- ntManager.getChildNodeDefinition(qname, parent.getPrimaryTypeName(), parent.getMixinTypeNames());
+ ntManager.getChildNodeDefinition(qname, node.getPrimaryTypeName(), parent.getPrimaryTypeName(),
+ parent.getMixinTypeNames());
if (ndef == null)
{
throw new ConstraintViolationException("Definition not found for " + qname.getAsString());
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataCopyIgnoredVisitor.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataCopyIgnoredVisitor.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataCopyIgnoredVisitor.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -57,6 +57,7 @@
this.restoredChanges = changes;
}
+ @Override
protected void entering(PropertyData property, int level) throws RepositoryException
{
@@ -108,6 +109,7 @@
}
}
+ @Override
protected void entering(NodeData node, int level) throws RepositoryException
{
@@ -122,8 +124,8 @@
{
NodeData existedParent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
NodeDefinitionData ndef =
- ntManager.getChildNodeDefinition(node.getQPath().getName(), existedParent.getPrimaryTypeName(),
- existedParent.getMixinTypeNames());
+ ntManager.getChildNodeDefinition(node.getQPath().getName(), node.getPrimaryTypeName(),
+ existedParent.getPrimaryTypeName(), existedParent.getMixinTypeNames());
// the node can be stored as IGNOREd in restore set, check an action
if (ndef.getOnParentVersion() == OnParentVersionAction.IGNORE)
@@ -164,6 +166,7 @@
parents.push(null); // skip this node as we hasn't parent in restore result
}
+ @Override
protected void leaving(NodeData node, int level) throws RepositoryException
{
if (parents.size() > 0)
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -536,7 +536,8 @@
// current C in the workspace will be left unchanged.
int action =
- nodeTypeDataManager.getChildNodeDefinition(qname, currentNode().getPrimaryTypeName(),
+ nodeTypeDataManager.getChildNodeDefinition(qname, frozen.getPrimaryTypeName(),
+ currentNode().getPrimaryTypeName(),
currentNode().getMixinTypeNames()).getOnParentVersion();
if (log.isDebugEnabled())
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java 2011-05-10 13:02:49 UTC (rev 4357)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.api.nodetypes;
+
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+
+import java.util.GregorianCalendar;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.version.Version;
+
+/**
+ * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
+ * @version $Id: TestNodeDefinitionWCM.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public class TestNodeDefinition extends JcrAPIBaseTest
+{
+
+ public void testNodeTypeWCM1() throws Exception
+ {
+ NodeImpl someNode = (NodeImpl)session.getRootNode().addNode("someNode");
+ someNode.addMixin("mix:referenceable");
+
+ NodeImpl exoWebContent = (NodeImpl)session.getRootNode().addNode("exoWebContent", "exo:webContent");
+ exoWebContent.setProperty("exo:title", "tit");
+ session.save();
+
+ // add nt:file
+ NodeImpl ntFile1 = (NodeImpl)exoWebContent.addNode("ntFile-1", "nt:file");
+ NodeImpl jcrContent = (NodeImpl)ntFile1.addNode("jcr:content", "nt:resource");
+ jcrContent.setProperty("jcr:data", "");
+ jcrContent.setProperty("jcr:mimeType", "");
+ jcrContent.setProperty("jcr:lastModified", new GregorianCalendar());
+ session.save();
+
+ exoWebContent.addMixin("exo:actionable");
+ exoWebContent.setProperty("exo:actions", someNode);
+ session.save();
+
+ // add exo:actionStorage
+ NodeImpl actionStorage = (NodeImpl)exoWebContent.addNode("actionStorage", "exo:actionStorage");
+ session.save();
+
+ // add nt:file
+ NodeImpl ntFile2 = (NodeImpl)exoWebContent.addNode("ntFile-2", "nt:file");
+ jcrContent = (NodeImpl)ntFile2.addNode("jcr:content", "nt:resource");
+ jcrContent.setProperty("jcr:data", "");
+ jcrContent.setProperty("jcr:mimeType", "");
+ jcrContent.setProperty("jcr:lastModified", new GregorianCalendar());
+ session.save();
+
+ SessionImpl session = (SessionImpl)repository.login(credentials, WORKSPACE);
+
+ ntFile1 = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("ntFile-1");
+ assertEquals(ntFile1.getDefinition().getRequiredPrimaryTypes()[0].getName(), "nt:base");
+
+ ntFile2 = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("ntFile-2");
+ assertEquals(ntFile2.getDefinition().getRequiredPrimaryTypes()[0].getName(), "nt:base");
+
+ actionStorage = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("actionStorage");
+ assertEquals(actionStorage.getDefinition().getRequiredPrimaryTypes()[0].getName(), "exo:actionStorage");
+ }
+
+ public void testNodeTypeWCM2() throws Exception
+ {
+ Node parent = session.getRootNode().addNode("parent", "exo:newsletterCategory");
+ parent.addNode("child", "nt:unstructured");
+ parent.setProperty("exo:newsletterCategoryTitle", "title");
+ session.save();
+ }
+
+ public void testNTVersionedChild() throws Exception
+ {
+ Node folder1 = session.getRootNode().addNode("folder1", "nt:folder");
+ Node folder2 = folder1.addNode("folder2", "nt:folder");
+ Node folder3 = folder2.addNode("folder3", "nt:folder");
+ folder1.addMixin("mix:versionable");
+ folder3.addMixin("mix:versionable");
+ session.save();
+
+ Version ver1 = folder1.checkin();
+ folder1.checkout();
+
+ folder3 =
+ (NodeImpl)session.getItem("/jcr:system/jcr:versionStorage/" + ver1.getParent().getUUID()
+ + "/1/jcr:frozenNode/folder2/folder3");
+
+ try
+ {
+ folder3.getDefinition();
+ }
+ catch (RepositoryException e)
+ {
+ fail();
+ }
+ }
+}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml 2011-05-10 12:18:02 UTC (rev 4356)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml 2011-05-10 13:02:49 UTC (rev 4357)
@@ -253,4 +253,90 @@
</propertyDefinitions>
</nodeType>
+ <nodeType name="exo:newsletterEntry" isMixin="true" hasOrderableChildNodes="true" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="exo:newsletterEntryCategoryName" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterEntrySubscriptionName" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterEntryType" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterEntryDate" requiredType="Date" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterEntryStatus" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="exo:newsletterSubscription" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:unstructured</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="exo:newsletterSubscribedUser" requiredType="Reference" autoCreated="true" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="nt:base" autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>nt:base</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="exo:newsletterCategory" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:unstructured</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="exo:newsletterCategoryTitle" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterCategoryDescription" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>nt:base</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ <childNodeDefinition name="*" defaultPrimaryType="exo:newsletterSubscription" autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSiblings="true">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>exo:newsletterSubscription</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="exo:newsletterUser" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:unstructured</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="exo:newsletterUserMail" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterUserConfirm" requiredType="Boolean" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterUserBanned" requiredType="Boolean" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:newsletterUserValidationCode" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
</nodeTypes>
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/readme.txt 2011-05-10 13:02:49 UTC (rev 4357)
@@ -0,0 +1,77 @@
+Summary
+
+ Status: Don't Allow adding Actions into Contents other than Folder nodetypes
+ CCP Issue: CCP-480, Product Jira Issues: JCR-1616. Backport of JCR-1595.
+ Fixes also: ECM-5477.
+ Needed also: ECM-5591.
+ Complexity: Low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+
+ To reproduce the problem:
+ Create/Open an Article node
+ Click on Manage Actions and add a new action.
+ Try to edit this node.
+ -> The node could not be edited .
+
+Fix description
+
+Problem analysis
+
+ Problem of getting node definition.
+
+How is the problem fixed?
+
+ Determinate more suitable node definition based on node type.
+
+Patch information:
+Patch files: JCR-1616.patch
+
+Tests to perform
+
+Reproduction test
+
+ TestNodeDefinition.java
+
+Tests performed at DevLevel
+
+ Functional testing in jcr.core project
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ No
+
+Configuration changes
+
+Configuration changes:
+ No
+
+Will previous configuration continue to work?
+ Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ No
+
+Is there a performance risk/cost?
+ No, patch tested by QA TESTUKR-220
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved
+
+Support Comment
+* Patch validated
+
+QA Feedbacks
+*
+
14 years, 11 months
exo-jcr SVN: r4356 - in jcr/branches/1.12.x: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/lock and 1 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-10 08:18:02 -0400 (Tue, 10 May 2011)
New Revision: 4356
Added:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1615/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLock.java
Log:
JCR-1615
What is the problem to fix?
1- Go to the Drive "Collaboration"
2- Lock the "documents" folder
3- Create a new document in the "documents" folder, save it as draft than close it
4- Click on the "publish" button: we get an exception: "javax.jcr.lock.LockException: Node /Documents is locked..."
5- Changing publication state through Manage Publications action: it works fine even if the item is locked.
How is the problem fixed?
On JCR side locking bug is fixed. When calling Node.checkIn() JCR checks if parent is locked, that is actually a bug. Since Node.checkIn() doesn't modify the parent node, so it should only check if current node not locked.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 12:01:51 UTC (rev 4355)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 12:18:02 UTC (rev 4356)
@@ -433,8 +433,8 @@
if (hasProperty(Constants.JCR_MERGEFAILED))
throw new VersionException("Node has jcr:mergeFailed " + getPath());
- if (!parent().checkLocking())
- throw new LockException("Node " + parent().getPath() + " is locked ");
+ if (!checkLocking())
+ throw new LockException("Node " + getPath() + " is locked ");
// the new version identifier
String verIdentifier = IdGenerator.generate();
@@ -480,6 +480,9 @@
throw new UnsupportedRepositoryOperationException(
"Node.checkout() is not supported for not mix:versionable node ");
+ if (!checkLocking())
+ throw new LockException("Node " + getPath() + " is locked ");
+
if (checkedOut())
return;
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLock.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLock.java 2011-05-10 12:01:51 UTC (rev 4355)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLock.java 2011-05-10 12:18:02 UTC (rev 4356)
@@ -50,17 +50,21 @@
super.setUp();
if (lockedNode == null)
+ {
try
{
lockedNode = root.addNode("locked node");
if (lockedNode.canAddMixin("mix:lockable"))
+ {
lockedNode.addMixin("mix:lockable");
+ }
root.save();
}
catch (RepositoryException e)
{
fail("Child node must be accessible and readable. But error occurs: " + e);
}
+ }
}
/**
@@ -223,7 +227,9 @@
Session session1 = repository.login(new CredentialsImpl("admin", "admin".toCharArray()), "ws");
Node nodeToLockSession1 = session1.getRootNode().addNode("nodeToLockSession1");
if (nodeToLockSession1.canAddMixin("mix:lockable"))
+ {
nodeToLockSession1.addMixin("mix:lockable");
+ }
session1.save();
Lock lock = nodeToLockSession1.lock(true, false);// boolean isSessionScoped
// in ECM we are using lock(true, true) without saving lockToken
@@ -317,7 +323,9 @@
Session session1 = repository.login(new CredentialsImpl("admin", "admin".toCharArray()), "ws");
Node nodeToCopyLock = session1.getRootNode().addNode("node2testCopyLockedNode");
if (nodeToCopyLock.canAddMixin("mix:lockable"))
+ {
nodeToCopyLock.addMixin("mix:lockable");
+ }
session1.save();
Lock lock = nodeToCopyLock.lock(true, false);// boolean isSessionScoped
// in ECM we are using lock(true, true) without saving lockToken
@@ -503,4 +511,70 @@
}
}
+
+ public void testCheckInWhenParentLocked() throws RepositoryException
+ {
+ // creating node that is going to be locked, adding a child also.
+
+ Session session1 = repository.login(new CredentialsImpl("root", "exo".toCharArray()), "ws");
+ Node parentLockedNodeSession1 = session1.getRootNode().addNode("testCheckInWhenParentLocked");
+ parentLockedNodeSession1.addMixin("mix:lockable");
+ parentLockedNodeSession1.addMixin("mix:versionable");
+ Node childNodeSession1 = parentLockedNodeSession1.addNode("child");
+ childNodeSession1.addMixin("mix:versionable");
+ childNodeSession1.setProperty("property", "value");
+ session1.save();
+ // locking it
+ parentLockedNodeSession1.lock(false, false);
+ session1.save();
+ assertTrue(parentLockedNodeSession1.isLocked());
+ Node parentLockedNode = session.getRootNode().getNode("testCheckInWhenParentLocked");
+ Node childNode = parentLockedNode.getNode("child");
+
+ try
+ {
+ childNode.checkin();
+ }
+ catch (LockException e)
+ {
+ fail("CheckIn shouldn't throw a lockException if parent node locked with isDeep=false");
+ }
+
+ session1.logout();
+
+ }
+
+ public void testCheckOutWhenLocked() throws RepositoryException
+ {
+ // creating node that is going to be locked, adding a child also.
+
+ Session session1 = repository.login(new CredentialsImpl("root", "exo".toCharArray()), "ws");
+ Node lockedNodeSession1 = session1.getRootNode().addNode("testCheckOutWhenLocked");
+ lockedNodeSession1.addMixin("mix:lockable");
+ lockedNodeSession1.addMixin("mix:versionable");
+ session1.save();
+ lockedNodeSession1.checkin();
+ // locking it
+ lockedNodeSession1.lock(false, false);
+ session1.save();
+ assertTrue(lockedNodeSession1.isLocked());
+
+ Node lockedNode = session.getRootNode().getNode("testCheckOutWhenLocked");
+
+ try
+ {
+ lockedNode.checkout();
+ fail("Lock exeption should be thrown");
+ }
+ catch (LockException e)
+ {
+ // it's okey
+ }
+
+ lockedNodeSession1.checkout();
+ session1.save();
+
+ session1.logout();
+ }
+
}
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1615/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1615/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1615/readme.txt 2011-05-10 12:18:02 UTC (rev 4356)
@@ -0,0 +1,70 @@
+Summary
+
+ Status: Problem when publishing a locked item
+ CCP Issue: CCP-848, Product Jira Issue: JCR-1615.
+ Fixes also: ECMS-2079
+ Complexity: N/A
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+1- Go to the Drive "Collaboration"
+2- Lock the "documents" folder
+3- Create a new document in the "documents" folder, save it as draft than close it
+4- Click on the "publish" button: we get an exception: "javax.jcr.lock.LockException: Node /Documents is locked..."
+5- Changing publication state through Manage Publications action: it works fine even if the item is locked.
+Fix description
+
+How is the problem fixed?
+
+ On JCR side locking bug is fixed. When calling Node.checkIn() JCR checks if parent is locked, that is actually a bug. Since Node.checkIn() doesn't modify the parent node, so it should only check if current node not locked.
+
+Patch information:
+Patch files: JCR-1615.patch
+
+Tests to perform
+
+Reproduction test
+
+ org.exoplatform.services.jcr.api.lock.TestLock.testCheckInWhenParentLocked()
+
+Tests performed at DevLevel
+
+ Full set of JCR-TCK and eXo-JCR tests
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ No
+
+Configuration changes
+
+Configuration changes:
+ No
+
+Will previous configuration continue to work?
+ Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ None
+
+Is there a performance risk/cost?
+ No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved.
+
+Support Comment
+* Patch validated.
+
+QA Feedbacks
+*
+
14 years, 11 months
exo-jcr SVN: r4355 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow and 3 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-10 08:01:51 -0400 (Tue, 10 May 2011)
New Revision: 4355
Added:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1613/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-usecase.xml
Log:
JCR-1613
This bug happens randomly (like EXOJCR-1234) when a node is ordered after it was moved at the same parent (to rename it).
For instance let's suppose we have an ordered list ("a","b") and we want to rename "a" to "c" and keep the same order then the JCR operations to do it are:
session.move(parent.getPath() + "/a", parent.getPath() + "/c");
parent.orderBefore("c", "b");
How is the problem fixed?
New node is added to the end of the list of parent node as implementation says
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 09:21:30 UTC (rev 4354)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-05-10 12:01:51 UTC (rev 4355)
@@ -2441,11 +2441,6 @@
protected void doOrderBefore(QPath srcPath, QPath destPath) throws RepositoryException
{
- if (!getPrimaryNodeType().hasOrderableChildNodes())
- {
- throw new UnsupportedRepositoryOperationException("child node ordering not supported on node " + getPath());
- }
-
if (srcPath.equals(destPath))
{
return;
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java 2011-05-10 09:21:30 UTC (rev 4354)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java 2011-05-10 12:01:51 UTC (rev 4355)
@@ -133,18 +133,23 @@
NodeData srcParent;
destIndex = 1;
+
+ // If ordering is supported by the node
+ // type of the parent node of the new location, then the
+ // newly moved node is appended to the end of the child
+ // node list.
destOrderNum = destChilds.size() > 0 ? destChilds.get(destChilds.size() - 1).getOrderNumber() + 1 : 0;
if (parent.getIdentifier().equals(node.getParentIdentifier()))
{
- // move to another dest
+ // move to same parent
srcChilds = destChilds;
srcParent = parent;
}
else
{
- // move of SNSes on same parent
- // find index and orederNum on destination
+ // move to another parent
+ // find index on destination
for (NodeData dchild : destChilds)
{
if (dchild.getQPath().getName().equals(qname))
@@ -154,16 +159,17 @@
// for fix SNSes on source
srcParent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
if (srcParent == null)
+ {
throw new RepositoryException("FATAL: parent Node not for " + node.getQPath().getAsString()
+ ", parent id: " + node.getParentIdentifier());
+ }
srcChilds = dataManager.getChildNodesData(srcParent);
}
- int srcOrderNum = 0;
int srcIndex = 1;
- // Calculate SNS index on source
+ // Fix SNS on source
for (int i = 0; i < srcChilds.size(); i++)
{
NodeData child = srcChilds.get(i);
@@ -173,22 +179,21 @@
{
QPath siblingPath = QPath.makeChildPath(srcParent.getQPath(), child.getQPath().getName(), srcIndex);
TransientNodeData sibling =
- new TransientNodeData(siblingPath, child.getIdentifier(), child.getPersistedVersion() + 1, child
- .getPrimaryTypeName(), child.getMixinTypeNames(), srcOrderNum, // orderNum
+ new TransientNodeData(siblingPath, child.getIdentifier(), child.getPersistedVersion() + 1,
+ child.getPrimaryTypeName(), child.getMixinTypeNames(), child.getOrderNumber(),
child.getParentIdentifier(), child.getACL());
+
addStates.add(new ItemState(sibling, ItemState.UPDATED, true, ancestorToSave, false, true));
srcIndex++;
}
-
- srcOrderNum++;
}
}
+ // in case of moving to the same parent destination index is calculated above
if (srcChilds == destChilds)
{
destIndex = srcIndex;
- destOrderNum = srcOrderNum;
}
}
else
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java 2011-05-10 09:21:30 UTC (rev 4354)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java 2011-05-10 12:01:51 UTC (rev 4355)
@@ -19,6 +19,9 @@
package org.exoplatform.services.jcr.api.writing;
import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.util.EntityCollection;
import java.util.ArrayList;
@@ -1032,6 +1035,76 @@
}
}
+ public void testOrderBeforeAfterMove() throws Exception
+ {
+ SessionImpl session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ Node list = session.getRootNode().addNode("list2", "list");
+ assertEquals("list", list.getPrimaryNodeType().getName());
+ assertTrue(list.getPrimaryNodeType().hasOrderableChildNodes());
+
+ String path = list.addNode("1").getPath();
+ list.addNode("2");
+ session.save();
+ session.logout();
+
+ session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ list = session.getRootNode().getNode("list2");
+ session.move(path, list.getPath() + "/3");
+ list.orderBefore("3", "2");
+ session.save();
+ session.logout();
+
+ session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ NodeIterator it = session.getRootNode().getNode("list2").getNodes();
+ NodeImpl node1 = (NodeImpl)it.nextNode();
+ NodeImpl node2 = (NodeImpl)it.nextNode();
+ assertEquals("3", node1.getName());
+ assertEquals("2", node2.getName());
+ assertTrue(((NodeData)node1.getData()).getOrderNumber() < ((NodeData)node2.getData()).getOrderNumber());
+
+ session.logout();
+ }
+
+ public void testOrderBeforeAfterMove2() throws Exception
+ {
+ SessionImpl session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ Node list = session.getRootNode().addNode("list2", "list");
+ assertEquals("list", list.getPrimaryNodeType().getName());
+ assertTrue(list.getPrimaryNodeType().hasOrderableChildNodes());
+
+ list.addNode("1");
+ list.addNode("2");
+ list.addNode("3");
+ list.addNode("4");
+ session.save();
+ session.logout();
+
+ session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ list = session.getRootNode().getNode("list2");
+ session.move(list.getPath() + "/2", list.getPath() + "/5");
+ list.orderBefore("5", "1");
+ session.save();
+ session.logout();
+
+ session = (SessionImpl)repository.login(credentials, WORKSPACE);
+ NodeIterator it = session.getRootNode().getNode("list2").getNodes();
+ NodeImpl node1 = (NodeImpl)it.nextNode();
+ NodeImpl node2 = (NodeImpl)it.nextNode();
+ NodeImpl node3 = (NodeImpl)it.nextNode();
+ NodeImpl node4 = (NodeImpl)it.nextNode();
+
+ assertEquals("5", node1.getName());
+ assertEquals("1", node2.getName());
+ assertEquals("3", node3.getName());
+ assertEquals("4", node4.getName());
+
+ assertTrue(((NodeData)node1.getData()).getOrderNumber() < ((NodeData)node2.getData()).getOrderNumber());
+ assertTrue(((NodeData)node2.getData()).getOrderNumber() < ((NodeData)node3.getData()).getOrderNumber());
+ assertTrue(((NodeData)node3.getData()).getOrderNumber() < ((NodeData)node4.getData()).getOrderNumber());
+
+ session.logout();
+ }
+
private EntityCollection getEntityCollection(NodeIterator nodes)
{
List result = new ArrayList();
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-usecase.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-usecase.xml 2011-05-10 09:21:30 UTC (rev 4354)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-usecase.xml 2011-05-10 12:01:51 UTC (rev 4355)
@@ -253,4 +253,18 @@
</propertyDefinitions>
</nodeType>
+ <nodeType name="list" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>nt:unstructured</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+
</nodeTypes>
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1613/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1613/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1613/readme.txt 2011-05-10 12:01:51 UTC (rev 4355)
@@ -0,0 +1,67 @@
+Summary
+
+ Status: Backporting EXOJCR-1305 to JCR 1.12.x
+ CCP Issue: CPP-915, Product Jira Issue: JCR-1613.
+ Complexity: Low
+
+The Proposal
+Problem description
+
+This bug happens randomly (like EXOJCR-1234) when a node is ordered after it was moved at the same parent (to rename it).
+For instance let's suppose we have an ordered list ("a","b") and we want to rename "a" to "c" and keep the same order then the JCR operations to do it are:
+
+session.move(parent.getPath() + "/a", parent.getPath() + "/c");
+parent.orderBefore("c", "b");
+
+Fix description
+
+How is the problem fixed?
+
+ New node is added to the end of the list of parent node as implementation says
+
+Patch information:
+Patch files: JCR-1613.patch
+
+Tests to perform
+
+Reproduction test
+ * TestOrderBefore.java
+
+Tests performed at DevLevel
+ * Functional tests
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ * No
+
+Configuration changes
+
+Configuration changes:
+ * No
+
+Will previous configuration continue to work?
+ * Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ No
+
+Is there a performance risk/cost?
+ * No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved
+
+Support Comment
+* Patch validated
+
+QA Feedbacks
+*
+
14 years, 11 months
exo-jcr SVN: r4354 - in core/branches/2.3.x: patch/2.3.9/COR-236 and 1 other directory.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-10 05:21:30 -0400 (Tue, 10 May 2011)
New Revision: 4354
Added:
core/branches/2.3.x/patch/2.3.9/COR-236/readme.txt
Modified:
core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java
core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/LDAPAttributeMapping.java
Log:
COR-236
What is the problem to fix?
Using Oracle Virtual Directory + MS SQL Server, there are problems with upper-case LDAP prefix "OU".
Queries must be lower-cased to avoid such problems.
How is the problem fixed?
Replace uppercased "OU" and "CN" by lower cased on "ou" and "cn" respectively.
Modified: core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java
===================================================================
--- core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java 2011-05-10 09:16:39 UTC (rev 4353)
+++ core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/ADUserDAOImpl.java 2011-05-10 09:21:30 UTC (rev 4354)
@@ -75,7 +75,7 @@
@Override
public void createUser(User user, boolean broadcast) throws Exception
{
- String userDN = "CN=" + user.getUserName() + "," + ldapAttrMapping.userURL;
+ String userDN = ldapAttrMapping.userDNKey + "=" + user.getUserName() + "," + ldapAttrMapping.userURL;
Attributes attrs = ldapAttrMapping.userToAttributes(user);
attrs.put("userAccountControl", Integer.toString(UF_NORMAL_ACCOUNT + UF_PASSWD_NOTREQD + UF_PASSWORD_EXPIRED
+ UF_ACCOUNTDISABLE));
Modified: core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/LDAPAttributeMapping.java
===================================================================
--- core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/LDAPAttributeMapping.java 2011-05-10 09:16:39 UTC (rev 4353)
+++ core/branches/2.3.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/LDAPAttributeMapping.java 2011-05-10 09:21:30 UTC (rev 4354)
@@ -67,14 +67,12 @@
// TODO remove initialization in major release. It may be not initialized from
// for AD.
- String userDNKey = "CN";
+ String userDNKey = "cn";
//TODO remove initialization in major release. Should be initialized from
// configuration.
- String groupDNKey = "OU";
+ String groupDNKey = "ou";
- //
-
String userUsernameAttr;
String userPassword;
Added: core/branches/2.3.x/patch/2.3.9/COR-236/readme.txt
===================================================================
--- core/branches/2.3.x/patch/2.3.9/COR-236/readme.txt (rev 0)
+++ core/branches/2.3.x/patch/2.3.9/COR-236/readme.txt 2011-05-10 09:21:30 UTC (rev 4354)
@@ -0,0 +1,78 @@
+Summary
+
+ Status: Case sensitivity Problem with Oracle Virtual Directory and SQL Server
+ CCP Issue: CCP-910, Product Jira Issue: COR-236. Backport of COR-233.
+ Complexity: Low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+Using Oracle Virtual Directory + MS SQL Server, there are problems with upper-case LDAP prefix "OU".
+Queries must be lower-cased to avoid such problems.
+Fix description
+
+How is the problem fixed?
+
+ Replace uppercased "OU" and "CN" by lower cased on "ou" and "cn" respectively.
+
+Patch information:
+Patch files: COR-236.patch
+
+Tests to perform
+
+Reproduction test
+
+ Reproduction can be only performed manually with Oracle Virtual Directory + MS SQL Server
+
+Tests performed at DevLevel
+
+ Tomcat AS + LDAP Organization service + AD
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ No
+
+Configuration changes
+
+Configuration changes:
+
+ By default, group and user DN keys are in lower case, but it is possible to configure via initialization params if needed:
+
+ <value-param>
+ <name>ldap.userDN.key</name>
+ <description>The key used to compose user DN</description>^
+ <value>cn</value>
+ </value-param>
+ <value-param>
+ <name>ldap.groupDN.key</name>
+ <description>The key used to compose group DN</description>^
+ <value>ou</value>
+ </value-param>
+
+Will previous configuration continue to work?
+ Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ No
+
+Is there a performance risk/cost?
+ No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Approved
+
+Support Comment
+* Validated
+
+QA Feedbacks
+*
+
14 years, 11 months