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
Constructors Constructor Description ComputerConfigHistoryAction(Slave agent)
Standard constructor using instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
checkConfigurePermission()
See whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject()
.protected void
checkDeleteEntryPermission()
XmlSyntaxChecker.Answer
checkXmlSyntax(String timestamp)
void
doDeleteRevision(org.kohsuke.stapler.StaplerRequest req)
void
doForwardToRestoreQuestion(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Action when 'restore' button in showDiffFiles.jelly is pressed.void
doRestore(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Action when 'restore' button is pressed: Replace current config file by older version.void
doToggleShowHideVersionDiffs(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Action when 'Show / hide Version Changes' button in showDiffFiles.jelly is pressed: Reloads the page with "showVersionDiffs" parameter inversed.protected AccessControlled
getAccessControlledObject()
Returns the object for which we want to provide access control.Slave
getAgent()
Returns the agent.List<ConfigInfo>
getAgentConfigs()
Returns the configuration history entries for oneSlave
.List<ConfigInfo>
getAgentConfigsREST()
Returns the configuration history entries for oneSlave
for the REST API.Api
getApi()
String
getDisplayName()
String
getFile()
ReturnsgetOldConfigXml(String)
as String.String
getIconFileName()
int
getLeadingWhitespace(String str)
List<SideBySideView.Line>
getLines(boolean hideVersionDiffs)
String
getNextTimestamp(int timestampNumber)
Used in the Difference jelly only.String
getOperation(int timestampNumber)
Used in the Difference jelly only.String
getPrevTimestamp(int timestampNumber)
Used in the Difference jelly only.int
getRevisionAmount()
Slave
getSlave()
Deprecated.UsegetAgent()
instead.List<ConfigInfo>
getSlaveConfigs()
Deprecated.UsegetAgentConfigs()
instead.List<ConfigInfo>
getSlaveConfigsREST()
Deprecated.UsegetAgentConfigs()
instead.String
getTimestamp(int timestampNumber)
Used in the Difference jelly only.String
getUrlName()
String
getUser(int timestampNumber)
Used in the Difference jelly only.String
getUserID(int timestamp)
boolean
hasAdminPermission()
boolean
hasConfigurePermission()
Returns whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject()
.boolean
hasDeleteEntryPermission()
boolean
revisionEqualsCurrent(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 Detail
-
ComputerConfigHistoryAction
public ComputerConfigHistoryAction(Slave agent)
Standard constructor using instance.- Parameters:
agent
- agent.
-
-
Method Detail
-
getDisplayName
public final String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
- Overrides:
getDisplayName
in classJobConfigHistoryBaseAction
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
- Overrides:
getUrlName
in classJobConfigHistoryBaseAction
-
getSlave
@Deprecated public Slave 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
public Slave getAgent()
Returns the agent.- Returns:
- the agent.
-
getAccessControlledObject
protected AccessControlled getAccessControlledObject()
Description copied from class:JobConfigHistoryBaseAction
Returns the object for which we want to provide access control.- Specified by:
getAccessControlledObject
in classJobConfigHistoryBaseAction
- Returns:
- the access controlled object.
-
checkConfigurePermission
protected void checkConfigurePermission()
Description copied from class:JobConfigHistoryBaseAction
See whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject()
.- Specified by:
checkConfigurePermission
in classJobConfigHistoryBaseAction
-
checkDeleteEntryPermission
protected void checkDeleteEntryPermission()
- Specified by:
checkDeleteEntryPermission
in classJobConfigHistoryBaseAction
-
hasAdminPermission
public boolean hasAdminPermission()
- Specified by:
hasAdminPermission
in classJobConfigHistoryBaseAction
-
hasDeleteEntryPermission
public boolean hasDeleteEntryPermission()
- Specified by:
hasDeleteEntryPermission
in classJobConfigHistoryBaseAction
-
hasConfigurePermission
public boolean hasConfigurePermission()
Description copied from class:JobConfigHistoryBaseAction
Returns whether the current user may read configurations in the object returned byJobConfigHistoryBaseAction.getAccessControlledObject()
.- Specified by:
hasConfigurePermission
in classJobConfigHistoryBaseAction
- Returns:
- true if the current user may read configurations.
-
getRevisionAmount
public int getRevisionAmount()
- Specified by:
getRevisionAmount
in classJobConfigHistoryBaseAction
- Returns:
- the amount of revisions existing for the given request (not page-dependant).
-
getIconFileName
public final String getIconFileName()
-
getSlaveConfigs
@Deprecated public final List<ConfigInfo> 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
public final List<ConfigInfo> getAgentConfigs()
Returns the configuration history entries for oneSlave
.- Returns:
- history list for one
Slave
.
-
getSlaveConfigsREST
@Deprecated @Exported(name="jobConfigHistory", visibility=1) public final List<ConfigInfo> getSlaveConfigsREST() throws IOException
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
for the REST API.- Returns:
- history list for one
Slave
, or an empty list if not authorized. - Throws:
IOException
- ifJobConfigHistoryConsts.HISTORY_FILE
might not be read or the path might not be urlencoded.
-
getAgentConfigsREST
@Exported(name="jobConfigHistory", visibility=1) public final List<ConfigInfo> getAgentConfigsREST() throws IOException
Returns the configuration history entries for oneSlave
for the REST API.- Returns:
- history list for one
Slave
, or an empty list if not authorized. - Throws:
IOException
- ifJobConfigHistoryConsts.HISTORY_FILE
might not be read or the path might not be urlencoded.
-
getTimestamp
public final String getTimestamp(int timestampNumber)
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
public final String getUser(int timestampNumber)
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
public final String getUserID(int timestamp)
-
getOperation
public final String getOperation(int timestampNumber)
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
public final String getNextTimestamp(int timestampNumber)
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
public final String getPrevTimestamp(int timestampNumber)
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
public final String getFile() throws IOException
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
public final List<SideBySideView.Line> getLines(boolean hideVersionDiffs) throws IOException
- Specified by:
getLines
in classJobConfigHistoryBaseAction
- Throws:
IOException
-
checkXmlSyntax
public XmlSyntaxChecker.Answer checkXmlSyntax(String timestamp)
-
doRestore
@POST public final void doRestore(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
Action when 'restore' button is pressed: Replace current config file by older version.- Parameters:
req
- Incoming StaplerRequestrsp
- Outgoing StaplerResponse- Throws:
IOException
- If something goes wrong
-
doForwardToRestoreQuestion
public final void doForwardToRestoreQuestion(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
Action when 'restore' button in showDiffFiles.jelly is pressed. Gets required parameter and forwards to restoreQuestion.jelly.- Parameters:
req
- StaplerRequest created by pressing the buttonrsp
- Outgoing StaplerResponse- Throws:
IOException
- If XML file can't be read
-
doDeleteRevision
@POST public final void doDeleteRevision(org.kohsuke.stapler.StaplerRequest req)
-
revisionEqualsCurrent
public boolean revisionEqualsCurrent(String timestamp)
-
doToggleShowHideVersionDiffs
public final void doToggleShowHideVersionDiffs(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
Action when 'Show / hide Version Changes' button in showDiffFiles.jelly is pressed: Reloads the page with "showVersionDiffs" parameter inversed.- Parameters:
req
- StaplerRequest created by pressing the buttonrsp
- Outgoing StaplerResponse- Throws:
IOException
- If XML file can't be read
-
getApi
public Api getApi()
-
getLeadingWhitespace
public int getLeadingWhitespace(String str)
-
-