Package hudson.plugins.jobConfigHistory
Class ComputerConfigHistoryAction
java.lang.Object
hudson.plugins.jobConfigHistory.JobConfigHistoryBaseAction
hudson.plugins.jobConfigHistory.ComputerConfigHistoryAction
- All Implemented Interfaces:
Action,ModelObject
@ExportedBean(defaultVisibility=-1)
public class ComputerConfigHistoryAction
extends JobConfigHistoryBaseAction
- Author:
- Lucie Votypkova
-
Constructor Summary
ConstructorsConstructorDescriptionComputerConfigHistoryAction(Slave agent) Standard constructor using instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSee whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject().protected voidcheckXmlSyntax(String timestamp) final voiddoDeleteRevision(org.kohsuke.stapler.StaplerRequest2 req) final voiddoRestore(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Action when 'restore' button is pressed: Replace current config file by older version.final voiddoToggleShowHideVersionDiffs(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Action when 'Show / hide Version Changes' button in showDiffFiles.jelly is pressed: Reloads the page with "showVersionDiffs" parameter inversed.protected AccessControlledReturns the object for which we want to provide access control.getAgent()Returns the agent.final List<ConfigInfo>Returns the configuration history entries for oneSlave.final List<ConfigInfo>getAgentConfigs(int from, int to) Calculates a list containing the .subList(from, to) of the newest-first list of job config revision entries.final List<ConfigInfo>Returns the configuration history entries for oneSlavefor the REST API.getApi()final StringgetChangeReasonComment(int timestamp) final Stringfinal StringgetFile()ReturnsgetOldConfigXml(String)as String.final Stringintfinal List<SideBySideView.Line>getLines(boolean hideVersionDiffs) final StringgetNextTimestamp(int timestampNumber) Used in the Difference jelly only.final StringgetOperation(int timestampNumber) Used in the Difference jelly only.final StringgetPrevTimestamp(int timestampNumber) Used in the Difference jelly only.intgetSlave()Deprecated.final List<ConfigInfo>Deprecated.UsegetAgentConfigs()instead.final List<ConfigInfo>Deprecated.UsegetAgentConfigs()instead.final StringgetTimestamp(int timestampNumber) Used in the Difference jelly only.final StringgetUser(int timestampNumber) Used in the Difference jelly only.final StringgetUserID(int timestamp) booleanfinal booleanhasChangeReasonComment(int timestamp) booleanReturns whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject().booleanbooleanbooleanrevisionEqualsCurrent(String timestamp) Methods inherited from class hudson.plugins.jobConfigHistory.JobConfigHistoryBaseAction
checkTimestamp, doDiffFiles, doDiffFilesPrevNext, getCurrentRequest, getDiffAsString, getDiffAsString, getDiffLines, getHistoryDao, getLines, getLines, getMaxEntriesPerPage, getMaxPageNum, getOutputType, getPlugin, getRelevantPageNums, getRelevantPageNums, getRequestParameter, getShowVersionDiffs
-
Constructor Details
-
ComputerConfigHistoryAction
Standard constructor using instance.- Parameters:
agent- agent.
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject- Overrides:
getDisplayNamein classJobConfigHistoryBaseAction
-
getUrlName
- Specified by:
getUrlNamein interfaceAction- Overrides:
getUrlNamein classJobConfigHistoryBaseAction
-
getSlave
Deprecated.UsegetAgent()instead. This method is subject to removal in future releases, to comply with Jenkins' terminology updates.Returns the agent.- Returns:
- the agent.
-
getAgent
Returns the agent.- Returns:
- the agent.
-
getAccessControlledObject
Description copied from class:JobConfigHistoryBaseActionReturns the object for which we want to provide access control.- Specified by:
getAccessControlledObjectin classJobConfigHistoryBaseAction- Returns:
- the access controlled object.
-
checkConfigurePermission
protected void checkConfigurePermission()Description copied from class:JobConfigHistoryBaseActionSee whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject().- Specified by:
checkConfigurePermissionin classJobConfigHistoryBaseAction
-
checkDeleteEntryPermission
protected void checkDeleteEntryPermission()- Specified by:
checkDeleteEntryPermissionin classJobConfigHistoryBaseAction
-
hasAdminPermission
public boolean hasAdminPermission()- Specified by:
hasAdminPermissionin classJobConfigHistoryBaseAction
-
hasDeleteEntryPermission
public boolean hasDeleteEntryPermission()- Specified by:
hasDeleteEntryPermissionin classJobConfigHistoryBaseAction
-
hasConfigurePermission
public boolean hasConfigurePermission()Description copied from class:JobConfigHistoryBaseActionReturns whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject().- Specified by:
hasConfigurePermissionin classJobConfigHistoryBaseAction- Returns:
- true if the current user may read configurations.
-
getRevisionAmount
public int getRevisionAmount()- Specified by:
getRevisionAmountin classJobConfigHistoryBaseAction- Returns:
- the amount of revisions existing for the given request (not page-dependant).
-
getIconFileName
-
getSlaveConfigs
Deprecated.UsegetAgentConfigs()instead. This method is subject to removal in future releases, to comply with Jenkins' terminology updates.Returns the configuration history entries for oneSlave.- Returns:
- history list for one
Slave.
-
getAgentConfigs
Returns the configuration history entries for oneSlave.- Returns:
- history list for one
Slave.
-
hasReadExtensionPermission
public boolean hasReadExtensionPermission() -
getAgentConfigs
Calculates a list containing the .subList(from, to) of the newest-first list of job config revision entries. Does not read the history.xmls unless it is inevitable.- Parameters:
from- the first revision to displayto- the first revision not to display anymore- Returns:
- a list equivalent to getJobConfigs().subList(from, to), but more efficiently calculated.
-
getSlaveConfigsREST
@Deprecated @Exported(name="jobConfigHistory", visibility=1) public final List<ConfigInfo> getSlaveConfigsREST() throws IOExceptionDeprecated.UsegetAgentConfigs()instead. This method is subject to removal in future releases, to comply with Jenkins' terminology updates.Returns the configuration history entries for oneSlavefor the REST API.- Returns:
- history list for one
Slave, or an empty list if not authorized. - Throws:
IOException- ifJobConfigHistoryConsts.HISTORY_FILEmight not be read or the path might not be urlencoded.
-
getAgentConfigsREST
@Exported(name="jobConfigHistory", visibility=1) public final List<ConfigInfo> getAgentConfigsREST() throws IOExceptionReturns the configuration history entries for oneSlavefor the REST API.- Returns:
- history list for one
Slave, or an empty list if not authorized. - Throws:
IOException- ifJobConfigHistoryConsts.HISTORY_FILEmight not be read or the path might not be urlencoded.
-
getTimestamp
Used in the Difference jelly only. Returns one of the two timestamps that have been passed to the Difference page as parameter. timestampNumber must be 1 or 2.- Parameters:
timestampNumber- 1 for timestamp1 and 2 for timestamp2- Returns:
- the timestamp as String.
-
getUser
Used in the Difference jelly only. Returns the user that made the change in one of the Files shown in the Difference view(A or B). timestampNumber decides between File A and File B.- Parameters:
timestampNumber- 1 for File A and 2 for File B- Returns:
- the user as String.
-
getUserID
-
getChangeReasonComment
-
hasChangeReasonComment
public final boolean hasChangeReasonComment(int timestamp) -
getOperation
Used in the Difference jelly only. Returns the operation made on one of the two Files A and B. timestampNumber decides which file exactly.- Parameters:
timestampNumber- 1 for File A, 2 for File B- Returns:
- the operation as String.
-
getNextTimestamp
Used in the Difference jelly only. Returns the next timestamp of the next entry of the two Files A and B. timestampNumber decides which file exactly.- Parameters:
timestampNumber- 1 for File A, 2 for File B- Returns:
- the timestamp of the next entry as String.
-
getPrevTimestamp
Used in the Difference jelly only. Returns the previous timestamp of the next entry of the two Files A and B. timestampNumber decides which file exactly.- Parameters:
timestampNumber- 1 for File A, 2 for File B- Returns:
- the timestamp of the previous entry as String.
-
getFile
ReturnsgetOldConfigXml(String)as String.- Returns:
- content of the config.xml found in directory given by the request parameter file.
- Throws:
IOException- if the config file could not be read or converted to an xml string.
-
getLines
- Specified by:
getLinesin classJobConfigHistoryBaseAction- Throws:
IOException
-
checkXmlSyntax
-
doRestore
@POST public final void doRestore(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Action when 'restore' button is pressed: Replace current config file by older version.- Parameters:
req- Incoming StaplerRequest2rsp- Outgoing StaplerResponse2- Throws:
IOException- If something goes wrong
-
doDeleteRevision
@POST public final void doDeleteRevision(org.kohsuke.stapler.StaplerRequest2 req) -
revisionEqualsCurrent
-
doToggleShowHideVersionDiffs
public final void doToggleShowHideVersionDiffs(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Action when 'Show / hide Version Changes' button in showDiffFiles.jelly is pressed: Reloads the page with "showVersionDiffs" parameter inversed.- Parameters:
req- StaplerRequest2 created by pressing the buttonrsp- Outgoing StaplerResponse2- Throws:
IOException- If XML file can't be read
-
getApi
-
getLeadingWhitespace
-
getAgent()instead.