當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.getPath方法代碼示例

本文整理匯總了Java中javax.jcr.Node.getPath方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getPath方法的具體用法?Java Node.getPath怎麽用?Java Node.getPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jcr.Node的用法示例。


在下文中一共展示了Node.getPath方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildPath

import javax.jcr.Node; //導入方法依賴的package包/類
private void buildPath(List<String> list, Node parentNode) throws RepositoryException {
	NodeIterator nodeIterator=parentNode.getNodes();
	while(nodeIterator.hasNext()){
		Node node=nodeIterator.nextNode();
		String nodePath=node.getPath();
		if(nodePath.endsWith(FileType.Ruleset.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.UL.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.DecisionTable.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.ScriptDecisionTable.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.DecisionTree.toString())){
			list.add(nodePath);					
		}else if(nodePath.endsWith(FileType.RuleFlow.toString())){
			list.add(nodePath);					
		}
		buildPath(list,node);
	}
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:22,代碼來源:RepositoryServiceImpl.java

示例2: unlockAllChildNodes

import javax.jcr.Node; //導入方法依賴的package包/類
private void unlockAllChildNodes(Node node,User user,List<Node> nodeList,String rootPath) throws Exception{
	NodeIterator iter=node.getNodes();
	while(iter.hasNext()){
		Node nextNode=iter.nextNode();
		String absPath=nextNode.getPath();
		if(!lockManager.isLocked(absPath)){
			continue;
		}
		Lock lock=lockManager.getLock(absPath);
		String owner=lock.getLockOwner();
		if(!user.getUsername().equals(owner)){
			throw new NodeLockException("當前目錄下有子目錄被其它人鎖定,您不能執行鎖定"+rootPath+"目錄");
		}
		nodeList.add(nextNode);
		unlockAllChildNodes(nextNode, user, nodeList, rootPath);
	}
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:18,代碼來源:RepositoryServiceImpl.java

示例3: unlockPath

import javax.jcr.Node; //導入方法依賴的package包/類
@Override
public void unlockPath(String path,User user) throws Exception{
	path = processPath(path);
	int pos=path.indexOf(":");
	if(pos!=-1){
		path=path.substring(0,pos);
	}
	Node rootNode=getRootNode();
	if (!rootNode.hasNode(path)) {
		throw new RuleException("File [" + path + "] not exist.");
	}
	Node fileNode = rootNode.getNode(path);
	String absPath=fileNode.getPath();
	if(!lockManager.isLocked(absPath)){
		throw new NodeLockException("當前文件未鎖定,不需要解鎖!");
	}
	Lock lock=lockManager.getLock(absPath);
	String owner=lock.getLockOwner();
	if(!owner.equals(user.getUsername())){
		throw new NodeLockException("當前文件由【"+owner+"】鎖定,您無權解鎖!");
	}
	lockManager.unlock(lock.getNode().getPath());
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:24,代碼來源:RepositoryServiceImpl.java

示例4: getDirectories

import javax.jcr.Node; //導入方法依賴的package包/類
@Override
public List<RepositoryFile> getDirectories(String project) throws Exception {
	Node rootNode=getRootNode();
	NodeIterator nodeIterator = rootNode.getNodes();
	Node targetProjectNode = null;
	while (nodeIterator.hasNext()) {
		Node projectNode = nodeIterator.nextNode();
		if (!projectNode.hasProperty(FILE)) {
			continue;
		}
		String projectName = projectNode.getName();
		if (project != null && !project.equals(projectName)) {
			continue;
		}
		targetProjectNode = projectNode;
		break;
	}
	if (targetProjectNode == null) {
		throw new RuleException("Project [" + project + "] not exist.");
	}
	List<RepositoryFile> fileList = new ArrayList<RepositoryFile>();
	RepositoryFile root = new RepositoryFile();
	root.setName("根目錄");
	String projectPath = targetProjectNode.getPath();
	root.setFullPath(projectPath);
	fileList.add(root);
	NodeIterator projectNodeIterator = targetProjectNode.getNodes();
	while (projectNodeIterator.hasNext()) {
		Node dirNode = projectNodeIterator.nextNode();
		if (!dirNode.hasProperty(DIR_TAG)) {
			continue;
		}
		RepositoryFile file = new RepositoryFile();
		file.setName(dirNode.getPath().substring(projectPath.length()));
		file.setFullPath(dirNode.getPath());
		fileList.add(file);
		buildDirectories(dirNode, fileList, projectPath);
	}
	return fileList;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:41,代碼來源:RepositoryServiceImpl.java

示例5: buildNodeLockInfo

import javax.jcr.Node; //導入方法依賴的package包/類
private void buildNodeLockInfo(Node node,RepositoryFile file) throws Exception{
	String absPath=node.getPath();
	if(!lockManager.isLocked(absPath)){
		return;
	}
	String owner=lockManager.getLock(absPath).getLockOwner();
	file.setLock(true);
	file.setLockInfo("被"+owner+"鎖定");
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:10,代碼來源:RepositoryServiceImpl.java

示例6: lockPath

import javax.jcr.Node; //導入方法依賴的package包/類
@Override
public void lockPath(String path,User user) throws Exception{
	path = processPath(path);
	int pos=path.indexOf(":");
	if(pos!=-1){
		path=path.substring(0,pos);
	}
	Node rootNode=getRootNode();
	if (!rootNode.hasNode(path)) {
		throw new RuleException("File [" + path + "] not exist.");
	}
	Node fileNode = rootNode.getNode(path);
	String topAbsPath=fileNode.getPath();
	if(lockManager.isLocked(topAbsPath)){
		String owner=lockManager.getLock(topAbsPath).getLockOwner();
		throw new NodeLockException("【"+path+"】已被"+owner+"鎖定,您不能進行再次鎖定!");
	}
	List<Node> nodeList=new ArrayList<Node>();
	unlockAllChildNodes(fileNode, user, nodeList, path);
	for(Node node:nodeList){
		if(!lockManager.isLocked(node.getPath())){
			continue;
		}
		Lock lock=lockManager.getLock(node.getPath());
		lockManager.unlock(lock.getNode().getPath());
	}
	if(!fileNode.isNodeType(NodeType.MIX_LOCKABLE)){
		if (!fileNode.isCheckedOut()) {
			versionManager.checkout(fileNode.getPath());
		}
		fileNode.addMixin("mix:lockable");
		session.save();
	}
	lockManager.lock(topAbsPath, true, true, Long.MAX_VALUE, user.getUsername());				
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:36,代碼來源:RepositoryServiceImpl.java

示例7: getResourceNodePath

import javax.jcr.Node; //導入方法依賴的package包/類
/**
 * Get resource node path by session and uuid
 *
 * @param session The session used to get resource node path
 * @param resourceNodeUUID The uuid used to get resource node path
 * @param renderContext A renderContext object
 * @param resource A resource object
 * @return resourceNodePath
 * @throws RepositoryException
 */
public static String getResourceNodePath(final Session session,
                                         final String resourceNodeUUID,
                                         final RenderContext renderContext,
                                         final Resource resource)
        throws RepositoryException {
    String resourcePath = "";
    if (StringUtils.isNotEmpty(resourceNodeUUID)) {

        Node n = session.getNodeByIdentifier(resourceNodeUUID);
        try {
            URLGenerator urlGenerator = new URLGenerator(renderContext, resource);
            String base = urlGenerator.getBase();
            String nodeType = n.getPrimaryNodeType().getName();
            if(nodeType.equals(JAHIA_JNT_PAGE)) {
                resourcePath = base + n.getPath() + HTML_EXT;
            } else {
                resourcePath = ( (JCRNodeWrapper) n).getUrl();
            }

        } catch (Exception e){
            log.error("Error casting Node: " + n + " to JCRNodeWrapper, using path only", e);
            resourcePath = n.getPath();
        }
    }

    return resourcePath;
}
 
開發者ID:DantaFramework,項目名稱:JahiaDF,代碼行數:38,代碼來源:ResourceUtils.java


注:本文中的javax.jcr.Node.getPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。