Search in sources :

Example 61 with ComponentDto

use of org.sonar.db.component.ComponentDto in project sonarqube by SonarSource.

the class PersistComponentsStep method createForDirectory.

public ComponentDto createForDirectory(Component directory, PathAwareVisitor.Path<ComponentDtoHolder> path) {
    ComponentDto res = createBase(directory);
    res.setScope(Scopes.DIRECTORY);
    res.setQualifier(Qualifiers.DIRECTORY);
    res.setName(directory.getReportAttributes().getPath());
    res.setLongName(directory.getReportAttributes().getPath());
    res.setPath(directory.getReportAttributes().getPath());
    setParentModuleProperties(res, path);
    return res;
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto)

Example 62 with ComponentDto

use of org.sonar.db.component.ComponentDto in project sonarqube by SonarSource.

the class PersistComponentsStep method createForProject.

public ComponentDto createForProject(Component project) {
    ComponentDto res = createBase(project);
    res.setScope(Scopes.PROJECT);
    res.setQualifier(Qualifiers.PROJECT);
    res.setName(project.getName());
    res.setLongName(res.name());
    res.setDescription(project.getDescription());
    res.setProjectUuid(res.uuid());
    res.setRootUuid(res.uuid());
    res.setUuidPath(UUID_PATH_OF_ROOT);
    res.setModuleUuidPath(UUID_PATH_SEPARATOR + res.uuid() + UUID_PATH_SEPARATOR);
    return res;
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto)

Example 63 with ComponentDto

use of org.sonar.db.component.ComponentDto in project sonarqube by SonarSource.

the class PersistComponentsStep method setRootAndParentModule.

/**
   * Applies to a node of type either MODULE, SUBVIEW, PROJECT_VIEW
   */
private static void setRootAndParentModule(ComponentDto res, PathAwareVisitor.Path<ComponentDtoHolder> path) {
    ComponentDto rootDto = path.root().getDto();
    res.setRootUuid(rootDto.uuid());
    res.setProjectUuid(rootDto.uuid());
    ComponentDto parentModule = path.parent().getDto();
    res.setUuidPath(formatUuidPathFromParent(parentModule));
    res.setModuleUuid(parentModule.uuid());
    res.setModuleUuidPath(parentModule.moduleUuidPath() + res.uuid() + UUID_PATH_SEPARATOR);
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto)

Example 64 with ComponentDto

use of org.sonar.db.component.ComponentDto in project sonarqube by SonarSource.

the class PersistComponentsStep method createForProjectView.

private ComponentDto createForProjectView(Component projectView, PathAwareVisitor.Path<ComponentDtoHolder> path) {
    ComponentDto res = createBase(projectView);
    res.setScope(Scopes.FILE);
    res.setQualifier(Qualifiers.PROJECT);
    res.setName(projectView.getName());
    res.setLongName(res.name());
    res.setCopyComponentUuid(projectView.getProjectViewAttributes().getProjectUuid());
    setRootAndParentModule(res, path);
    return res;
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto)

Example 65 with ComponentDto

use of org.sonar.db.component.ComponentDto in project sonarqube by SonarSource.

the class PersistComponentsStep method createForView.

private ComponentDto createForView(Component view) {
    ComponentDto res = createBase(view);
    res.setScope(Scopes.PROJECT);
    res.setQualifier(Qualifiers.VIEW);
    res.setName(view.getName());
    res.setDescription(view.getDescription());
    res.setLongName(res.name());
    res.setProjectUuid(res.uuid());
    res.setRootUuid(res.uuid());
    res.setUuidPath(UUID_PATH_OF_ROOT);
    res.setModuleUuidPath(UUID_PATH_SEPARATOR + res.uuid() + UUID_PATH_SEPARATOR);
    return res;
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto)

Aggregations

ComponentDto (org.sonar.db.component.ComponentDto)836 Test (org.junit.Test)661 OrganizationDto (org.sonar.db.organization.OrganizationDto)151 SnapshotDto (org.sonar.db.component.SnapshotDto)94 DbSession (org.sonar.db.DbSession)70 SearchOptions (org.sonar.server.es.SearchOptions)62 MetricDto (org.sonar.db.metric.MetricDto)49 IssueDto (org.sonar.db.issue.IssueDto)48 RuleDto (org.sonar.db.rule.RuleDto)47 GroupDto (org.sonar.db.user.GroupDto)39 UserDto (org.sonar.db.user.UserDto)38 WsTester (org.sonar.server.ws.WsTester)33 MetricTesting.newMetricDto (org.sonar.db.metric.MetricTesting.newMetricDto)25 PropertyDto (org.sonar.db.property.PropertyDto)23 IssueIndexer (org.sonar.server.issue.index.IssueIndexer)21 ProjectRepositories (org.sonar.scanner.protocol.input.ProjectRepositories)18 Date (java.util.Date)16 ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)14 RuleTesting.newRuleDto (org.sonar.db.rule.RuleTesting.newRuleDto)14 ComponentTreeWsResponse (org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse)13