@Immutable
public class ProjectViewAttributes {
- private final String projectUuid;
+ private final String uuid;
private final String originalKey;
@CheckForNull
private final Long analysisDate;
private final String branchName;
- public ProjectViewAttributes(String projectUuid, String originalKey, @Nullable Long analysisDate, @Nullable String branchName) {
- this.projectUuid = requireNonNull(projectUuid, "projectUuid can't be null");
- this.originalKey = requireNonNull(originalKey, "projectKey can't be null");
+ public ProjectViewAttributes(String uuid, String originalKey, @Nullable Long analysisDate, @Nullable String branchName) {
+ this.uuid = requireNonNull(uuid, "uuid can't be null");
+ this.originalKey = requireNonNull(originalKey, "originalKey can't be null");
this.analysisDate = analysisDate;
this.branchName = branchName;
}
- public String getProjectUuid() {
- return projectUuid;
+ public String getUuid() {
+ return uuid;
}
@CheckForNull
return analysisDate;
}
-
public String getBranchName() {
return branchName;
}
@Override
public String toString() {
return "ProjectViewAttributes{" +
- ", projectUuid='" + projectUuid + '\'' +
+ ", uuid='" + uuid + '\'' +
", branchName='" + branchName + '\'' +
", analysisDate=" + analysisDate +
'}';
res.setQualifier(PROJECT);
res.setName(projectView.getName());
res.setLongName(res.name());
- res.setCopyComponentUuid(projectView.getProjectViewAttributes().getProjectUuid());
+ res.setCopyComponentUuid(projectView.getProjectViewAttributes().getUuid());
setRootAndParentModule(res, path);
}
private static Optional<ComponentUpdateDto> compareForUpdate(ComponentDto existing, ComponentDto target) {
- boolean hasDifferences = !StringUtils.equals(existing.getCopyResourceUuid(), target.getCopyResourceUuid()) ||
+ boolean hasDifferences = !StringUtils.equals(existing.getCopyComponentUuid(), target.getCopyComponentUuid()) ||
!StringUtils.equals(existing.description(), target.description()) ||
!StringUtils.equals(existing.getDbKey(), target.getDbKey()) ||
!existing.isEnabled() ||
assertRowsCountInTableProjects(2);
ComponentDto subView = getComponentFromDb(SUBVIEW_1_KEY);
- assertThat(subView.getCopyResourceUuid()).isEqualTo("ORIGINAL_UUID");
+ assertThat(subView.getCopyComponentUuid()).isEqualTo("ORIGINAL_UUID");
}
@Test
dbTester.commit();
ComponentDto subViewReloaded = getComponentFromDb(SUBVIEW_1_KEY);
- assertThat(subViewReloaded.getCopyResourceUuid()).isEqualTo("NEW_COPY");
+ assertThat(subViewReloaded.getCopyComponentUuid()).isEqualTo("NEW_COPY");
}
@Test
assertThat(dto.moduleUuidPath()).isEqualTo("." + dto.uuid() + ".");
assertThat(dto.qualifier()).isEqualTo(Qualifiers.VIEW);
assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
- assertThat(dto.getCopyResourceUuid()).isNull();
+ assertThat(dto.getCopyComponentUuid()).isNull();
assertThat(dto.getCreatedAt()).isEqualTo(now);
}
assertThat(dto.moduleUuidPath()).isEqualTo("." + dto.uuid() + ".");
assertThat(dto.qualifier()).isEqualTo(Qualifiers.APP);
assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
- assertThat(dto.getCopyResourceUuid()).isNull();
+ assertThat(dto.getCopyComponentUuid()).isNull();
assertThat(dto.getCreatedAt()).isEqualTo(now);
}
assertThat(sv1Dto.moduleUuidPath()).isEqualTo(viewDto.moduleUuidPath() + sv1Dto.uuid() + ".");
assertThat(sv1Dto.qualifier()).isEqualTo(Qualifiers.SUBVIEW);
assertThat(sv1Dto.scope()).isEqualTo(Scopes.PROJECT);
- assertThat(sv1Dto.getCopyResourceUuid()).isNull();
+ assertThat(sv1Dto.getCopyComponentUuid()).isNull();
assertThat(sv1Dto.getCreatedAt()).isEqualTo(now);
}
assertThat(pv1Dto.moduleUuidPath()).isEqualTo(parentViewDto.moduleUuidPath() + pv1Dto.uuid() + ".");
assertThat(pv1Dto.qualifier()).isEqualTo(Qualifiers.PROJECT);
assertThat(pv1Dto.scope()).isEqualTo(Scopes.FILE);
- assertThat(pv1Dto.getCopyResourceUuid()).isEqualTo(project.uuid());
+ assertThat(pv1Dto.getCopyComponentUuid()).isEqualTo(project.uuid());
assertThat(pv1Dto.getCreatedAt()).isEqualTo(now);
}
}
@CheckForNull
- public String getCopyResourceUuid() {
+ public String getCopyComponentUuid() {
return copyComponentUuid;
}
.setUuid(from.uuid())
.setBChanged(false)
.setBKey(from.getDbKey())
- .setBCopyComponentUuid(from.getCopyResourceUuid())
+ .setBCopyComponentUuid(from.getCopyComponentUuid())
.setBDescription(from.description())
.setBEnabled(from.isEnabled())
.setBUuidPath(from.getUuidPath())
assertThat(result.qualifier()).isEqualTo("TRK");
assertThat(result.scope()).isEqualTo("PRJ");
assertThat(result.language()).isNull();
- assertThat(result.getCopyResourceUuid()).isNull();
+ assertThat(result.getCopyComponentUuid()).isNull();
assertThat(result.isPrivate()).isTrue();
assertThat(underTest.selectByUuid(dbSession, "UNKNOWN")).isEmpty();
assertThat(result.qualifier()).isEqualTo("TRK");
assertThat(result.scope()).isEqualTo("FIL");
assertThat(result.language()).isNull();
- assertThat(result.getCopyResourceUuid()).isEqualTo(project.uuid());
+ assertThat(result.getCopyComponentUuid()).isEqualTo(project.uuid());
assertThat(result.isPrivate()).isFalse();
}
Map<String, Object> row1 = selectBColumnsForUuid("U1");
assertThat(row1.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
assertThat(row1.get("bKey")).isEqualTo(dto1.getDbKey());
- assertThat(row1.get("bCopyComponentUuid")).isEqualTo(dto1.getCopyResourceUuid());
+ assertThat(row1.get("bCopyComponentUuid")).isEqualTo(dto1.getCopyComponentUuid());
assertThat(row1.get("bDescription")).isEqualTo(dto1.description());
assertThat(row1.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
assertThat(row1.get("bUuidPath")).isEqualTo(dto1.getUuidPath());
Map<String, Object> row2 = selectBColumnsForUuid("U2");
assertThat(row2.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
assertThat(row2.get("bKey")).isEqualTo(dto2.getDbKey());
- assertThat(row2.get("bCopyComponentUuid")).isEqualTo(dto2.getCopyResourceUuid());
+ assertThat(row2.get("bCopyComponentUuid")).isEqualTo(dto2.getCopyComponentUuid());
assertThat(row2.get("bDescription")).isEqualTo(dto2.description());
assertThat(row2.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
assertThat(row2.get("bUuidPath")).isEqualTo(dto2.getUuidPath());
assertThat(componentDto.language()).isEqualTo("java");
assertThat(componentDto.description()).isEqualTo("desc");
assertThat(componentDto.getRootUuid()).isEqualTo("uuid_3");
- assertThat(componentDto.getCopyResourceUuid()).isEqualTo("uuid_5");
+ assertThat(componentDto.getCopyComponentUuid()).isEqualTo("uuid_5");
assertThat(componentDto.isPrivate()).isFalse();
}
private Map<String, ComponentDto> searchReferenceComponentsByUuid(DbSession dbSession, List<ComponentDto> components) {
List<String> referenceComponentIds = components.stream()
- .map(ComponentDto::getCopyResourceUuid)
+ .map(ComponentDto::getCopyComponentUuid)
.filter(Objects::nonNull)
.collect(toList());
if (referenceComponentIds.isEmpty()) {
wsComponent = componentDtoToWsComponent(component, parentProject.orElse(null), null);
}
- ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+ ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
if (referenceComponent != null) {
wsComponent.setRefId(referenceComponent.uuid());
wsComponent.setRefKey(referenceComponent.getKey());
}
private Optional<ComponentDto> getReferenceComponent(DbSession dbSession, ComponentDto component) {
- if (component.getCopyResourceUuid() == null) {
+ if (component.getCopyComponentUuid() == null) {
return Optional.empty();
}
- return dbClient.componentDao().selectByUuid(dbSession, component.getCopyResourceUuid());
+ return dbClient.componentDao().selectByUuid(dbSession, component.getCopyComponentUuid());
}
private static ComponentWsResponse buildResponse(ComponentRequest request, ComponentDto component, Optional<ComponentDto> refComponent,
Map<String, ComponentDto> referenceComponentsByUuid) {
Component.Builder wsComponent = componentDtoToWsComponent(component);
- ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+ ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
if (referenceComponent != null) {
wsComponent.setRefKey(referenceComponent.getDbKey());
}
private static Measures.Component.Builder toWsComponent(ComponentDto component, Map<MetricDto, ComponentTreeData.Measure> measures,
Map<String, ComponentDto> referenceComponentsByUuid) {
Measures.Component.Builder wsComponent = componentDtoToWsComponent(component);
- ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+ ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
if (referenceComponent != null) {
wsComponent.setRefKey(referenceComponent.getKey());
String displayQualifier = getDisplayQualifier(component, referenceComponent);
private Map<String, ComponentDto> searchReferenceComponentsById(DbSession dbSession, List<ComponentDto> components) {
List<String> referenceComponentUUids = components.stream()
- .map(ComponentDto::getCopyResourceUuid)
+ .map(ComponentDto::getCopyComponentUuid)
.filter(Objects::nonNull)
.collect(MoreCollectors.toList(components.size()));
if (referenceComponentUUids.isEmpty()) {