res.setName(project.getName());
res.setLongName(res.name());
res.setDescription(project.getDescription());
+
res.setProjectUuid(res.uuid());
res.setRootUuid(res.uuid());
res.setUuidPath(ComponentDto.UUID_PATH_OF_ROOT);
res.setName(view.getName());
res.setDescription(view.getDescription());
res.setLongName(res.name());
+
res.setProjectUuid(res.uuid());
res.setRootUuid(res.uuid());
res.setUuidPath(ComponentDto.UUID_PATH_OF_ROOT);
* Applies to a node of type either MODULE, SUBVIEW, PROJECT_VIEW
*/
private static void setRootAndParentModule(ComponentDto res, PathAwareVisitor.Path<ComponentDtoHolder> path) {
- ComponentDto projectDto = from(path.getCurrentPath()).last().get().getElement().getDto();
- res.setRootUuid(projectDto.uuid());
- res.setProjectUuid(projectDto.uuid());
+ ComponentDto rootDto = path.root().getDto();
+ res.setRootUuid(rootDto.uuid());
+ res.setProjectUuid(rootDto.uuid());
ComponentDto parentModule = path.parent().getDto();
res.setUuidPath(formatUuidPathFromParent(parentModule));
* Applies to a node of type either DIRECTORY or FILE
*/
private static void setParentModuleProperties(ComponentDto componentDto, PathAwareVisitor.Path<ComponentDtoHolder> path) {
+ componentDto.setProjectUuid(path.root().getDto().uuid());
+
ComponentDto parentModule = from(path.getCurrentPath())
.filter(ParentModulePathElement.INSTANCE)
.first()
.getElement().getDto();
componentDto.setUuidPath(formatUuidPathFromParent(path.parent().getDto()));
componentDto.setRootUuid(parentModule.uuid());
- componentDto.setProjectUuid(parentModule.projectUuid());
componentDto.setModuleUuid(parentModule.uuid());
componentDto.setModuleUuidPath(parentModule.moduleUuidPath());
+
}
private static boolean updateExisting(ComponentDto existingComponent, ComponentDto newComponent) {
assertThat(projectDto.description()).isEqualTo(VIEW_DESCRIPTION);
assertThat(projectDto.path()).isNull();
assertThat(projectDto.uuid()).isEqualTo(VIEW_UUID);
- assertThat(projectDto.projectUuid()).isEqualTo(projectDto.uuid());
+ assertThat(projectDto.projectUuid()).isEqualTo(VIEW_UUID);
assertThat(projectDto.getRootUuid()).isEqualTo(VIEW_UUID);
assertThat(projectDto.moduleUuid()).isNull();
assertThat(projectDto.moduleUuidPath()).isEqualTo("." + projectDto.uuid() + ".");