class OrientMaven2BrowseNodeGenerator extends ComponentPathBrowseNodeGenerator {

  @Override
  public List<BrowsePaths> computeComponentPaths(final Asset asset, final Component component) {
    List<String> pathParts = new ArrayList<>();

    if (!Strings2.isBlank(component.group())) {
      pathParts.addAll(Splitter.on('.').omitEmptyStrings().splitToList(component.group()));
    }

    pathParts.add(component.name());

    List<BrowsePaths> paths = BrowsePaths.fromPaths(pathParts, true);

    if (!Strings2.isBlank(component.version())) {
      String baseVersion = component.attributes().child("maven2").get("baseVersion", String.class);
      //the request path should be as expected by maven, so that security is applied properly, hence we use the
      //same path for both nodes added below
      String requestPath = paths.get(paths.size() - 1).getRequestPath() + baseVersion + SLASH;
      if (!component.version().equals(baseVersion)) {
        // Put the SNAPSHOT version (baseVersion) before the component version in the tree.
        BrowsePaths.appendPath(paths, baseVersion, requestPath);
      }
      BrowsePaths.appendPath(paths, component.version(), requestPath);
    }

    return paths;
  }

}