hudson.model.Hudson.isUpgradedFromBefore()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中hudson.model.Hudson.isUpgradedFromBefore()方法的一些代码示例,展示了Hudson.isUpgradedFromBefore()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.isUpgradedFromBefore()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:isUpgradedFromBefore

Hudson.isUpgradedFromBefore介绍

[英]Returns true if the current running Hudson is upgraded from a version earlier than the specified version.

This method continues to return true until the system configuration is saved, at which point #version will be overwritten and Hudson forgets the upgrade history.

To handle SNAPSHOTS correctly, pass in "1.N." to test if it's upgrading from the version equal or younger than N. So say if you implement a feature in 1.301 and you want to check if the installation upgraded from pre-1.301, pass in "1.300."
[中]如果当前运行的Hudson从早于指定版本的版本升级,则返回true。
此方法继续返回true,直到保存系统配置,此时#版本将被覆盖,Hudson将忘记升级历史。
要正确处理快照,请传入“1.N.”以测试它是否从等于或小于N的版本升级。因此,如果您在1.301中实现了一项功能,并且希望检查安装是否从1.301之前的版本升级,请传入“1.300.

代码示例

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Due to HUDSON-2324, we want to inject Item.READ permission to everyone who has Hudson.READ,
 * to remain backward compatible.
 * @param grantedPermissions
 */
/*package*/ static boolean migrateHudson2324(Map<Permission,Set<String>> grantedPermissions) {
  boolean result = false;
  if(Hudson.getInstance().isUpgradedFromBefore(new VersionNumber("1.300.*"))) {
    Set<String> f = grantedPermissions.get(Hudson.READ);
    if (f!=null) {
      Set<String> t = grantedPermissions.get(Item.READ);
      if (t!=null)
        result = t.addAll(f);
      else {
        t = new HashSet<String>(f);
        result = true;
      }
      grantedPermissions.put(Item.READ,t);
    }
  }
  return result;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Due to HUDSON-2324, we want to inject Item.READ permission to everyone who has Hudson.READ,
 * to remain backward compatible.
 * @param grantedPermissions
 */
/*package*/ static boolean migrateHudson2324(Map<Permission,Set<String>> grantedPermissions) {
  boolean result = false;
  if(Hudson.getInstance().isUpgradedFromBefore(new VersionNumber("1.300.*"))) {
    Set<String> f = grantedPermissions.get(Hudson.READ);
    if (f!=null) {
      Set<String> t = grantedPermissions.get(Item.READ);
      if (t!=null)
        result = t.addAll(f);
      else {
        t = new HashSet<String>(f);
        result = true;
      }
      grantedPermissions.put(Item.READ,t);
    }
  }
  return result;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Due to HUDSON-2324, we want to inject Item.READ permission to everyone who has Hudson.READ,
 * to remain backward compatible.
 * @param grantedPermissions
 */
/*package*/ static boolean migrateHudson2324(Map<Permission,Set<String>> grantedPermissions) {
  boolean result = false;
  if(Hudson.getInstance().isUpgradedFromBefore(new VersionNumber("1.300.*"))) {
    Set<String> f = grantedPermissions.get(Hudson.READ);
    if (f!=null) {
      Set<String> t = grantedPermissions.get(Item.READ);
      if (t!=null)
        result = t.addAll(f);
      else {
        t = new HashSet<String>(f);
        result = true;
      }
      grantedPermissions.put(Item.READ,t);
    }
  }
  return result;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Due to HUDSON-2324, we want to inject Item.READ permission to everyone
 * who has Hudson.READ, to remain backward compatible.
 *
 * @param grantedPermissions
 */
/*package*/ static boolean migrateHudson2324(Map<Permission, Set<String>> grantedPermissions) {
  boolean result = false;
  // Hudson may not be initialized yet in case of Initial Setup
  if (Hudson.getInstance() == null) {
    return false;
  }
  if (Hudson.getInstance().isUpgradedFromBefore(new VersionNumber("1.300.*"))) {
    Set<String> f = grantedPermissions.get(Hudson.READ);
    if (f != null) {
      Set<String> t = grantedPermissions.get(Item.READ);
      if (t != null) {
        result = t.addAll(f);
      } else {
        t = new HashSet<String>(f);
        result = true;
      }
      grantedPermissions.put(Item.READ, t);
    }
  }
  return result;
}

相关文章

Hudson类方法