public Optional<LiveMeasureDto> selectByComponentUuidAndMetricKey(DbSession dbSession, String componentUuid, String metricKey) { LiveMeasureDto liveMeasureDto = mapper(dbSession).selectByComponentUuidAndMetricKey(componentUuid, metricKey); return Optional.ofNullable(liveMeasureDto); }
public int deleteByComponentUuidExcludingMetricIds(DbSession dbSession, String componentUuid, List<Integer> excludedMetricIds) { return mapper(dbSession).deleteByComponentUuidExcludingMetricIds(componentUuid, excludedMetricIds); }
public List<LiveMeasureDto> selectByComponentUuidsAndMetricKeys(DbSession dbSession, Collection<String> largeComponentUuids, Collection<String> metricKeys) { if (largeComponentUuids.isEmpty() || metricKeys.isEmpty()) { return Collections.emptyList(); } return executeLargeInputs( largeComponentUuids, componentUuids -> mapper(dbSession).selectByComponentUuidsAndMetricKeys(componentUuids, metricKeys)); }
public List<LiveMeasureDto> selectByComponentUuidsAndMetricIds(DbSession dbSession, Collection<String> largeComponentUuids, Collection<Integer> metricIds) { if (largeComponentUuids.isEmpty() || metricIds.isEmpty()) { return Collections.emptyList(); } return executeLargeInputs( largeComponentUuids, componentUuids -> mapper(dbSession).selectByComponentUuidsAndMetricIds(componentUuids, metricIds)); }
/** * Similar to {@link #insertOrUpdate(DbSession, LiveMeasureDto)}, except that: * <ul> * <li>it is batch session friendly (single same statement for both updates and inserts)</li> * <li>it triggers a single SQL request</li> * </ul> * <p> * <strong>This method should not be called unless {@link Dialect#supportsUpsert()} is true</strong> */ public int upsert(DbSession dbSession, LiveMeasureDto dto) { return mapper(dbSession).upsert(dto, Uuids.create(), system2.now()); }
public void insert(DbSession dbSession, LiveMeasureDto dto) { mapper(dbSession).insert(dto, Uuids.create(), system2.now()); }
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); }
public void insertOrUpdate(DbSession dbSession, LiveMeasureDto dto) { LiveMeasureMapper mapper = mapper(dbSession); long now = system2.now(); if (mapper.update(dto, now) == 0) { mapper.insert(dto, Uuids.create(), now); } }
/** * 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; }