Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Add phase, distribution, and match adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Killough committed Jul 21, 2017
1 parent bc79805 commit a0921e4
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,11 @@ private HubScanConfig getScanConfig(final File workingDirectory, final File tool

private ProjectRequest getProjectRequest(final IntLogger logger, final CIEnvironmentVariables commonVariables) {
final ProjectRequestBuilder projectRequestBuilder = new ProjectRequestBuilder();
projectRequestBuilder.setProjectName((commonVariables.getValue(HubConstantValues.HUB_PROJECT_NAME)));
projectRequestBuilder.setVersionName((commonVariables.getValue(HubConstantValues.HUB_PROJECT_VERSION)));
projectRequestBuilder.setProjectName(commonVariables.getValue(HubConstantValues.HUB_PROJECT_NAME));
projectRequestBuilder.setVersionName(commonVariables.getValue(HubConstantValues.HUB_PROJECT_VERSION));
projectRequestBuilder.setPhase(commonVariables.getValue(HubConstantValues.HUB_PHASE));
projectRequestBuilder.setDistribution(commonVariables.getValue(HubConstantValues.HUB_DISTRIBUTION));
projectRequestBuilder.setProjectLevelAdjustments(Boolean.valueOf(commonVariables.getValue(HubConstantValues.HUB_MATCH_ADJUSTMENTS)));
try {
return projectRequestBuilder.build();
} catch (final IllegalStateException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public final class HubConstantValues {

public static final String HUB_PROJECT_VERSION = PLUGIN_PREFIX + "projectVersion";

public static final String HUB_PHASE = PLUGIN_PREFIX + "phase";

public static final String HUB_DISTRIBUTION = PLUGIN_PREFIX + "distribution";

public static final String HUB_MATCH_ADJUSTMENTS = PLUGIN_PREFIX + "projectLevelAdjustments";

public static final String HUB_GENERATE_RISK_REPORT = PLUGIN_PREFIX + "generateRiskReport";

public static final String HUB_MAX_WAIT_TIME_FOR_RISK_REPORT = PLUGIN_PREFIX + "maxWaitTimeForRiskReport";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import org.jetbrains.annotations.NotNull;

import com.blackducksoftware.integration.hub.global.HubServerConfig;
import com.blackducksoftware.integration.hub.model.enumeration.ProjectVersionDistributionEnum;
import com.blackducksoftware.integration.hub.model.enumeration.ProjectVersionRequestPhaseEnum;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -83,6 +87,22 @@ public void setHubWorkspaceCheck(final boolean hubWorkspaceCheck) {
this.hubWorkspaceCheck = hubWorkspaceCheck;
}

public List<String> getPhaseList() {
final List<String> phaseList = new LinkedList<>();
for (final ProjectVersionRequestPhaseEnum phase : ProjectVersionRequestPhaseEnum.values()) {
phaseList.add(phase.toString());
}
return phaseList;
}

public List<String> getDistributionList() {
final List<String> distributionList = new LinkedList<>();
for (final ProjectVersionDistributionEnum dist : ProjectVersionDistributionEnum.values()) {
distributionList.add(dist.toString());
}
return distributionList;
}

public void loadSettings() {
if (configFile.exists()) {
try (BufferedReader reader = new BufferedReader(new FileReader(configFile))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
type="com.blackducksoftware.integration.hub.teamcity.server.global.ServerHubConfigPersistenceManager"
scope="request" />


<style type="text/css">
.bdLongTextArea{
min-width: 40em !important;
Expand Down Expand Up @@ -59,6 +58,72 @@
</td>
</tr>

<tr class="noBorder" id="blackDuckHubPhase"
style="">
<th>
<label
for="com.blackducksoftware.integration.hub.phase">
Phase: <bs:helpIcon
iconTitle="The Phase of this Project-Version." />
</label>
</th>
<td>
<props:selectProperty
name="com.blackducksoftware.integration.hub.phase"
className="longField">
<c:forEach var="phase"
items="${hubConfigPersistenceManager.getPhaseList()}">
<c:set var="selected" value="false" />

<props:option value="${phase}"
selected="${selected}">
<c:out
value="${phase}" />
</props:option>
</c:forEach>
</props:selectProperty>
</td>
</tr>

<tr class="noBorder" id="blackDuckHubDistribution"
style="">
<th>
<label
for="com.blackducksoftware.integration.hub.distribution">
Distribution: <bs:helpIcon
iconTitle="The Distribution of this Project-Version." />
</label>
</th>
<td>
<props:selectProperty
name="com.blackducksoftware.integration.hub.distribution"
className="longField">
<c:forEach var="dist"
items="${hubConfigPersistenceManager.getDistributionList()}">
<c:set var="selected" value="false" />

<props:option value="${dist}"
selected="${selected}">
<c:out
value="${dist}" />
</props:option>
</c:forEach>
</props:selectProperty>
</td>
</tr>

<tr class="noBorder" id="blackDuckHubProjectLevelAdjustments" style="">
<th>
<label for="com.blackducksoftware.integration.hub.projectLevelAdjustments">
Match Adjustments: <bs:helpIcon
iconTitle="Always maintain component adjustments to all versions of this project." />
</label>
</th>
<td>
<props:checkboxProperty name="com.blackducksoftware.integration.hub.projectLevelAdjustments" className="longField" />
</td>
</tr>

<tr class="noBorder" id="blackDuckHubGenerateRiskReport" style="">
<th>
<label for="com.blackducksoftware.integration.hub.generateRiskReport">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
Version: <props:displayValue
name="com.blackducksoftware.integration.hub.projectVersion" />
</div>
<div class="parameter">
Phase: <props:displayValue
name="com.blackducksoftware.integration.hub.phase" />
</div>
<div class="parameter">
Distribution: <props:displayValue
name="com.blackducksoftware.integration.hub.distribution" />
</div>
<div class="parameter">
Match Adjustments: <props:displayValue name="com.blackducksoftware.integration.hub.projectLevelAdjustments" />
</div>
<div class="parameter">
Generate Black Duck Risk Report: <props:displayValue name="com.blackducksoftware.integration.hub.generateRiskReport" />
</div>
Expand Down

0 comments on commit a0921e4

Please sign in to comment.