public static Boolean insertTaskRun( String text, int task_id, int project_id, String contributor_name, String source) { Document taskRun = MongodbMethods.getTaskRunsFromMongoDB(task_id, contributor_name, text); if (taskRun != null) { logger.error("You are only allowed one contribution for each task."); logger.error("task_id= " + task_id + " screen_name: " + contributor_name); return false; } JSONObject jsonData = PybossaMethods.BuildJsonTaskRunContent(text, task_id, project_id); if (MongodbMethods.insertTaskRunIntoMongoDB(jsonData, contributor_name, source)) { logger.debug("Task run was successfully inserted into MongoDB"); // Project has to be reqested before inserting a task run logger.debug("Requesting the project ID from PyBossa before inserting it"); String postURL = Config.PyBossahost + Config.taskRunDir + Config.api_key; JSONObject postResponse = PybossaMethods.insertTaskRunIntoPyBossa(postURL, jsonData); if (postResponse != null) { logger.debug("Task run was successfully inserted into PyBossa"); return true; } else { return false; } } else { logger.error("Task run was not inserted into MongoDB!"); return false; } }