public Collection mapFullPath()

in clearcase-server/src/jetbrains/buildServer/buildTriggers/vcs/clearcase/ClearCaseSupport.java [584:616]


  public Collection<String> mapFullPath(@NotNull final VcsRootEntry rootEntry, @NotNull final String fullPath) {
    final ViewPath viewPath;

    try {
      viewPath = getViewPath(rootEntry.getVcsRoot());
    }
    catch (final Exception e) {
      LOG.debug("CC.MapFullPath: View path not defined: " + e.getLocalizedMessage());
      return Collections.emptySet();
    }

    final File viewPathFile = cutOffVobsDir(viewPath.getWholePath(), viewPath);
    if (viewPathFile == null) { // actually impossible
      LOG.debug("CC.MapFullPath: Unknown error");
      return Collections.emptySet();
    }

    final File fullPathFile = cutOffVobsDir(fullPath, viewPath);
    if (fullPathFile == null) {
      LOG.debug("CC.MapFullPath: File \"" + fullPath + "\" is not under view \"" + viewPath.getWholePath() + "\"");
      return Collections.emptySet();
    }

    final String relativePath = getRelativePathIfAncestor(viewPathFile, fullPathFile);
    if (relativePath != null) {
      LOG.debug("CC.MapFullPath: File \"" + fullPathFile.getAbsolutePath() + "\" is under \"" + viewPathFile.getAbsolutePath() + "\" result is \"" + relativePath + "\"");
      return Collections.singleton(relativePath);
    }
    else {
      LOG.debug("CC.MapFullPath: File \"" + fullPathFile.getAbsolutePath() + "\" is not under \"" + viewPathFile.getAbsolutePath() + "\"");
      return Collections.emptySet();
    }
  }