Skip to content

Commit

Permalink
[FIXED JENKINS-22796] Added REST API support for root and job actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfs-pure committed Apr 29, 2014
1 parent 7eff75b commit a18dfd1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Expand Up @@ -3,6 +3,7 @@
import hudson.XmlFile;
import hudson.maven.MavenModule;
import hudson.model.AbstractItem;
import hudson.model.Api;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.plugins.jobConfigHistory.SideBySideView.Line;
Expand All @@ -24,10 +25,13 @@

import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Exported;

/**
* @author Stefan Brausch
*/
@ExportedBean
public class JobConfigHistoryProjectAction extends JobConfigHistoryBaseAction {

/** The project. */
Expand Down Expand Up @@ -78,6 +82,7 @@ public final String getIconFileName() {
* @throws IOException
* if {@link JobConfigHistoryConsts#HISTORY_FILE} might not be read or the path might not be urlencoded.
*/
@Exported
public final List<ConfigInfo> getJobConfigs() throws IOException {
checkConfigurePermission();
final ArrayList<ConfigInfo> configs = new ArrayList<ConfigInfo>();
Expand Down Expand Up @@ -330,4 +335,7 @@ HistoryDao getHistoryDao() {
return PluginUtils.getHistoryDao();
}

public Api getApi() {
return new Api(this);
}
}
Expand Up @@ -2,6 +2,7 @@

import hudson.Extension;
import hudson.XmlFile;
import hudson.model.Api;
import hudson.model.Item;
import hudson.model.RootAction;
import hudson.model.TopLevelItem;
Expand All @@ -24,12 +25,15 @@
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Exported;

/**
*
* @author Stefan Brausch, mfriedenhagen
*/

@ExportedBean
@Extension
public class JobConfigHistoryRootAction extends JobConfigHistoryBaseAction
implements RootAction {
Expand Down Expand Up @@ -79,6 +83,7 @@ public final String getIconFileName() {
* @throws IOException
* if one of the history entries might not be read.
*/
@Exported
public final List<ConfigInfo> getConfigs() throws IOException {
final String filter = getRequestParameter("filter");
List<ConfigInfo> configs = null;
Expand Down Expand Up @@ -447,4 +452,8 @@ HistoryDao getHistoryDao() {
OverviewHistoryDao getOverviewHistoryDao() {
return PluginUtils.getHistoryDao();
}

public Api getApi() {
return new Api(this);
}
}

0 comments on commit a18dfd1

Please sign in to comment.