Java 类hudson.model.ItemGroup 实例源码

项目:yaml-project-plugin    文件:YamlBuild.java   
private void deleteWorkspaceRecursive(AbstractProject project)
    throws IOException {
  final AbstractBuild build = project.getLastBuild();
  if (build != null) {
    final FilePath workspace = build.getWorkspace();
    if (workspace != null) {
      try {
        workspace.deleteRecursive();
      } catch (InterruptedException e) {
        throw new IOException(e);
      }
    }
  }

  if (project instanceof ItemGroup) {
    deleteWorkspacesRecursive((ItemGroup) project);
  }
}
项目:yaml-project-plugin    文件:AbstractBranchAwareProject.java   
/** Fetch the branch of the project. */
public Branch getBranch() {
  if (isDelegate()) {
    final ItemGroup parent = getParent();
    // If we are a delegate, defer to our project context for our Branch
    // since it provides the complete version.
    // NOTE: A delegate SCM is only an option for projects contained
    // within an AbstractBranchAwareProject, so validate this invariant.
    checkState(parent instanceof AbstractBranchAwareProject);
    final AbstractBranchAwareProject parentProject =
        (AbstractBranchAwareProject) parent;
    return parentProject.getBranch();
  } else {
    // If we are not a delegate, than the branch we store is accurate.
    return checkNotNull(branch);
  }
}
项目:yaml-project-plugin    文件:DelegateSCM.java   
/**
 * Walk the ancestors of the current project to identify from which
 * project we inherit our {@link SCM}.
 *
 * @param project The project that is consuming this {@link DelegateSCM}
 * @return The project from which to inherit our actual {@link SCM}
 */
private T getParentProject(AbstractProject project) {
  // We expect this SCM to be shared by 1 or more layers beneath a project
  // matching our clazz, from which we inherit our source context.
  // NOTE: multiple layers are possible with a matrix job, for example.
  checkArgument(this == project.getScm());

  // Some configuration, e.g. MatrixProject/MatrixConfiguration
  // have several layers of project that we need to walk through
  // get to the real container.  Walk through all of the projects
  // that share this SCM to find the AbstractBranchAwareProject
  // that contains this and assigned this sub-project the DelegateSCM.
  AbstractProject cursor = project;
  do {
    ItemGroup parent = cursor.getParent();
    // We are searching for a project, so at any point in time our
    // container must remain a project.  Validate the cast.
    checkState(parent instanceof AbstractProject);
    cursor = (AbstractProject) parent;
  } while (this == cursor.getScm());

  // Validate that the container we ultimately find matches our
  // expected container type before casting and returning it.
  checkState(clazz.isInstance(cursor));
  return clazz.cast(cursor);
}
项目:yaml-project-plugin    文件:JobHistoryViewTest.java   
@Test
public void testGetItems() throws Exception {
  List<TopLevelItem> list = ImmutableList.of(mockItem, mockItem);
  when(mockItemGroup.getItems()).thenReturn(list);
  JobHistoryView underTest = new JobHistoryView() {
      @Override
      public ItemGroup getOwnerItemGroup() {
        return mockItemGroup;
      }
    };

  assertEquals(list, underTest.getItems());

  verify(mockItemGroup, times(1)).getItems();
  verifyNoMoreInteractions(mockItemGroup);
  verifyNoMoreInteractions(mockItem);
}
项目:yaml-project-plugin    文件:LastProjectViewTest.java   
@Test
public void testGetItems() throws Exception {
  List<TopLevelItem> list = ImmutableList.of(mockItem, mockItem);
  when(mockItemGroup.getItems()).thenReturn(list);
  LastProjectView underTest = new LastProjectView() {
      @Override
      public ItemGroup getOwnerItemGroup() {
        return mockItemGroup;
      }
    };

  assertEquals(0, underTest.getItems().size());

  verifyNoMoreInteractions(mockItemGroup);
  verifyNoMoreInteractions(mockItem);
}
项目:gitlab-plugin    文件:ActionResolver.java   
private Item resolveProject(final String projectName, final Iterator<String> restOfPathParts) {
    return ACLUtil.impersonate(ACL.SYSTEM, new ACLUtil.Function<Item>() {
        public Item invoke() {
            final Jenkins jenkins = Jenkins.getInstance();
            if (jenkins != null) {
                Item item = jenkins.getItemByFullName(projectName);
                while (item instanceof ItemGroup<?> && !(item instanceof Job<?, ?> || item instanceof SCMSourceOwner) && restOfPathParts.hasNext()) {
                    item = jenkins.getItem(restOfPathParts.next(), (ItemGroup<?>) item);
                }
                if (item instanceof Job<?, ?> || item instanceof SCMSourceOwner) {
                    return item;
                }
            }
            LOGGER.log(Level.FINE, "No project found: {0}, {1}", toArray(projectName, Joiner.on('/').join(restOfPathParts)));
            return null;
        }
    });
}
项目:docker-plugin    文件:DockerTemplateBase.java   
public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {

            AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
            if (!ac.hasPermission(Jenkins.ADMINISTER)) {
                return new ListBoxModel();
            }

            return new SSHUserListBoxModel().withMatching(
                    SSHAuthenticator.matcher(Connection.class),
                    CredentialsProvider.lookupCredentials(
                            StandardUsernameCredentials.class,
                            context,
                            ACL.SYSTEM,
                            SSHLauncher.SSH_SCHEME)
            );
        }
项目:DotCi    文件:DynamicSubProject.java   
@Override
public void onLoad(final ItemGroup<? extends Item> parent, final String name) throws IOException {
    try {
        final Field parentField = AbstractItem.class.getDeclaredField("parent");
        parentField.setAccessible(true);
        ReflectionUtils.setField(parentField, this, parent);
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }

    doSetName(name);
    if (this.transientActions == null) {
        this.transientActions = new Vector<>();
    }
    updateTransientActions();
    getBuildersList().setOwner(this);
    getPublishersList().setOwner(this);
    getBuildWrappersList().setOwner(this);

    initRepos();
}
项目:jenkins-inheritance-plugin    文件:RelatedProjectView.java   
@Override
public Item doCreateItem(StaplerRequest req, StaplerResponse rsp)
        throws IOException, ServletException {
    //First, we just create this item
    Item item = null;
    ItemGroup<? extends TopLevelItem> ig = getOwnerItemGroup();
       if (ig instanceof ModifiableItemGroup)
           item = ((ModifiableItemGroup<? extends TopLevelItem>)ig).doCreateItem(req, rsp);

       //Checking if we deal with an inheritable job
       if (item == null || !(item instanceof InheritanceProject)) {
        return item;
       }
       //If we deal with an inheritable project, we assign it to the currently
       //viewed creation class, if any
       InheritanceProject ip = (InheritanceProject) item;
       //Checking if we define a CC
       if (!this.creationClassFilter.isEmpty()) {
        ip.setCreationClass(this.creationClassFilter);
       }
       return item;
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * This method restores transient fields that could not be deserialized.
 * Do note that there is no guaranteed order of deserialization, so
 * don't expect other objects to be present, when this method is called.
 */
@Override
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
    //Creating & clearing buffers, if necessary
    createBuffers();
    clearBuffers(null);

    /* We need to create a dummy version store first, as we can't get the
     * project root directory before super() is executed (as no name is
     * set yet); but that one needs a version store available to load
     * certain values reliably without a null pointer access.
     */
    this.versionStore = new VersionedObjectStore();

    //Then loading the elements defined in the parent
    //TODO: What to do if a transient job is attempted to be loaded?
    super.onLoad(parent, name);

    //Loading the correct version store
    this.versionStore = this.loadVersionedObjectStore();

    //And clearing the buffers again, as a new job with new props is available
    clearBuffers(null);
}
项目:delivery-pipeline-plugin    文件:ProjectUtil.java   
public static List<AbstractProject> getProjectList(String projects, ItemGroup context, EnvVars env) {
    List<AbstractProject> projectList = new ArrayList<>();

    // expand variables if applicable
    StringBuilder projectNames = new StringBuilder();
    StringTokenizer tokens = new StringTokenizer(projects, ",");
    while (tokens.hasMoreTokens()) {
        if (projectNames.length() > 0) {
            projectNames.append(',');
        }
        projectNames.append(env != null ? env.expand(tokens.nextToken().trim()) : tokens.nextToken().trim());
    }

    projectList.addAll(Items.fromNameList(context, projectNames.toString(), AbstractProject.class));
    return projectList;
}
项目:delivery-pipeline-plugin    文件:BPPManualTrigger.java   
@Override
public void triggerManual(AbstractProject<?, ?> project, AbstractProject<?, ?> upstream, String buildId,
                          ItemGroup<? extends TopLevelItem> itemGroup) throws TriggerException {
    StandardBuildCard buildCard = new StandardBuildCard();

    if (upstream != null && upstream.getBuild(buildId) != null) {

        try {
            buildCard.triggerManualBuild(itemGroup, Integer.parseInt(buildId),
                    project.getRelativeNameFrom(itemGroup),
                    upstream.getRelativeNameFrom(itemGroup));
        } catch (Exception e) {
            throw new TriggerException("Could not trigger", e);
        }
    } else {
        throw new TriggerException("Could not find build: " + buildId + " for project: " + upstream);
    }
}
项目:delivery-pipeline-plugin    文件:DownstreamPipeline.java   
@Override
public List<Pipeline> createPipelineLatest(int noOfPipelines,
                                           ItemGroup context,
                                           boolean pagingEnabled,
                                           boolean showChanges,
                                           Component component) throws PipelineException {
    List<AbstractProject> firstProjects = ProjectUtil.getStartUpstreams(getFirstProject());
    List<AbstractBuild> builds = resolveBuilds(firstProjects);

    //TODO check if in queue

    int totalNoOfPipelines = builds.size();
    component.setTotalNoOfPipelines(totalNoOfPipelines);
    int startIndex = getStartIndex(component, pagingEnabled, noOfPipelines);
    int retrieveSize = calculateRetreiveSize(component, pagingEnabled, noOfPipelines, totalNoOfPipelines);

    return getPipelines(builds.listIterator(startIndex), context, startIndex, retrieveSize, showChanges);
}
项目:delivery-pipeline-plugin    文件:Pipeline.java   
void setAggregatedChanges(ItemGroup context, List<Stage> pipelineStages) {
    // We use size() - 1 because last stage's changelog can't be calculated against next stage (no such)
    for (int i = 0; i < pipelineStages.size() - 1; i++) {
        Stage stage = pipelineStages.get(i);
        Stage nextStage = pipelineStages.get(i + 1);

        final AbstractBuild nextBuild = nextStage.getHighestBuild(firstProject, context, Result.SUCCESS);

        Set<Change> changes = new LinkedHashSet<>();

        AbstractBuild build = stage.getHighestBuild(firstProject, context, Result.SUCCESS);
        for (; build != null && build != nextBuild; build = build.getPreviousBuild()) {
            changes.addAll(Change.getChanges(build));
        }

        stage.setChanges(changes);
    }
}
项目:delivery-pipeline-plugin    文件:Task.java   
public Task getLatestTask(ItemGroup context, AbstractBuild firstBuild) {
    AbstractProject<?, ?> project = getProject(this, context);
    AbstractBuild<?, ?> build = null;
    if (!ProjectUtil.isQueued(project, firstBuild)) {
        build = BuildUtil.match(project.getBuilds(), firstBuild);
    }

    final Status taskStatus = SimpleStatus.resolveStatus(project, build, firstBuild);
    final ManualStep manualStep = ManualStep.getManualStepLatest(project, build, firstBuild);

    return new Task(this,
                    resolveTaskName(project, getExpandedName(build)),
                    resolveBuildId(taskStatus, build),
                    taskStatus,
                    resolveTaskLink(taskStatus, build),
                    manualStep,
                    TestResult.getResults(build),
                    StaticAnalysisResult.getResults(build),
                    getBuildDescription(build));
}
项目:delivery-pipeline-plugin    文件:Task.java   
public Task getAggregatedTask(AbstractBuild versionBuild, ItemGroup context) {
    AbstractProject<?, ?> taskProject = getProject(this, context);
    AbstractBuild<?, ?> build = BuildUtil.match(taskProject.getBuilds(), versionBuild);

    final Status taskStatus = SimpleStatus.resolveStatus(taskProject, build, null);
    final ManualStep manualStep = this.getManualStep();

    return new Task(this,
                    resolveTaskName(project, getExpandedName(build)),
                    resolveBuildId(taskStatus, build),
                    taskStatus,
                    resolveTaskLink(taskStatus, build),
                    manualStep,
                    TestResult.getResults(build),
                    StaticAnalysisResult.getResults(build),
                    getBuildDescription(build));
}
项目:delivery-pipeline-plugin    文件:Stage.java   
@CheckForNull
public AbstractBuild getHighestBuild(AbstractProject firstProject, ItemGroup context, Result minResult) {
    int highest = -1;
    for (Task task : getTasks()) {
        AbstractProject project = ProjectUtil.getProject(task.getId(), context);
        AbstractBuild firstBuild = getFirstUpstreamBuild(project, firstProject, minResult);
        if (firstBuild != null && firstBuild.getNumber() > highest) {
            highest = firstBuild.getNumber();
        }
    }

    if (highest > 0) {
        return firstProject.getBuildByNumber(highest);
    } else {
        return null;
    }
}
项目:openshift-sync-plugin    文件:PipelineJobListener.java   
public void upsertItem(Item item) {
    if (item instanceof WorkflowJob) {
        upsertWorkflowJob((WorkflowJob) item);
    } else if (item instanceof ItemGroup) {
        upsertItemGroup((ItemGroup) item);
    }
}
项目:openshift-sync-plugin    文件:PipelineJobListener.java   
private void upsertItemGroup(ItemGroup itemGroup) {
    Collection items = itemGroup.getItems();
    if (items != null) {
        for (Object child : items) {
            if (child instanceof WorkflowJob) {
                upsertWorkflowJob((WorkflowJob) child);
            } else if (child instanceof ItemGroup) {
                upsertItemGroup((ItemGroup) child);
            }
        }
    }
}
项目:pipeline-maven-plugin    文件:WithMavenStep.java   
@Restricted(NoExternalUse.class) // Only for UI calls
public ListBoxModel doFillMavenSettingsConfigItems(@AncestorInPath ItemGroup context) {
    ListBoxModel r = new ListBoxModel();
    r.add("--- Use system default settings or file path ---",null);
    for (Config config : ConfigFiles.getConfigsInContext(context, MavenSettingsConfigProvider.class)) {
        r.add(config.name, config.id);
    }
    return r;
}
项目:pipeline-maven-plugin    文件:WithMavenStep.java   
@Restricted(NoExternalUse.class) // Only for UI calls
public ListBoxModel doFillGlobalMavenSettingsConfigItems(@AncestorInPath ItemGroup context) {
    ListBoxModel r = new ListBoxModel();
    r.add("--- Use system default settings or file path ---",null);
    for (Config config : ConfigFiles.getConfigsInContext(context, GlobalMavenSettingsConfigProvider.class)) {
        r.add(config.name, config.id);
    }
    return r;
}
项目:pipeline-maven-plugin    文件:DatabaseSyncItemListener.java   
public void onRenamed(WorkflowJob pipeline, String oldName, String newName) {
    LOGGER.log(Level.FINE, "onRenamed({0}, {1}, {2})", new Object[]{pipeline, oldName, newName});

    String oldFullName;
    ItemGroup parent = pipeline.getParent();
    if (parent.equals(Jenkins.getInstance())) {
        oldFullName = oldName;
    } else {
        oldFullName = parent.getFullName() + "/" + oldName;
    }
    String newFullName = pipeline.getFullName();
    GlobalPipelineMavenConfig.getDao().renameJob(oldFullName, newFullName);
}
项目:parameter-pool-plugin    文件:ParameterPoolBuilder.java   
/**
 * Autocompletion method
 *
 * Copied from hudson.tasks.BuildTrigger.doAutoCompleteChildProjects(String value)
 *
 * @param value
 * @return
 */
public AutoCompletionCandidates doAutoCompleteProjects(@QueryParameter String value, @AncestorInPath ItemGroup context) {
    AutoCompletionCandidates candidates = new AutoCompletionCandidates();
    List<Job> jobs = Jenkins.getInstance().getAllItems(Job.class);
    for (Job job: jobs) {
        String relativeName = job.getRelativeNameFrom(context);
        if (relativeName.startsWith(value)) {
            if (job.hasPermission(Item.READ)) {
                candidates.add(relativeName);
            }
        }
    }
    return candidates;
}
项目:yet-another-docker-plugin    文件:DockerRegistryCredential.java   
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    List<DockerRegistryAuthCredentials> credentials =
            CredentialsProvider.lookupCredentials(DockerRegistryAuthCredentials.class, context, ACL.SYSTEM,
                    Collections.emptyList());

    return new CredentialsListBoxModel()
            .includeEmptyValue()
            .withMatching(CredentialsMatchers.always(), credentials);
}
项目:yet-another-docker-plugin    文件:DockerPullImage.java   
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    List<DockerRegistryAuthCredentials> credentials =
            CredentialsProvider.lookupCredentials(DockerRegistryAuthCredentials.class, context, ACL.SYSTEM,
                    Collections.<DomainRequirement>emptyList());

    return new StandardListBoxModel().withEmptySelection()
            .withMatching(CredentialsMatchers.instanceOf(DockerRegistryAuthCredentials.class), credentials);
}
项目:yet-another-docker-plugin    文件:DockerCreateContainer.java   
public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    return new SSHUserListBoxModel().withMatching(
            SSHAuthenticator.matcher(Connection.class),
            CredentialsProvider.lookupCredentials(
                    StandardUsernameCredentials.class,
                    context,
                    ACL.SYSTEM,
                    SSHLauncher.SSH_SCHEME)
    );
}
项目:yet-another-docker-plugin    文件:DockerConnector.java   
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    List<StandardCredentials> credentials =
            CredentialsProvider.lookupCredentials(StandardCredentials.class, context, ACL.SYSTEM,
                    Collections.emptyList());

    return new CredentialsListBoxModel()
            .withEmptySelection()
            .withMatching(CredentialsMatchers.always(), credentials);
}
项目:aws-credentials-plugin    文件:AWSCredentialsHelper.java   
@CheckForNull
public static AmazonWebServicesCredentials getCredentials(@Nullable String credentialsId, ItemGroup context) {
    if (StringUtils.isBlank(credentialsId)) {
        return null;
    }
    return (AmazonWebServicesCredentials) CredentialsMatchers.firstOrNull(
            CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class, context,
                    ACL.SYSTEM, Collections.EMPTY_LIST),
            CredentialsMatchers.withId(credentialsId));
}
项目:aws-credentials-plugin    文件:AWSCredentialsHelper.java   
public static ListBoxModel doFillCredentialsIdItems(ItemGroup context) {
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.always(),
                    CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class,
                            context,
                            ACL.SYSTEM,
                            Collections.EMPTY_LIST));
}
项目:multi-branch-project-plugin    文件:SelectJobsBallColorFolderIcon.java   
/**
 * Form validation method.  Similar to
 * {@link hudson.tasks.BuildTrigger.DescriptorImpl#doCheck(AbstractProject, String)}.
 *
 * @param folder the folder being configured
 * @param value  the user-entered value
 * @return validation result
 */
public FormValidation doCheck(@AncestorInPath AbstractFolder folder, @QueryParameter String value) {
    // Require CONFIGURE permission on this project
    if (!folder.hasPermission(Item.CONFIGURE)) {
        return FormValidation.ok();
    }

    boolean hasJobs = false;

    StringTokenizer tokens = new StringTokenizer(Util.fixNull(value), ",");
    while (tokens.hasMoreTokens()) {
        String jobName = tokens.nextToken().trim();

        if (StringUtils.isNotBlank(jobName)) {
            Item item = Jenkins.getActiveInstance().getItem(jobName, (ItemGroup) folder, Item.class);

            if (item == null) {
                Job nearest = Items.findNearest(Job.class, jobName, folder);
                String alternative = nearest != null ? nearest.getRelativeNameFrom((ItemGroup) folder) : "?";
                return FormValidation.error(
                        hudson.tasks.Messages.BuildTrigger_NoSuchProject(jobName, alternative));
            }

            if (!(item instanceof Job)) {
                return FormValidation.error(hudson.tasks.Messages.BuildTrigger_NotBuildable(jobName));
            }

            hasJobs = true;
        }
    }

    if (!hasJobs) {
        return FormValidation.error(hudson.tasks.Messages.BuildTrigger_NoProjectSpecified());
    }

    return FormValidation.ok();
}
项目:yaml-project-plugin    文件:AbstractRestriction.java   
/**
 * @return the {@link ClassLoader} on top of which to layer our restrictions.
 */
protected final ClassLoader getBaseClassLoader(RestrictedProject project) {
  // Search the project's parent hierarchy for additional
  // restricted projects on which to base our restrictions.
  ItemGroup parent = project.asProject().getParent();
  while (parent != null) {
    if (parent instanceof RestrictedProject) {
      final RestrictedProject parentProject = (RestrictedProject) parent;
      return parentProject.getRestriction().getClassLoader(parentProject);
    }
    if (!(parent instanceof AbstractItem)) {
      break;
    }
    parent = ((AbstractItem) parent).getParent();
  }

  // If no parents of this are restricted, then base things on the
  // unrestricted uber class loader.
  // NOTE: we wrap this class loader anyways to surface diagnostics
  // when there are actual class loading failures, so we can surface
  // them to the user.
  final ClassLoader base =
      checkNotNull(Jenkins.getInstance()).getPluginManager().uberClassLoader;
  return new ClassLoader() {
    @Override
    public Class loadClass(String name) throws ClassNotFoundException {
      try {
        return base.loadClass(name);
      } catch (ClassNotFoundException e) {
        throw new BadTypeException(
            Messages.AbstractRestriction_ClassNotFound(name));
      }
    }
  };
}
项目:yaml-project-plugin    文件:YamlProject.java   
/**
 * Build up our Yaml project shell, which gets populated in
 * {@link #submit(StaplerRequest, StaplerResponse)}.
 */
public YamlProject(ItemGroup parent, String name,
    @Nullable YamlModule module) throws IOException {
  super(parent, name);
  this.module = (module != null) ? module : new YamlModule();

  this.yamlPath = DEFAULT_YAML;
}
项目:yaml-project-plugin    文件:YamlProject.java   
/** {@inheritDoc} */
@Override
public YamlProject newInstance(ItemGroup parent, String name) {
  try {
    return new YamlProject(parent, name, null /* module */);
  } catch (IOException e) {
    throw new IllegalStateException(e);
  }
}
项目:yaml-project-plugin    文件:YamlBuild.java   
private void deleteWorkspacesRecursive(ItemGroup<? extends Item> itemGroup)
    throws IOException {
  for (Item item : itemGroup.getItems()) {
    if (item instanceof AbstractProject) {
      deleteWorkspaceRecursive((AbstractProject) item);
    } else if (item instanceof ItemGroup) {
      deleteWorkspacesRecursive((ItemGroup) item);
    }
  }
}
项目:yaml-project-plugin    文件:YamlMultiBranchProject.java   
/**
 * Build up our Yaml multibranch project shell, which gets populated in
 * {@link #submit(StaplerRequest, StaplerResponse)}.
 */
public YamlMultiBranchProject(ItemGroup parent, String name) {
  super(parent, name);

  // By default, clean up branches that have been deleted.
  DefaultDeadBranchStrategy deadBranchStrategy =
      new DefaultDeadBranchStrategy(
          true /* prune dead branches */,
          "0" /* days to keep */,
          "0" /* num to keep */);

  // Monkey patch the better default.
  // TODO(mattmoor): upstream making the "deadBranchStrategy"
  // field protected instead of patching the object to set it here.
  {
    Class<?> clazz = YamlMultiBranchProject.class.getSuperclass();
    Field field = null;
    for (Field iter : clazz.getDeclaredFields()) {
      if ("deadBranchStrategy".equals(iter.getName())) {
        field = iter;
        break;
      }
    }
    if (field == null) {
      throw new IllegalStateException(
          "deadBranchStrategy field missing from MultiBranchProject");
    }
    try {
      field.setAccessible(true);
      field.set(this, deadBranchStrategy);
    } catch (IllegalAccessException e) {
      // Impossible, we have given ourselves access.
    }
  }
  deadBranchStrategy.setOwner(this);
}
项目:yaml-project-plugin    文件:AbstractRunnableItemGroup.java   
/**
 * Build up our Yaml project shell, which gets populated in
 * {@link #submit(StaplerRequest, StaplerResponse)}.
 */
public AbstractRunnableItemGroup(ItemGroup parent, String name)
    throws IOException {
  super(parent, name);
  this.projects = Maps.newHashMap();

  init();
}
项目:yaml-project-plugin    文件:AbstractRunnableItemGroup.java   
/** {@inheritDoc} */
@Override
public void onLoad(ItemGroup<? extends Item> parent, String name)
    throws IOException {
  super.onLoad(parent, name);
  getPublishersList().setOwner(this);
  getBuildWrappersList().setOwner(this);

  this.projects = loadChildren(this, getJobsDir(), KEYED_BY_NAME);
  init();
}
项目:yaml-project-plugin    文件:DelegateSCM.java   
/**
 * Find the nearest {@link AbstractBranchAwareProject} containing the
 * project to which the candidate project is descended, or null.
 */
@Nullable private AbstractBranchAwareProject getContainer(
    AbstractProject project) {
  // Determine whether we are a child of an AbstractBranchAwareProject
  AbstractProject cursor = project;
  do {
    ItemGroup parent = cursor.getParent();
    if (!(parent instanceof AbstractProject)) {
      return null;
    }
    cursor = (AbstractProject) parent;
  } while (!(cursor instanceof AbstractBranchAwareProject));

  return (AbstractBranchAwareProject) cursor;
}
项目:yaml-project-plugin    文件:AbstractRunnableItemGroupTest.java   
public TestImpl(ItemGroup parent, String name, ViewsTabBar tabBar,
    List<View> views, ViewGroupMixIn mixIn) throws IOException {
  super(parent, name);

  this.viewsTabBar = tabBar;
  this.views = views;
  views.add(new AllView("foo", this));

  this.primaryViewName = PRIMARY_VIEW_NAME;

  super.init();
  this.viewGroupMixIn = mixIn;
}