Package org.sonar.api.utils.text

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


      ComponentDto component = findComponent(fileKey, session);
      JsonWriter json = response.newJsonWriter().beginObject();
      String duplications = findDataFromComponent(fileKey, CoreMetrics.DUPLICATIONS_DATA_KEY, session);
      List<DuplicationsParser.Block> blocks = parser.parse(component, duplications, session);
      duplicationsJsonWriter.write(blocks, json, session);
      json.endObject().close();
    } finally {
      MyBatis.closeQuietly(session);
    }
  }
View Full Code Here


          .endObject();
      }
      json.endArray();
    }

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

}
View Full Code Here

    writer.endArray();
    QualityGateDto defaultQgate = qualityGates.getDefault();
    if (defaultQgate != null) {
      writer.prop("default", defaultQgate.getId());
    }
    writer.endObject().close();
  }

}
View Full Code Here

  public void handle(Request request, Response response) {
    JsonWriter writer = response.newJsonWriter().beginObject();
    addPermissions(writer);
    addPeriods(writer);
    addMetrics(writer);
    writer.endObject().close();
  }

  private void addPermissions(JsonWriter writer) {
    writer.prop("edit", qualityGates.currentUserHasWritePermission());
  }
View Full Code Here

    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

      for (QualityGateConditionDto condition : conditions) {
        QGatesWs.writeQualityGateCondition(condition, writer);
      }
      writer.endArray();
    }
    writer.endObject().close();
  }

  private void checkOneOfIdOrNamePresent(@Nullable Long qGateId, @Nullable String qGateName) {
    if (qGateId == null && qGateName == null) {
      throw new BadRequestException("Either one of 'id' or 'name' is required.");
View Full Code Here

        json.prop("id", favorite.id());
        json.prop("name", favorite.name());
        json.prop("user", favorite.user());
        json.prop("shared", favorite.shared());
        // no need to export description and query fields
        json.endObject();
      }
    }
    json.endArray().endObject().close();
  }
View Full Code Here

    StringWriter json = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(json).beginObject();
    Result result = mock(Result.class);
    when(result.getTotal()).thenReturn(42L);
    options.writeStatistics(jsonWriter, result);
    jsonWriter.endObject().close();

    JSONAssert.assertEquals("{\"total\": 42, \"p\": 3, \"ps\": 10}", json.toString(), true);
  }

  @Test
View Full Code Here

      writeJsonIssues(json, ruleKeys, userLogins);
      writeJsonComponents(json);
      writeJsonRules(json, ruleKeys);
      List<User> users = userFinder.findByLogins(new ArrayList<String>(userLogins));
      writeUsers(json, users);
      json.endObject().close();

    } catch (IOException e) {
      throw new SonarException("Unable to write JSON report", e);
    }
  }
View Full Code Here

          .prop("line", issue.line());
        Severity overridenSeverity = issue.overridenSeverity();
        if (overridenSeverity != null) {
          jsonWriter.prop("severity", overridenSeverity.name());
        }
        jsonWriter.endObject();
      }
      jsonWriter.endArray()
        .endObject()
        .close();
    } catch (IOException e) {
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.