本文整理汇总了Java中com.blackducksoftware.integration.hub.model.view.ProjectVersionView类的典型用法代码示例。如果您正苦于以下问题:Java ProjectVersionView类的具体用法?Java ProjectVersionView怎么用?Java ProjectVersionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectVersionView类属于com.blackducksoftware.integration.hub.model.view包,在下文中一共展示了ProjectVersionView类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectVersionItemsAndMaxBomUpdatedDate
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Iterate the hub project versions mapper and get the project version view for each item and calculate the max BOM
* updated date
*
* @param hubProjectVersions
* @return
* @throws IllegalArgumentException
* @throws IntegrationException
*/
private List<ProjectVersionView> getProjectVersionItemsAndMaxBomUpdatedDate(final List<HubProjectVersion> hubProjectVersions)
throws IllegalArgumentException, IntegrationException {
List<ProjectVersionView> projectVersionItems = new ArrayList<>();
for (HubProjectVersion hubProjectVersion : hubProjectVersions) {
String projectName = hubProjectVersion.getHubProject();
String projectVersion = hubProjectVersion.getHubProjectVersion();
// Get the project version
final ProjectVersionView projectVersionItem = hubServices.getProjectVersion(projectName, projectVersion);
projectVersionItems.add(projectVersionItem);
Date bomUpdatedValueAt = hubServices.getBomLastUpdatedAt(projectVersionItem);
if (maxBomUpdatedDate == null || bomUpdatedValueAt.after(maxBomUpdatedDate)) {
maxBomUpdatedDate = bomUpdatedValueAt;
}
logger.debug("bomUpdatedValueAt::" + bomUpdatedValueAt);
}
return projectVersionItems;
}
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:29,代码来源:BlackDuckFortifyPushThread.java
示例2: mergeVulnerabilities
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Iterate the hub project versions and find the vulnerabilities for Hub project version and transform the
* vulnerability component view to CSV vulnerability view and merge all the vulnerabilities
*
* @param hubProjectVersions
* @param projectVersionItems
* @return
* @throws IntegrationException
* @throws IllegalArgumentException
*/
private List<Vulnerability> mergeVulnerabilities(final List<HubProjectVersion> hubProjectVersions, final List<ProjectVersionView> projectVersionItems)
throws IllegalArgumentException, IntegrationException {
int index = 0;
List<Vulnerability> mergedVulnerabilities = new ArrayList<>();
for (HubProjectVersion hubProjectVersion : hubProjectVersions) {
// Get the Vulnerability information
final List<VulnerableComponentView> vulnerableComponentViews = hubServices.getVulnerabilityComponentViews(projectVersionItems.get(index));
index++;
// Convert the Hub Vulnerability component view to CSV Vulnerability object
List<Vulnerability> vulnerabilities = VulnerabilityUtil.transformMapping(vulnerableComponentViews, hubProjectVersion.getHubProject(),
hubProjectVersion.getHubProjectVersion(), maxBomUpdatedDate, propertyConstants);
// Add the vulnerabilities to the main list
mergedVulnerabilities.addAll(vulnerabilities);
}
return mergedVulnerabilities;
}
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:31,代码来源:BlackDuckFortifyPushThread.java
示例3: publishRiskReportFiles
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
private void publishRiskReportFiles(final IntLogger logger, final TaskContext taskContext, final SecureToken token, final RiskReportDataService riskReportDataService, final ProjectView project, final ProjectVersionView version) {
final BuildContext buildContext = taskContext.getBuildContext();
final PlanResultKey planResultKey = buildContext.getPlanResultKey();
final BuildLogger buildLogger = taskContext.getBuildLogger();
try {
final File baseDirectory = new File(taskContext.getWorkingDirectory(), HubBambooUtils.HUB_RISK_REPORT_ARTIFACT_NAME);
riskReportDataService.createReportFiles(baseDirectory, project, version);
final Map<String, String> config = new HashMap<>();
final ArtifactDefinitionContext artifact = createArtifactDefContext(token);
final ArtifactPublishingResult publishResult = artifactManager.publish(buildLogger, planResultKey, baseDirectory, artifact, config, RISK_REPORT_MINIMUM_FILE_COUNT);
if (!publishResult.shouldContinueBuild()) {
logger.error("Could not publish the artifacts for the Risk Report");
}
cleanupReportFiles(baseDirectory);
} catch (final IntegrationException ex) {
logger.error("Could not publish the Risk Report", ex);
}
}
示例4: getVulnerabilityComponentViews
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Vulnerability component views
*
* @param projectVersionItem
* @return
* @throws IllegalArgumentException
* @throws IntegrationException
*/
public List<VulnerableComponentView> getVulnerabilityComponentViews(final ProjectVersionView projectVersionItem)
throws IllegalArgumentException, IntegrationException {
if (projectVersionItem != null) {
final String vulnerabililtyBomComponentUrl = getVulnerabililtyBomComponentUrl(projectVersionItem);
return getVulnerabililtyComponentViews(vulnerabililtyBomComponentUrl);
}
return new ArrayList<>();
}
示例5: getBomLastUpdatedAt
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Hub project version last BOM updated date based on Hub project version view
*
* @param projectVersionItem
* @return
* @throws IllegalArgumentException
* @throws IntegrationException
*/
public Date getBomLastUpdatedAt(final ProjectVersionView projectVersionItem)
throws IllegalArgumentException, IntegrationException {
logger.info("Getting Hub last BOM updated at");
if (projectVersionItem != null) {
final String projectVersionRiskProfileUrl = getProjectVersionRiskProfileUrl(projectVersionItem);
RiskProfile riskProfile = getBomLastUpdatedAt(projectVersionRiskProfileUrl);
return riskProfile.getBomLastUpdatedAt();
}
return null;
}
示例6: publishRiskReportFiles
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
private void publishRiskReportFiles(final IntLogger logger, final File workingDirectory, final RiskReportDataService riskReportDataService, final ProjectView project, final ProjectVersionView version)
throws IOException, URISyntaxException, InterruptedException, IntegrationException {
final String reportDirectoryPath = workingDirectory.getCanonicalPath() + File.separator + HubConstantValues.HUB_RISK_REPORT_DIRECTORY_NAME;
final File reportDirectory = new File(reportDirectoryPath);
riskReportDataService.createReportFiles(reportDirectory, project, version);
artifactsWatcher.addNewArtifactsPath(reportDirectoryPath + "=>" + HubConstantValues.HUB_RISK_REPORT_DIRECTORY_NAME);
// If we do not wait, the report tab will not be added and
// it will appear that the report was unsuccessful
Thread.sleep(2000);
}
示例7: checkPolicyFailures
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
private void checkPolicyFailures(final AgentRunningBuild build, final IntLogger logger, final HubServicesFactory services, final MetaService metaService, final ProjectVersionView version, final boolean isDryRun) {
try {
if (isDryRun) {
logger.warn("Will not run the Failure conditions because this was a dry run scan.");
return;
}
final String policyStatusLink = metaService.getFirstLink(version, MetaService.POLICY_STATUS_LINK);
final VersionBomPolicyStatusView policyStatusItem = services.createHubResponseService().getItem(policyStatusLink, VersionBomPolicyStatusView.class);
if (policyStatusItem == null) {
final String message = "Could not find any information about the Policy status of the bom.";
logger.error(message);
build.stopBuild(message);
}
final PolicyStatusDescription policyStatusDescription = new PolicyStatusDescription(policyStatusItem);
final String policyStatusMessage = policyStatusDescription.getPolicyStatusMessage();
if (policyStatusItem.overallStatus == VersionBomPolicyStatusOverallStatusEnum.IN_VIOLATION) {
build.stopBuild(policyStatusMessage);
} else {
logger.info(policyStatusMessage);
}
} catch (final Exception e) {
logger.error(e.getMessage(), e);
build.stopBuild(e.getMessage());
}
}
示例8: checkPolicyFailures
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
private TaskResultBuilder checkPolicyFailures(final TaskResultBuilder resultBuilder, final TaskContext taskContext, final IntLogger logger, final HubServicesFactory services, final MetaService metaService,
final ProjectVersionView version, final boolean isDryRun) {
try {
if (isDryRun) {
logger.warn("Will not run the Failure conditions because this was a dry run scan.");
return resultBuilder.success();
}
final String policyStatusLink = metaService.getFirstLink(version, MetaService.POLICY_STATUS_LINK);
final VersionBomPolicyStatusView policyStatusItem = services.createHubResponseService().getItem(policyStatusLink, VersionBomPolicyStatusView.class);
if (policyStatusItem == null) {
logger.error("Could not find any information about the Policy status of the bom.");
return resultBuilder.failed();
}
final PolicyStatusDescription policyStatusDescription = new PolicyStatusDescription(policyStatusItem);
final String policyStatusMessage = policyStatusDescription.getPolicyStatusMessage();
if (policyStatusItem.overallStatus == VersionBomPolicyStatusOverallStatusEnum.IN_VIOLATION) {
logger.error(policyStatusMessage);
return resultBuilder.failedWithError();
}
logger.info(policyStatusMessage);
return resultBuilder.success();
} catch (final IntegrationException e) {
logger.error(e.getMessage(), e);
return resultBuilder.failed();
}
}
示例9: call
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
@Override
public Boolean call() throws DateTimeParseException, IntegrationException, IllegalArgumentException, JsonGenerationException, JsonMappingException,
FileNotFoundException, UnsupportedEncodingException, IOException {
logger.info("blackDuckFortifyMapper::" + blackDuckFortifyMapperGroup.toString());
final List<HubProjectVersion> hubProjectVersions = blackDuckFortifyMapperGroup.getHubProjectVersion();
// Get the last successful runtime of the job
final Date getLastSuccessfulJobRunTime = getLastSuccessfulJobRunTime(propertyConstants.getBatchJobStatusFilePath());
logger.debug("Last successful job excecution:" + getLastSuccessfulJobRunTime);
// Get the project version view from Hub and calculate the max BOM updated date
final List<ProjectVersionView> projectVersionItems = getProjectVersionItemsAndMaxBomUpdatedDate(hubProjectVersions);
logger.info("Compare Dates: "
+ ((getLastSuccessfulJobRunTime != null && maxBomUpdatedDate.after(getLastSuccessfulJobRunTime)) || (getLastSuccessfulJobRunTime == null)
|| (!propertyConstants.isBatchJobStatusCheck())));
logger.debug("maxBomUpdatedDate:: " + maxBomUpdatedDate);
logger.debug("isBatchJobStatusCheck::" + propertyConstants.isBatchJobStatusCheck());
if ((getLastSuccessfulJobRunTime != null && maxBomUpdatedDate.after(getLastSuccessfulJobRunTime)) || (getLastSuccessfulJobRunTime == null)
|| (!propertyConstants.isBatchJobStatusCheck())) {
// Get the vulnerabilities for all Hub project versions and merge it
List<Vulnerability> mergedVulnerabilities = mergeVulnerabilities(hubProjectVersions, projectVersionItems);
if (mergedVulnerabilities.size() > 0) {
if (hubProjectVersions.size() > 1) {
// Removing Duplicates within multiple Hub Project Versions.
mergedVulnerabilities = VulnerabilityUtil.removeDuplicates(mergedVulnerabilities);
}
final String fileDir = propertyConstants.getReportDir();
final String fileName = hubProjectVersions.get(0).getHubProject() + UNDERSCORE + hubProjectVersions.get(0).getHubProjectVersion()
+ UNDERSCORE + DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now()) + ".csv";
// Write the vulnerabilities to CSV
CSVUtils.writeToCSV(mergedVulnerabilities, fileDir + fileName, ',');
// Get the file token for upload
String token = getFileToken();
// Upload the vulnerabilities CSV to Fortify
uploadCSV(token, fileDir + fileName, blackDuckFortifyMapperGroup.getFortifyApplicationId());
// Delete the file token that is created for upload
fortifyFileTokenApi.deleteFileToken();
}
}
return true;
}
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:47,代码来源:BlackDuckFortifyPushThread.java
示例10: getProjectFromVersion
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
private ProjectView getProjectFromVersion(final ProjectRequestService projectRequestService, final MetaService metaService, final ProjectVersionView version) throws IntegrationException {
final String projectURL = metaService.getFirstLink(version, MetaService.PROJECT_LINK);
final ProjectView projectVersion = projectRequestService.getItem(projectURL, ProjectView.class);
return projectVersion;
}
示例11: getProjectVersion
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Hub project version information
*
* @param projectName
* @param versionName
* @return
* @throws IllegalArgumentException
* @throws IntegrationException
*/
public ProjectVersionView getProjectVersion(final String projectName, final String versionName)
throws IllegalArgumentException, IntegrationException {
logger.info("Getting Hub project and project version info for::" + projectName + ", " + versionName);
final ProjectView projectItem = getProjectByProjectName(projectName);
return getProjectVersion(projectItem, versionName);
}
示例12: getProjectVersionsByProject
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Hub Project version information based on project view
*
* @param project
* @return
* @throws IntegrationException
*/
public List<ProjectVersionView> getProjectVersionsByProject(final ProjectView project) throws IntegrationException {
final ProjectVersionRequestService projectVersionRequestService = hubServicesFactory
.createProjectVersionRequestService();
return projectVersionRequestService.getAllProjectVersions(project);
}
示例13: getVulnerabililtyBomComponentUrl
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Hub Vulnerability BOM component Url
*
* @param projectVersionItem
* @return
* @throws HubIntegrationException
* @throws IllegalArgumentException
* @throws EncryptionException
*/
private String getVulnerabililtyBomComponentUrl(final ProjectVersionView projectVersionItem)
throws HubIntegrationException, IllegalArgumentException, EncryptionException {
final MetaService metaService = hubServicesFactory.createMetaService();
return metaService.getFirstLink(projectVersionItem, MetaService.VULNERABLE_COMPONENTS_LINK);
}
示例14: getProjectVersionRiskProfileUrl
import com.blackducksoftware.integration.hub.model.view.ProjectVersionView; //导入依赖的package包/类
/**
* Get the Hub Project version risk-profile url
*
* @param projectVersionItem
* @return
* @throws HubIntegrationException
* @throws IllegalArgumentException
* @throws EncryptionException
*/
private String getProjectVersionRiskProfileUrl(final ProjectVersionView projectVersionItem)
throws HubIntegrationException, IllegalArgumentException, EncryptionException {
final MetaService metaService = hubServicesFactory.createMetaService();
return metaService.getFirstLink(projectVersionItem, MetaService.RISK_PROFILE_LINK);
}