Package org.sonar.api.utils.text

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


  }

  @Override
  public void handle(Request request, Response response) throws Exception {
    JsonWriter json = response.newJsonWriter();
    json.beginObject();
    addPermissions(json);
    addProfiles(json);
    addLanguages(json);
    addRuleRepositories(json);
    addStatuses(json);
View Full Code Here



  private void test(String authors, String dates, int from, int to, boolean group, String expected) throws JSONException {
    StringWriter output = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(output);
    jsonWriter.beginObject();
    writer.write(authors, dates, from, to, group, jsonWriter);
    jsonWriter.endObject();
    JSONAssert.assertEquals(output.toString(), expected, true);
  }
}
View Full Code Here

  }

  private void test(UserSession userSession, DefaultIssueFilter filter, String expected) throws JSONException {
    StringWriter output = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(output);
    jsonWriter.beginObject();
    writer.write(userSession, filter, jsonWriter);
    jsonWriter.endObject();
    JSONAssert.assertEquals(output.toString(), expected, true);
  }
}
View Full Code Here

  @Override
  public void handle(Request request, Response response) {
    String issueKey = request.mandatoryParam("key");

    JsonWriter json = response.newJsonWriter();
    json.beginObject().name("issue").beginObject();

    DbSession session = dbClient.openSession(false);
    try {
      Issue issue = issueService.getByKey(issueKey);
View Full Code Here

  @Override
  public void handle(Request request, Response response) throws Exception {
    UserSession session = UserSession.get();

    JsonWriter json = response.newJsonWriter();
    json.beginObject();

    // Current filter (optional)
    Integer filterId = request.paramAsInt("id");
    DefaultIssueFilter filter = null;
    if (filterId != null && filterId >= 0) {
View Full Code Here

    // Favorite filters, if logged in
    if (session.isLoggedIn()) {
      List<DefaultIssueFilter> favorites = service.findFavoriteFilters(session);
      json.name("favorites").beginArray();
      for (DefaultIssueFilter favorite : favorites) {
        json
          .beginObject()
          .prop("id", favorite.id())
          .prop("name", favorite.name())
          .endObject();
      }
View Full Code Here

      .projectSearch(request.param(QGatesWs.PARAM_QUERY))
      .pageIndex(request.paramAsInt(QGatesWs.PARAM_PAGE))
      .pageSize(request.paramAsInt(QGatesWs.PARAM_PAGE_SIZE))
      .build());
    JsonWriter writer = response.newJsonWriter();
    writer.beginObject().prop("more", associations.hasMoreResults());
    writer.name("results").beginArray();
    for (ProjectQgateAssociation project : associations.projects()) {
      writer.beginObject().prop("id", project.id()).prop("name", project.name()).prop(QGatesWs.PARAM_SELECTED, project.isMember()).endObject();
    }
    writer.endArray().endObject().close();
View Full Code Here

      .build());
    JsonWriter writer = response.newJsonWriter();
    writer.beginObject().prop("more", associations.hasMoreResults());
    writer.name("results").beginArray();
    for (ProjectQgateAssociation project : associations.projects()) {
      writer.beginObject().prop("id", project.id()).prop("name", project.name()).prop(QGatesWs.PARAM_SELECTED, project.isMember()).endObject();
    }
    writer.endArray().endObject().close();
  }

}
View Full Code Here

  public void handle(Request request, Response response) throws Exception {
    UserSession session = UserSession.get();
    DefaultIssueFilter filter = service.find(request.mandatoryParamAsLong("id"), session);

    JsonWriter json = response.newJsonWriter();
    json.beginObject();
    issueFilterWriter.write(session, filter, json);
    json.endObject();
    json.close();
  }
}
View Full Code Here

  @Override
  public void handle(Request request, Response response) throws Exception {
    UserSession session = UserSession.get();
    JsonWriter json = response.newJsonWriter();
    json.beginObject().name("favoriteFilters").beginArray();
    if (session.isLoggedIn()) {
      for (DefaultIssueFilter favorite : service.findFavoriteFilters(session)) {
        json.beginObject();
        json.prop("id", favorite.id());
        json.prop("name", favorite.name());
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.