04-29-2010 08:29 AM
05-24-2010 07:04 PM
05-25-2010 05:39 AM
private void cacheNodesNoBatch(Store store, List<String> uuids)
{
Criteria criteria = getSession().createCriteria(NodeImpl.class, "node");
// ————————————————————————————-
// Kludge AW 2010-05-07: Discard duplicate node ids
//
// criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
// ————————————————————————————-
05-25-2010 07:00 AM
05-25-2010 07:49 AM
private void cacheNodesNoBatch(Store store, List<String> uuids)
{
Criteria criteria = getSession().createCriteria(NodeImpl.class, "node");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.eq("store.id", store.getId()));
criteria.add(Restrictions.in("uuid", uuids));
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
List nodeList = criteria.list();
List nodeIds = new ArrayList(nodeList.size());
for (Node node : nodeList)
{
Long nodeId = node.getId();
this.storeAndNodeIdCache.put(node.getNodeRef(), nodeId);
nodeIds.add(nodeId);
}
if (nodeIds.size() == 0)
{
return;
}
criteria = getSession().createCriteria(ChildAssocImpl.class, "parentAssoc");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.in("child.id", nodeIds));
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
List parentAssocs = criteria.list();
Map parentAssocMap = new HashMap(nodeIds.size() * 2);
for (ChildAssoc parentAssoc : parentAssocs)
{
nodeId = parentAssoc.getChild().getId();
List parentAssocsOfNode = (List)parentAssocMap.get(nodeId);
if (parentAssocsOfNode == null)
{
parentAssocsOfNode = new ArrayList(3);
parentAssocMap.put(nodeId, parentAssocsOfNode);
}
parentAssocsOfNode.add(parentAssoc);
if (this.isDebugParentAssocCacheEnabled)
{
loggerParentAssocsCache.debug("\nParent associations cache - Adding entry: \n Node: " + nodeId + "\n" + " Assocs: " + parentAssocsOfNode);
}
}
for (Node node : nodeList)
{
nodeId = node.getId();
List parentAsssocsOfNode = (List)parentAssocMap.get(nodeId);
if (parentAsssocsOfNode == null)
{
parentAsssocsOfNode = Collections.emptyList();
}
this.parentAssocsCache.put(nodeId, new NodeInfo(node, this.qnameDAO, parentAsssocsOfNode));
}
}
private void cacheNodesNoBatch(Store store, List<String> uuids)
{
Criteria criteria = getSession().createCriteria(NodeImpl.class, "node");
// ————————————————————————————-
// Kludge AW 2010-05-07: Discard duplicate node ids
//
// criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
// ————————————————————————————-
private void cacheNodesNoBatch(Store store, List<String> uuids)
{
Criteria criteria = getSession().createCriteria(NodeImpl.class, "node");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.eq("store.id", store.getId()));
criteria.add(Restrictions.in("uuid", uuids));
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
List<Node> nodeList = criteria.list();
Set<Long> nodeIds = new HashSet<Long>(nodeList.size()*2);
for (Node node : nodeList)
{
// We have duplicate nodes, so make sure we only process each node once
Long nodeId = node.getId();
if (!nodeIds.add(nodeId))
{
// Already processed
continue;
}
storeAndNodeIdCache.put(node.getNodeRef(), nodeId);
}
if (nodeIds.size() == 0)
{
// Can't query
return;
}
criteria = getSession().createCriteria(ChildAssocImpl.class, "parentAssoc");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.in("child.id", nodeIds));
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
List<ChildAssoc> parentAssocs = criteria.list();
Map<Long, List<ChildAssoc>> parentAssocMap = new HashMap<Long, List<ChildAssoc>>(nodeIds.size() * 2);
for (ChildAssoc parentAssoc : parentAssocs)
{
Long nodeId = parentAssoc.getChild().getId();
List<ChildAssoc> parentAssocsOfNode = parentAssocMap.get(nodeId);
if (parentAssocsOfNode == null)
{
parentAssocsOfNode = new ArrayList<ChildAssoc>(3);
parentAssocMap.put(nodeId, parentAssocsOfNode);
}
parentAssocsOfNode.add(parentAssoc);
if (isDebugParentAssocCacheEnabled)
{
loggerParentAssocsCache.debug("\n" +
"Parent associations cache - Adding entry: \n" +
" Node: " + nodeId + "\n" +
" Assocs: " + parentAssocsOfNode);
}
}
// Cache NodeInfo for each node
for (Node node : nodeList)
{
Long nodeId = node.getId();
List<ChildAssoc> parentAsssocsOfNode = parentAssocMap.get(nodeId);
if (parentAsssocsOfNode == null)
{
parentAsssocsOfNode = Collections.emptyList();
}
parentAssocsCache.put(nodeId, new NodeInfo(node, qnameDAO, parentAsssocsOfNode));
}
}
05-25-2010 10:25 AM
05-25-2010 12:58 PM
// Get nodes and properties
Criteria criteria = getSession().createCriteria(NodeImpl.class, "node");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.eq("store.id", store.getId()));
criteria.add(Restrictions.in("uuid", uuids));
criteria.setFetchMode("aspects", FetchMode.SELECT); // Don't join to aspects
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
criteria.list();
// Get nodes and aspects
criteria = getSession().createCriteria(NodeImpl.class, "node");
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
criteria.add(Restrictions.eq("store.id", store.getId()));
criteria.add(Restrictions.in("uuid", uuids));
criteria.setFetchMode("properties", FetchMode.SELECT); // Don't join to properties
criteria.setCacheMode(CacheMode.PUT);
criteria.setFlushMode(FlushMode.MANUAL);
List<Node> nodeList = criteria.list();
Set<Long> nodeIds = new HashSet<Long>(nodeList.size()*2);
for (Node node : nodeList)
{
// We have duplicate nodes, so make sure we only process each node once
Long nodeId = node.getId();
if (!nodeIds.add(nodeId))
{
// Already processed
continue;
}
storeAndNodeIdCache.put(node.getNodeRef(), nodeId);
}
if (nodeIds.size() == 0)
{
// Can't query
return;
}
05-26-2010 03:33 AM
criteria.setResultTransformer(Criteria.ROOT_ENTITY);
with criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
for (Node node : nodeList)
{
Long nodeId = node.getId();
this.storeAndNodeIdCache.put(node.getNodeRef(), nodeId);
nodeIds.add(nodeId);
}
with for (Node node : nodeList)
{
// We have duplicate nodes, so make sure we only process each node once
Long nodeId = node.getId();
if (!nodeIds.add(nodeId))
{
// Already processed
continue;
}
storeAndNodeIdCache.put(node.getNodeRef(), nodeId);
}
…..
criteria.setFetchMode("aspects", FetchMode.SELECT);
……
criteria.setFetchMode("properties", FetchMode.SELECT);
…..
Do i have applay all?05-26-2010 07:23 AM
05-26-2010 08:29 AM
14:18:29,218 User:admin WARN [org.alfresco.storeAndNodeIdTransactionalCache] Transactional update cache 'org.alfresco.storeAndNodeIdTransactionalCach
e' is full (10000).
05-26-2010 08:43 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.