hudson.model.Job.getCascadingProject()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(95)

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

Job.getCascadingProject介绍

[英]Returns selected ccascading project.
[中]返回选定的ccascading项目。

代码示例

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

/**
 * Checks whether current job is inherited from other project.
 * @return boolean.
 */
public boolean hasCascadingProject() {
  return null != getCascadingProject();
}

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

Trigger parentTrigger = findCascadingParentTrigger(job.getCascadingProject(), key);
if (parentTrigger != null) {
  parentTrigger.removeJob(job);
Trigger parentTrigger = findCascadingParentTrigger(job.getCascadingProject(), key);
if (parentTrigger != null) {
  if (!parentTrigger.hasJob(job)) {

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

/**
 * Checks whether current job is inherited from other project.
 *
 * @return boolean.
 */
public boolean hasCascadingProject() {
  return null != getCascadingProject();
}

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

/**
 * Checks whether current job is inherited from other project.
 * @return boolean.
 */
public boolean hasCascadingProject() {
  return null != getCascadingProject();
}

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

/**
 * Checks whether current job is inherited from other project.
 * @return boolean.
 */
public boolean hasCascadingProject() {
  return null != getCascadingProject();
}

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

public void cleanCascading() throws IOException{
  Set<String> cascadingChildrenToRemove = new HashSet();
  for (String cascadingChild : getCascadingChildrenNames()) {
    TopLevelItem tlItem = Hudson.getInstance().getItem(cascadingChild);
    if ((tlItem != null) && getClass().isAssignableFrom(tlItem.getClass())) {
      JobT cascadingChildJob = (JobT) tlItem;
      if (cascadingChildJob.getCascadingProject() != this) {
        cascadingChildrenToRemove.add(cascadingChild);
      }
    }else{
      cascadingChildrenToRemove.add(cascadingChild);
    }
  }
  //390862: Can't delete jobs copied from cascading parent
  if (!cascadingChildrenToRemove.isEmpty()) {
    cascadingChildrenNames.removeAll(cascadingChildrenToRemove);
  }
  //406889: Cleanup the non overridden job properties or properties with no values in config.xml
  save();
}

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

private static Trigger findCascadingParentTrigger(Job parent, String propertyKey) {
  Trigger parentTrigger = null;
  if (parent != null) {
    TriggerProjectProperty parentTriggerProperty = CascadingUtil.getTriggerProjectProperty(parent, propertyKey);
    if (parentTriggerProperty.getValue() != null) {
      parentTrigger = parentTriggerProperty.getValue();
    } else {
      parentTrigger = findCascadingParentTrigger(parent.getCascadingProject(), propertyKey);
    }
  }
  return parentTrigger;
}

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

/**
 * Returns possible cascading parents for current job, which are filtered by type and checked for avoidness cyclic
 * dependency
 *
 * @param type project type.
 * @param currentJob current job instance
 * @param <T> Item
 * @return list of cascading parents.
 */
@SuppressWarnings("unchecked")
public static <T extends Item> List<Job> getCascadingParents(Class<T> type, Job currentJob) {
  Job currentParent = currentJob.getCascadingProject();
  if (type.isInstance(currentParent) && !currentParent.hasPermission(Item.READ)) {
    return Collections.EMPTY_LIST; // user can't see parent so don't let them change it
  }
  List<T> allItems = Hudson.getInstance().getAllItems(type);
  List<Job> result = new ArrayList<Job>(allItems.size());
  for (T item : allItems) {
    Job job = (Job) item;
    if (!StringUtils.equals(currentJob.getName(), job.getName())
      && !hasCyclicCascadingLink(job, currentJob.getCascadingChildrenNames())) {
      result.add(job);
    }
  }
  return result;
}

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

/**
 * Returns possible cascading parents for current job, which are filtered by
 * type and checked for avoidness cyclic dependency
 *
 * @param type project type.
 * @param currentJob current job instance
 * @param <T> Item
 * @return list of cascading parents.
 */
@SuppressWarnings("unchecked")
public static <T extends Item> List<Job> getCascadingParents(Class<T> type, Job currentJob) {
  Job currentParent = currentJob.getCascadingProject();
  if (type.isInstance(currentParent) && !currentParent.hasPermission(Item.READ)) {
    return Collections.EMPTY_LIST; // user can't see parent so don't let them change it
  }
  List<T> allItems = Hudson.getInstance().getAllItems(type);
  List<Job> result = new ArrayList<Job>(allItems.size());
  for (T item : allItems) {
    Job job = (Job) item;
    if (!StringUtils.equals(currentJob.getName(), job.getName())
        && !hasCyclicCascadingLink(job, currentJob.getCascadingChildrenNames())) {
      result.add(job);
    }
  }
  return result;
}

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

/**
 * Returns possible cascading parents for current job, which are filtered by type and checked for avoidness cyclic
 * dependency
 *
 * @param type project type.
 * @param currentJob current job instance
 * @param <T> Item
 * @return list of cascading parents.
 */
@SuppressWarnings("unchecked")
public static <T extends Item> List<Job> getCascadingParents(Class<T> type, Job currentJob) {
  Job currentParent = currentJob.getCascadingProject();
  if (type.isInstance(currentParent) && !currentParent.hasPermission(Item.READ)) {
    return Collections.EMPTY_LIST; // user can't see parent so don't let them change it
  }
  List<T> allItems = Hudson.getInstance().getAllItems(type);
  List<Job> result = new ArrayList<Job>(allItems.size());
  for (T item : allItems) {
    Job job = (Job) item;
    if (!StringUtils.equals(currentJob.getName(), job.getName())
      && !hasCyclicCascadingLink(job, currentJob.getCascadingChildrenNames())) {
      result.add(job);
    }
  }
  return result;
}

代码示例来源:origin: org.hudsonci.plugins/subversion

XmlFile getXmlFile(Job prj) {
  //default behaviour
  File rootDir = prj.getRootDir();
  File credentialFile = new File(rootDir, credentialsFileName);
  if (credentialFile.exists()) {
    return new XmlFile(credentialFile);
  }
  //matrix configuration project
  if (prj instanceof MatrixConfiguration && prj.getParent() != null) {
    ItemGroup parent = prj.getParent();
    return getXmlFile((Job)parent);
  }
  if (prj.hasCascadingProject()) {
    return getXmlFile(prj.getCascadingProject());
  }
  return new XmlFile(new File(rootDir, credentialsFileName));
}

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

@Override
protected void performDelete() throws IOException, InterruptedException {
  // if a build is in progress. Cancel it.
  RunT lb = getLastBuild();
  if (lb != null) {
    Executor e = lb.getExecutor();
    if (e != null) {
      e.interrupt();
      // should we block until the build is cancelled?
    }
  }
  CascadingUtil.unlinkProjectFromCascadingParents(getCascadingProject(), name);
  super.performDelete();
}

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

@Override
protected void performDelete() throws IOException, InterruptedException {
  // if a build is in progress. Cancel it.
  RunT lb = getLastBuild();
  if (lb != null) {
    Executor e = lb.getExecutor();
    if (e != null) {
      e.interrupt();
      // should we block until the build is cancelled?
    }
  }
  CascadingUtil.unlinkProjectFromCascadingParents(getCascadingProject(), name);
  super.performDelete();
}

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

@Override
protected void performDelete() throws IOException, InterruptedException {
  // if a build is in progress. Cancel it.
  RunT lb = getLastBuild();
  if (lb != null) {
    Executor e = lb.getExecutor();
    if (e != null) {
      e.interrupt();
      // should we block until the build is cancelled?
    }
  }
  CascadingUtil.unlinkProjectFromCascadingParents(getCascadingProject(), name);
  super.performDelete();
}

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

@Override
protected void performDelete() throws IOException, InterruptedException {
  // if a build is in progress. Cancel it.
  RunT lb = getLastBuild();
  if (lb != null) {
    Executor e = lb.getExecutor();
    if (e != null) {
      e.interrupt();
      // should we block until the build is cancelled?
    }
  }
  Set<String> cascadingChildren = new HashSet(getCascadingChildrenNames());
  for (String cascadingChild : cascadingChildren) {
    Item item = Hudson.getInstance().getItem(cascadingChild);
    if (item != null && item instanceof Job) {
      Job childJob = (Job) item;
      if (this.equals(childJob.getCascadingProject())) {
        childJob.clearCascadingProject();
      }
    }
  }
  clearCascadingProject();
  cascadingChildrenNames.clear();
  super.performDelete();
}

相关文章

微信公众号

最新文章

更多

Job类方法