本文整理汇总了Java中org.alfresco.service.cmr.repository.Path类的典型用法代码示例。如果您正苦于以下问题:Java Path类的具体用法?Java Path怎么用?Java Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Path类属于org.alfresco.service.cmr.repository包,在下文中一共展示了Path类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateDisplayPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private StringBuilder calculateDisplayPath(final NodeRef nodeRef)
{
return AuthenticationUtil.runAs(new RunAsWork<StringBuilder>()
{
@Override
public StringBuilder doWork() throws Exception
{
// Get the full path to the file/folder node
Path nodePath = m_nodeService.getPath(nodeRef);
String fName = (String) m_nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
// Build the share relative path to the node
StringBuilder result = new StringBuilder();
result.append(nodePath.toDisplayPath(m_nodeService, m_permissionService));
if ((0 == result.length()) || ('/' != (result.charAt(result.length() - 1)) && ('\\' != result.charAt(result.length() - 1))))
{
result.append("\\");
}
return result.append(fName);
}
}, AuthenticationUtil.SYSTEM_USER_NAME);
}
示例2: buildRelativePathString
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
/**
* The relative path of a renamed/moved node
*
* ALF-2309: construct the path from the old parent of the moved
* node (parentNodeRef) - this will have the correct path
*
* @param parentNodeRef the old parent of the node
* @param nodeName the old name of the childs
* @return String
*/
private String buildRelativePathString(NodeRef parentNodeRef, String nodeName) {
Path nodePath = m_nodeService.getPath(parentNodeRef);
StringBuilder pathStr = new StringBuilder();
pathStr.append(nodePath.toDisplayPath(m_nodeService, m_permissionService));
if (pathStr.length() == 0
|| pathStr.charAt(pathStr.length() - 1) != '/' && pathStr.charAt(pathStr.length() - 1) != '\\')
pathStr.append("/");
pathStr.append((String) m_nodeService.getProperty( parentNodeRef, ContentModel.PROP_NAME))
.append("\\")
.append( nodeName);
return pathStr.toString();
}
示例3: toDisplayPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
/**
* @param path Path
* @return display path
*/
private String toDisplayPath(Path path)
{
StringBuffer displayPath = new StringBuffer();
if (path.size() == 1)
{
displayPath.append("/");
}
else
{
for (int i = 1; i < path.size(); i++)
{
Path.Element element = path.get(i);
if (element instanceof ChildAssocElement)
{
ChildAssociationRef assocRef = ((ChildAssocElement)element).getRef();
NodeRef node = assocRef.getChildRef();
displayPath.append("/");
displayPath.append(nodeService.getProperty(node, ContentModel.PROP_NAME));
}
}
}
return displayPath.toString();
}
示例4: startNode
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
public void startNode(NodeRef nodeRef)
{
try
{
AttributesImpl attrs = new AttributesImpl();
Path path = nodeService.getPath(nodeRef);
if (path.size() > 1)
{
// a child name does not exist for root
Path.ChildAssocElement pathElement = (Path.ChildAssocElement)path.last();
QName childQName = pathElement.getRef().getQName();
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, CHILDNAME_LOCALNAME, CHILDNAME_QNAME.toPrefixString(), null, toPrefixString(childQName));
}
QName type = nodeService.getType(nodeRef);
contentHandler.startElement(type.getNamespaceURI(), type.getLocalName(), toPrefixString(type), attrs);
}
catch (SAXException e)
{
throw new ExporterException("Failed to process start node event - node ref " + nodeRef.toString(), e);
}
}
示例5: resolveCorrespondingNode
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
public ResolvedParentChildPair resolveCorrespondingNode(NodeRef sourceNodeRef, ChildAssociationRef primaryAssoc,
Path parentPath)
{
ResolvedParentChildPair result = cache.get(sourceNodeRef);
if (result != null)
{
if (log.isDebugEnabled())
{
log.debug("Found fully-resolved entry in cache for node " + sourceNodeRef);
}
return result;
}
result = delegateResolver.resolveCorrespondingNode(sourceNodeRef, primaryAssoc, parentPath);
//If we have fully resolved the parent and child nodes then stick it in the cache...
if (result.resolvedChild != null && result.resolvedParent != null)
{
cache.put(sourceNodeRef, result);
}
return result;
}
示例6: stringToPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
/**
* Converts a String representation of a path to a Path
*
* e.g "/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/application/1.0}dictionary/{http://www.alfresco.org/model/application/1.0}transfers/{http://www.alfresco.org/model/content/1.0}default/{http://www.alfresco.org/model/transfer/1.0}snapshotMe";
* @param value the string representation of the path.
* @return Path
*/
public static Path stringToPath(String value)
{
Path path = new Path();
// pattern for QName e.g. /{stuff}stuff
Pattern pattern = Pattern.compile("/\\{[a-zA-Z:./0-9]*\\}[^/]*");
Matcher matcher = pattern.matcher(value);
// This is the root node
path.append(new SimplePathElement("/"));
while ( matcher.find() )
{
String group = matcher.group();
final String val = ISO9075.decode(group.substring(1));
path.append(new SimplePathElement(val));
}
return path;
}
示例7: writePrimaryParent
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private void writePrimaryParent(ChildAssociationRef parentAssoc, Path parentPath)
throws SAXException
{
writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PARENT, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PARENT, EMPTY_ATTRIBUTES);
writeParentAssoc(parentAssoc);
writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PATH, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PATH, EMPTY_ATTRIBUTES);
if (parentPath != null)
{
String path = parentPath.toString();
writer.characters(path.toCharArray(), 0, path.length());
}
writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PATH, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PATH);
writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PARENT, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PARENT);
}
示例8: writePrimaryParent
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private void writePrimaryParent(ChildAssociationRef parentAssoc, Path parentPath) throws SAXException
{
writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PARENT, PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PARENT, EMPTY_ATTRIBUTES);
writeParentAssoc(parentAssoc);
writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PATH, PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PATH, EMPTY_ATTRIBUTES);
if(parentPath != null)
{
String path = parentPath.toString();
writer.characters(path.toCharArray(), 0, path.length());
}
writer.endElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PATH, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PATH);
writer.endElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_PRIMARY_PARENT, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PRIMARY_PARENT);
}
示例9: buildXPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private String buildXPath(Path path)
{
StringBuilder pathBuffer = new StringBuilder(64);
for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
{
Path.Element element = elit.next();
if (!(element instanceof Path.ChildAssocElement))
{
throw new IndexerException("Confused path: " + path);
}
Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
if (cae.getRef().getParentRef() != null)
{
pathBuffer.append("/");
pathBuffer.append(getPrefix(cae.getRef().getQName().getNamespaceURI()));
pathBuffer.append(ISO9075.encode(cae.getRef().getQName().getLocalName()));
}
}
return pathBuffer.toString();
}
示例10: deleteNode
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
public void deleteNode(ChildAssociationRef relationshipRef) throws LuceneIndexException
{
if (s_logger.isDebugEnabled())
{
NodeRef parentRef = relationshipRef.getParentRef();
Path path = parentRef == null ? new Path() : nodeService.getPath(parentRef);
path.append(new ChildAssocElement(relationshipRef));
s_logger.debug("Delete node " + path + " " + relationshipRef.getChildRef());
}
checkAbleToDoWork(IndexUpdateStatus.SYNCRONOUS);
try
{
if (!relationshipRef.getChildRef().getStoreRef().equals(store))
{
throw new LuceneIndexException("Delete node failed - node is not in the required store");
}
delete(relationshipRef.getChildRef());
}
catch (LuceneIndexException e)
{
setRollbackOnly();
throw new LuceneIndexException("Delete node failed", e);
}
}
示例11: getParents
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private ArrayList<NodeRef> getParents(Path path)
{
ArrayList<NodeRef> parentsInDepthOrderStartingWithSelf = new ArrayList<NodeRef>(8);
for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
{
Path.Element element = elit.next();
if (!(element instanceof Path.ChildAssocElement))
{
throw new IndexerException("Confused path: " + path);
}
Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
parentsInDepthOrderStartingWithSelf.add(0, tenantService.getName(cae.getRef().getChildRef()));
}
return parentsInDepthOrderStartingWithSelf;
}
示例12: readDocuments
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
protected List<Document> readDocuments(final String stringNodeRef, final FTSStatus ftsStatus,
final boolean indexAllProperties, final boolean includeDirectoryDocuments, final boolean cascade,
final Set<Pair<Boolean, Path>> pathsToRegenerate,
final Map<NodeRef, List<ChildAssociationRef>> childAssociationsSinceFlush, final IndexReader deltaReader,
final IndexReader mainReader)
{
return doInReadthroughTransaction(new RetryingTransactionCallback<List<Document>>()
{
@Override
public List<Document> execute() throws Throwable
{
return createDocuments(stringNodeRef, ftsStatus, indexAllProperties, includeDirectoryDocuments,
cascade, pathsToRegenerate, childAssociationsSinceFlush, deltaReader, mainReader);
}
});
}
示例13: isSystemPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
private boolean isSystemPath(NodeRef parentNodeRef, String filename)
{
boolean ret = false;
Path path = nodeService.getPath(parentNodeRef);
Iterator<Element> it = path.iterator();
while(it.hasNext())
{
Path.ChildAssocElement elem = (Path.ChildAssocElement)it.next();
QName qname = elem.getRef().getQName();
if(qname != null && systemPaths.isFiltered(qname.getLocalName()))
{
ret = true;
break;
}
}
return ret;
}
示例14: onHiddenPath
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
/**
* Checks whether the node is on a hidden path
*
* @param nodeRef NodeRef
* @return the matching filter, or null if no match
*/
public HiddenFileInfo onHiddenPath(NodeRef nodeRef)
{
HiddenFileInfo ret = null;
// TODO would be nice to check each part of the path in turn, bailing out if a match is found
Path path = nodeService.getPath(nodeRef);
nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
Iterator<Element> it = path.iterator();
while(it.hasNext())
{
Path.ChildAssocElement elem = (Path.ChildAssocElement)it.next();
QName qname = elem.getRef().getQName();
if(qname != null)
{
ret = isHidden(qname.getLocalName());
if(ret != null)
{
break;
}
}
}
return ret;
}
示例15: findTaggedNodes
import org.alfresco.service.cmr.repository.Path; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.tagging.TaggingService#findTaggedNodes(StoreRef, java.lang.String, org.alfresco.service.cmr.repository.NodeRef)
*/
public List<NodeRef> findTaggedNodes(StoreRef storeRef, String tag, NodeRef nodeRef)
{
// Lower the case of the tag
tag = tag.toLowerCase();
// Get path
Path nodePath = this.nodeService.getPath(nodeRef);
String pathString = nodePath.toPrefixString(this.namespaceService);
ResultSet resultSet = null;
try
{
// Do query
resultSet = this.searchService.query(
storeRef,
SearchService.LANGUAGE_LUCENE,
"+PATH:\"" + pathString + "//*\" +PATH:\"/cm:taggable/cm:" + ISO9075.encode(tag) + "/member\"");
List<NodeRef> nodeRefs = resultSet.getNodeRefs();
return nodeRefs;
}
finally
{
if(resultSet != null) {resultSet.close();}
}
}