Skip to content
Permalink
Browse files

[JENKINS-43507] Documenting SCMHeadAuthority

  • Loading branch information...
stephenc committed May 3, 2017
1 parent 6c581b0 commit 0978e5df727681f3d8fa0f134dbaacfc7228e452
@@ -4,9 +4,10 @@
import hudson.Extension;
import hudson.scm.SCM;
import hudson.util.ListBoxModel;
import jenkins.scm.api.trait.SCMBuilder;
import jenkins.scm.api.SCMHead;
import jenkins.scm.api.SCMHeadCategory;
import jenkins.scm.api.SCMRevision;
import jenkins.scm.api.trait.SCMBuilder;
import jenkins.scm.api.trait.SCMHeadAuthority;
import jenkins.scm.api.trait.SCMHeadAuthorityDescriptor;
import jenkins.scm.api.trait.SCMHeadFilter;
@@ -122,7 +123,7 @@ public ListBoxModel doFillStrategyIdItems() {
}
}

public static class BranchSCMHeadAuthority extends SCMHeadAuthority<SCMSourceRequest,BranchSCMHead> {
public static class BranchSCMHeadAuthority extends SCMHeadAuthority<SCMSourceRequest, BranchSCMHead, SCMRevision> {
@Override
protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull BranchSCMHead head) {
return true;
@@ -10,6 +10,7 @@
import java.util.List;
import jenkins.scm.api.SCMHeadCategory;
import jenkins.scm.api.SCMHeadOrigin;
import jenkins.scm.api.SCMRevision;
import jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy;
import jenkins.scm.api.mixin.ChangeRequestSCMHead2;
import jenkins.scm.api.trait.SCMBuilder;
@@ -26,12 +27,14 @@

public class ForkPullRequestDiscoveryTrait extends SCMSourceTrait {
private final int strategyId;
private final SCMHeadAuthority<? super GitHubSCMSourceRequest, ? extends ChangeRequestSCMHead2> trust;
private final SCMHeadAuthority<? super GitHubSCMSourceRequest, ? extends ChangeRequestSCMHead2, ? extends
SCMRevision>
trust;

@DataBoundConstructor
public ForkPullRequestDiscoveryTrait(int strategyId,
SCMHeadAuthority<? super GitHubSCMSourceRequest, ? extends
ChangeRequestSCMHead2> trust) {
ChangeRequestSCMHead2, ? extends SCMRevision> trust) {
this.strategyId = strategyId;
this.trust = trust;
}
@@ -55,7 +58,7 @@ public boolean isPRHead() {
return (strategyId & 1) != 0;
}

public SCMHeadAuthority<? super GitHubSCMSourceRequest, ? extends ChangeRequestSCMHead2> getTrust() {
public SCMHeadAuthority<? super GitHubSCMSourceRequest, ? extends ChangeRequestSCMHead2, ? extends SCMRevision> getTrust() {
return trust;
}

@@ -110,7 +113,8 @@ public ListBoxModel doFillStrategyIdItems() {
}


public static class TrustContributors extends SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead> {
public static class TrustContributors
extends SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
@DataBoundConstructor
public TrustContributors() {
}
@@ -132,7 +136,7 @@ public String getDisplayName() {
}
}

public static class TrustNobody extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2> {
public static class TrustNobody extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2, SCMRevision> {
@DataBoundConstructor
public TrustNobody() {
}
@@ -152,7 +156,7 @@ public String getDisplayName() {
}
}

public static class TrustEveryone extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2> {
public static class TrustEveryone extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2, SCMRevision> {
@DataBoundConstructor
public TrustEveryone() {
}
@@ -5,11 +5,12 @@
import hudson.scm.SCM;
import hudson.util.ListBoxModel;
import java.util.Collections;
import jenkins.scm.api.trait.SCMBuilder;
import jenkins.scm.api.SCMHeadCategory;
import jenkins.scm.api.SCMHeadOrigin;
import jenkins.scm.api.SCMRevision;
import jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy;
import jenkins.scm.api.mixin.ChangeRequestSCMHead2;
import jenkins.scm.api.trait.SCMBuilder;
import jenkins.scm.api.trait.SCMHeadAuthority;
import jenkins.scm.api.trait.SCMHeadAuthorityDescriptor;
import jenkins.scm.api.trait.SCMSourceContext;
@@ -88,7 +89,7 @@ public ListBoxModel doFillStrategyIdItems() {
}

public static class OriginChangeRequestSCMHeadAuthority
extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2> {
extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2, SCMRevision> {
@Override
protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) {
return SCMHeadOrigin.DEFAULT.equals(head.getOrigin());

0 comments on commit 0978e5d

Please sign in to comment.
You can’t perform that action at this time.