Skip to content
Permalink
Browse files

[FIXED JENKINS-11781]

  • Loading branch information...
jacob_robertson
jacob_robertson committed Nov 24, 2011
1 parent 1643a39 commit 0eaf854157c95f0e4e41b19e1bb566a9fb441a3d
Showing with 30 additions and 9 deletions.
  1. +30 −9 src/main/java/configurationslicing/executeshell/ExecuteShellSlicer.java
@@ -1,7 +1,9 @@
package configurationslicing.executeshell;

import hudson.Extension;
import hudson.matrix.MatrixProject;
import hudson.model.Descriptor;
import hudson.model.AbstractProject;
import hudson.model.Hudson;
import hudson.model.Project;
import hudson.tasks.Builder;
@@ -20,13 +22,13 @@
* @author Victor Garcia <bravejolie@gmail.com> <victor@tuenti.com>
*/
@Extension
public class ExecuteShellSlicer extends UnorderedStringSlicer<Project<?,?>>{
public class ExecuteShellSlicer extends UnorderedStringSlicer<AbstractProject<?,?>>{

public ExecuteShellSlicer() {
super(new ExecuteShellSliceSpec());
}

public static class ExecuteShellSliceSpec extends UnorderedStringSlicerSpec<Project<?,?>> {
public static class ExecuteShellSliceSpec extends UnorderedStringSlicerSpec<AbstractProject<?,?>> {

private static final String NOTHING = "(nothing)";

@@ -38,17 +40,17 @@ public String getName() {
return "Execute shell slicer";
}

public String getName(Project<?, ?> item) {
public String getName(AbstractProject<?, ?> item) {
return item.getName();
}

public String getUrl() {
return "executeshellslicestring";
}

public List<String> getValues(Project<?, ?> item) {
public List<String> getValues(AbstractProject<?, ?> item) {
List<String> shellContent = new ArrayList<String>();
DescribableList<Builder,Descriptor<Builder>> buildersList = item.getBuildersList();
DescribableList<Builder,Descriptor<Builder>> buildersList = getBuildersList(item);

Shell shell = (Shell)buildersList.get(Shell.class);
if(shell != null) {
@@ -61,12 +63,31 @@ public String getUrl() {
}

@SuppressWarnings("unchecked")
public List<Project<?, ?>> getWorkDomain() {
return (List) Hudson.getInstance().getItems(Project.class);
public List<AbstractProject<?, ?>> getWorkDomain() {
List<AbstractProject<?, ?>> list = new ArrayList<AbstractProject<?, ?>>();
List<AbstractProject> temp = Hudson.getInstance().getItems(AbstractProject.class);
for (AbstractProject p: temp) {
if (p instanceof Project || p instanceof MatrixProject) {
list.add(p);
}
}
return list;
}

@SuppressWarnings("unchecked")
private DescribableList<Builder,Descriptor<Builder>> getBuildersList(AbstractProject<?, ?> item) {
if (item instanceof Project) {
return ((Project) item).getBuildersList();
} else if (item instanceof MatrixProject) {
return ((MatrixProject) item).getBuildersList();
} else {
return null;
}

}

public boolean setValues(Project<?, ?> item, Set<String> set) {
DescribableList<Builder,Descriptor<Builder>> buildersList = item.getBuildersList();
public boolean setValues(AbstractProject<?, ?> item, Set<String> set) {
DescribableList<Builder,Descriptor<Builder>> buildersList = getBuildersList(item);
Shell shell = null;
String command = set.iterator().next();

0 comments on commit 0eaf854

Please sign in to comment.
You can’t perform that action at this time.