diff --git a/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java b/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
index 09f2ed3b20..28e0ef6cc3 100644
--- a/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
+++ b/src/main/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
@@ -4960,6 +4960,18 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
return (id == null ? LONG_ZERO : id);
}
+ @Override
+ public Long getMinTxInNodeIdRange(Long fromNodeId, Long toNodeId)
+ {
+ return selectMinTxInNodeIdRange(fromNodeId, toNodeId);
+ }
+
+ @Override
+ public Long getMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId)
+ {
+ return selectMaxTxInNodeIdRange(fromNodeId, toNodeId);
+ }
+
/*
* Abstract methods for underlying CRUD
*/
@@ -5128,4 +5140,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
protected abstract Long selectMinTxnId();
protected abstract Long selectMaxTxnId();
protected abstract Long selectMinUnusedTxnCommitTime();
+ protected abstract Long selectMinTxInNodeIdRange(Long fromNodeId, Long toNodeId);
+ protected abstract Long selectMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
}
diff --git a/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java b/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java
index bc1371262e..75288a5b5b 100644
--- a/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java
+++ b/src/main/java/org/alfresco/repo/domain/node/NodeDAO.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.domain.node;
import java.io.Serializable;
@@ -936,4 +936,23 @@ public interface NodeDAO extends NodeBulkLoader
Long toTimeExclusive,
boolean remoteOnly);
+ /**
+ * Gets the minimum commit time from transactions including a node id
+ * in the range [fromNodeId:toNodeId]
+ *
+ * @param fromNodeId Initial node id
+ * @param toNodeId Final node id
+ * @return minimum commit time
+ */
+ public Long getMinTxInNodeIdRange(Long fromNodeId, Long toNodeId);
+
+ /**
+ * Gets the maximum commit time from transactions including a node id
+ * in the range [fromNodeId:toNodeId]
+ *
+ * @param fromNodeId Initial node id
+ * @param toNodeId Final node id
+ * @return maximum commit time
+ */
+ public Long getMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId);
}
diff --git a/src/main/java/org/alfresco/repo/domain/node/NodeRangeEntity.java b/src/main/java/org/alfresco/repo/domain/node/NodeRangeEntity.java
new file mode 100644
index 0000000000..a4cb34b97f
--- /dev/null
+++ b/src/main/java/org/alfresco/repo/domain/node/NodeRangeEntity.java
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.repo.domain.node;
+
+/**
+ * Node Range bean including an initial fromNodeId and a final fromNodeId
+ *
+ * @author aborroy
+ *
+ */
+public class NodeRangeEntity
+{
+
+ private Long fromNodeId;
+ private Long toNodeId;
+
+ /**
+ * @return the fromNodeId
+ */
+ public Long getFromNodeId()
+ {
+ return fromNodeId;
+ }
+ /**
+ * @param fromNodeId the fromNodeId to set
+ */
+ public void setFromNodeId(Long fromNodeId)
+ {
+ this.fromNodeId = fromNodeId;
+ }
+ /**
+ * @return the toNodeId
+ */
+ public Long getToNodeId()
+ {
+ return toNodeId;
+ }
+ /**
+ * @param toNodeId the toNodeId to set
+ */
+ public void setToNodeId(Long toNodeId)
+ {
+ this.toNodeId = toNodeId;
+ }
+
+}
diff --git a/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java b/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java
index 75c8726b6e..4782ea1fd1 100644
--- a/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java
+++ b/src/main/java/org/alfresco/repo/domain/node/ibatis/NodeDAOImpl.java
@@ -50,6 +50,7 @@ import org.alfresco.repo.domain.node.NodeIdAndAclId;
import org.alfresco.repo.domain.node.NodePropertyEntity;
import org.alfresco.repo.domain.node.NodePropertyKey;
import org.alfresco.repo.domain.node.NodePropertyValue;
+import org.alfresco.repo.domain.node.NodeRangeEntity;
import org.alfresco.repo.domain.node.NodeUpdateEntity;
import org.alfresco.repo.domain.node.NodeVersionKey;
import org.alfresco.repo.domain.node.PrimaryChildrenAclUpdateEntity;
@@ -165,6 +166,8 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String SELECT_TXN_MAX_ID = "alfresco.node.select_TxnMaxId";
private static final String SELECT_TXN_UNUSED_MIN_COMMIT_TIME = "alfresco.node.select_TxnMinUnusedCommitTime";
private static final String SELECT_ONE_TXNS_BY_COMMIT_TIME_DESC = "alfresco.node.select_OneTxnsByCommitTimeDescending";
+ private static final String SELECT_TXN_MIN_TX_ID_IN_NODE_IDRANGE = "alfresco.node.select_TxnMinTxIdInNodeIdRange";
+ private static final String SELECT_TXN_MAX_TX_ID_IN_NODE_IDRANGE = "alfresco.node.select_TxnMaxTxIdInNodeIdRange";
protected QNameDAO qnameDAO;
protected DictionaryService dictionaryService;
@@ -1751,6 +1754,42 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
return template.selectOne(COUNT_CHILD_ASSOC_BY_PARENT_ID, childAssoc);
}
+ /**
+ * Gets the minimum commit time from transactions including a node id
+ * in the range [fromNodeId:toNodeId]
+ *
+ * @param fromNodeId Initial node id
+ * @param toNodeId Final node id
+ * @return minimum commit time
+ */
+ @Override
+ protected Long selectMinTxInNodeIdRange(Long fromNodeId, Long toNodeId)
+ {
+ NodeRangeEntity nodeRangeEntity = new NodeRangeEntity();
+ nodeRangeEntity.setFromNodeId(fromNodeId);
+ nodeRangeEntity.setToNodeId(toNodeId);
+
+ return template.selectOne(SELECT_TXN_MIN_TX_ID_IN_NODE_IDRANGE, nodeRangeEntity);
+ }
+
+ /**
+ * Gets the maximum commit time from transactions including a node id
+ * in the range [fromNodeId:toNodeId]
+ *
+ * @param fromNodeId Initial node id
+ * @param toNodeId Final node id
+ * @return maximum commit time
+ */
+ @Override
+ protected Long selectMaxTxInNodeIdRange(Long fromNodeId, Long toNodeId)
+ {
+ NodeRangeEntity nodeRangeEntity = new NodeRangeEntity();
+ nodeRangeEntity.setFromNodeId(fromNodeId);
+ nodeRangeEntity.setToNodeId(toNodeId);
+
+ return template.selectOne(SELECT_TXN_MAX_TX_ID_IN_NODE_IDRANGE, nodeRangeEntity);
+ }
+
/*
* DAO OVERRIDES
*/
diff --git a/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml b/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml
index dfeecef619..09b39c5ebe 100644
--- a/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml
+++ b/src/main/resources/alfresco/ibatis/org.alfresco.repo.domain.dialect.Dialect/node-common-SqlMap.xml
@@ -1487,4 +1487,40 @@
= #{minCommitTime}]]>
+
+
+
+
\ No newline at end of file