Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
setting default values for the new parameters in remoteCreate (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcanar9 authored Aug 12, 2022
1 parent 45865f9 commit e38eeef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>api</artifactId>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<version>3.4.44</version>
<version>3.4.45</version>
<description>Hygieia Rest API Layer</description>
<url>https://github.com/Hygieia/api</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.WhiteSourceComponent;
import com.capitalone.dashboard.util.GitHubParsedUrl;
import org.hibernate.validator.constraints.NotEmpty;

Expand All @@ -17,6 +18,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Arrays;

public class DashboardRemoteRequest extends BaseRequest {
@Valid
Expand Down Expand Up @@ -237,6 +239,18 @@ public CollectorItem toCollectorItem(Collector collector) throws HygieiaExceptio
throw new HygieiaException(toolName + " collector does not support field: " + key, HygieiaException.COLLECTOR_ITEM_CREATE_ERROR);
}
}
// set options with defaults
if (collector.getName().equals("WhiteSource") && !options.keySet().contains("localConfig")){
collectorItem.getOptions().put("localConfig", false);
}
else if(collector.getName().equals("Checkmarx")){
if(!options.keySet().contains("fileExclusions") || options.get("fileExclusions").equals("")){
collectorItem.getOptions().put("fileExclusions", " ");
}
if(!options.keySet().contains("folderExclusions") || options.get("folderExclusions").equals("")){
collectorItem.getOptions().put("folderExclusions", " ");
}
}
return collectorItem;
} else {
throw new HygieiaException("Missing required fields. " + toolName + " collector required fields are: " + String.join(", ", collector.getUniqueFields().keySet()), HygieiaException.COLLECTOR_ITEM_CREATE_ERROR);
Expand Down

0 comments on commit e38eeef

Please sign in to comment.