本文整理汇总了Java中org.alfresco.service.cmr.repository.ChildAssociationRef.setNthSibling方法的典型用法代码示例。如果您正苦于以下问题:Java ChildAssociationRef.setNthSibling方法的具体用法?Java ChildAssociationRef.setNthSibling怎么用?Java ChildAssociationRef.setNthSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.ChildAssociationRef
的用法示例。
在下文中一共展示了ChildAssociationRef.setNthSibling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCachedChildren
import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private List<ChildAssociationRef> getCachedChildren(
Map<NodeRef, List<ChildAssociationRef>> childAssociationsSinceFlush, NodeRef nodeRef, boolean bulkLoad)
{
List <ChildAssociationRef> children = childAssociationsSinceFlush.get(nodeRef);
// Cache the children in case there are many paths to the same node
if (children == null)
{
children = nodeService.getChildAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, bulkLoad);
for (ChildAssociationRef childRef : children)
{
// We don't want index numbers in generated paths
childRef.setNthSibling(-1);
}
childAssociationsSinceFlush.put(nodeRef, children);
}
return children;
}
示例2: createIndexedPath
import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
* Helper to convert a path into an indexed path which uniquely identifies a node
*
* @param nodeRef NodeRef
* @param path Path
* @return Path
*/
private Path createIndexedPath(NodeRef nodeRef, Path path)
{
// Add indexes for same name siblings
// TODO: Look at more efficient approach
for (int i = path.size() - 1; i >= 0; i--)
{
Path.Element pathElement = path.get(i);
if (i > 0 && pathElement instanceof Path.ChildAssocElement)
{
int index = 1; // for xpath index compatibility
String searchPath = path.subPath(i).toPrefixString(namespaceService);
List<NodeRef> siblings = searchService.selectNodes(nodeRef, searchPath, null, namespaceService, false);
if (siblings.size() > 1)
{
ChildAssociationRef childAssoc = ((Path.ChildAssocElement)pathElement).getRef();
NodeRef childRef = childAssoc.getChildRef();
for (NodeRef sibling : siblings)
{
if (sibling.equals(childRef))
{
childAssoc.setNthSibling(index);
break;
}
index++;
}
}
}
}
return path;
}