1 package net.avcompris.commons3.jenkins;
2
3 import static com.google.common.base.Preconditions.checkNotNull;
4
5 import javax.annotation.Nullable;
6
7 import net.avcompris.binding.annotation.XPath;
8
9 public interface JobDtoContainer {
10
11 @XPath("job")
12 Job[] getJobs();
13
14 enum JobClass {
15
16 MavenModuleSet("hudson.maven.MavenModuleSet"),
17 Folder("com.cloudbees.hudson.plugins.folder.Folder"),
18 FreeStyleProject("hudson.model.FreeStyleProject");
19
20 private JobClass(final String className) {
21
22 this.className = checkNotNull(className, "className");
23 }
24
25 private final String className;
26
27 @Override
28 public String toString() {
29
30 return className;
31 }
32 }
33
34 enum Color {
35
36 BLUE("blue"), BLUE_ANIME("blue_anime");
37
38 private Color(final String label) {
39
40 this.label = checkNotNull(label, "label");
41 }
42
43 private final String label;
44
45 @Override
46 public String toString() {
47
48 return label;
49 }
50 }
51
52 interface Job {
53
54 @XPath("@_class")
55 JobClass getJobClass();
56
57 @XPath("name")
58 String getName();
59
60 @XPath(value = "url", function = "normalize-space()")
61 String getURL();
62
63 @Nullable
64 @XPath("color")
65 Color getColor();
66 }
67 }