Package org.sonar.api.utils.text

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


      activeRuleCompleter.completeSearch(query, results.getHits(), json);
    }
    if (queryContext.isFacet()) {
      writeFacets(results, json);
    }
    json.endObject().close();
  }

  public static RuleQuery createRuleQuery(RuleQuery query, Request request) {
    query.setQueryText(request.param(SearchOptions.PARAM_TEXT_QUERY));
    query.setSeverities(request.paramAsStrings(PARAM_SEVERITIES));
View Full Code Here


    this.writeStatistics(json, result, context);
    doContextResponse(request, context, result, json);
    if (context.isFacet()) {
      writeFacets(request, context, result, json);
    }
    json.endObject().close();
  }

  private QueryContext getQueryContext(Request request) {
    int pageSize = request.mandatoryParamAsInt(PARAM_PAGE_SIZE);
    QueryContext queryContext = new QueryContext().addFieldsToReturn(request.paramAsStrings(PARAM_FIELDS));
View Full Code Here

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

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

  private void checkUserRights() {
    UserSession.get().checkGlobalPermission(GlobalPermissions.SYSTEM_ADMIN);
  }
View Full Code Here

    }

    JsonWriter json = response.newJsonWriter().beginObject();
    writeSource(sourceHtml, from, json);

    json.endObject().close();
  }

  private void writeSource(List<String> lines, int from, JsonWriter json) {
    json.name("sources").beginArray();
    for (int i = 0; i < lines.size(); i++) {
View Full Code Here

    JsonWriter json = response.newJsonWriter().beginObject();
    int from = Math.max(request.mandatoryParamAsInt("from"), 1);
    int to = (Integer) ObjectUtils.defaultIfNull(request.paramAsInt("to"), Integer.MAX_VALUE);
    scmWriter.write(authors, dates, from, to, request.mandatoryParamAsBoolean("commits_by_line"), json);
    json.endObject().close();
  }
}
View Full Code Here

  public void handle(Request request, Response response) throws Exception {
    List<AnalysisReportDto> reports = queue.all();

    JsonWriter json = response.newJsonWriter().beginObject();
    writeReports(reports, json);
    json.endObject();
    json.close();
  }

  private void writeReports(List<AnalysisReportDto> reports, JsonWriter json) {
    json.name("reports").beginArray();
View Full Code Here

      }
      JsonWriter json = response.newJsonWriter().beginObject();
      for (String messageKey: i18n.getPropertyKeys()) {
        json.prop(messageKey, i18n.message(locale, messageKey, messageKey));
      }
      json.endObject().close();
    }
  }
}
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

    } finally {
      session.close();
    }

    json.endObject().endObject().close();
  }

  private void writeIssue(DbSession session, Issue issue, JsonWriter json) {
    String actionPlanKey = issue.actionPlanKey();
    ActionPlan actionPlan = actionPlanKey != null ? actionPlanService.findByKey(actionPlanKey, UserSession.get()) : null;
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.