public List<ComponentDto> selectSubProjectsByComponentUuids(DbSession session, Collection<String> uuids) { if (uuids.isEmpty()) { return emptyList(); } return mapper(session).selectSubProjectsByComponentUuids(uuids); }
/** * Selects all components that are relevant for indexing. The result is not returned (since it is usually too big), but handed over to the <code>handler</code> * * @param session the database session * @param projectUuid the project uuid, which is selected with all of its children * @param handler the action to be applied to every result */ public void scrollForIndexing(DbSession session, @Nullable String projectUuid, ResultHandler<ComponentDto> handler) { mapper(session).scrollForIndexing(projectUuid, handler); }
/** * Retrieve enabled components keys with given qualifiers * <p> * Used by Views plugin */ public Set<ComponentDto> selectComponentsByQualifiers(DbSession dbSession, Set<String> qualifiers) { checkArgument(!qualifiers.isEmpty(), "Qualifiers cannot be empty"); return new HashSet<>(mapper(dbSession).selectComponentsByQualifiers(qualifiers)); }
/** * Return all components of a project (including disable ones) */ public List<ComponentDto> selectAllComponentsFromProjectKey(DbSession session, String projectKey) { return mapper(session).selectComponentsFromProjectKeyAndScope(projectKey, null, false); }
/** * Returns all projects (Scope {@link Scopes#PROJECT} and qualifier * {@link Qualifiers#PROJECT}) which are enabled. * <p> * Branches are not returned. * <p> * Used by Views. */ public List<ComponentDto> selectProjects(DbSession session) { return mapper(session).selectProjects(); }
/** * Scroll all <strong>enabled</strong> files of the specified project (same project_uuid) in no specific order with * 'SOURCE' source and a non null path. */ public void scrollAllFilesForFileMove(DbSession session, String projectUuid, ResultHandler<FileMoveRowDto> handler) { mapper(session).scrollAllFilesForFileMove(projectUuid, handler); }
/** * Select all projects for a given organization. * <p> * Branches are not returned */ public List<ComponentDto> selectProjectsByOrganization(DbSession dbSession, String organizationUuid) { return mapper(dbSession).selectProjectsByOrganization(organizationUuid); }
/** * Retrieves all components with a specific root project Uuid, no other filtering is done by this method. * <p> * Used by Views plugin */ public List<ComponentDto> selectByProjectUuid(String projectUuid, DbSession dbSession) { return mapper(dbSession).selectByProjectUuid(projectUuid); }
public List<KeyWithUuidDto> selectUuidsByKeyFromProjectKey(DbSession session, String projectKey) { return mapper(session).selectUuidsByKeyFromProjectKey(projectKey); }
public List<ComponentDto> selectComponentsHavingSameKeyOrderedById(DbSession session, String key) { return mapper(session).selectComponentsHavingSameKeyOrderedById(key); }
public List<String> selectProjectsFromView(DbSession session, String viewUuid, String projectViewUuid) { return mapper(session).selectProjectsFromView("%." + viewUuid + ".%", projectViewUuid); }
public void update(DbSession session, ComponentUpdateDto component) { mapper(session).update(component); }
public List<ComponentDto> selectProjectsByNameQuery(DbSession dbSession, @Nullable String nameQuery, boolean includeModules) { String nameQueryForSql = nameQuery == null ? null : buildLikeValue(nameQuery, BEFORE_AND_AFTER).toUpperCase(Locale.ENGLISH); return mapper(dbSession).selectProjectsByNameQuery(nameQueryForSql, includeModules); }
public Optional<ComponentDto> selectByKeyAndPullRequest(DbSession session, String key, String pullRequestId) { return Optional.ofNullable(mapper(session).selectPrByKeyAndBranchKey(key, generatePullRequestKey(key, pullRequestId), pullRequestId)); }
public List<ComponentDto> selectByKeysAndBranch(DbSession session, Collection<String> keys, String branch) { List<String> dbKeys = keys.stream().map(k -> generateBranchKey(k, branch)).collect(toList()); List<String> allKeys = Stream.of(keys, dbKeys).flatMap(Collection::stream).collect(toList()); return executeLargeInputs(allKeys, subKeys -> mapper(session).selectByKeysAndBranch(subKeys, branch)); }
public List<ComponentDto> selectByKeysAndPullRequest(DbSession session, Collection<String> keys, String pullRequestId) { List<String> dbKeys = keys.stream().map(k -> generatePullRequestKey(k, pullRequestId)).collect(toList()); List<String> allKeys = Stream.of(keys, dbKeys).flatMap(Collection::stream).collect(toList()); return executeLargeInputs(allKeys, subKeys -> mapper(session).selectByKeysAndBranch(subKeys, pullRequestId)); }
/** * Used by Governance */ public Set<String> selectViewKeysWithEnabledCopyOfProject(DbSession session, Set<String> projectUuids) { return executeLargeInputsIntoSet(projectUuids, partition -> mapper(session).selectViewKeysWithEnabledCopyOfProject(partition), i -> i); }
private static int countByQueryImpl(DbSession session, @Nullable String organizationUuid, ComponentQuery query) { if (query.hasEmptySetOfComponents()) { return 0; } checkThatNotTooManyComponents(query); return mapper(session).countByQuery(organizationUuid, query); }
private static List<ComponentDto> selectByQueryImpl(DbSession session, @Nullable String organizationUuid, ComponentQuery query, int offset, int limit) { if (query.hasEmptySetOfComponents()) { return emptyList(); } checkThatNotTooManyComponents(query); return mapper(session).selectByQuery(organizationUuid, query, new RowBounds(offset, limit)); }
/** * Select the children or the leaves of a base component, given by its UUID. The components that are not present in last * analysis are ignored. * <p> * An empty list is returned if the base component does not exist or if the base component is a leaf. */ public List<ComponentDto> selectDescendants(DbSession dbSession, ComponentTreeQuery query) { Optional<ComponentDto> componentOpt = selectByUuid(dbSession, query.getBaseUuid()); if (!componentOpt.isPresent()) { return emptyList(); } ComponentDto component = componentOpt.get(); return mapper(dbSession).selectDescendants(query, componentOpt.get().uuid(), query.getUuidPath(component)); }