Skip to content

Commit

Permalink
integrated RebuildParameterProvider extension for rebuild plugin comp…
Browse files Browse the repository at this point in the history
…atibility

1. added rebuild dependency to pom
2. created ExtendedChoiceRebuildParameterProvider class
2. ExtendedChoiceParameterValue - get/set methods
3. ExtendedChoiceParameterDefinition - import Messages
  • Loading branch information
lkisac committed Feb 25, 2015
1 parent b7a5a76 commit 152e781
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/target/
/work/
/work/
/classes/
.project
.classpath
.settings/
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<artifactId>opencsv</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.sonyericsson.hudson.plugins.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>1.21</version> <!-- RebuildParameterProvider is available since 1.21 -->
<optional>true</optional>
</dependency>
</dependencies>

<!-- get every artifact through maven.glassfish.org, which proxies all the artifacts that we need -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
*Copyright (c) 2015 Len Isac
*Copyright (c) 2013 Costco, Vimil Saju
*Copyright (c) 2013 John DiMatteo
*See the file license.txt for copying permission.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
*Copyright (c) 2015 Len Isac
*Copyright (c) 2013 Costco, Vimil Saju
*See the file license.txt for copying permission.
*/
Expand All @@ -9,17 +8,16 @@

import org.kohsuke.stapler.DataBoundConstructor;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.List;

import hudson.model.StringParameterValue;

public class ExtendedChoiceParameterValue extends StringParameterValue{
public class ExtendedChoiceParameterValue extends StringParameterValue {
private static final long serialVersionUID = 7993744779892775177L;
private Map<Integer, String> allCols;
private Map<Integer, List<String>> allColsList;
private int multiLevelColumns;
private int multiLevelColumns;

@DataBoundConstructor
public ExtendedChoiceParameterValue(String name, String value) {
Expand All @@ -29,7 +27,31 @@ public ExtendedChoiceParameterValue(String name, String value) {
public ExtendedChoiceParameterValue(String name, String value,
int multiLevelColumns, Map<Integer, String> allCols) {
super(name, value);
this.setAllCols(allCols);
this.setMultiLevelColumns(multiLevelColumns);
}

public Map<Integer, String> getAllCols() {
return allCols;
}

public void setAllCols(Map<Integer, String> allCols) {
this.allCols = allCols;
}

public Map<Integer, List<String>> getAllColsList() {
return allColsList;
}

public void setAllColsList(Map<Integer, List<String>> allColsList) {
this.allColsList = allColsList;
}

public int getMultiLevelColumns() {
return multiLevelColumns;
}

public void setMultiLevelColumns(int multiLevelColumns) {
this.multiLevelColumns = multiLevelColumns;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
*Copyright (c) 2015 Len Isac
*See the file license.txt for copying permission.
*/
package main.java.com.cwctravel.hudson.plugins.extended_choice_parameter;

import hudson.Extension;
import hudson.model.ParameterValue;

import com.sonyericsson.rebuild.RebuildParameterPage;
import com.sonyericsson.rebuild.RebuildParameterProvider;

/**
* An extension class to inject {@link ExtendedChoiceParameterValue} to rebuild-plugin.
*/
@Extension(optional = true)
public class ExtendedChoiceRebuildParameterProvider extends RebuildParameterProvider {
/**
* @param value
* @return
* @see com.sonyericsson.rebuild.RebuildParameterProvider#getRebuildPage(hudson.model.ParameterValue)
*/
@Override
public RebuildParameterPage getRebuildPage(ParameterValue value) {
if (value instanceof ExtendedChoiceParameterValue) {
return new RebuildParameterPage(ExtendedChoiceParameterValue.class, "rebuild.groovy");
}

return null;
}
}

0 comments on commit 152e781

Please sign in to comment.