use of org.alfresco.repo.domain.node.TransactionQueryEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNextTxCommitTime.
/**
* Gets the next commit time from [fromCommitTime]
*
* @param fromCommitTime Initial commit time
* @return next commit time
*/
@Override
public Long selectNextTxCommitTime(Long fromCommitTime) {
TransactionQueryEntity fromCommitTimeEntity = new TransactionQueryEntity();
fromCommitTimeEntity.setMinCommitTime(fromCommitTime);
return template.selectOne(SELECT_TXN_NEXT_TXN_COMMIT_TIME, fromCommitTimeEntity);
}
use of org.alfresco.repo.domain.node.TransactionQueryEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method deleteNodesByCommitTime.
@Override
protected int deleteNodesByCommitTime(long fromTxnCommitTimeMs, long toTxnCommitTimeMs) {
// Get the deleted nodes
Pair<Long, QName> deletedTypePair = qnameDAO.getQName(ContentModel.TYPE_DELETED);
if (deletedTypePair == null) {
// Nothing to do
return 0;
}
TransactionQueryEntity query = new TransactionQueryEntity();
query.setTypeQNameId(deletedTypePair.getFirst());
query.setMinCommitTime(fromTxnCommitTimeMs);
query.setMaxCommitTime(toTxnCommitTimeMs);
// TODO: Fix ALF-16030 Use ON DELETE CASCADE for node aspects and properties
// First clean up properties
template.delete(DELETE_NODE_PROPS_BY_TXN_COMMIT_TIME, query);
// Finally remove the nodes
return template.delete(DELETE_NODES_BY_TXN_COMMIT_TIME, query);
}
use of org.alfresco.repo.domain.node.TransactionQueryEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method deleteTxnsUnused.
@Override
public int deleteTxnsUnused(long fromCommitTime, long toCommitTime) {
TransactionQueryEntity txnQuery = new TransactionQueryEntity();
txnQuery.setMinCommitTime(fromCommitTime);
txnQuery.setMaxCommitTime(toCommitTime);
int numDeleted = template.delete(DELETE_TXNS_UNUSED, txnQuery);
return numDeleted;
}
use of org.alfresco.repo.domain.node.TransactionQueryEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectTxns.
@Override
public List<Transaction> selectTxns(Long fromTimeInclusive, Long toTimeExclusive, Integer count, List<Long> includeTxnIds, List<Long> excludeTxnIds, Boolean ascending) {
TransactionQueryEntity query = new TransactionQueryEntity();
query.setMinCommitTime(fromTimeInclusive);
query.setMaxCommitTime(toTimeExclusive);
if ((includeTxnIds != null) && (includeTxnIds.size() > 0)) {
query.setIncludeTxnIds(includeTxnIds);
}
if ((excludeTxnIds != null) && (excludeTxnIds.size() > 0)) {
query.setExcludeTxnIds(excludeTxnIds);
}
query.setAscending(ascending);
if (count == null) {
return template.selectList(SELECT_TXNS, query);
} else {
return template.selectList(SELECT_TXNS, query, new RowBounds(0, count));
}
}
use of org.alfresco.repo.domain.node.TransactionQueryEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method getNodeIdsIntervalForType.
@Override
@SuppressWarnings("rawtypes")
public Pair<Long, Long> getNodeIdsIntervalForType(QName type, Long startTxnTime, Long endTxnTime) {
final Pair<Long, Long> intervalPair = new Pair<Long, Long>(LONG_ZERO, LONG_ZERO);
Pair<Long, QName> typePair = qnameDAO.getQName(type);
if (typePair == null) {
// Return default
return intervalPair;
}
TransactionQueryEntity txnQuery = new TransactionQueryEntity();
txnQuery.setTypeQNameId(typePair.getFirst());
txnQuery.setMinCommitTime(startTxnTime);
txnQuery.setMaxCommitTime(endTxnTime);
ResultHandler resultHandler = new ResultHandler() {
@SuppressWarnings("unchecked")
public void handleResult(ResultContext context) {
Map<Long, Long> result = (Map<Long, Long>) context.getResultObject();
if (result != null) {
intervalPair.setFirst(result.get("minId"));
intervalPair.setSecond(result.get("maxId"));
}
}
};
template.select(SELECT_NODE_INTERVAL_BY_TYPE, txnQuery, resultHandler);
return intervalPair;
}
Aggregations