@Test public void testGetAnalysisAnswersMetrics() throws Exception { initNetwork(); initSnapshot(); String analysisName = "analysis1"; String questionName = "question1"; Question questionObj = new TestQuestion(); String questionContent = BatfishObjectMapper.writeString(questionObj); String analysisQuestionsStr = BatfishObjectMapper.writePrettyString(ImmutableList.of(questionName)); String analysisJsonString = String.format("{\"%s\":%s}", questionName, questionContent); File analysisFile = _networksFolder.newFile(analysisName); FileUtils.writeStringToFile(analysisFile, analysisJsonString, StandardCharsets.UTF_8); _service.configureAnalysis( CoordConsts.DEFAULT_API_KEY, BatfishVersion.getVersionStatic(), _networkName, "new", analysisName, new FileInputStream(analysisFile), "", null); AnalysisId analysisId = idm().getAnalysisId(analysisName, _networkId).get(); QuestionId questionId = idm().getQuestionId(questionName, _networkId, analysisId).get(); AnswerId answerId = idm() .getAnswerId( _networkId, _snapshotId, questionId, DEFAULT_NETWORK_NODE_ROLES_ID, null, analysisId); Answer testAnswer = new Answer(); testAnswer.setStatus(AnswerStatus.SUCCESS); testAnswer.addAnswerElement(new TableAnswerElement(MOCK_TABLE_METADATA)); String testAnswerStr = BatfishObjectMapper.writeString(testAnswer); AnswerMetadata answerMetadata = AnswerMetadataUtil.computeAnswerMetadata(testAnswer, Main.getLogger()); Main.getWorkMgr().getStorage().storeAnswer(testAnswerStr, answerId); Main.getWorkMgr().getStorage().storeAnswerMetadata(answerMetadata, answerId); JSONArray answerOutput = _service.getAnalysisAnswersMetrics( CoordConsts.DEFAULT_API_KEY, BatfishVersion.getVersionStatic(), _networkName, _snapshotName, null, analysisName, analysisQuestionsStr, null); assertThat(answerOutput.get(0), equalTo(CoordConsts.SVC_KEY_SUCCESS)); JSONObject answerJsonObject = (JSONObject) answerOutput.get(1); String answerJsonString = answerJsonObject.getString(CoordConsts.SVC_KEY_ANSWER); GetAnalysisAnswerMetricsAnswer structuredAnswer = BatfishObjectMapper.mapper() .readValue(answerJsonString, new TypeReference<GetAnalysisAnswerMetricsAnswer>() {}); assertThat( structuredAnswer, equalTo(new GetAnalysisAnswerMetricsAnswer(ImmutableMap.of(questionName, answerMetadata)))); }
@POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) public JSONArray getAnalysisAnswersMetrics( @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey, @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion, @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName, @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS) String analysisQuestionsStr , @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr ) { try { _logger.infof( "WMS:getAnalysisAnswersMetrics %s %s %s %s %s\n", apiKey, networkName, snapshotName, analysisName, analysisQuestionsStr); checkStringParam(apiKey, "API key"); checkStringParam(clientVersion, "Client version"); checkStringParam(networkName, "Network name"); checkStringParam(snapshotName, "Current snapshot name"); checkStringParam(analysisName, "Analysis name"); Set<String> analysisQuestions = Strings.isNullOrEmpty(analysisQuestionsStr) ? ImmutableSet.of() : BatfishObjectMapper.mapper() .readValue(analysisQuestionsStr, new TypeReference<Set<String>>() {}); checkApiKeyValidity(apiKey); checkNetworkAccessibility(apiKey, networkName); JSONObject response = new JSONObject(); if (!Strings.isNullOrEmpty(workItemStr)) { WorkItem workItem = BatfishObjectMapper.mapper().readValue(workItemStr, WorkItem.class); if (!workItem.getNetwork().equals(networkName) || !workItem.getSnapshot().equals(snapshotName)) { return failureResponse( "Mismatch in parameters: WorkItem is not for the supplied network or snapshot"); } QueuedWork work = Main.getWorkMgr().getMatchingWork(workItem, QueueType.INCOMPLETE); if (work != null) { String taskStr = BatfishObjectMapper.writePrettyString(work.getLastTaskCheckResult()); response .put(CoordConsts.SVC_KEY_WORKID, work.getWorkItem().getId()) .put(CoordConsts.SVC_KEY_WORKSTATUS, work.getStatus().toString()) .put(CoordConsts.SVC_KEY_TASKSTATUS, taskStr); } } Map<String, AnswerMetadata> answersMetadata = Main.getWorkMgr() .getAnalysisAnswersMetadata( networkName, snapshotName, referenceSnapshot, analysisName, analysisQuestions); GetAnalysisAnswerMetricsAnswer answer = new GetAnalysisAnswerMetricsAnswer(answersMetadata); String answerStr = BatfishObjectMapper.writeString(answer); return successResponse(response.put(CoordConsts.SVC_KEY_ANSWER, answerStr)); } catch (IllegalArgumentException | AccessControlException e) { _logger.errorf("WMS:getAnalysisAnswers exception: %s\n", e.getMessage()); return failureResponse(e.getMessage()); } catch (Exception e) { String stackTrace = Throwables.getStackTraceAsString(e); _logger.errorf( "WMS:getAnalysisAnswersMetrics exception for apikey:%s in network:%s, snapshot:%s, " + "referencesnapshot:%s; exception:%s", apiKey, networkName, snapshotName, referenceSnapshot, stackTrace); return failureResponse(e.getMessage()); } }
WorkMgrService { @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) public JSONArray getAnalysisAnswersMetrics( @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey, @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion, @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName, @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS) String analysisQuestionsStr , @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr ) { try { _logger.infof( "WMS:getAnalysisAnswersMetrics %s %s %s %s %s\n", apiKey, networkName, snapshotName, analysisName, analysisQuestionsStr); checkStringParam(apiKey, "API key"); checkStringParam(clientVersion, "Client version"); checkStringParam(networkName, "Network name"); checkStringParam(snapshotName, "Current snapshot name"); checkStringParam(analysisName, "Analysis name"); Set<String> analysisQuestions = Strings.isNullOrEmpty(analysisQuestionsStr) ? ImmutableSet.of() : BatfishObjectMapper.mapper() .readValue(analysisQuestionsStr, new TypeReference<Set<String>>() {}); checkApiKeyValidity(apiKey); checkNetworkAccessibility(apiKey, networkName); JSONObject response = new JSONObject(); if (!Strings.isNullOrEmpty(workItemStr)) { WorkItem workItem = BatfishObjectMapper.mapper().readValue(workItemStr, WorkItem.class); if (!workItem.getNetwork().equals(networkName) || !workItem.getSnapshot().equals(snapshotName)) { return failureResponse( "Mismatch in parameters: WorkItem is not for the supplied network or snapshot"); } QueuedWork work = Main.getWorkMgr().getMatchingWork(workItem, QueueType.INCOMPLETE); if (work != null) { String taskStr = BatfishObjectMapper.writePrettyString(work.getLastTaskCheckResult()); response .put(CoordConsts.SVC_KEY_WORKID, work.getWorkItem().getId()) .put(CoordConsts.SVC_KEY_WORKSTATUS, work.getStatus().toString()) .put(CoordConsts.SVC_KEY_TASKSTATUS, taskStr); } } Map<String, AnswerMetadata> answersMetadata = Main.getWorkMgr() .getAnalysisAnswersMetadata( networkName, snapshotName, referenceSnapshot, analysisName, analysisQuestions); GetAnalysisAnswerMetricsAnswer answer = new GetAnalysisAnswerMetricsAnswer(answersMetadata); String answerStr = BatfishObjectMapper.writeString(answer); return successResponse(response.put(CoordConsts.SVC_KEY_ANSWER, answerStr)); } catch (IllegalArgumentException | AccessControlException e) { _logger.errorf("WMS:getAnalysisAnswers exception: %s\n", e.getMessage()); return failureResponse(e.getMessage()); } catch (Exception e) { String stackTrace = Throwables.getStackTraceAsString(e); _logger.errorf( "WMS:getAnalysisAnswersMetrics exception for apikey:%s in network:%s, snapshot:%s, " + "referencesnapshot:%s; exception:%s", apiKey, networkName, snapshotName, referenceSnapshot, stackTrace); return failureResponse(e.getMessage()); } } }
WorkMgrService { @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) public JSONArray getAnalysisAnswersMetrics( @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey, @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion, @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName, @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS) String analysisQuestionsStr , @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr ) { try { _logger.infof( "WMS:getAnalysisAnswersMetrics %s %s %s %s %s\n", apiKey, networkName, snapshotName, analysisName, analysisQuestionsStr); checkStringParam(apiKey, "API key"); checkStringParam(clientVersion, "Client version"); checkStringParam(networkName, "Network name"); checkStringParam(snapshotName, "Current snapshot name"); checkStringParam(analysisName, "Analysis name"); Set<String> analysisQuestions = Strings.isNullOrEmpty(analysisQuestionsStr) ? ImmutableSet.of() : BatfishObjectMapper.mapper() .readValue(analysisQuestionsStr, new TypeReference<Set<String>>() {}); checkApiKeyValidity(apiKey); checkNetworkAccessibility(apiKey, networkName); JSONObject response = new JSONObject(); if (!Strings.isNullOrEmpty(workItemStr)) { WorkItem workItem = BatfishObjectMapper.mapper().readValue(workItemStr, WorkItem.class); if (!workItem.getNetwork().equals(networkName) || !workItem.getSnapshot().equals(snapshotName)) { return failureResponse( "Mismatch in parameters: WorkItem is not for the supplied network or snapshot"); } QueuedWork work = Main.getWorkMgr().getMatchingWork(workItem, QueueType.INCOMPLETE); if (work != null) { String taskStr = BatfishObjectMapper.writePrettyString(work.getLastTaskCheckResult()); response .put(CoordConsts.SVC_KEY_WORKID, work.getWorkItem().getId()) .put(CoordConsts.SVC_KEY_WORKSTATUS, work.getStatus().toString()) .put(CoordConsts.SVC_KEY_TASKSTATUS, taskStr); } } Map<String, AnswerMetadata> answersMetadata = Main.getWorkMgr() .getAnalysisAnswersMetadata( networkName, snapshotName, referenceSnapshot, analysisName, analysisQuestions); GetAnalysisAnswerMetricsAnswer answer = new GetAnalysisAnswerMetricsAnswer(answersMetadata); String answerStr = BatfishObjectMapper.writeString(answer); return successResponse(response.put(CoordConsts.SVC_KEY_ANSWER, answerStr)); } catch (IllegalArgumentException | AccessControlException e) { _logger.errorf("WMS:getAnalysisAnswers exception: %s\n", e.getMessage()); return failureResponse(e.getMessage()); } catch (Exception e) { String stackTrace = Throwables.getStackTraceAsString(e); _logger.errorf( "WMS:getAnalysisAnswersMetrics exception for apikey:%s in network:%s, snapshot:%s, " + "referencesnapshot:%s; exception:%s", apiKey, networkName, snapshotName, referenceSnapshot, stackTrace); return failureResponse(e.getMessage()); } }  }
WorkMgrService { @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) public JSONArray getAnalysisAnswersMetrics( @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey, @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion, @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName, @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS) String analysisQuestionsStr , @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr ) { try { _logger.infof( "WMS:getAnalysisAnswersMetrics %s %s %s %s %s\n", apiKey, networkName, snapshotName, analysisName, analysisQuestionsStr); checkStringParam(apiKey, "API key"); checkStringParam(clientVersion, "Client version"); checkStringParam(networkName, "Network name"); checkStringParam(snapshotName, "Current snapshot name"); checkStringParam(analysisName, "Analysis name"); Set<String> analysisQuestions = Strings.isNullOrEmpty(analysisQuestionsStr) ? ImmutableSet.of() : BatfishObjectMapper.mapper() .readValue(analysisQuestionsStr, new TypeReference<Set<String>>() {}); checkApiKeyValidity(apiKey); checkNetworkAccessibility(apiKey, networkName); JSONObject response = new JSONObject(); if (!Strings.isNullOrEmpty(workItemStr)) { WorkItem workItem = BatfishObjectMapper.mapper().readValue(workItemStr, WorkItem.class); if (!workItem.getNetwork().equals(networkName) || !workItem.getSnapshot().equals(snapshotName)) { return failureResponse( "Mismatch in parameters: WorkItem is not for the supplied network or snapshot"); } QueuedWork work = Main.getWorkMgr().getMatchingWork(workItem, QueueType.INCOMPLETE); if (work != null) { String taskStr = BatfishObjectMapper.writePrettyString(work.getLastTaskCheckResult()); response .put(CoordConsts.SVC_KEY_WORKID, work.getWorkItem().getId()) .put(CoordConsts.SVC_KEY_WORKSTATUS, work.getStatus().toString()) .put(CoordConsts.SVC_KEY_TASKSTATUS, taskStr); } } Map<String, AnswerMetadata> answersMetadata = Main.getWorkMgr() .getAnalysisAnswersMetadata( networkName, snapshotName, referenceSnapshot, analysisName, analysisQuestions); GetAnalysisAnswerMetricsAnswer answer = new GetAnalysisAnswerMetricsAnswer(answersMetadata); String answerStr = BatfishObjectMapper.writeString(answer); return successResponse(response.put(CoordConsts.SVC_KEY_ANSWER, answerStr)); } catch (IllegalArgumentException | AccessControlException e) { _logger.errorf("WMS:getAnalysisAnswers exception: %s\n", e.getMessage()); return failureResponse(e.getMessage()); } catch (Exception e) { String stackTrace = Throwables.getStackTraceAsString(e); _logger.errorf( "WMS:getAnalysisAnswersMetrics exception for apikey:%s in network:%s, snapshot:%s, " + "referencesnapshot:%s; exception:%s", apiKey, networkName, snapshotName, referenceSnapshot, stackTrace); return failureResponse(e.getMessage()); } }  @POST @Path(CoordConsts.SVC_RSC_AUTO_COMPLETE) @Produces(MediaType.APPLICATION_JSON) JSONArray autoComplete(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      /* Optional: not needed for some completions */
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_COMPLETION_TYPE) String completionType,
      @FormDataParam(CoordConsts.SVC_KEY_QUERY) String query,
      /* Optional */
      @FormDataParam(CoordConsts.SVC_KEY_MAX_SUGGESTIONS) String maxSuggestions); @POST @Path(CoordConsts.SVC_RSC_CHECK_API_KEY) @Produces(MediaType.APPLICATION_JSON) JSONArray checkApiKey(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion); @POST @Path(CoordConsts.SVC_RSC_CONFIGURE_ANALYSIS) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray configureAnalysis(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_NEW_ANALYSIS) String newAnalysisStr,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_FILE) InputStream addQuestionsStream,
      @FormDataParam(CoordConsts.SVC_KEY_DEL_ANALYSIS_QUESTIONS) String delQuestions,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_SUGGESTED) Boolean suggested); @POST @Path(CoordConsts.SVC_RSC_CONFIGURE_QUESTION_TEMPLATE) @Produces(MediaType.APPLICATION_JSON) JSONArray configureQuestionTemplate(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION) String questionTemplate,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_EXCEPTIONS) String exceptions,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_ASSERTION) String assertion); @POST @Path(CoordConsts.SVC_RSC_DEL_ANALYSIS) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delAnalysis(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName); @POST @Path(CoordConsts.SVC_RSC_DEL_NETWORK) @Produces(MediaType.APPLICATION_JSON) JSONArray delNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName); @POST @Path(CoordConsts.SVC_RSC_DEL_QUESTION) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delQuestion(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName); @POST @Path(CoordConsts.SVC_RSC_DEL_SNAPSHOT) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delSnapshot(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWER) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswer(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswers(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswersMetrics(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS)
          String analysisQuestionsStr /* optional */,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_ROWS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswersRows(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answersRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswer(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_ROWS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerRows(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answerRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_ROWS2) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerRows2(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answerRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_METRICS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerMetrics(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysis,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String question,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr); @POST @Path(CoordConsts.SVC_RSC_GET_NETWORK) @Produces(MediaType.APPLICATION_JSON) Response getNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName); @GET @Produces(MediaType.APPLICATION_JSON) JSONArray getInfo(); @POST @Path(CoordConsts.SVC_RSC_GET_QUESTION_TEMPLATES) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray getQuestionTemplates(@FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey); @GET @Path(CoordConsts.SVC_RSC_GETSTATUS) @Produces(MediaType.APPLICATION_JSON) JSONArray getStatus(); @POST @Path(CoordConsts.SVC_RSC_GET_WORKSTATUS) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray getWorkStatus(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKID) String workId); @POST @Path(CoordConsts.SVC_RSC_INIT_NETWORK) @Produces(MediaType.APPLICATION_JSON) JSONArray initNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_PREFIX) String networkPrefix); @POST @Path(CoordConsts.SVC_RSC_KILL_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray killWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKID) String workId); @POST @Path(CoordConsts.SVC_RSC_LIST_ANALYSES) @Produces(MediaType.APPLICATION_JSON) JSONArray listAnalyses(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_TYPE) AnalysisType analysisType); @POST @Path(CoordConsts.SVC_RSC_LIST_NETWORKS) @Produces(MediaType.APPLICATION_JSON) JSONArray listNetworks(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion); @POST @Path(CoordConsts.SVC_RSC_LIST_INCOMPLETE_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray listIncompleteWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, /* optional */
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_WORK_TYPE) WorkType workType /* optional */); @POST @Path(CoordConsts.SVC_RSC_LIST_QUESTIONS) @Produces(MediaType.APPLICATION_JSON) JSONArray listQuestions(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_VERBOSE) boolean verbose); @POST @Path(CoordConsts.SVC_RSC_QUEUE_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray queueWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr); @GET @Path("test") @Produces(MediaType.TEXT_PLAIN) String test(); @POST @Path(CoordConsts.SVC_RSC_UPLOAD_QUESTION) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray uploadQuestion(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String qName,
      @FormDataParam(CoordConsts.SVC_KEY_FILE) String questionJson); @POST @Path(CoordConsts.SVC_RSC_UPLOAD_SNAPSHOT) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray uploadSnapshot(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_ZIPFILE) InputStream fileStream,
      @FormDataParam(CoordConsts.SVC_KEY_AUTO_ANALYZE_TESTRIG) String autoAnalyzeTestrigStr,
      @FormDataParam(CoordConsts.SVC_KEY_AUTO_ANALYZE) String autoAnalyzeStr); }
WorkMgrService { @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) public JSONArray getAnalysisAnswersMetrics( @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey, @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion, @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName, @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName, @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS) String analysisQuestionsStr , @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr ) { try { _logger.infof( "WMS:getAnalysisAnswersMetrics %s %s %s %s %s\n", apiKey, networkName, snapshotName, analysisName, analysisQuestionsStr); checkStringParam(apiKey, "API key"); checkStringParam(clientVersion, "Client version"); checkStringParam(networkName, "Network name"); checkStringParam(snapshotName, "Current snapshot name"); checkStringParam(analysisName, "Analysis name"); Set<String> analysisQuestions = Strings.isNullOrEmpty(analysisQuestionsStr) ? ImmutableSet.of() : BatfishObjectMapper.mapper() .readValue(analysisQuestionsStr, new TypeReference<Set<String>>() {}); checkApiKeyValidity(apiKey); checkNetworkAccessibility(apiKey, networkName); JSONObject response = new JSONObject(); if (!Strings.isNullOrEmpty(workItemStr)) { WorkItem workItem = BatfishObjectMapper.mapper().readValue(workItemStr, WorkItem.class); if (!workItem.getNetwork().equals(networkName) || !workItem.getSnapshot().equals(snapshotName)) { return failureResponse( "Mismatch in parameters: WorkItem is not for the supplied network or snapshot"); } QueuedWork work = Main.getWorkMgr().getMatchingWork(workItem, QueueType.INCOMPLETE); if (work != null) { String taskStr = BatfishObjectMapper.writePrettyString(work.getLastTaskCheckResult()); response .put(CoordConsts.SVC_KEY_WORKID, work.getWorkItem().getId()) .put(CoordConsts.SVC_KEY_WORKSTATUS, work.getStatus().toString()) .put(CoordConsts.SVC_KEY_TASKSTATUS, taskStr); } } Map<String, AnswerMetadata> answersMetadata = Main.getWorkMgr() .getAnalysisAnswersMetadata( networkName, snapshotName, referenceSnapshot, analysisName, analysisQuestions); GetAnalysisAnswerMetricsAnswer answer = new GetAnalysisAnswerMetricsAnswer(answersMetadata); String answerStr = BatfishObjectMapper.writeString(answer); return successResponse(response.put(CoordConsts.SVC_KEY_ANSWER, answerStr)); } catch (IllegalArgumentException | AccessControlException e) { _logger.errorf("WMS:getAnalysisAnswers exception: %s\n", e.getMessage()); return failureResponse(e.getMessage()); } catch (Exception e) { String stackTrace = Throwables.getStackTraceAsString(e); _logger.errorf( "WMS:getAnalysisAnswersMetrics exception for apikey:%s in network:%s, snapshot:%s, " + "referencesnapshot:%s; exception:%s", apiKey, networkName, snapshotName, referenceSnapshot, stackTrace); return failureResponse(e.getMessage()); } }  @POST @Path(CoordConsts.SVC_RSC_AUTO_COMPLETE) @Produces(MediaType.APPLICATION_JSON) JSONArray autoComplete(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      /* Optional: not needed for some completions */
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_COMPLETION_TYPE) String completionType,
      @FormDataParam(CoordConsts.SVC_KEY_QUERY) String query,
      /* Optional */
      @FormDataParam(CoordConsts.SVC_KEY_MAX_SUGGESTIONS) String maxSuggestions); @POST @Path(CoordConsts.SVC_RSC_CHECK_API_KEY) @Produces(MediaType.APPLICATION_JSON) JSONArray checkApiKey(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion); @POST @Path(CoordConsts.SVC_RSC_CONFIGURE_ANALYSIS) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray configureAnalysis(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_NEW_ANALYSIS) String newAnalysisStr,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_FILE) InputStream addQuestionsStream,
      @FormDataParam(CoordConsts.SVC_KEY_DEL_ANALYSIS_QUESTIONS) String delQuestions,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_SUGGESTED) Boolean suggested); @POST @Path(CoordConsts.SVC_RSC_CONFIGURE_QUESTION_TEMPLATE) @Produces(MediaType.APPLICATION_JSON) JSONArray configureQuestionTemplate(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION) String questionTemplate,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_EXCEPTIONS) String exceptions,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_ASSERTION) String assertion); @POST @Path(CoordConsts.SVC_RSC_DEL_ANALYSIS) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delAnalysis(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName); @POST @Path(CoordConsts.SVC_RSC_DEL_NETWORK) @Produces(MediaType.APPLICATION_JSON) JSONArray delNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName); @POST @Path(CoordConsts.SVC_RSC_DEL_QUESTION) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delQuestion(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName); @POST @Path(CoordConsts.SVC_RSC_DEL_SNAPSHOT) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray delSnapshot(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWER) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswer(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswers(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_METRICS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswersMetrics(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_QUESTIONS)
          String analysisQuestionsStr /* optional */,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANALYSIS_ANSWERS_ROWS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnalysisAnswersRows(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answersRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswer(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshot,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_ROWS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerRows(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answerRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_ROWS2) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerRows2(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String questionName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysisName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_ANSWERS_OPTIONS) String answerRowsOptionsStr,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr /* optional */); @POST @Path(CoordConsts.SVC_RSC_GET_ANSWER_METRICS) @Produces(MediaType.APPLICATION_JSON) JSONArray getAnswerMetrics(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_REFERENCE_SNAPSHOT_NAME) String referenceSnapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_NAME) String analysis,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String question,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr); @POST @Path(CoordConsts.SVC_RSC_GET_NETWORK) @Produces(MediaType.APPLICATION_JSON) Response getNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName); @GET @Produces(MediaType.APPLICATION_JSON) JSONArray getInfo(); @POST @Path(CoordConsts.SVC_RSC_GET_QUESTION_TEMPLATES) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray getQuestionTemplates(@FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey); @GET @Path(CoordConsts.SVC_RSC_GETSTATUS) @Produces(MediaType.APPLICATION_JSON) JSONArray getStatus(); @POST @Path(CoordConsts.SVC_RSC_GET_WORKSTATUS) @Produces(MediaType.APPLICATION_JSON) @Deprecated JSONArray getWorkStatus(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKID) String workId); @POST @Path(CoordConsts.SVC_RSC_INIT_NETWORK) @Produces(MediaType.APPLICATION_JSON) JSONArray initNetwork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_PREFIX) String networkPrefix); @POST @Path(CoordConsts.SVC_RSC_KILL_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray killWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKID) String workId); @POST @Path(CoordConsts.SVC_RSC_LIST_ANALYSES) @Produces(MediaType.APPLICATION_JSON) JSONArray listAnalyses(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_ANALYSIS_TYPE) AnalysisType analysisType); @POST @Path(CoordConsts.SVC_RSC_LIST_NETWORKS) @Produces(MediaType.APPLICATION_JSON) JSONArray listNetworks(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion); @POST @Path(CoordConsts.SVC_RSC_LIST_INCOMPLETE_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray listIncompleteWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName, /* optional */
      @Nullable @FormDataParam(CoordConsts.SVC_KEY_WORK_TYPE) WorkType workType /* optional */); @POST @Path(CoordConsts.SVC_RSC_LIST_QUESTIONS) @Produces(MediaType.APPLICATION_JSON) JSONArray listQuestions(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_VERBOSE) boolean verbose); @POST @Path(CoordConsts.SVC_RSC_QUEUE_WORK) @Produces(MediaType.APPLICATION_JSON) JSONArray queueWork(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_WORKITEM) String workItemStr); @GET @Path("test") @Produces(MediaType.TEXT_PLAIN) String test(); @POST @Path(CoordConsts.SVC_RSC_UPLOAD_QUESTION) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray uploadQuestion(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_QUESTION_NAME) String qName,
      @FormDataParam(CoordConsts.SVC_KEY_FILE) String questionJson); @POST @Path(CoordConsts.SVC_RSC_UPLOAD_SNAPSHOT) @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) JSONArray uploadSnapshot(
      @FormDataParam(CoordConsts.SVC_KEY_API_KEY) String apiKey,
      @FormDataParam(CoordConsts.SVC_KEY_VERSION) String clientVersion,
      @FormDataParam(CoordConsts.SVC_KEY_NETWORK_NAME) String networkName,
      @FormDataParam(CoordConsts.SVC_KEY_SNAPSHOT_NAME) String snapshotName,
      @FormDataParam(CoordConsts.SVC_KEY_ZIPFILE) InputStream fileStream,
      @FormDataParam(CoordConsts.SVC_KEY_AUTO_ANALYZE_TESTRIG) String autoAnalyzeTestrigStr,
      @FormDataParam(CoordConsts.SVC_KEY_AUTO_ANALYZE) String autoAnalyzeStr);  }