@Extension public class ManualTriggerAction extends Object implements hudson.model.RootAction
Modifier and Type | Class and Description |
---|---|
static class |
ManualTriggerAction.Approval
Represents a "vote"-type or Approval of a change in the JSON structure.
|
static class |
ManualTriggerAction.HighLow
A tuple of a high and a low number.
|
Modifier and Type | Field and Description |
---|---|
static int |
EXPECTED_NR_OF_PARTS_IN_A_GENERATED_ID
The expected number of parts separated by _ in a generated id.
|
static String |
ID_SEPARATOR
The char that separates the different id components in a search-result-row.
|
Constructor and Description |
---|
ManualTriggerAction() |
Modifier and Type | Method and Description |
---|---|
void |
doBuild(String selectedIds,
org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
Builds the selected patch-set(s).
|
void |
doGerritSearch(String queryString,
String selectedServer,
boolean allPatchSets,
org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
Does a search.
|
String |
generateTheId(net.sf.json.JSONObject change,
net.sf.json.JSONObject patch)
Generates a "unique" id for the change and/or patch.
|
ManualTriggerAction.HighLow |
getCodeReview(net.sf.json.JSONObject res)
Finds the highest and lowest code review vote for the provided patch set.
|
String |
getDisplayName() |
ArrayList<String> |
getEnabledServers()
Returns the list of servers allowed to be queried and manually triggered.
|
String |
getFrontEndUrl(String serverName)
Return the front end url of selected server, or first enabled server if
selected doesn't exists (happens when serverName is null also).
|
String |
getGerritUrl(net.sf.json.JSONObject change,
String serverName)
Generates the URL to the provided change in Gerrit
If the change already has a URL provided, that URL will be used.
|
String |
getIconFileName() |
String |
getJsUrl(String jsName)
Gets the full path to the provided javascript file.
|
List<hudson.model.ParameterValue> |
getParametersForPatchSet(net.sf.json.JSONObject jsonChange,
net.sf.json.JSONObject jsonPatchSet,
String serverName)
Creates a list of the parameters as they would be in a scheduled build.
|
hudson.security.Permission |
getRequiredPermission()
Serves the permission required to perform this action.
|
String |
getUrlName() |
ManualTriggerAction.HighLow |
getVerified(net.sf.json.JSONObject res)
Finds the lowest and highest verified vote for the provided patch set.
|
boolean |
hasEnabledServers()
If this page/link is enabled or not, depending on whether at least one server is enabled.
|
boolean |
hasUrl(hudson.model.ParameterValue parameterValue)
Tells if the given parameter should have a URL or not.
|
String |
toReadableHtml(String subject)
Cuts the string to a max length of
MAX_SUBJECT_STR_LENGTH and escapes unsafe HTML characters. |
public static final int EXPECTED_NR_OF_PARTS_IN_A_GENERATED_ID
public static final String ID_SEPARATOR
public String getIconFileName()
getIconFileName
in interface hudson.model.Action
public String getDisplayName()
getDisplayName
in interface hudson.model.Action
getDisplayName
in interface hudson.model.ModelObject
public String getUrlName()
getUrlName
in interface hudson.model.Action
public boolean hasEnabledServers()
IGerritHudsonTriggerConfig.isEnableManualTrigger()
public String getFrontEndUrl(String serverName)
serverName
- the name of the GerritServer or null.public ArrayList<String> getEnabledServers()
public hudson.security.Permission getRequiredPermission()
public String getJsUrl(String jsName)
jsName
- the javascript filename.public ManualTriggerAction.HighLow getCodeReview(net.sf.json.JSONObject res)
res
- the patch set.public ManualTriggerAction.HighLow getVerified(net.sf.json.JSONObject res)
res
- the patch-set.public String toReadableHtml(String subject)
MAX_SUBJECT_STR_LENGTH
and escapes unsafe HTML characters.subject
- the string to fix if needed.Util.escape(String)
public void doGerritSearch(@QueryParameter(value="queryString") String queryString, @QueryParameter(value="selectedServer") String selectedServer, @QueryParameter(value="allPatchSets") boolean allPatchSets, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws IOException
queryString
- the query to send to Gerrit.request
- the request.selectedServer
- the selected Gerrit server.allPatchSets
- if the result includes all patchsets in a change.response
- the response.IOException
- if the query fails.public void doBuild(@QueryParameter(value="selectedIds") String selectedIds, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws IOException
selectedIds
- the selected rows in the form's search-result separated by "[]".request
- the request.response
- the response.IOException
- if the query fails.public String generateTheId(net.sf.json.JSONObject change, net.sf.json.JSONObject patch)
change
- the change.patch
- the patch-set in the change.public List<hudson.model.ParameterValue> getParametersForPatchSet(net.sf.json.JSONObject jsonChange, net.sf.json.JSONObject jsonPatchSet, String serverName)
jsonChange
- the JSON data for the change.jsonPatchSet
- the JSON data for the patch-set.serverName
- the name of the GerritServer from the current session.public boolean hasUrl(hudson.model.ParameterValue parameterValue)
GerritTriggerParameters.GERRIT_CHANGE_URL
.parameterValue
- the parameter.public String getGerritUrl(net.sf.json.JSONObject change, String serverName)
change
- the change to link to.serverName
- the name of the selected Gerrit server.Copyright © 2004-2015. All Rights Reserved.