Class TaskAction
- All Implemented Interfaces:
Action
,ModelObject
,SearchableModelObject
,SearchItem
- Direct Known Subclasses:
AbstractScmTagAction
Action
implementation for those who kick some
processing asynchronously (such as SCM tagging.)
The class offers the basic set of functionality to do it.
- Since:
- 1.191
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected WeakReference<AnnotatedLargeText>
Hold the log of the tagging operation.protected TaskThread
If non-null, that means either the activity is in progress asynchronously, or it failed unexpectedly and the thread is dead. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doClearError
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Clears the error status.void
doProgressiveHtml
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Handles incremental log output.void
doProgressiveLog
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Handles incremental log output.protected abstract ACL
getACL()
Gets theACL
against whichgetPermission()
is checked.abstract String
Gets the name of the icon.org.kohsuke.stapler.framework.io.LargeText
getLog()
Deprecated.protected abstract Permission
Gets the permission object that represents the permission (againstgetACL()
) to perform this task.Returns the URL of this item relative to the parentSearchItem
.Obtains the log file.Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.model.Action
getDisplayName, getUrlName
Methods inherited from interface hudson.search.SearchItem
getSearchIcon
-
Field Details
-
workerThread
If non-null, that means either the activity is in progress asynchronously, or it failed unexpectedly and the thread is dead. -
log
Hold the log of the tagging operation.
-
-
Constructor Details
-
TaskAction
public TaskAction()
-
-
Method Details
-
getPermission
Gets the permission object that represents the permission (againstgetACL()
) to perform this task. Generally your implementation ofgetIconFileName()
should return null if!getACL().hasPermission2(getPermission())
. -
getACL
Gets theACL
against whichgetPermission()
is checked. -
getIconFileName
Description copied from interface:Action
Gets the name of the icon.- Specified by:
getIconFileName
in interfaceAction
- Returns:
- If the icon name is prefixed with "symbol-", a Jenkins Symbol
will be used.
If just a file name (like "abc.gif") is returned, it will be interpreted as a file name inside
/images/24x24
. This is useful for using one of the stock images.If an absolute file name that starts from '/' is returned (like "/plugin/foo/abc.gif"), then it will be interpreted as a path from the context root of Jenkins. This is useful to pick up image files from a plugin.
Finally, return null to hide it from the task list. This is normally not very useful, but this can be used for actions that only contribute
floatBox.jelly
and no task list item. The other case where this is useful is to avoid showing links that require a privilege when the user is anonymous. - See Also:
-
getLog
Deprecated.as of 1.350 UseobtainLog()
, which returns the same object in a more type-safe signature. -
obtainLog
Obtains the log file.The default implementation get this from
workerThread
, so when it's complete, the log could be gone any time.Derived classes that persist the text should override this method so that it fetches the file from disk.
-
getSearchUrl
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Specified by:
getSearchUrl
in interfaceSearchItem
- Returns:
- URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
-
getWorkerThread
-
doProgressiveLog
public void doProgressiveLog(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Handles incremental log output.- Throws:
IOException
-
doProgressiveHtml
public void doProgressiveHtml(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Handles incremental log output.- Throws:
IOException
-
doClearError
public void doClearError(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Clears the error status.- Throws:
IOException
jakarta.servlet.ServletException
-
obtainLog()
, which returns the same object in a more type-safe signature.