mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
[FIXED HUDSON-3054] refactor method returning html into jelly files
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15572 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
6ea426678b
commit
28b3861603
9 files changed
+147
-28
No files matched your search
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
package hudson.model;
|
||||
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
|
||||
@@ -39,11 +38,6 @@ public abstract class Cause {
|
||||
@Exported(visibility=3)
|
||||
abstract public String getShortDescription();
|
||||
|
||||
public String getHTMLDescription() {
|
||||
// Default to same as ShortDescription; subclasses can override
|
||||
return getShortDescription();
|
||||
}
|
||||
|
||||
public static class LegacyCodeCause extends Cause {
|
||||
private StackTraceElement [] stackTrace;
|
||||
public LegacyCodeCause() {
|
||||
@@ -68,17 +62,23 @@ public abstract class Cause {
|
||||
CauseAction ca = up.getAction(CauseAction.class);
|
||||
upstreamCause = ca == null ? null : ca.getCause();
|
||||
}
|
||||
|
||||
public String getUpstreamProject() {
|
||||
return upstreamProject;
|
||||
}
|
||||
|
||||
public int getUpstreamBuild() {
|
||||
return upstreamBuild;
|
||||
}
|
||||
|
||||
public String getUpstreamUrl() {
|
||||
return upstreamUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return Messages.Cause_UpstreamCause_ShortDescription(upstreamProject, upstreamBuild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHTMLDescription() {
|
||||
// upstreamUrl added in 1.284, so handle missing value
|
||||
return upstreamUrl==null ? getShortDescription() : Messages.Cause_UpstreamCause_HTMLDescription(upstreamProject, upstreamBuild, upstreamUrl, Stapler.getCurrentRequest().getContextPath());
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserCause extends Cause {
|
||||
@@ -87,15 +87,14 @@ public abstract class Cause {
|
||||
this.authenticationName = Hudson.getAuthentication().getName();
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return authenticationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return Messages.Cause_UserCause_ShortDescription(authenticationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHTMLDescription() {
|
||||
return Messages.Cause_UserCause_HTMLDescription(authenticationName, Stapler.getCurrentRequest().getContextPath());
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoteCause extends Cause {
|
||||
@@ -109,6 +108,5 @@ public abstract class Cause {
|
||||
public String getShortDescription() {
|
||||
return Messages.Cause_RemoteCause_ShortDescription(addr);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,6 @@ public class CauseAction implements Action {
|
||||
return cause.getShortDescription();
|
||||
}
|
||||
|
||||
public String getHTMLDescription() {
|
||||
return cause.getHTMLDescription();
|
||||
}
|
||||
|
||||
public CauseAction(Cause c) {
|
||||
this.cause = c;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user