当前位置: 首页>>代码示例>>Java>>正文


Java CodeTreeNode类代码示例

本文整理汇总了Java中com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode的典型用法代码示例。如果您正苦于以下问题:Java CodeTreeNode类的具体用法?Java CodeTreeNode怎么用?Java CodeTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CodeTreeNode类属于com.blackducksoftware.sdk.protex.project.codetree包,在下文中一共展示了CodeTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStringSearchDiscoveries

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
public List<StringSearchDiscovery> getStringSearchDiscoveries(String projectID, String path) {
	CodeTreeNode tmpCodeTreeNode = new CodeTreeNode();
	tmpCodeTreeNode.setNodeType(CodeTreeNodeType.FILE);
	tmpCodeTreeNode.setName(path);
	
	PartialCodeTree fileOnlyTree = new PartialCodeTree();
	fileOnlyTree.setParentPath("/");
       fileOnlyTree.getNodes().add(tmpCodeTreeNode);
	
	List<StringSearchPatternOriginType> searchOnly = new ArrayList<StringSearchPatternOriginType>(1);
	searchOnly.add(StringSearchPatternOriginType.STANDARD);
	searchOnly.add(StringSearchPatternOriginType.CUSTOM);
	
	try {
		return this.discoveryAPI.getStringSearchDiscoveries(projectID, fileOnlyTree, searchOnly);
	} catch (SdkFault e) {
		log.error(e.getMessage());
	}
	
	return null;	
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:22,代码来源:ProtexSDKAPIService.java

示例2: getCodeMatchDiscoveries

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
private static int[] getCodeMatchDiscoveries(List<CodeTreeNode> partialCodeTree, List<CodeMatchType> filterByCodeMatchType) {
    int totalDiscoveryCount = 0;
    int totalFileCount = 0;
    List<CodeTreeNode> getDiscoveriesFor = new ArrayList<CodeTreeNode>();
    int partialDiscoveryCount = 0;

    for (CodeTreeNode node : partialCodeTree) {
        if (getNodeCount(node, NodeCountType.PENDING_ID_CODE_MATCH) != 0) {
            int nodeDiscoveryCount = getNodeCount(node, NodeCountType.DISCOVERIES).intValue();

            if ((partialDiscoveryCount + nodeDiscoveryCount > maximumChildElements) && (partialDiscoveryCount != 0)) {
                discoveryExecService.submit(new SlimCodeMatchDiscoveryGetter(discoveries, getDiscoveriesFor, filterByCodeMatchType));
                getDiscoveriesFor = new ArrayList<CodeTreeNode>();
                partialDiscoveryCount = 0;
            }

            getDiscoveriesFor.add(node);
            partialDiscoveryCount += nodeDiscoveryCount;
            totalDiscoveryCount += nodeDiscoveryCount;
            totalFileCount++;
        }
    }

    if (!getDiscoveriesFor.isEmpty()) {
        discoveryExecService.submit(new SlimCodeMatchDiscoveryGetter(discoveries, getDiscoveriesFor, filterByCodeMatchType));
    }

    return new int[] { totalDiscoveryCount, totalFileCount };
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:30,代码来源:SampleIdentifyAllCodeMatchDiscoveriesMemoryManagedAdvanced.java

示例3: getNodeCount

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
private static Long getNodeCount(CodeTreeNode node, NodeCountType type) {
    for (NodeCount count : node.getNodeCounts()) {
        if (count.getCountType() == type) {
            return count.getCount();
        }
    }
    throw new IllegalArgumentException("Node \"" + node.getName() + "\" doesn't have a " + type.toString() + " count");
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:9,代码来源:SampleIdentifyAllCodeMatchDiscoveriesMemoryManagedAdvanced.java

示例4: getNodeCountMap

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
/**
 * Extracts count information into a more random-access friendly form
 *
 * @param node
 *            A code tree node with count information
 * @return A map relating each count type to the returned count
 */
public static Map<NodeCountType, Long> getNodeCountMap(CodeTreeNode node) {
    Map<NodeCountType, Long> counts = new HashMap<NodeCountType, Long>();

    if (node != null && node.getNodeCounts() != null) {
        for (NodeCount count : node.getNodeCounts()) {
            counts.put(count.getCountType(), count.getCount());
        }
    }

    return counts;
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:19,代码来源:CodeTreeUtilities.java

示例5: getNodeCountsEmptyNodeCounts

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
@Test
public void getNodeCountsEmptyNodeCounts() throws Exception {
    CodeTreeNode node = new CodeTreeNode();

    Map<NodeCountType, Long> counts = CodeTreeUtilities.getNodeCountMap(node);

    Assert.assertTrue(counts.isEmpty());
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:9,代码来源:CodeTreeUtilitiesTest.java

示例6: getNodeCounts

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
@Test
public void getNodeCounts() throws Exception {
    CodeTreeNode node = new CodeTreeNode();
    NodeCount count = new NodeCount();
    count.setCount(10L);
    count.setCountType(NodeCountType.APPROVED);
    node.getNodeCounts().add(count);

    Map<NodeCountType, Long> counts = CodeTreeUtilities.getNodeCountMap(node);

    Assert.assertEquals(counts.size(), 1);
    Assert.assertEquals(counts.get(NodeCountType.APPROVED), count.getCount());
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:14,代码来源:CodeTreeUtilitiesTest.java

示例7: compare

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
@Override
public int compare(CodeTreeNode arg0, CodeTreeNode arg1) {
	if(arg0.getNodeType() != arg1.getNodeType()) {
		return (arg0.getNodeType() == CodeTreeNodeType.FILE)?1:-1;
	} else {
		return arg0.getName().compareTo(arg1.getName());
	}
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:9,代码来源:JTreeAllFiles.java

示例8: treeWalk

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
public void treeWalk(String parentPath) throws SdkFault {
	log.debug("treeWalk: "+parentPath);

    PartialCodeTree thisLevel = mCodeTreeAPI.getCodeTree(mProjectID, parentPath, CodeTreeUtilities.DIRECT_CHILDREN, Boolean.FALSE);
    // Deal with all the sub-folders first

    for (CodeTreeNode node : thisLevel.getNodes()) {
    	
        if ((node.getNodeType() == CodeTreeNodeType.EXPANDED_ARCHIVE) || (node.getNodeType() == CodeTreeNodeType.FOLDER)) {
        	treeWalk(constructPath(parentPath, node.getName()));
        }
    }
    
    doWork(thisLevel);
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:16,代码来源:BOMReportAPIWrapper.java

示例9: getPendingIds

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
/**
 * Get the pending Id count of the specified project
 *
 * @throws ServerConfigException
 * @throws ProtexFacadeException
 * @throws ServerConnectionException
 */
public long getPendingIds(final String projectId)
		throws ProtexFacadeException, ServerConfigException, ServerConnectionException {

	if (StringUtils.isBlank(projectId)) {
		throw new IllegalArgumentException(
				"Need to provide the Id of the Protex Project that you want the Pending Id's of.");
	}

	long pendingIds = 0L;

	try {
		// needed to model this code around the common framework 7 code to
		// get a list of pending IDs
		final List<CodeTreeNode> nodes = getCodeTreeNodes(projectId, NodeCountType.PENDING_ID_ALL);

		Map<NodeCountType, Long> map = new HashMap<NodeCountType, Long>();
		for (final CodeTreeNode node : nodes) {
			map = CodeTreeUtilities.getNodeCountMap(node);
		}
		final long count = map.get(NodeCountType.PENDING_ID_ALL);
		if (count > 0) {
			pendingIds = count;

		}
		// code used to work but there appears to be a bug in the 7.4 SDK so
		// needed to use an alternate method for the time being.
		// if (nodes.size() != 1) {
		// throw new ProtexFacadeException(
		// "Getting discoveries pending Id file count failed : Expected to
		// get 1 CodeTreeNode, but got : "
		// + nodes.size());
		// } else if (nodes.get(0).getNodeCounts().size() != 1) {
		// throw new ProtexFacadeException(
		// "Getting discoveries pending Id file count failed : Expected to
		// get 1 NodeCount, but got : "
		// + nodes.get(0).getNodeCounts().size());
		// } else {
		// pendingIds = nodes.get(0).getNodeCounts().get(0).getCount();
		// }
		logger.info("File(s) Pending Identification : " + pendingIds);

	} catch (final ServerConnectionException e) {
		throw e;
	}
	return pendingIds;
}
 
开发者ID:blackducksoftware,项目名称:protex-common,代码行数:54,代码来源:ProtexFacade.java

示例10: SlimCodeMatchDiscoveryGetter

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
public SlimCodeMatchDiscoveryGetter(Collection<SlimCodeMatchDiscovery> accumulator, List<CodeTreeNode> partialCodeTree,
        List<CodeMatchType> filterByCodeMatchType) {
    this.accumulator = accumulator;
    this.partialCodeTree = partialCodeTree;
    this.filterByCodeMatchType = filterByCodeMatchType;
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:7,代码来源:SampleIdentifyAllCodeMatchDiscoveriesMemoryManagedAdvanced.java

示例11: getInstance

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
public static Comparator<CodeTreeNode> getInstance() {
    return INSTANCE;
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:4,代码来源:CodeTreeNodeComparator.java

示例12: preprocess

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
protected static String preprocess(CodeTreeNode node) {
    return (node.getNodeType() != CodeTreeNodeType.FILE ? node.getName() + "/" : node.getName()).replaceAll("([^/]*)/+", "\0$1/");
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:4,代码来源:CodeTreeNodeComparator.java

示例13: compare

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
@Override
public int compare(CodeTreeNode node1, CodeTreeNode node2) {
    String str1 = preprocess(node1);
    String str2 = preprocess(node2);
    return str1.compareToIgnoreCase(str2);
}
 
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:7,代码来源:CodeTreeNodeComparator.java

示例14: makeTree

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
public DefaultMutableTreeNode makeTree() {
	
	String projectName = IdentifyMediator.getInstance().getSelectedProjectName();
	
	String[] splitNodePath = null;
	FileNodeInfo rootFileNodeInfo = new FileNodeInfo(
			projectName, 
			this.rootPath, 
			SelectedFilePathInfo.PROJECT_TYPE);
	
	rootNode = new DefaultMutableTreeNode(rootFileNodeInfo);
	DefaultMutableTreeNode  parentNode = null;

	
	if(partialCodeTree==null)
		return null;
	
	List<CodeTreeNode> codeTreeNodeList= partialCodeTree.getNodes();
	Collections.sort(codeTreeNodeList, new NameAscCompare());
	
	for(CodeTreeNode tmpCodeTreeNode:codeTreeNodeList) {
		String nodePath = tmpCodeTreeNode.getName();
		String nodeType = tmpCodeTreeNode.getNodeType().toString();
		int pathType = SelectedFilePathInfo.INVALID_TYPE;
		
		if(IdentifyMediator.STR_FILE.equals(nodeType))
			pathType = SelectedFilePathInfo.SINGLE_FILE_TYPE;
		else if(IdentifyMediator.STR_FOLDER.equals(nodeType))
			pathType = SelectedFilePathInfo.FOLDER_TYPE;
		else if(IdentifyMediator.STR_PROJECT.equals(nodeType))		
			pathType = SelectedFilePathInfo.PROJECT_TYPE;
		
		
		if(nodePath.length() == 0) continue;
		
		splitNodePath = nodePath.split("/");
		parentNode = rootNode;

		for(int i=0; i<splitNodePath.length; i++) {
			DefaultMutableTreeNode tn = findTreeNode(parentNode, splitNodePath[i]);
			if(tn == null){
				addSubNode(splitNodePath, i, parentNode, nodePath, pathType);
				break;
			}
			else{
				parentNode = tn;
			}
		}
	}
		
	return rootNode;
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:53,代码来源:JTreeAllFiles.java

示例15: doWork

import com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode; //导入依赖的package包/类
private void doWork(PartialCodeTree thisLevel) throws SdkFault {
    // do the work here
    if (thisLevel.getNodes().size() == 0) {
        return;
    }
    PartialCodeTree fileNodes = new PartialCodeTree();
    fileNodes.setParentPath(thisLevel.getParentPath());
    for (CodeTreeNode node : thisLevel.getNodes()) {
        if (node.getNodeType() == CodeTreeNodeType.FILE) {
            fileNodes.getNodes().add(node);
        }
    }
    if (fileNodes.getNodes().size() == 0) {
        return;
    }
    
    List<CodeTreeIdentificationInfo> idInfos = mIdentificationAPI.getEffectiveIdentifications(mProjectID,fileNodes);
    for (CodeTreeIdentificationInfo idInfo : idInfos) {
        String filePath = constructPath(thisLevel.getParentPath(), idInfo.getName());
    	for (Identification id : idInfo.getIdentifications()) {
    		String mComponentID = id.getIdentifiedComponentId();
	        Component mComponent = mProjectAPI.getComponentById(mProjectID, mComponentID);
	        if(mComponent == null) continue;
	        String mComponentName = mComponent.getName();
	        String fileComment = mCodeTreeAPI.getFileOrFolderComment(mProjectID, filePath);
	
	        String fileLicense = "";
	        LicenseInfo mLicenseInfo = id.getIdentifiedLicenseInfo();
	        if(mLicenseInfo != null) fileLicense = parseFileLicense(mLicenseInfo.getName());
	        
	        IdentificationType discoveryType = id.getType();
	        
	        String mIndetifyURL = mBomAPI.getIdentifyBomUrl(mProjectID,filePath);
	        log.debug("-- " + filePath + " : " + mIndetifyURL);
	
	        identifiedFileList.add(new IdentifiedFilesRow(filePath, mComponentName, fileComment, fileLicense, mProjectName, discoveryType.toString()));

String msg = "    "+ identifiedFileList.size() + " files are loaded.";    	        
observer.pushMessage(msg);
log.debug(msg);
    	}
    }
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:44,代码来源:BOMReportAPIWrapper.java


注:本文中的com.blackducksoftware.sdk.protex.project.codetree.CodeTreeNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。