diff options
author | James Moger <james.moger@gitblit.com> | 2014-03-06 13:38:12 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-03-06 13:38:12 -0500 |
commit | 88693e491b0d929b6b3f5783d11126fce87b1370 (patch) | |
tree | 6cf89f7fa51cd838883599d5b474064098ab1841 /src/main | |
parent | 9883341c1fbb35abcb7a1d09f93f6a9e805ea551 (diff) | |
download | gitblit-88693e491b0d929b6b3f5783d11126fce87b1370.tar.gz gitblit-88693e491b0d929b6b3f5783d11126fce87b1370.zip |
Add and document REINDEX_TICKETS rpc request type
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/gitblit/Constants.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/RpcServlet.java | 15 | ||||
-rw-r--r-- | src/main/java/com/gitblit/utils/RpcUtils.java | 31 |
3 files changed, 46 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/Constants.java b/src/main/java/com/gitblit/Constants.java index 5b71eeb9..e93f7b1d 100644 --- a/src/main/java/com/gitblit/Constants.java +++ b/src/main/java/com/gitblit/Constants.java @@ -350,7 +350,7 @@ public class Constants { public static enum RpcRequest {
// Order is important here. anything above LIST_SETTINGS requires
// administrator privileges and web.allowRpcManagement.
- CLEAR_REPOSITORY_CACHE, GET_PROTOCOL, LIST_REPOSITORIES, LIST_BRANCHES, GET_USER, LIST_SETTINGS,
+ CLEAR_REPOSITORY_CACHE, REINDEX_TICKETS, GET_PROTOCOL, LIST_REPOSITORIES, LIST_BRANCHES, GET_USER, LIST_SETTINGS,
CREATE_REPOSITORY, EDIT_REPOSITORY, DELETE_REPOSITORY,
LIST_USERS, CREATE_USER, EDIT_USER, DELETE_USER,
LIST_TEAMS, CREATE_TEAM, EDIT_TEAM, DELETE_TEAM,
diff --git a/src/main/java/com/gitblit/servlet/RpcServlet.java b/src/main/java/com/gitblit/servlet/RpcServlet.java index 28f0d5bf..2d59ebd7 100644 --- a/src/main/java/com/gitblit/servlet/RpcServlet.java +++ b/src/main/java/com/gitblit/servlet/RpcServlet.java @@ -59,7 +59,7 @@ public class RpcServlet extends JsonServlet { private static final long serialVersionUID = 1L;
- public static final int PROTOCOL_VERSION = 6;
+ public static final int PROTOCOL_VERSION = 7;
private IStoredSettings settings;
@@ -383,6 +383,19 @@ public class RpcServlet extends JsonServlet { } else {
response.sendError(notAllowedCode);
}
+ } else if (RpcRequest.REINDEX_TICKETS.equals(reqType)) {
+ if (allowManagement) {
+ if (StringUtils.isEmpty(objectName)) {
+ // reindex all tickets
+ gitblit.getTicketService().reindex();
+ } else {
+ // reindex tickets in a specific repository
+ RepositoryModel model = gitblit.getRepositoryModel(objectName);
+ gitblit.getTicketService().reindex(model);
+ }
+ } else {
+ response.sendError(notAllowedCode);
+ }
}
// send the result of the request
diff --git a/src/main/java/com/gitblit/utils/RpcUtils.java b/src/main/java/com/gitblit/utils/RpcUtils.java index 24e07dcd..5e577fb6 100644 --- a/src/main/java/com/gitblit/utils/RpcUtils.java +++ b/src/main/java/com/gitblit/utils/RpcUtils.java @@ -252,6 +252,37 @@ public class RpcUtils { }
/**
+ * Reindex all tickets on the Gitblit server.
+ *
+ * @param serverUrl
+ * @param account
+ * @param password
+ * @return true if the action succeeded
+ * @throws IOException
+ */
+ public static boolean reindexTickets(String serverUrl, String account,
+ char[] password) throws IOException {
+ return doAction(RpcRequest.REINDEX_TICKETS, null, null, serverUrl, account,
+ password);
+ }
+
+ /**
+ * Reindex tickets for the specified repository on the Gitblit server.
+ *
+ * @param serverUrl
+ * @param repositoryName
+ * @param account
+ * @param password
+ * @return true if the action succeeded
+ * @throws IOException
+ */
+ public static boolean reindexTickets(String serverUrl, String repositoryName,
+ String account, char[] password) throws IOException {
+ return doAction(RpcRequest.REINDEX_TICKETS, repositoryName, null, serverUrl,
+ account, password);
+ }
+
+ /**
* Create a user on the Gitblit server.
*
* @param user
|