Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JENKINS-31162] First commit after merge with Gus's work
- Loading branch information
Showing
54 changed files
with
2,280 additions
and
143 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
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
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
37 changes: 37 additions & 0 deletions
37
core/src/main/java/jenkins/model/ItemCategory/Categories.java
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package jenkins.model.ItemCategory; | ||
|
||
import org.kohsuke.stapler.HttpResponse; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
import org.kohsuke.stapler.export.Exported; | ||
import org.kohsuke.stapler.export.ExportedBean; | ||
import org.kohsuke.stapler.export.Flavor; | ||
|
||
import javax.servlet.ServletException; | ||
import java.io.IOException; | ||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* It is a logic representation of a set of {$Category}. | ||
*/ | ||
@ExportedBean | ||
public class Categories implements HttpResponse, Serializable { | ||
|
||
private List<Category> items; | ||
|
||
public Categories() { | ||
items = new ArrayList<Category>(); | ||
} | ||
|
||
@Exported(name = "categories") | ||
public List<Category> getItems() { | ||
return items; | ||
} | ||
|
||
@Override | ||
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { | ||
rsp.serveExposedBean(req, this, Flavor.JSON); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
core/src/main/java/jenkins/model/ItemCategory/Category.java
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package jenkins.model.ItemCategory; | ||
|
||
import hudson.model.TopLevelItem; | ||
import org.kohsuke.stapler.export.Exported; | ||
import org.kohsuke.stapler.export.ExportedBean; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents an {$link ItemCategory} and its {@link TopLevelItem}s. | ||
*/ | ||
@ExportedBean | ||
public class Category implements Serializable { | ||
|
||
private String id; | ||
|
||
private String name; | ||
|
||
private String description; | ||
|
||
private String iconClassName; | ||
|
||
private int weight; | ||
|
||
private List<Map<String, Object>> items; | ||
|
||
public Category(String id, String name, String description, String iconClassName, int weight, List<Map<String, Object>> items) { | ||
this.id= id; | ||
this.name = name; | ||
this.description = description; | ||
this.iconClassName = iconClassName; | ||
this.weight = weight; | ||
this.items = items; | ||
} | ||
|
||
@Exported | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
@Exported | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Exported | ||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
@Exported | ||
public String getIconClassName() { | ||
return iconClassName; | ||
} | ||
|
||
@Exported | ||
public int getWeight() { | ||
return weight; | ||
} | ||
|
||
@Exported | ||
public List<Map<String, Object>> getItems() { | ||
return items; | ||
} | ||
|
||
} |
74 changes: 74 additions & 0 deletions
74
core/src/main/java/jenkins/model/ItemCategory/ItemCategory.java
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package jenkins.model.ItemCategory; | ||
|
||
import hudson.Extension; | ||
import hudson.ExtensionPoint; | ||
import hudson.model.ModelObject; | ||
import jenkins.model.Messages; | ||
|
||
/** | ||
* A category for {@link hudson.model.Item}s. | ||
*/ | ||
public abstract class ItemCategory implements ModelObject, ExtensionPoint { | ||
|
||
/** | ||
* Identifier, e.g. "category-id-default", etc. | ||
* | ||
* @return the identifier | ||
*/ | ||
public abstract String getId(); | ||
|
||
/** | ||
* The icon class specification e.g. 'category-icon-folder', 'category-icon-default', etc. | ||
* | ||
* @return the icon class specification | ||
*/ | ||
public abstract String getIconClassName(); | ||
|
||
/** | ||
* The description in plain text | ||
* | ||
* @return the description | ||
*/ | ||
public abstract String getDescription(); | ||
|
||
/** | ||
* Helpful to set the order. | ||
* | ||
* @return the weight | ||
*/ | ||
public abstract int getWeight(); | ||
|
||
/** | ||
* The default category, if an item doesn't belong anywhere else, this is where it goes by default. | ||
*/ | ||
@Extension | ||
public static final class Default extends ItemCategory { | ||
|
||
@Override | ||
public String getId() { | ||
return "category-id-default"; | ||
} | ||
|
||
@Override | ||
public String getIconClassName() { | ||
return "category-icon-default"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return Messages.ItemCategory_BasicProjects_Description(); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return Messages.ItemCategory_BasicProjects_DisplayName(); | ||
} | ||
|
||
@Override | ||
public int getWeight() { | ||
return Integer.MIN_VALUE; | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.