Beispiel #1
0
  /**
   * Search for the enabled version of the given application.
   *
   * @param name the application name
   * @param target an option supply from admin command, it's retained for compatibility with other
   *     releases
   * @return the enabled version of the application, if exists
   * @throws VersioningSyntaxException if getUntaggedName throws an exception
   */
  public final String getEnabledVersion(String name, String target)
      throws VersioningSyntaxException {

    String untaggedName = VersioningUtils.getUntaggedName(name);
    List<String> allVersions = getAllversions(untaggedName, target);

    if (allVersions != null) {
      Iterator it = allVersions.iterator();

      while (it.hasNext()) {
        String app = (String) it.next();

        // if a version of the app is enabled
        if (domain.isAppEnabledInTarget(app, target)) {
          return app;
        }
      }
    }
    // no enabled version found
    return null;
  }