mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
implemented #475 "Support for views in XML API"
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3117 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
4fe6510ac5
commit
3b1af1bbf0
2 files changed
+14
-1
No files matched your search
@@ -14,6 +14,7 @@ import hudson.Util;
|
||||
import static hudson.Util.fixEmpty;
|
||||
import hudson.XmlFile;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
import hudson.model.Descriptor.FormException;
|
||||
import hudson.model.listeners.ItemListener;
|
||||
import hudson.model.listeners.JobListener;
|
||||
@@ -419,7 +420,6 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
|
||||
*
|
||||
* @see #getAllItems(Class)
|
||||
*/
|
||||
@Exported(name="jobs")
|
||||
public List<TopLevelItem> getItems() {
|
||||
return new ArrayList<TopLevelItem>(items.values());
|
||||
}
|
||||
@@ -505,6 +505,7 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
|
||||
/**
|
||||
* Gets the read-only list of all {@link View}s.
|
||||
*/
|
||||
@Exported
|
||||
public synchronized View[] getViews() {
|
||||
if(views==null)
|
||||
views = new ArrayList<ListView>();
|
||||
|
||||
@@ -2,10 +2,12 @@ package hudson.model;
|
||||
|
||||
import hudson.Util;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import hudson.scm.ChangeLogSet.Entry;
|
||||
import hudson.util.RunList;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
@@ -31,6 +33,7 @@ public abstract class View extends AbstractModelObject {
|
||||
/**
|
||||
* Gets all the items in this collection in a read-only view.
|
||||
*/
|
||||
@Exported(name="jobs")
|
||||
public abstract Collection<TopLevelItem> getItems();
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,7 @@ public abstract class View extends AbstractModelObject {
|
||||
/**
|
||||
* Message displayed in the top page. Can be null. Includes HTML.
|
||||
*/
|
||||
@Exported
|
||||
public abstract String getDescription();
|
||||
|
||||
/**
|
||||
@@ -53,6 +57,14 @@ public abstract class View extends AbstractModelObject {
|
||||
*/
|
||||
public abstract String getUrl();
|
||||
|
||||
/**
|
||||
* Gets the absolute URL of this view.
|
||||
*/
|
||||
@Exported(visibility=2,name="url")
|
||||
public String getAbsoluteUrl() {
|
||||
return Stapler.getCurrentRequest().getRootPath()+'/'+getUrl();
|
||||
}
|
||||
|
||||
public static final class UserInfo implements Comparable<UserInfo> {
|
||||
private final User user;
|
||||
private Calendar lastChange;
|
||||
|
||||
Reference in new issue
Block a user