P - the type of the branch projects.R - the type of the builds of the branch projects.public abstract class BranchProjectFactory<P extends Job<P,R> & TopLevelItem,R extends Run<P,R>> extends AbstractDescribableImpl<BranchProjectFactory<?,?>> implements Saveable, ExtensionPoint
Branch and also provides some utility methods for
updating the branch specific projects.
Please define a 'getting-started' view for a subclass, if you would like to provide specific information to the user
how to get started using the type of project factory. This view is displayed when there are no subfolders found.| Modifier and Type | Class and Description |
|---|---|
static class |
BranchProjectFactory.HeadByItemImpl |
static class |
BranchProjectFactory.SourceByItemImpl |
ExtensionPoint.LegacyInstancesAreScopedToHudson| Constructor and Description |
|---|
BranchProjectFactory() |
| Modifier and Type | Method and Description |
|---|---|
P |
asProject(Item item)
Casts the
Item into the project type supported by this BranchProjectFactory. |
P |
decorate(P project)
Decorates the project in with all the
JobDecorator instances. |
abstract Branch |
getBranch(P project)
Gets the
Branch that a specific project was configured for. |
BranchProjectFactoryDescriptor |
getDescriptor() |
jenkins.scm.api.SCMRevision |
getLastSeenRevision(P project)
Gets the
SCMRevision that the project was last seen for. |
MultiBranchProject<P,R> |
getOwner()
Gets the current owner.
|
Class<P> |
getProjectClass()
Returns the base class of the projects that are produced by this factory.
|
jenkins.scm.api.SCMRevision |
getRevision(P project)
Gets the
SCMRevision that the project was last built for. |
abstract boolean |
isProject(Item item)
Test if the specified
Item is the branch project type supported by this BranchProjectFactory |
abstract P |
newInstance(Branch branch)
Creates a new branch project.
|
void |
save()
Saves the
BranchProjectFactory |
abstract P |
setBranch(P project,
Branch branch)
|
void |
setLastSeenRevisionHash(P project,
jenkins.scm.api.SCMRevision revision)
Sets the
SCMRevision that the project was last seen |
void |
setOwner(MultiBranchProject<P,R> owner)
Sets the owner.
|
void |
setRevisionHash(P project,
jenkins.scm.api.SCMRevision revision)
Sets the
SCMRevision that the project was last built for. |
public abstract P newInstance(Branch branch)
Item.getName() must match Branch.getEncodedName().branch - the branch.public void save()
throws IOException
BranchProjectFactorysave in interface SaveableIOException - if issues saving.public void setOwner(MultiBranchProject<P,R> owner)
owner - the owner.public MultiBranchProject<P,R> getOwner()
@NonNull public abstract Branch getBranch(@NonNull P project)
Branch that a specific project was configured for.project - the project; should assume isProject(hudson.model.Item) has already been tested on itBranch that the project was configured for.@NonNull public abstract P setBranch(@NonNull P project, @NonNull Branch branch)
project - the project.branch - the new branch.public abstract boolean isProject(@CheckForNull
Item item)
Item is the branch project type supported by this BranchProjectFactoryitem - the Itemtrue if and only if the Item is a project supported by this BranchProjectFactory.@NonNull public P asProject(@NonNull Item item)
Item into the project type supported by this BranchProjectFactory.item - the Item.Item upcast to the project type supported by this BranchProjectFactory.@CheckForNull public jenkins.scm.api.SCMRevision getRevision(P project)
SCMRevision that the project was last built for.project - the project.SCMRevision of the last build.public void setRevisionHash(P project, jenkins.scm.api.SCMRevision revision) throws IOException
SCMRevision that the project was last built for.project - the project.revision - the SCMRevision of the last build.IOException - if there was an issue persisting the details.@CheckForNull public jenkins.scm.api.SCMRevision getLastSeenRevision(P project)
SCMRevision that the project was last seen for.project - the project.SCMRevision of the last seen.public void setLastSeenRevisionHash(P project, jenkins.scm.api.SCMRevision revision) throws IOException
SCMRevision that the project was last seenproject - the project.revision - the SCMRevision of the last build.IOException - if there was an issue persisting the details.public P decorate(P project)
JobDecorator instances.
NOTE: This method should suppress saving the project and only affect the in-memory state.
NOTE: Override if the default strategy is not appropriate for the specific project type.project - the project.@NonNull public BranchProjectFactoryDescriptor getDescriptor()
getDescriptor in interface Describable<BranchProjectFactory<?,?>>getDescriptor in class AbstractDescribableImpl<BranchProjectFactory<?,?>>Copyright © 2016–2019. All rights reserved.