hudson.model.Project.save()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(128)

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

Project.save介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

private void locationChanged(Item item, String oldFullName, String newFullName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for( Project<?,?> p : Jenkins.getInstance().allItems(Project.class) ) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if(t!=null) {
        String cp2 = Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, t.childProjects, p.getParent());
        if (!cp2.equals(t.childProjects)) {
          t.childProjects = cp2;
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldFullName+" to "+newFullName,e);
          }
        }
      }
    }
  }
}

代码示例来源:origin: hudson.plugins/project-inheritance

/**
 * This method serializes this object to offline storage. The default
 * implementation of Jenkins is XML-File based, but that can be
 * overridden herein. Of course, if you override the saving method,
 * you will also have to override the loading method from
 * {@link InheritanceProject.DescriptorImpl}.
 */
@Override
public synchronized void save() throws IOException {
  //Checking if we're marked as transient; which causes no saving to occur
  if (this.isTransient) { return; }
  
  //Invoking the super constructor to save use
  super.save();
  //TODO: Save the version store to disk here
}

代码示例来源:origin: i-m-c/jenkins-inheritance-plugin

/**
 * This method serializes this object to offline storage. The default
 * implementation of Jenkins is XML-File based, but that can be
 * overridden herein. Of course, if you override the saving method,
 * you will also have to override the loading method from
 * {@link InheritanceProject.DescriptorImpl}.
 */
@Override
public synchronized void save() throws IOException {
  //Checking if we're marked as transient; which causes no saving to occur
  if (this.isTransient) { return; }
  
  //Invoking the super constructor to save use
  super.save();
  //TODO: Save the version store to disk here
}

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

@Override
public final boolean setValues(Project<?, ?> project, List<String> list) {
 if (list.isEmpty()) {
  return false;
 }
 for (SonarRunnerBuilder builder : getSonarRunnerBuilders(project)) {
  doSetValue(builder, list.iterator().next());
 }
 try {
  project.save();
 } catch (IOException e) {
  Logger.LOG.throwing(this.getClass().getName(), "setValues", e);
  return false;
 }
 return true;
}

代码示例来源:origin: org.jenkins-ci.plugins/build-pipeline-plugin

@Override
public void onRenamed(final Item item, final String oldName, final String newName) {
  for (final Project<?, ?> p : Jenkins.getInstance().getAllItems(Project.class)) {
    final BuildPipelineTrigger bpTrigger = p.getPublishersList().get(BuildPipelineTrigger.class);
    if (bpTrigger != null) {
      boolean changed = false;
      changed = bpTrigger.onDownstreamProjectRenamed(oldName, newName);
      if (changed) {
        try {
          p.save();
        } catch (final IOException e) {
          Logger.getLogger(ItemListenerImpl.class.getName()).log(Level.SEVERE,
              String.format(Strings.getString("BuildPipelineTrigger.FailedPersistDuringRename_FMT"), //$NON-NLS-1$
                  oldName, newName), e);
        }
      }
    }
  }
}

代码示例来源: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: org.jenkins-ci.main/jenkins-core

private void locationChanged(Item item, String oldFullName, String newFullName) {
    // update BuildTrigger of other projects that point to this object.
    // can't we generalize this?
    for( Project<?,?> p : Jenkins.getInstance().allItems(Project.class) ) {
      BuildTrigger t = p.getPublishersList().get(BuildTrigger.class);
      if(t!=null) {
        String cp2 = Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, t.childProjects, p.getParent());
        if (!cp2.equals(t.childProjects)) {
          t.childProjects = cp2;
          try {
            p.save();
          } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldFullName+" to "+newFullName,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.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: 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.hudsonci.plugins/parameterized-trigger

p.getBuildersList().remove(tb);
  p.save();
} catch (IOException e) {
  Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,

代码示例来源: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);
      }
    }
    
  }
}

代码示例来源:origin: jenkinsci/parameterized-trigger-plugin

p.getBuildersList().remove(tb);
  p.save();
} catch (IOException e) {
  Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,

代码示例来源:origin: jenkinsci/parameterized-trigger-plugin

p.save();
} catch (IOException e) {
  Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,

相关文章