// Update a failed search from historic search table @Path("/updateFailedSearch") @POST // @Produces(MediaType.APPLICATION_JSON) public String updateFailedSearch(@Context HttpServletRequest req) throws Exception { logger.debug("Method updateFailedSearch(): Start"); try { TwitterSearch twitterSearch = new TwitterSearch(); // reading the user input String searchID = req.getParameter("searchID"); // set ready parameters twitterSearch.setSearchID(Long.parseLong(searchID)); TwitterAnalysisLauncher twitterAnalysisLauncher = new TwitterAnalysisLauncher(twitterSearch); String label = twitterAnalysisLauncher.updateFailedSearch(); logger.debug("Method updateFailedSearch(): End"); return "Historical failed search '" + label + "' updated. Partial results loaded"; } catch (Throwable th) { throw new SpagoBIRuntimeException( "Method updateFailedSearch(): An error occurred in Twitter Historical Search API for REST service updateFailedSearch ", th); } }
// Delete a new Twitter Search @Path("/deleteSearch") @POST @UserConstraint(functionalities = {SpagoBIConstants.CREATE_SOCIAL_ANALYSIS}) public String delete(@Context HttpServletRequest req) throws Exception { logger.debug("Method delete(): Start.."); try { TwitterSearch twitterSearch = new TwitterSearch(); // reading the user input String searchID = req.getParameter("searchID"); // set ready parameters twitterSearch.setSearchID(Long.parseLong(searchID)); TwitterAnalysisLauncher twitterAnalysisLauncher = new TwitterAnalysisLauncher(twitterSearch); String label = twitterAnalysisLauncher.deleteSearch(); String result = "Historical search '" + label + "' deleted"; return result; } catch (Throwable th) { throw new SpagoBIRuntimeException( "Method delete(): An error occurred in Twitter Historical Search API for REST service delete ", th); } }
// Stop the search scheduler and start monitor scheduler @Path("/stopSearchScheduler") @POST @UserConstraint(functionalities = {SpagoBIConstants.CREATE_SOCIAL_ANALYSIS}) public String stopSearchScheduler(@Context HttpServletRequest req) throws Exception { logger.debug("Method stopSearchScheduler(): Start.."); try { TwitterSearch twitterSearch = new TwitterSearch(); // reading the user input String searchID = req.getParameter("searchID"); // set ready parameters twitterSearch.setSearchID(Long.parseLong(searchID)); TwitterAnalysisLauncher twitterAnalysisLauncher = new TwitterAnalysisLauncher(twitterSearch); twitterAnalysisLauncher.stopSearchScheduler(); // JSONObject resObj = new JSONObject(); // try { // resObj.put("success", true); // resObj.put("msg", "Historical search scheduler \"" + searchID + "\" stopped"); // // } catch (JSONException e) { // logger.error("Method stopSearchScheduler(): Error trying to stop search scheduler " + // searchID + " - " + e.getMessage()); // } logger.debug("Method stopSearchScheduler(): End"); return "Historical search scheduler " + searchID + " stopped"; } catch (Throwable th) { throw new SpagoBIRuntimeException( "Method stopSearchScheduler(): An error occurred in Twitter Historical Search API for REST service stopSearchScheduler ", th); } }