Package org.sonar.api.utils.text

Examples of org.sonar.api.utils.text.JsonWriter.endObject()


      Map<String, Integer> refByTestPlan = newHashMap();
      Map<String, Component> componentsByKey = newHashMap();
      writeTests(testable, line, refByTestPlan, componentsByKey, json);
      writeFiles(refByTestPlan, componentsByKey, json);
    }
    json.endObject().close();
  }

  private void writeTests(Testable testable, Integer line, Map<String, Integer> refByTestPlan, Map<String, Component> componentsByKey, JsonWriter json) {
    json.name("tests").beginArray();
    for (TestCase testCase : testable.testCasesOfLine(line)) {
View Full Code Here


    });
    for (Controller controller : ordering.sortedCopy(controllers)) {
      writeController(writer, controller, includeInternals);
    }
    writer.endArray();
    writer.endObject();
    writer.close();
  }

  private void writeController(JsonWriter writer, Controller controller, boolean includeInternals) {
    if (includeInternals || !controller.isInternal()) {
View Full Code Here

      MutableTestPlan testPlan = snapshotPerspectives.as(MutableTestPlan.class, fileKey);
      if (testPlan != null) {
        writeFromTestable(testPlan, json);
      }
    }
    json.endObject().close();
  }

  private void writeFromTestable(MutableTestPlan testPlan, JsonWriter json) {
    json.name("tests").beginArray();
    for (TestCase testCase : testPlan.testCases()) {
View Full Code Here

    MutableTestPlan testPlan = snapshotPerspectives.as(MutableTestPlan.class, fileKey);
    JsonWriter json = response.newJsonWriter().beginObject();
    if (testPlan != null) {
      writeTests(testPlan, test, json);
    }
    json.endObject().close();
  }

  private void writeTests(TestPlan<MutableTestCase> testPlan, String test, JsonWriter json) {
    json.name("files").beginArray();
    for (TestCase testCase : testPlan.testCasesByName(test)) {
View Full Code Here

    Result<Activity> results = logService.search(query, queryContext);

    JsonWriter json = response.newJsonWriter().beginObject();
    searchOptions.writeStatistics(json, results);
    writeLogs(results, json, searchOptions);
    json.endObject().close();
  }

  private void writeLogs(Result<Activity> result, JsonWriter json, SearchOptions options) {
    json.name("logs").beginArray();
    for (Activity log : result.getHits()) {
View Full Code Here

  private void writeResponse(Response response, RuleKey ruleKey) {
    Rule rule = service.getNonNullByKey(ruleKey);
    JsonWriter json = response.newJsonWriter().beginObject().name("rule");
    mapping.write(rule, json, null /* TODO replace by SearchOptions immutable constant */);
    json.endObject().close();
  }

  private void write409(Response response, RuleKey ruleKey) {
    Rule rule = service.getNonNullByKey(ruleKey);

View Full Code Here

    Response.Stream stream = response.stream();
    stream.setStatus(409);
    stream.setMediaType(MimeTypes.JSON);
    JsonWriter json = JsonWriter.of(new OutputStreamWriter(stream.output())).beginObject().name("rule");
    mapping.write(rule, json, null /* TODO replace by SearchOptions immutable constant */);
    json.endObject().close();
  }
}
View Full Code Here

    addProfiles(json);
    addLanguages(json);
    addRuleRepositories(json);
    addStatuses(json);
    addCharacteristics(json);
    json.endObject().close();
  }

  private void addPermissions(JsonWriter json) {
    json.prop("canWrite", UserSession.get().hasGlobalPermission(GlobalPermissions.QUALITY_PROFILE_ADMIN));
  }
View Full Code Here

    if (request.mandatoryParamAsBoolean(PARAM_ACTIVES)) {
      activeRuleCompleter.completeShow(rule, json);
    }

    json.endObject().close();
  }
}
View Full Code Here

  private void writeResponse(Response response, RuleKey ruleKey) {
    Rule rule = service.getNonNullByKey(ruleKey);
    JsonWriter json = response.newJsonWriter().beginObject().name("rule");
    mapping.write(rule, json, null /* TODO replace by SearchOptions immutable constant */);
    json.endObject().close();
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.