コード例 #1
0
 /** {@inheritDoc} */
 @CheckForNull
 public SCMSource getSCMSource(@CheckForNull String sourceId) {
   for (SCMSource source : getSCMSources()) {
     if (source.getId().equals(sourceId)) {
       return source;
     }
   }
   return nullSCMSource;
 }
コード例 #2
0
  /**
   * Creates a {@link Branch} for a specific {@link SCMSource} and {@link SCMHead}.
   *
   * @param source the {@link SCMSource}
   * @param head the {@link SCMHead}.
   * @return the {@link Branch}
   */
  @NonNull
  private Branch newBranch(@NonNull SCMSource source, @NonNull SCMHead head) {
    source.getClass(); // throw NPE if null
    head.getClass(); // throw NPE if null

    String sourceId = source.getId();
    if (NullSCMSource.ID.equals(sourceId)) {
      return new Branch.Dead(head, Collections.<BranchProperty>emptyList());
    } else {
      final BranchPropertyStrategy strategy = getBranchPropertyStrategy(source);
      return new Branch(
          sourceId,
          head,
          source.build(head),
          strategy != null
              ? strategy.getPropertiesFor(head)
              : Collections.<BranchProperty>emptyList());
    }
  }