Codota Logo
org.sonar.db.measure
Code IndexAdd Codota to your IDE (free)

How to use org.sonar.db.measure

Best Java code snippets using org.sonar.db.measure (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

/**
 * Example:
 * If Main Branch = 0 LOCs (provisioned but never analyzed) and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
 * If Main Branch = 100 LOCs and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
 * If Main Branch = 100 LOCs and the "largest long-lived branch" is 80 LOCs, I'm expecting to consider the value 100.
 */
public long sumNclocOfBiggestLongLivingBranch(DbSession dbSession, SumNclocDbQuery dbQuery) {
 Long ncloc = mapper(dbSession).sumNclocOfBiggestLongLivingBranch(
  NCLOC_KEY, KeyType.BRANCH, BranchType.LONG, dbQuery.getOrganizationUuid(), dbQuery.getOnlyPrivateProjects(), dbQuery.getProjectUuidToExclude());
 return ncloc == null ? 0L : ncloc;
}
origin: SonarSource/sonarqube

/**
 * Select measures of:
 * - one component
 * - for a list of metrics
 * - with analysis from a date (inclusive) - optional
 * - with analysis to a date (exclusive) - optional
 *
 * If no constraints on dates, all the history is returned
 */
public List<MeasureDto> selectPastMeasures(DbSession dbSession, PastMeasureQuery query) {
 return mapper(dbSession).selectPastMeasuresOnSeveralAnalyses(query);
}
origin: SonarSource/sonarqube

public void insert(DbSession session, Collection<MeasureDto> items) {
 for (MeasureDto item : items) {
  insert(session, item);
 }
}
origin: SonarSource/sonarqube

@Test
public void insertOrUpdate() {
 // insert
 LiveMeasureDto dto = newLiveMeasure();
 underTest.insertOrUpdate(db.getSession(), dto);
 verifyPersisted(dto);
 verifyTableSize(1);
 // update
 dto.setValue(dto.getValue() + 1);
 dto.setVariation(dto.getVariation() + 10);
 dto.setData(dto.getDataAsString() + "_new");
 underTest.insertOrUpdate(db.getSession(), dto);
 verifyPersisted(dto);
 verifyTableSize(1);
}
origin: SonarSource/sonarqube

private void insertMeasure(String id, String analysisUuid, String componentUuid, int metricId) {
 MeasureDto measure = MeasureTesting.newMeasure()
  .setAnalysisUuid(analysisUuid)
  .setComponentUuid(componentUuid)
  .setMetricId(metricId)
  // as ids can't be forced when inserting measures, the field "data"
  // is used to store a virtual id. It is used then in assertions.
  .setData(id);
 db.getDbClient().measureDao().insert(db.getSession(), measure);
}
origin: SonarSource/sonarqube

 private static MeasureDto createMeasureDto(int metricId, String componentUuid, String analysisUuid) {
  return new MeasureDto()
   .setComponentUuid(componentUuid)
   .setAnalysisUuid(analysisUuid)
   .setData(SOME_DATA)
   .setMetricId(metricId);
 }
}
origin: SonarSource/sonarqube

 private long computeNcloc() {
  try (DbSession dbSession = dbClient.openSession(false)) {
   SumNclocDbQuery query = SumNclocDbQuery.builder()
    .setOnlyPrivateProjects(false)
    .setOrganizationUuid(defaultOrganizationProvider.get().getUuid())
    .build();
   return dbClient.liveMeasureDao().sumNclocOfBiggestLongLivingBranch(dbSession, query);
  }
 }
}
origin: SonarSource/sonarqube

 private static MeasureDto newTextMeasure(String data) {
  return new MeasureDto().setData(data);
 }
}
origin: SonarSource/sonarqube

@Override
@CheckForNull
protected ProjectMeasures doNext() {
 if (!projects.hasNext()) {
  return null;
 }
 Project project = projects.next();
 Measures measures = selectMeasures(project.getUuid());
 return new ProjectMeasures(project, measures);
}
origin: SonarSource/sonarqube

public void selectTreeByQuery(DbSession dbSession, ComponentDto baseComponent, MeasureTreeQuery query, ResultHandler<LiveMeasureDto> resultHandler) {
 if (query.returnsEmpty()) {
  return;
 }
 mapper(dbSession).selectTreeByQuery(query, baseComponent.uuid(), query.getUuidPath(baseComponent), resultHandler);
}
origin: SonarSource/sonarqube

private void insertMeasure(double value, ComponentDto componentDto, MetricDto metric) {
 db.measures().insertLiveMeasure(componentDto, metric, m -> m.setValue(value));
}
origin: SonarSource/sonarqube

public void insert(DbSession session, MeasureDto measureDto) {
 mapper(session).insert(measureDto);
}
origin: SonarSource/sonarqube

public Optional<MeasureDto> selectMeasure(DbSession dbSession, String analysisUuid, String componentUuid, String metricKey) {
 return Optional.ofNullable(mapper(dbSession).selectMeasure(analysisUuid, componentUuid, metricKey));
}
origin: SonarSource/sonarqube

 public MeasureQuery build() {
  return new MeasureQuery(this);
 }
}
origin: SonarSource/sonarqube

public int deleteByComponentUuidExcludingMetricIds(DbSession dbSession, String componentUuid, List<Integer> excludedMetricIds) {
 return mapper(dbSession).deleteByComponentUuidExcludingMetricIds(componentUuid, excludedMetricIds);
}
origin: SonarSource/sonarqube

 public MeasureTreeQuery build() {
  return new MeasureTreeQuery(this);
 }
}
origin: SonarSource/sonarqube

public static Builder builder() {
 return new Builder();
}
origin: SonarSource/sonarqube

public Optional<LiveMeasureDto> selectByComponentUuidAndMetricKey(DbSession dbSession, String componentUuid, String metricKey) {
 LiveMeasureDto liveMeasureDto = mapper(dbSession).selectByComponentUuidAndMetricKey(componentUuid, metricKey);
 return Optional.ofNullable(liveMeasureDto);
}
origin: SonarSource/sonarqube

private Map<String, ProjectMeasures> createResultSetAndReturnDocsById() {
 return createResultSetAndReturnDocsById(null);
}
origin: SonarSource/sonarqube

static MeasureQuery copyWithSubsetOfProjectUuids(MeasureQuery query, Collection<String> projectUuids) {
 return new MeasureQuery(query.analysisUuid, projectUuids, query.componentUuids, query.metricIds, query.metricKeys);
}
org.sonar.db.measure

Most used classes

  • MeasureDao
  • CustomMeasureDao
  • LiveMeasureDao
  • LiveMeasureDto
  • MeasureDto
  • MeasureTreeQuery$Builder,
  • MeasureTreeQuery,
  • ProjectMeasuresIndexerIterator$Measures,
  • ProjectMeasuresIndexerIterator$Project,
  • ProjectMeasuresIndexerIterator$ProjectMeasures,
  • ProjectMeasuresIndexerIterator,
  • MeasureDbTester,
  • MeasureQuery$Builder,
  • MeasureQuery,
  • MeasureTesting,
  • SumNclocDbQuery$Builder,
  • SumNclocDbQuery,
  • CustomMeasureTesting,
  • MeasureMapper
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now