提交 f5514b6b 编写于 作者: K kohsuke

description support is moved up to AbstractItem from Job.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1851 71c3de6d-444a-0410-be80-ed276b4c234a
上级 6c7ef1fb
......@@ -10,6 +10,8 @@ import java.util.Collection;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
/**
* Partial default implementation of {@link Item}.
*
......@@ -23,6 +25,11 @@ public abstract class AbstractItem extends Actionable implements Item {
*/
protected /*final*/ transient String name;
/**
* Project description. Can be HTML.
*/
protected String description;
/**
* Root directory for this view item on the file system.
*/
......@@ -44,6 +51,20 @@ public abstract class AbstractItem extends Actionable implements Item {
return root;
}
/**
* Gets the project description HTML.
*/
public String getDescription() {
return description;
}
/**
* Sets the project description HTML.
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Just update {@link #name} and {@link #root}, since they are linked.
*/
......@@ -96,6 +117,19 @@ public abstract class AbstractItem extends Actionable implements Item {
return Items.getConfigFile(this);
}
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
if(!Hudson.adminCheck(req,rsp))
return;
req.setCharacterEncoding("UTF-8");
setDescription(req.getParameter("description"));
save();
rsp.sendRedirect("."); // go to the top page
}
/**
* Deletes this item.
*/
......
......@@ -52,11 +52,6 @@ import java.util.SortedMap;
public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,RunT>>
extends AbstractItem implements ExtensionPoint {
/**
* Project description. Can be HTML.
*/
protected String description;
/**
* Next build number.
* Kept in a separate file because this is the only information
......@@ -147,20 +142,6 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
return nextBuildNumber;
}
/**
* Gets the project description HTML.
*/
public String getDescription() {
return description;
}
/**
* Sets the project description HTML.
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Returns the log rotator for this job, or null if none.
*/
......@@ -478,19 +459,6 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
}
}
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
if(!Hudson.adminCheck(req,rsp))
return;
req.setCharacterEncoding("UTF-8");
description = req.getParameter("description");
save();
rsp.sendRedirect("."); // go to the top page
}
/**
* Returns the image that shows the current buildCommand status.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册