@CheckForNull
 private static String extractFilePath(@Nullable String filePath, String scope) {
   // On modules, the path contains the relative path of the module starting from its parent, and
   // in E/S we're only interested in the path
   // of files and directories.
   // That's why the file path should be null on modules and projects.
   if (filePath != null && !Scopes.PROJECT.equals(scope)) {
     return filePath;
   }
   return null;
 }
 private Map<String, String> keysByUUid(DbSession session, ComponentDto component) {
   Map<String, String> keysByUUid = newHashMap();
   if (Scopes.PROJECT.equals(component.scope())) {
     List<ComponentDto> modulesTree =
         dbClient.componentDao().selectDescendantModules(session, component.uuid());
     for (ComponentDto componentDto : modulesTree) {
       keysByUUid.put(componentDto.uuid(), componentDto.key());
     }
   } else {
     String moduleUuid = component.moduleUuid();
     if (moduleUuid == null) {
       throw new IllegalArgumentException(
           String.format("The component '%s' has no module uuid", component.uuid()));
     }
     ComponentDto module = dbClient.componentDao().selectOrFailByUuid(session, moduleUuid);
     keysByUUid.put(module.uuid(), module.key());
   }
   return keysByUUid;
 }
Example #3
0
 public boolean isRootProject() {
   return moduleUuid == null && Scopes.PROJECT.equals(scope);
 }