]> source.dussan.org Git - gitblit.git/commitdiff
Add and document REINDEX_TICKETS rpc request type
authorJames Moger <james.moger@gitblit.com>
Thu, 6 Mar 2014 18:38:12 +0000 (13:38 -0500)
committerJames Moger <james.moger@gitblit.com>
Thu, 6 Mar 2014 18:38:12 +0000 (13:38 -0500)
src/main/java/com/gitblit/Constants.java
src/main/java/com/gitblit/servlet/RpcServlet.java
src/main/java/com/gitblit/utils/RpcUtils.java
src/site/rpc.mkd

index 5b71eeb959e5eaf72e4689e6379a06f46aca0b86..e93f7b1decf047076daee9f6cd69fdfc24325010 100644 (file)
@@ -350,7 +350,7 @@ public class Constants {
        public static enum RpcRequest {\r
                // Order is important here.  anything above LIST_SETTINGS requires\r
                // administrator privileges and web.allowRpcManagement.\r
-               CLEAR_REPOSITORY_CACHE, GET_PROTOCOL, LIST_REPOSITORIES, LIST_BRANCHES, GET_USER, LIST_SETTINGS,\r
+               CLEAR_REPOSITORY_CACHE, REINDEX_TICKETS, GET_PROTOCOL, LIST_REPOSITORIES, LIST_BRANCHES, GET_USER, LIST_SETTINGS,\r
                CREATE_REPOSITORY, EDIT_REPOSITORY, DELETE_REPOSITORY,\r
                LIST_USERS, CREATE_USER, EDIT_USER, DELETE_USER,\r
                LIST_TEAMS, CREATE_TEAM, EDIT_TEAM, DELETE_TEAM,\r
index 28f0d5bf959c5c34fe7fa5a9ad2998ba1eb1d3e4..2d59ebd7eada640432d2ae598d85183fc897ca14 100644 (file)
@@ -59,7 +59,7 @@ public class RpcServlet extends JsonServlet {
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       public static final int PROTOCOL_VERSION = 6;\r
+       public static final int PROTOCOL_VERSION = 7;\r
 \r
        private IStoredSettings settings;\r
 \r
@@ -383,6 +383,19 @@ public class RpcServlet extends JsonServlet {
                        } else {\r
                                response.sendError(notAllowedCode);\r
                        }\r
+               } else if (RpcRequest.REINDEX_TICKETS.equals(reqType)) {\r
+                       if (allowManagement) {\r
+                               if (StringUtils.isEmpty(objectName)) {\r
+                                       // reindex all tickets\r
+                                       gitblit.getTicketService().reindex();\r
+                               } else {\r
+                                       // reindex tickets in a specific repository\r
+                                       RepositoryModel model = gitblit.getRepositoryModel(objectName);\r
+                                       gitblit.getTicketService().reindex(model);\r
+                               }\r
+                       } else {\r
+                               response.sendError(notAllowedCode);\r
+                       }\r
                }\r
 \r
                // send the result of the request\r
index 24e07dcd70f6a6ea098ecf07298b5725f4d47337..5e577fb68f6853eda35047ce7ab37efb48a44481 100644 (file)
@@ -251,6 +251,37 @@ public class RpcUtils {
                                password);\r
        }\r
 \r
+       /**\r
+        * Reindex all tickets on the Gitblit server.\r
+        *\r
+        * @param serverUrl\r
+        * @param account\r
+        * @param password\r
+        * @return true if the action succeeded\r
+        * @throws IOException\r
+        */\r
+       public static boolean reindexTickets(String serverUrl, String account,\r
+                       char[] password) throws IOException {\r
+               return doAction(RpcRequest.REINDEX_TICKETS, null, null, serverUrl, account,\r
+                               password);\r
+       }\r
+\r
+       /**\r
+        * Reindex tickets for the specified repository on the Gitblit server.\r
+        *\r
+        * @param serverUrl\r
+        * @param repositoryName\r
+        * @param account\r
+        * @param password\r
+        * @return true if the action succeeded\r
+        * @throws IOException\r
+        */\r
+       public static boolean reindexTickets(String serverUrl, String repositoryName,\r
+                       String account, char[] password) throws IOException {\r
+               return doAction(RpcRequest.REINDEX_TICKETS, repositoryName, null, serverUrl,\r
+                               account, password);\r
+       }\r
+\r
        /**\r
         * Create a user on the Gitblit server.\r
         *\r
index 58b2966c8f14463945630e83f163f94d544eff65..b86fd9ad55cd9be5ec37ce34cfb88512d828612c 100644 (file)
@@ -59,6 +59,7 @@ The Gitblit API includes methods for retrieving and interpreting RSS feeds.  The
 <tr><td>Gitblit v1.1.0</td><td>4</td></tr>\r
 <tr><td>Gitblit v1.2.0+</td><td>5</td></tr>\r
 <tr><td>Gitblit v1.3.1+</td><td>6</td></tr>\r
+<tr><td>Gitblit v1.4.0+</td><td>7</td></tr>\r
 </tbody>\r
 </table>\r
 \r
@@ -102,6 +103,7 @@ Use *SET_REPOSITORY_TEAM_PERMISSIONS* instead.
 <tr><td>SET_REPOSITORY_TEAM_PERMISSIONS</td><td>repository name</td><td><em>admin</em></td><td>5</td><td>List&lt;String&gt;</td><td>-</td></tr>\r
 <tr><td>LIST_SETTINGS</td><td>-</td><td><em>admin</em></td><td>1</td><td>-</td><td>ServerSettings (management keys)</td></tr>\r
 <tr><td>CLEAR_REPOSITORY_CACHE</td><td>-</td><td><em>-</em></td><td>4</td><td>-</td><td>-</td></tr>\r
+<tr><td>REINDEX_TICKETS</td><td>repository name</td><td><em>-</em></td><td>7</td><td>-</td><td>-</td></tr>\r
 <tr><td colspan='6'><em>web.enableRpcAdministration=true</em></td></tr>\r
 <tr><td>LIST_FEDERATION_REGISTRATIONS</td><td>-</td><td><em>admin</em></td><td>1</td><td>-</td><td>List&lt;FederationModel&gt;</td></tr>\r
 <tr><td>LIST_FEDERATION_RESULTS</td><td>-</td><td><em>admin</em></td><td>1</td><td>-</td><td>List&lt;FederationModel&gt;</td></tr>\r