Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code for JENKINS-17518 #2

Merged
merged 5 commits into from
Apr 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,13 @@ public FormValidation doCheckDefaultPropertyKey(@QueryParameter final String def
private String defaultPropertyFile;

private String defaultPropertyKey;

private String multiSelectDelimiter;

@DataBoundConstructor
public ExtendedChoiceParameterDefinition(String name, String type, String value, String propertyFile, String propertyKey, String defaultValue,
String defaultPropertyFile, String defaultPropertyKey, boolean quoteValue, int visibleItemCount, String description) {
String defaultPropertyFile, String defaultPropertyKey, boolean quoteValue, int visibleItemCount, String description,
String multiSelectDelimiter) {
super(name, description);
this.type = type;

Expand All @@ -135,6 +138,11 @@ public ExtendedChoiceParameterDefinition(String name, String type, String value,
visibleItemCount = 5;
}
this.visibleItemCount = visibleItemCount;

if(multiSelectDelimiter.equals("")) {
multiSelectDelimiter = ",";
}
this.multiSelectDelimiter = multiSelectDelimiter;
}

private Map<String, Boolean> computeDefaultValueMap() {
Expand Down Expand Up @@ -176,7 +184,7 @@ public ParameterValue createValue(StaplerRequest request) {
}
}

return new ExtendedChoiceParameterValue(getName(), StringUtils.join(result, ","));
return new ExtendedChoiceParameterValue(getName(), StringUtils.join(result, getMultiSelectDelimiter()));
}
}
return null;
Expand All @@ -191,7 +199,7 @@ public ParameterValue createValue(StaplerRequest request, JSONObject jO) {
}
else if(value instanceof JSONArray) {
JSONArray jsonValues = (JSONArray)value;
strValue = StringUtils.join(jsonValues.iterator(), ',');
strValue = StringUtils.join(jsonValues.iterator(), getMultiSelectDelimiter());
}

if(quoteValue) {
Expand Down Expand Up @@ -318,6 +326,14 @@ public int getVisibleItemCount() {
public void setVisibleItemCount(int visibleItemCount) {
this.visibleItemCount = visibleItemCount;
}

public String getMultiSelectDelimiter() {
return this.multiSelectDelimiter;
}

public void setMultiSelectDelimiter(final String multiSelectDelimiter) {
this.multiSelectDelimiter = multiSelectDelimiter;
}

public void setDefaultPropertyFile(String defaultPropertyFile) {
this.defaultPropertyFile = defaultPropertyFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
<f:textbox value="${visibleItemCount}"/>
</f:entry>


<f:entry title="Delimiter" field="multiSelectDelimiter">
<f:textbox value="${multiSelectDelimiter}"/>
</f:entry>

</j:jelly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<p>Inserts this value between selections when the parameter is a multi-select.</p>
<p>The default when empty is ','</p>
</div>