use of org.opengrok.indexer.configuration.Group in project OpenGrok by OpenGrok.
the class PageConfigRequestedProjectsTest method setUp.
@BeforeEach
public void setUp() {
oldProjects = env.getProjects();
oldGroups = env.getGroups();
oldPluginStack = env.getPluginStack();
Set<Group> groups = new TreeSet<>();
Map<String, Project> projects = new TreeMap<>();
for (int i = 0; i < 10; i++) {
Project project = new Project();
project.setName("project-" + i);
project.setPath("/project-" + i);
project.setIndexed(true);
projects.put("project-" + i, project);
}
Group group;
group = new Group();
group.setName("group-1-2-3");
group.setPattern("project-(1|2|3)");
groups.add(group);
group = new Group();
group.setName("group-7-8-9");
group.setPattern("project-(7|8|9)");
groups.add(group);
env.setGroups(groups);
env.setProjects(projects);
env.setProjectsEnabled(true);
env.setPluginStack(null);
env.applyConfig(false, CommandTimeoutType.INDEXER);
}
use of org.opengrok.indexer.configuration.Group in project OpenGrok by OpenGrok.
the class ProjectsController method deleteProjectWorkHorse.
private void deleteProjectWorkHorse(String projectName, Project project) {
// Delete index data associated with the project.
deleteProjectDataWorkHorse(projectName, true);
// Remove the project from its groups.
for (Group group : project.getGroups()) {
group.getRepositories().remove(project);
group.getProjects().remove(project);
}
if (env.isHistoryEnabled()) {
// Now remove the repositories associated with this project.
List<RepositoryInfo> repos = env.getProjectRepositoriesMap().get(project);
if (repos != null) {
env.getRepositories().removeAll(repos);
}
env.getProjectRepositoriesMap().remove(project);
}
env.getProjects().remove(projectName, project);
// Prevent the project to be included in new searches.
env.refreshSearcherManagerMap();
}
use of org.opengrok.indexer.configuration.Group in project OpenGrok by OpenGrok.
the class ProjectHelper method populateGroups.
/**
* Generates ungrouped projects and repositories.
*/
private void populateGroups() {
groups.addAll(cfg.getEnv().getGroups());
for (Project project : cfg.getEnv().getProjectList()) {
// filterProjects() only adds groups which match project's name.
Set<Group> copy = Group.matching(project, groups);
// If no group matches the project, add it to not-grouped projects.
if (copy.isEmpty()) {
if (cfg.getEnv().getProjectRepositoriesMap().get(project) == null) {
ungroupedProjects.add(project);
} else {
ungroupedRepositories.add(project);
}
}
}
// populate all grouped
for (Group g : getGroups()) {
allProjects.addAll(g.getProjects());
allRepositories.addAll(g.getRepositories());
}
}
Aggregations