Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fixed JENKINS-11928] Added posibility to specify also exclude filter
- Loading branch information
Showing
3 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,67 @@ | ||
package hudson.plugins.ws_cleanup; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Describable; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Hudson; | ||
import hudson.util.ListBoxModel; | ||
|
||
import java.io.Serializable; | ||
|
||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a> | ||
*/ | ||
public class Pattern implements Serializable{ | ||
public class Pattern implements Serializable, Describable<Pattern>{ | ||
|
||
private final String pattern; | ||
private PatternType type; | ||
|
||
@DataBoundConstructor | ||
public Pattern(String pattern) { | ||
public Pattern(String pattern, PatternType type) { | ||
this.pattern = pattern; | ||
this.type = type; | ||
} | ||
|
||
public Object readResolve(){ | ||
if(type == null) | ||
type = PatternType.INCLUDE; | ||
return this; | ||
} | ||
|
||
public String getPattern() { | ||
return pattern; | ||
} | ||
|
||
public PatternType getType(){ | ||
return type; | ||
} | ||
|
||
public Descriptor<Pattern> getDescriptor() { | ||
return Hudson.getInstance().getDescriptor(getClass()); | ||
} | ||
|
||
@Extension | ||
public static final class DescriptorImpl extends Descriptor<Pattern>{ | ||
|
||
public String getDisplayName(){ | ||
return "Directory scanner pattern"; | ||
} | ||
|
||
public ListBoxModel doFillTypeItems(){ | ||
ListBoxModel model = new ListBoxModel(2); | ||
model.add("Include",PatternType.INCLUDE.toString()); | ||
model.add("Exclude",PatternType.EXCLUDE.toString()); | ||
return model; | ||
} | ||
|
||
} | ||
|
||
public enum PatternType{ | ||
INCLUDE, | ||
EXCLUDE; | ||
} | ||
|
||
private static final long serialVerisonUID = 1L; | ||
} |
7 changes: 6 additions & 1 deletion
7
src/main/resources/hudson/plugins/ws_cleanup/Pattern/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | ||
<f:textbox field="pattern"/> | ||
<table> | ||
<tr> | ||
<td width="15%"><f:select field="type" /></td> | ||
<td width="85%"><f:textbox field="pattern"/></td> | ||
</tr> | ||
</table> | ||
</j:jelly> |