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

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

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

Hudson.getProjects介绍

[英]Gets the list of all the projects.

Since Project can only show up under Hudson, no need to search recursively.
[中]获取所有项目的列表。
由于该项目只能显示在Hudson下,所以无需递归搜索。

代码示例

代码示例来源:origin: org.hudsonci.plugins/downstream-ext

@Override
public void onRenamed(Item item, String oldName, String newName) {
  // update DownstreamTrigger of other projects that point to this object.
  // can't we generalize this?
  for( Project<?,?> p : Hudson.getInstance().getProjects() ) {
    DownstreamTrigger t = p.getPublishersList().get(DownstreamTrigger.class);
    if(t!=null) {
      if(t.onJobRenamed(oldName,newName)) {
        try {
          p.save();
        } catch (IOException e) {
          LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e);
        }
      }
    }
  }
}

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

@Override
  public void onRenamed(Item item, String oldName, String newName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for( Project<?,?> p : Hudson.getInstance().getProjects() ) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if(t!=null) {
        if(t.onJobRenamed(oldName,newName)) {
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e);
          }
        }
      }
    }
  }
}

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

@Override
  public void onRenamed(Item item, String oldName, String newName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for( Project<?,?> p : Hudson.getInstance().getProjects() ) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if(t!=null) {
        if(t.onJobRenamed(oldName,newName)) {
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e);
          }
        }
      }
    }
  }
}

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

@Override
  public void onRenamed(Item item, String oldName, String newName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for (Project<?, ?> p : Hudson.getInstance().getProjects()) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if (t != null) {
        if (t.onJobRenamed(oldName, newName)) {
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from " + oldName + " to " + newName, e);
          }
        }
      }
    }
  }
}

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

@Override
  public void onRenamed(Item item, String oldName, String newName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for( Project<?,?> p : Hudson.getInstance().getProjects() ) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if(t!=null) {
        if(t.onJobRenamed(oldName,newName)) {
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e);
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.hudsonci.plugins/parameterized-trigger

@Override
public void onDeleted(Item item) {
  for (Project<?,?> p : Hudson.getInstance().getProjects()) {
    String oldName = item.getName();
    boolean changed = false;

代码示例来源:origin: org.hudsonci.plugins/parameterized-trigger

@Override
public void onRenamed(Item item, String oldName, String newName) {
  for (Project<?,?> p : Hudson.getInstance().getProjects()) {
    boolean changed = false;
    //iterate over post build triggers
    BuildTrigger bt = p.getPublishersList().get(BuildTrigger.class);
    if (bt != null) {
      for (BuildTriggerConfig c : bt.getConfigs()){
        changed |= c.onJobRenamed(oldName, newName);
      }
    }
    //iterate over build step triggers
    TriggerBuilder tb = p.getBuildersList().get(TriggerBuilder.class);
    if (tb != null) {
      for (BuildTriggerConfig co : tb.getConfigs()){
        changed |= co.onJobRenamed(oldName, newName);
      }
    }
    //if something changed, save the project
    if (changed){
        try {
        p.save();
      } catch (IOException e) {
        Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,
            "Failed to persist project setting during rename from "+oldName+" to "+newName, e);
      }
    }
    
  }
}

相关文章

Hudson类方法