[exo-jcr-commits] exo-jcr SVN: r4163 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core and 11 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Mar 22 12:14:39 EDT 2011
Author: sergiykarpenko
Date: 2011-03-22 12:14:38 -0400 (Tue, 22 Mar 2011)
New Revision: 4163
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
Log:
EXOJCR-1234: NodeImpl.getNextChildOrderNum() now uses special query that returns last order number.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -91,6 +91,15 @@
* @return int, child nodes count
*/
int getChildNodesCount(NodeData parent) throws RepositoryException;
+
+ /**
+ * Get order number of parent's last child node.
+ *
+ * @param parent node
+ * @return int Returns last child nodes order number or -1 if there is no subnodes.
+ * @throws RepositoryException
+ */
+ int getLastOrderNumber(NodeData parent) throws RepositoryException;
/**
* Get child Properties of the parent node.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -2984,7 +2984,7 @@
private int getNextChildOrderNum() throws RepositoryException
{
- return dataManager.getChildNodesCount(nodeData());
+ return dataManager.getLastOrderNumber(nodeData()) + 1;
}
private int getNextChildIndex(InternalQName nameToAdd, NodeData parentNode) throws RepositoryException,
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -963,6 +963,24 @@
/**
* {@inheritDoc}
*/
+ public int getLastOrderNumber(NodeData parent) throws RepositoryException
+ {
+ int lastOrderNumber = changesLog.getLastChildOrderNumber(parent.getIdentifier());
+ int lastPersistedNodeOrderNumber = transactionableManager.getLastOrderNumber(parent);
+
+ if (lastOrderNumber != -1 && lastPersistedNodeOrderNumber < lastOrderNumber)
+ {
+ return lastOrderNumber;
+ }
+ else
+ {
+ return lastPersistedNodeOrderNumber;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
int childsCount =
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -264,7 +264,7 @@
protected int calculateNewNodeOrderNumber() throws RepositoryException
{
- return dataManager.getChildNodesCount(curParent());
+ return (dataManager.getLastOrderNumber(curParent()))+1;
}
protected QPath calculateNewNodePath(NodeData node, int level) throws RepositoryException
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -158,6 +158,14 @@
/**
* {@inheritDoc}
*/
+ public int getLastOrderNumber(final NodeData parent) throws RepositoryException
+ {
+ return persistentManager.getLastOrderNumber(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
return persistentManager.getChildNodesCount(parent);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -467,10 +467,27 @@
con.close();
}
}
-
+
/**
* {@inheritDoc}
*/
+ @Override
+ public int getLastOrderNumber(final NodeData nodeData) throws RepositoryException
+ {
+ final WorkspaceStorageConnection con = dataContainer.openConnection();
+ try
+ {
+ return con.getLastOrderNumber(nodeData);
+ }
+ finally
+ {
+ con.close();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -135,6 +135,14 @@
/**
* {@inheritDoc}
*/
+ public int getLastOrderNumber(final NodeData parent) throws RepositoryException
+ {
+ return storageDataManager.getLastOrderNumber(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
return storageDataManager.getChildNodesCount(parent);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -416,6 +416,13 @@
return childCount == null ? 0 : childCount[0];
}
+ public int getLastChildOrderNumber(String rootIdentifier)
+ {
+
+ int[] childInfo = childNodesCount.get(rootIdentifier);
+ return childInfo == null ? -1 : childInfo[1];
+ }
+
/**
* Collect last in ChangesLog order item child changes.
*
@@ -665,13 +672,17 @@
{
int[] childCount = childNodesCount.get(item.getData().getParentIdentifier());
if (childCount == null)
- childCount = new int[1];
+ childCount = new int[2];
if (item.isDeleted())
+ {
--childCount[0];
+ }
else if (item.isAdded())
+ {
++childCount[0];
-
+ childCount[1] = ((NodeData)item.getData()).getOrderNumber();
+ }
childNodesCount.put(item.getData().getParentIdentifier(), childCount);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -114,6 +114,46 @@
/**
* {@inheritDoc}
*/
+ public int getLastOrderNumber(final NodeData parent) throws RepositoryException
+ {
+ if (txStarted())
+ {
+ int txLastOrderNumber = -1;
+ for (ItemState change : transactionLog.getAllStates())
+ {
+ if (change.isNode() && change.isPersisted()
+ && change.getData().getParentIdentifier().equals(parent.getIdentifier()))
+ {
+ if (change.isAdded())
+ {
+ int orderNumber = ((NodeData)change.getData()).getOrderNumber();
+ if (orderNumber > txLastOrderNumber)
+ {
+ txLastOrderNumber = orderNumber;
+ }
+ }
+ }
+ }
+
+ int lastOrderNumber = storageDataManager.getLastOrderNumber(parent);
+ if (lastOrderNumber > txLastOrderNumber)
+ {
+ return lastOrderNumber;
+ }
+ else
+ {
+ return txLastOrderNumber;
+ }
+ }
+ else
+ {
+ return storageDataManager.getLastOrderNumber(parent);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
if (txStarted())
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -129,6 +129,11 @@
return null;
}
+ public int getLastOrderNumber(NodeData nodeData) throws RepositoryException
+ {
+ return -1;
+ }
+
public int getChildNodesCount(NodeData nodeData) throws RepositoryException
{
return 0;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -128,8 +128,13 @@
* FIND_NODES_BY_PARENTID.
*/
protected String FIND_NODES_BY_PARENTID;
-
+
/**
+ * FIND_LAST_ORDER_NUMBER_BY_PARENTID.
+ */
+ protected String FIND_LAST_ORDER_NUMBER_BY_PARENTID;
+
+ /**
* FIND_NODES_COUNT_BY_PARENTID.
*/
protected String FIND_NODES_COUNT_BY_PARENTID;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -158,6 +158,8 @@
protected PreparedStatement findNodesByParentId;
+ protected PreparedStatement findLastOrderNumberByParentId;
+
protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
@@ -935,6 +937,51 @@
/**
* {@inheritDoc}
*/
+ public int getLastOrderNumber(NodeData parent) throws RepositoryException
+ {
+ checkIfOpened();
+ try
+ {
+ ResultSet count = findLastOrderNumberByParentIdentifier(getInternalId(parent.getIdentifier()));
+ try
+ {
+ if (count.next())
+ {
+ if (count.getInt(1) > 0)
+ {
+ return count.getInt(2);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ finally
+ {
+ try
+ {
+ count.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("Can't close the ResultSet: " + e);
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
checkIfOpened();
@@ -2772,6 +2819,8 @@
protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
+ protected abstract ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException;
+
protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -81,6 +81,8 @@
"select V.DATA" + " from JCR_MITEM I, JCR_MVALUE V"
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1" + " order by N_ORDER_NUM";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_MITEM where PARENT_ID=? and I_CLASS=1";
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=2" + " order by ID";
}
@@ -185,6 +187,18 @@
}
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(final String parentIdentifier) throws SQLException
+ {
+ return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
+ {
+ public ResultSet run() throws Exception
+ {
+ return HSQLDBMultiDbJDBCConnection.super.findLastOrderNumberByParentIdentifier(parentIdentifier);
+ }
+ });
+ }
+
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(final String parentIdentifier) throws SQLException
{
return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -87,6 +87,8 @@
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?" + " order by N_ORDER_NUM";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_SITEM where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?";
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?";
FIND_PROPERTIES_BY_PARENTID =
@@ -172,6 +174,30 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, parentIdentifier);
+ findLastOrderNumberByParentId.setString(2, containerName);
+
+ PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+ {
+ public ResultSet run() throws Exception
+ {
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+ };
+ return SecurityHelper.doPrivilegedSQLExceptionAction(action);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
{
if (findNodesCountByParentId == null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -129,6 +129,9 @@
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?" + " order by N_ORDER_NUM";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_MITEM where I_CLASS=1 and PARENT_ID=?";
+
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
@@ -374,6 +377,21 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, parentIdentifier);
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException
{
if (findNodesCountByParentId == null)
@@ -521,6 +539,7 @@
@Override
protected ResultSet findNodesAndProperties(String lastNodeId, int offset, int limit) throws SQLException
{
- throw new UnsupportedOperationException("The method findNodesAndProperties is not supported for this type of connection use the complex queries instead");
+ throw new UnsupportedOperationException(
+ "The method findNodesAndProperties is not supported for this type of connection use the complex queries instead");
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -135,6 +135,9 @@
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?" + " order by N_ORDER_NUM";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
+
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
@@ -284,6 +287,22 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, containerName);
+ findLastOrderNumberByParentId.setString(2, parentIdentifier);
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
{
if (findNodesCountByParentId == null)
@@ -542,6 +561,7 @@
@Override
protected ResultSet findNodesAndProperties(String lastNodeId, int offset, int limit) throws SQLException
{
- throw new UnsupportedOperationException("The method findNodesAndProperties is not supported for this type of connection use the complex queries instead");
+ throw new UnsupportedOperationException(
+ "The method findNodesAndProperties is not supported for this type of connection use the complex queries instead");
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -83,6 +83,10 @@
"select V.DATA" + " from JCR_MITEM I, JCR_MVALUE V"
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1" + " order by N_ORDER_NUM";
+
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_MITEM where PARENT_ID=? and I_CLASS=1";
+
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=2" + " order by ID";
FIND_NODES_BY_PARENTID_CQ =
@@ -215,6 +219,18 @@
}
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(final String parentIdentifier) throws SQLException
+ {
+ return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
+ {
+ public ResultSet run() throws Exception
+ {
+ return HSQLDBMultiDbJDBCConnection.super.findLastOrderNumberByParentIdentifier(parentIdentifier);
+ }
+ });
+ }
+
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(final String parentIdentifier) throws SQLException
{
return SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -91,6 +91,10 @@
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?" + " order by N_ORDER_NUM";
+
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_SITEM where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?";
+
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?";
FIND_PROPERTIES_BY_PARENTID =
@@ -195,6 +199,30 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, parentIdentifier);
+ findLastOrderNumberByParentId.setString(2, containerName);
+
+ PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+ {
+ public ResultSet run() throws Exception
+ {
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+ };
+ return SecurityHelper.doPrivilegedSQLExceptionAction(action);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
{
if (findNodesCountByParentId == null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -153,6 +153,9 @@
+ " from JCR_MITEM I, (SELECT ID, PARENT_ID from JCR_MITEM where ID=?) J"
+ " where I.ID = J.ID or I.ID = J.PARENT_ID";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_MITEM where I_CLASS=1 and PARENT_ID=?";
+
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by NAME";
@@ -180,8 +183,8 @@
DELETE_VALUE = "delete from JCR_MVALUE where PROPERTY_ID=?";
DELETE_REF = "delete from JCR_MREF where PROPERTY_ID=?";
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
@@ -423,6 +426,21 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, parentIdentifier);
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException
{
if (findNodesCountByParentId == null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -159,6 +159,9 @@
+ " from JCR_SITEM I, (SELECT ID, PARENT_ID from JCR_SITEM where ID=?) J"
+ " where I.ID = J.ID or I.ID = J.PARENT_ID";
+ FIND_LAST_ORDER_NUMBER_BY_PARENTID =
+ "select count(*), max(N_ORDER_NUM) from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
+
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
@@ -187,8 +190,8 @@
DELETE_VALUE = "delete from JCR_SVALUE where PROPERTY_ID=?";
DELETE_REF = "delete from JCR_SREF where PROPERTY_ID=?";
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
@@ -317,6 +320,21 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findLastOrderNumberByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findLastOrderNumberByParentId == null)
+ findLastOrderNumberByParentId = dbConnection.prepareStatement(FIND_LAST_ORDER_NUMBER_BY_PARENTID);
+ else
+ findLastOrderNumberByParentId.clearParameters();
+
+ findLastOrderNumberByParentId.setString(1, parentIdentifier);
+ return findLastOrderNumberByParentId.executeQuery();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
{
if (findNodesCountByParentId == null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -117,6 +117,12 @@
* <code>getChildNodesCount(NodeData parent)</code>
*/
private static final String GET_CHILD_NODES_COUNT_DESCR = "getChildNodesCount";
+
+ /**
+ * The description of the statistics corresponding to the method
+ * <code>getLastOrderNumber(NodeData parent)</code>
+ */
+ private static final String GET_LAST_ORDER_NUMBER_DESCR = "getLastOrderNumber";
/**
* The description of the statistics corresponding to the method
@@ -171,6 +177,8 @@
GET_ITEM_DATA_BY_NODE_DATA_NQ_PATH_ENTRY_DESCR));
ALL_STATISTICS.put(GET_CHILD_NODES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS, GET_CHILD_NODES_DATA_DESCR));
ALL_STATISTICS.put(GET_CHILD_NODES_COUNT_DESCR, new Statistics(GLOBAL_STATISTICS, GET_CHILD_NODES_COUNT_DESCR));
+ ALL_STATISTICS.put(GET_LAST_ORDER_NUMBER_DESCR, new Statistics(GLOBAL_STATISTICS, GET_LAST_ORDER_NUMBER_DESCR));
+
ALL_STATISTICS.put(GET_CHILD_PROPERTIES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS,
GET_CHILD_PROPERTIES_DATA_DESCR));
ALL_STATISTICS.put(LIST_CHILD_PROPERTIES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS,
@@ -335,6 +343,23 @@
/**
* @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getChildNodesCount(org.exoplatform.services.jcr.datamodel.NodeData)
*/
+ public int getLastOrderNumber(NodeData parent) throws RepositoryException
+ {
+ Statistics s = ALL_STATISTICS.get(GET_LAST_ORDER_NUMBER_DESCR);
+ try
+ {
+ s.begin();
+ return wcs.getLastOrderNumber(parent);
+ }
+ finally
+ {
+ s.end();
+ }
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getChildNodesCount(org.exoplatform.services.jcr.datamodel.NodeData)
+ */
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
Statistics s = ALL_STATISTICS.get(GET_CHILD_NODES_COUNT_DESCR);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -126,6 +126,15 @@
int getChildNodesCount(NodeData parent) throws RepositoryException;
/**
+ * Reads order number of last <code>parent<code/> child nodes.
+ *
+ * @param parent NodeData
+ * @return long, order number of last parent's child node.
+ * @throws RepositoryException if error occurs
+ */
+ int getLastOrderNumber(NodeData parent) throws RepositoryException;
+
+ /**
* Reads <code>List</code> of <code>PropertyData</code> from the storage using item's parent
* location.
*
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -36,14 +36,14 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+
import javax.jcr.ItemExistsException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Session;
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-
/**
* Created by The eXo Platform SAS.
*
@@ -227,7 +227,7 @@
assertEquals(order++, orderNumb);
}
}
-
+
public void testOrderWithRefreshKeep() throws Exception
{
Node testNode = root.addNode("testNode");
@@ -268,4 +268,41 @@
}
}
+ public void testRemoveOrder() throws Exception
+ {
+ Node list = session.getRootNode().addNode("list");
+ assertTrue(list.getPrimaryNodeType().hasOrderableChildNodes());
+ list.addNode("foo", "nt:unstructured");
+ list.addNode("bar", "nt:unstructured");
+ list.addNode("juu", "nt:unstructured");
+ session.save();
+
+ list = session.getRootNode().getNode("list");
+ list.getNode("bar").remove();
+ session.save();
+
+ list = session.getRootNode().getNode("list");
+ list.addNode("daa", "nt:unstructured");
+ session.save();
+
+ //check order numbers
+ NodeImpl foo = (NodeImpl)list.getNode("foo");
+ assertEquals(0, ((NodeData)foo.getData()).getOrderNumber());
+ NodeImpl juu = (NodeImpl)list.getNode("juu");
+ assertEquals(2, ((NodeData)juu.getData()).getOrderNumber());
+ NodeImpl daa = (NodeImpl)list.getNode("daa");
+ assertEquals(3, ((NodeData)daa.getData()).getOrderNumber());
+
+ // list.orderBefore("daa", null);
+ NodeIterator it = list.getNodes();
+ foo = (NodeImpl)it.nextNode();
+ assertEquals("foo", foo.getName());
+ juu = (NodeImpl)it.nextNode();
+ assertEquals("juu", juu.getName());
+ daa = (NodeImpl)it.nextNode();
+ assertEquals("daa", daa.getName());
+ assertFalse(it.hasNext());
+ session.save();
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-03-22 12:36:59 UTC (rev 4162)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-03-22 16:14:38 UTC (rev 4163)
@@ -534,6 +534,12 @@
{
}
+ @Override
+ public int getLastOrderNumber(NodeData parent) throws RepositoryException
+ {
+ return -1;
+ }
+
};
private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
More information about the exo-jcr-commits
mailing list