本文整理汇总了Java中org.alfresco.repo.solr.NodeParameters类的典型用法代码示例。如果您正苦于以下问题:Java NodeParameters类的具体用法?Java NodeParameters怎么用?Java NodeParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeParameters类属于org.alfresco.repo.solr包,在下文中一共展示了NodeParameters类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetNodesSimple
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
public void testGetNodesSimple()
{
long startTime = 0L;
List<Transaction> txns = getTransactions(null, startTime, null, null, 500);
List<Long> txnIds = toTxnIds(txns);
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds);
nodeParameters.setStoreProtocol(StoreRef.PROTOCOL_WORKSPACE);
nodeParameters.setStoreIdentifier(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getIdentifier());
List<Node> nodes = getNodes(nodeParameters);
assertTrue("Expect 'some' nodes associated with txns", nodes.size() > 0);
}
示例2: testGetNodesForTxnRange
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
public void testGetNodesForTxnRange()
{
List<Transaction> txns = getTransactions(null, null, null, null, 500);
List<Long> txnIds = toTxnIds(txns);
// Only works if there are transactions
if (txnIds.size() < 2)
{
// Nothing to test
return;
}
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setFromTxnId(txnIds.get(0));
nodeParameters.setToTxnId(txnIds.get(1));
List<Node> nodes = getNodes(nodeParameters);
assertTrue("Expect 'some' nodes associated with txns", nodes.size() > 0);
}
示例3: isNodeParamsFromTxnId
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
private Matcher<NodeParameters> isNodeParamsFromTxnId(final Long fromTxnId)
{
return new BaseMatcher<NodeParameters>()
{
@Override
public void describeTo(Description description)
{
description.appendText(NodeParameters.class.getSimpleName()+"[fromTxId="+fromTxnId+"]");
}
@Override
public boolean matches(Object item)
{
if (!(item instanceof NodeParameters))
{
return false;
}
NodeParameters np = (NodeParameters) item;
if (fromTxnId == null)
{
return np.getFromTxnId() == null;
}
else
{
return fromTxnId.equals(np.getFromTxnId());
}
}
};
}
示例4: getNodes
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
private List<Node> getNodes(final NodeParameters nodeParameters)
{
return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<List<Node>>()
{
@Override
public List<Node> execute() throws Throwable
{
return solrDAO.getNodes(nodeParameters, null);
}
}, true);
}
示例5: testGetNodesForStore
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
public void testGetNodesForStore()
{
List<Transaction> txns = getTransactions(null, null, null, null, 500);
List<Long> txnIds = toTxnIds(txns);
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds);
List<Node> nodes = getNodes(nodeParameters);
assertTrue("Expect 'some' nodes associated with txns", nodes.size() > 0);
}
示例6: getNodes
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public List<Node> getNodes(NodeParameters nodeParameters, QName shardPropertyQName)
{
NodeParametersEntity params = new NodeParametersEntity(nodeParameters, qnameDAO);
if(shardPropertyQName !=null)
{
if(shardPropertyQName.equals(ContentModel.PROP_CREATED))
{
params.setShardPropertyQNameId(-1L);
}
else if (shardPropertyQName.equals(ContentModel.PROP_MODIFIED))
{
params.setShardPropertyQNameId(-2L);
}
else
{
Pair<Long, QName> propertyQNamePair = qnameDAO.getQName(shardPropertyQName);
if(propertyQNamePair != null)
{
params.setShardPropertyQNameId(propertyQNamePair.getFirst());
}
}
}
if(nodeParameters.getMaxResults() != 0 && nodeParameters.getMaxResults() != Integer.MAX_VALUE)
{
return template.selectList(
SELECT_NODES, params,
new RowBounds(0, nodeParameters.getMaxResults()));
}
else
{
return template.selectList(SELECT_NODES, params);
}
}
示例7: getNodes
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public List<Node> getNodes(NodeParameters nodeParameters, QName shardPropertyQName)
{
NodeParametersEntity params = new NodeParametersEntity(nodeParameters, qnameDAO);
if(shardPropertyQName !=null)
{
if(shardPropertyQName.equals(ContentModel.PROP_CREATED))
{
params.setShardPropertyQNameId(-1L);
}
else if (shardPropertyQName.equals(ContentModel.PROP_MODIFIED))
{
params.setShardPropertyQNameId(-2L);
}
else if (shardPropertyQName.equals(ContentModel.PROP_CREATOR))
{
params.setShardPropertyQNameId(-3L);
}
else if (shardPropertyQName.equals(ContentModel.PROP_MODIFIER))
{
params.setShardPropertyQNameId(-4L);
}
else
{
Pair<Long, QName> propertyQNamePair = qnameDAO.getQName(shardPropertyQName);
if(propertyQNamePair != null)
{
params.setShardPropertyQNameId(propertyQNamePair.getFirst());
}
}
}
if(nodeParameters.getMaxResults() != 0 && nodeParameters.getMaxResults() != Integer.MAX_VALUE)
{
return template.selectList(
SELECT_NODES, params,
new RowBounds(0, nodeParameters.getMaxResults()));
}
else
{
return template.selectList(SELECT_NODES, params);
}
}
示例8: testGetNodesFromTxnId
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
/**
* MNT-12798
*/
public void testGetNodesFromTxnId()
{
final StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime());
try
{
RetryingTransactionCallback<Long> createNodeWork1 = new RetryingTransactionCallback<Long>()
{
@Override
public Long execute() throws Throwable
{
createTestNode(nodeService.getRootNode(storeRef));
return nodeDAO.getCurrentTransactionId(true);
}
};
RetryingTransactionCallback<Long> createNodeWork2 = new RetryingTransactionCallback<Long>()
{
@Override
public Long execute() throws Throwable
{
createTestNode(nodeService.getRootNode(storeRef));
return nodeDAO.getCurrentTransactionId(true);
}
};
Long txnId1 = transactionService.getRetryingTransactionHelper().doInTransaction(createNodeWork1);
Long txnId2 = transactionService.getRetryingTransactionHelper().doInTransaction(createNodeWork2);
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setFromTxnId(txnId1);
nodeParameters.setToTxnId(null);
List<Node> nodes1 = getNodes(nodeParameters);
assertTrue("Expect 'some' nodes associated with txns", nodes1.size() > 0);
NodeParameters nodeParameters2 = new NodeParameters();
nodeParameters2.setFromTxnId(txnId2);
nodeParameters2.setToTxnId(null);
List<Node> nodes2 = getNodes(nodeParameters2);
assertTrue("Higher 'fromTxnId' param should yield fewer results", nodes2.size() < nodes1.size());
}
finally
{
nodeService.deleteStore(storeRef);
}
}
示例9: getNodes
import org.alfresco.repo.solr.NodeParameters; //导入依赖的package包/类
/**
* Get the nodes satisfying the constraints in nodeParameters
*
* @param nodeParameters set of constraints for which nodes to return
* @param shardPropertQName
* @return list of matching nodes
*/
public List<Node> getNodes(NodeParameters nodeParameters, QName shardPropertQName);