@Test(expected = NullPointerException.class) public void testNullPointerExceptionOnInvalidCollectionCodeInGenerateTweetsIDSJSONFromAllJSONFiltered() throws UnknownHostException { Boolean downloadLimited = true; String jsonType = "TEXT_JSON"; String queryString = "{ \"constraints\": [] }"; persister4TaggerAPI.generateTweetsIDSJSONFromAllJSONFiltered(queryString, sampleCollectionCode , downloadLimited, jsonType, userName); }
@POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") public Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, @QueryParam("collectionCode") String collectionCode, @DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType, @QueryParam("userName") String userName) throws UnknownHostException { logger.debug("In tagger-persister genTweetIds"); logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); DeserializeFilters des = new DeserializeFilters(); JsonQueryList queryList = des.deserializeConstraints(queryString); if (queryList != null) { logger.info(collectionCode + ": received constraints = " + queryList.toString()); } else { logger.info(collectionCode + ": received constraints = " + queryList); } JsonDeserializer jsonD = new JsonDeserializer(); Map<String, Object> result = jsonD.generateClassifiedJson2TweetIdsJSONFiltered(collectionCode, downloadLimited, queryList, DownloadJsonType.getDownloadJsonTypeFromString(jsonType), userName); logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + result.get("fileName")); JSONObject obj = new JSONObject(); if ((Integer) result.get("count") < Integer.parseInt(PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT))) { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } else { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } }
Persister4TaggerAPI { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") public Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, @QueryParam("collectionCode") String collectionCode, @DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType, @QueryParam("userName") String userName) throws UnknownHostException { logger.debug("In tagger-persister genTweetIds"); logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); DeserializeFilters des = new DeserializeFilters(); JsonQueryList queryList = des.deserializeConstraints(queryString); if (queryList != null) { logger.info(collectionCode + ": received constraints = " + queryList.toString()); } else { logger.info(collectionCode + ": received constraints = " + queryList); } JsonDeserializer jsonD = new JsonDeserializer(); Map<String, Object> result = jsonD.generateClassifiedJson2TweetIdsJSONFiltered(collectionCode, downloadLimited, queryList, DownloadJsonType.getDownloadJsonTypeFromString(jsonType), userName); logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + result.get("fileName")); JSONObject obj = new JSONObject(); if ((Integer) result.get("count") < Integer.parseInt(PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT))) { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } else { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } } }
Persister4TaggerAPI { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") public Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, @QueryParam("collectionCode") String collectionCode, @DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType, @QueryParam("userName") String userName) throws UnknownHostException { logger.debug("In tagger-persister genTweetIds"); logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); DeserializeFilters des = new DeserializeFilters(); JsonQueryList queryList = des.deserializeConstraints(queryString); if (queryList != null) { logger.info(collectionCode + ": received constraints = " + queryList.toString()); } else { logger.info(collectionCode + ": received constraints = " + queryList); } JsonDeserializer jsonD = new JsonDeserializer(); Map<String, Object> result = jsonD.generateClassifiedJson2TweetIdsJSONFiltered(collectionCode, downloadLimited, queryList, DownloadJsonType.getDownloadJsonTypeFromString(jsonType), userName); logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + result.get("fileName")); JSONObject obj = new JSONObject(); if ((Integer) result.get("count") < Integer.parseInt(PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT))) { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } else { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } } Persister4TaggerAPI(); }
Persister4TaggerAPI { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") public Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, @QueryParam("collectionCode") String collectionCode, @DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType, @QueryParam("userName") String userName) throws UnknownHostException { logger.debug("In tagger-persister genTweetIds"); logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); DeserializeFilters des = new DeserializeFilters(); JsonQueryList queryList = des.deserializeConstraints(queryString); if (queryList != null) { logger.info(collectionCode + ": received constraints = " + queryList.toString()); } else { logger.info(collectionCode + ": received constraints = " + queryList); } JsonDeserializer jsonD = new JsonDeserializer(); Map<String, Object> result = jsonD.generateClassifiedJson2TweetIdsJSONFiltered(collectionCode, downloadLimited, queryList, DownloadJsonType.getDownloadJsonTypeFromString(jsonType), userName); logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + result.get("fileName")); JSONObject obj = new JSONObject(); if ((Integer) result.get("count") < Integer.parseInt(PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT))) { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } else { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } } Persister4TaggerAPI(); @GET @Produces("application/json") @Consumes("application/json") @Path("/start") Response startPersister(@QueryParam("file") String fileLocation, @QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Consumes("application/json") @Path("/stop") Response stopPersister(@QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Path("/ping") Response ping(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genCSV") Response generateCSVFromLastestJSON(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genCSV") Response generateCSVFromLastestJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@QueryParam("userName") String userName); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genTweetIds") Response generateTweetsIDSCSVFromAllJSON(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIds") Response generateTweetsIDSCSVFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@QueryParam("userName") String userName); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIdsOnly") Response generateTweetsIDSOnlyCSVFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode,
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@QueryParam("userName") String userName); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSON(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJson") Response generateJSONFromLastestJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName,
			@QueryParam("removeRetweet") boolean removeRetweet); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIdsOnly") Response generateTweetsIDSOnlyJSONFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genCSV") Response generateCSVFromLastestJSONFiltered(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIds") Response generateTweetsIDSCSVFromAllJSONFiltered(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @Deprecated @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/getClassifiedTweets") Response get_N_LatestClassifiedTweetsFiltered(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit, 
			@QueryParam("callback") String callback); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/downloadFacebookPosts") Response downloadFacebookPosts(@QueryParam("collectionCode") String collectionCode,
							@QueryParam("exportLimit") Integer exportLimit); }
Persister4TaggerAPI { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") public Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, @QueryParam("collectionCode") String collectionCode, @DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType, @QueryParam("userName") String userName) throws UnknownHostException { logger.debug("In tagger-persister genTweetIds"); logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); DeserializeFilters des = new DeserializeFilters(); JsonQueryList queryList = des.deserializeConstraints(queryString); if (queryList != null) { logger.info(collectionCode + ": received constraints = " + queryList.toString()); } else { logger.info(collectionCode + ": received constraints = " + queryList); } JsonDeserializer jsonD = new JsonDeserializer(); Map<String, Object> result = jsonD.generateClassifiedJson2TweetIdsJSONFiltered(collectionCode, downloadLimited, queryList, DownloadJsonType.getDownloadJsonTypeFromString(jsonType), userName); logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + result.get("fileName")); JSONObject obj = new JSONObject(); if ((Integer) result.get("count") < Integer.parseInt(PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT))) { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } else { obj.putAll(ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_PREFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.DEFAULT_TWEETID_VOLUME_LIMIT)+ PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.TWEET_DOWNLOAD_LIMIT_MSG_SUFFIX) + PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_CHANGE_NOTIFY_MSG), result.get("fileName").toString(), true)); return Response.ok(obj.toJSONString()) .allow("POST", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } } Persister4TaggerAPI(); @GET @Produces("application/json") @Consumes("application/json") @Path("/start") Response startPersister(@QueryParam("file") String fileLocation, @QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Consumes("application/json") @Path("/stop") Response stopPersister(@QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Path("/ping") Response ping(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genCSV") Response generateCSVFromLastestJSON(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genCSV") Response generateCSVFromLastestJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@QueryParam("userName") String userName); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genTweetIds") Response generateTweetsIDSCSVFromAllJSON(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIds") Response generateTweetsIDSCSVFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@QueryParam("userName") String userName); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIdsOnly") Response generateTweetsIDSOnlyCSVFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode,
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@QueryParam("userName") String userName); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSON(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJson") Response generateJSONFromLastestJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName,
			@QueryParam("removeRetweet") boolean removeRetweet); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genJsonTweetIdsOnly") Response generateTweetsIDSOnlyJSONFromAllJSONFiltered(String queryString, 
			@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") Integer exportLimit,
			@QueryParam("removeRetweet") boolean removeRetweet,
			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType,
			@QueryParam("userName") String userName); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genCSV") Response generateCSVFromLastestJSONFiltered(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/genTweetIds") Response generateTweetsIDSCSVFromAllJSONFiltered(@QueryParam("collectionCode") String collectionCode,
			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @Deprecated @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/filter/getClassifiedTweets") Response get_N_LatestClassifiedTweetsFiltered(@QueryParam("collectionCode") String collectionCode, 
			@QueryParam("exportLimit") int exportLimit, 
			@QueryParam("callback") String callback); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/downloadFacebookPosts") Response downloadFacebookPosts(@QueryParam("collectionCode") String collectionCode,
							@QueryParam("exportLimit") Integer exportLimit);  }