public List<String> assemblePybossaTaskPublishFormWithIndex( String inputData, ClientApp clientApp, int indexStart, int indexEnd) throws Exception { List<String> outputFormatData = new ArrayList<String>(); JSONParser parser = new JSONParser(); Object obj = parser.parse(inputData); JSONArray jsonObject = (JSONArray) obj; Iterator itr = jsonObject.iterator(); for (int i = indexStart; i < indexEnd; i++) { JSONObject featureJsonObj = (JSONObject) jsonObject.get(i); JSONObject info = assemblePybossaInfoFormat(featureJsonObj, parser, clientApp); JSONObject tasks = new JSONObject(); tasks.put("info", info); tasks.put("n_answers", clientApp.getTaskRunsPerTask()); tasks.put("quorum", clientApp.getQuorum()); tasks.put("calibration", new Integer(0)); tasks.put("app_id", clientApp.getPlatformAppID()); tasks.put("priority_0", new Integer(0)); outputFormatData.add(tasks.toJSONString()); } return outputFormatData; }
public List<String> assemblePybossaTaskPublishForm(String inputData, ClientApp clientApp) throws Exception { List<String> outputFormatData = new ArrayList<String>(); JSONParser parser = new JSONParser(); Object obj = parser.parse(inputData); JSONArray jsonObject = (JSONArray) obj; Iterator itr = jsonObject.iterator(); while (itr.hasNext()) { JSONObject featureJsonObj = (JSONObject) itr.next(); JSONObject info = assemblePybossaInfoFormat(featureJsonObj, parser, clientApp); JSONObject tasks = new JSONObject(); tasks.put("info", info); tasks.put("n_answers", clientApp.getTaskRunsPerTask()); tasks.put("quorum", clientApp.getQuorum()); tasks.put("calibration", new Integer(0)); tasks.put("app_id", clientApp.getPlatformAppID()); tasks.put("priority_0", new Integer(0)); outputFormatData.add(tasks.toJSONString()); // System.out.println(featureJsonObj.toString()); } return outputFormatData; }