Class VcsRepository<T extends VcsRepository<T,E>,E extends VcsRepositoryProperties>
- java.lang.Object
-
- com.atlassian.bamboo.specs.api.builders.EntityPropertiesBuilder<T>
-
- com.atlassian.bamboo.specs.api.builders.RootEntityPropertiesBuilder<E>
-
- com.atlassian.bamboo.specs.api.builders.repository.VcsRepository<T,E>
-
- Direct Known Subclasses:
AnyVcsRepository,BitbucketCloudRepository,BitbucketServerRepository,GitHubRepository,GitRepository
public abstract class VcsRepository<T extends VcsRepository<T,E>,E extends VcsRepositoryProperties> extends RootEntityPropertiesBuilder<E>
Represents a definition of VCS repository.This class contains common data only. In order to define a specific type of repository one should use the specialised implementation or, if such is not available,
AnyVcsRepositoryclass.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringdescriptionprotected java.lang.Stringnameprotected BambooOidPropertiesoidprotected java.lang.Stringparentprotected ProjectPropertiesprojectprotected VcsRepositoryViewerPropertiesrepositoryViewerstatic java.lang.StringTYPE
-
Constructor Summary
Constructors Constructor Description VcsRepository()Specifies a new repository definition.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Ebuild()Tdescription(@Nullable java.lang.String description)Sets repository description.@NotNull VcsRepositoryIdentifiergetIdentifier()Returns identifier for this object.@NotNull java.lang.StringgetName()Returns repository name, which serves as identifier for this object.@NotNull BambooOidgetOid()Returns repository's oid.java.lang.StringhumanReadableId()Entity type and id representation that is shown to human.java.lang.StringhumanReadableType()Entity type that is shown to human.Tname(@Nullable java.lang.String name)Sets the name by which repository will be identified by Bamboo.Toid(@Nullable BambooOid oid)Sets the repository's oid.Toid(@Nullable java.lang.String oid)Sets the repository's oid from string.Tparent(@Nullable java.lang.String parent)Sets the parent of this repository should inherit data from.Tproject(@Nullable Project project)Set the repository's project.TrepositoryViewer(@Nullable VcsRepositoryViewer repositoryViewer)Sets a web repository viewer to be used with this repository.
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
parent
protected java.lang.String parent
-
name
protected java.lang.String name
-
oid
protected BambooOidProperties oid
-
description
protected java.lang.String description
-
project
protected ProjectProperties project
-
repositoryViewer
protected VcsRepositoryViewerProperties repositoryViewer
-
-
Constructor Detail
-
VcsRepository
public VcsRepository() throws PropertiesValidationExceptionSpecifies a new repository definition.A repository can be global, in which case any changes made to a repository are automatically applied to all plans or jobs that use that repository. Also repository can be project, in which case it can be used only in plans from corresponding project. Repository can also be defined in scope of a
Plan, in which case it is only accessible in context of plan it is defined for.- Throws:
PropertiesValidationException
-
-
Method Detail
-
name
public T name(@Nullable @Nullable java.lang.String name) throws PropertiesValidationException
Sets the name by which repository will be identified by Bamboo. In the absence of oid, the name is used to identify the repository. If the repository with given name does not exist, a new one is created, otherwise existing one is updated.The name should be unique in scope a repository is defined in.
The name must not be set if repository inherits data from another repository.
- Throws:
PropertiesValidationException- See Also:
parent(String)
-
oid
public T oid(@Nullable @Nullable java.lang.String oid) throws PropertiesValidationException
Sets the repository's oid from string.If set, it is used to identify the repository. If the repository with given oid does not exist, a new one is created, otherwise existing one is updated. Setting both oid and name may result in existing repository being renamed.
- Throws:
PropertiesValidationException
-
oid
public T oid(@Nullable @Nullable BambooOid oid) throws PropertiesValidationException
Sets the repository's oid.If set, it is used to identify the repository. If the repository with given oid does not exist, a new one is created, otherwise existing one is updated. Setting both oid and name may result in existing repository being renamed.
- Throws:
PropertiesValidationException
-
parent
public T parent(@Nullable @Nullable java.lang.String parent) throws PropertiesValidationException
Sets the parent of this repository should inherit data from. When defining repository for a plan user can decide to inherit its data from an existing global repository instead of creating it from scratch. In that case, any change to parent's repository configuration will automatically be applied to all its children, unless a respective data has been overridden.- Throws:
PropertiesValidationException
-
description
public T description(@Nullable @Nullable java.lang.String description) throws PropertiesValidationException
Sets repository description.The description must not be set if repository inherits from another repository.
- Throws:
PropertiesValidationException
-
repositoryViewer
public T repositoryViewer(@Nullable @Nullable VcsRepositoryViewer repositoryViewer) throws PropertiesValidationException
Sets a web repository viewer to be used with this repository.Web repository viewer allows Bamboo to render correct links to commits, files, etc. in the Bamboo UI.
- Throws:
PropertiesValidationException- See Also:
VcsRepositoryViewer
-
project
public T project(@Nullable @Nullable Project project)
Set the repository's project. Available for Bamboo DC only.If set, it is Project repository, otherwise it is Global or plan repository.
- Since:
- 8.0
-
getName
@NotNull public @NotNull java.lang.String getName()
Returns repository name, which serves as identifier for this object.- Throws:
java.lang.IllegalStateException- if name is undefined
-
getOid
@NotNull public @NotNull BambooOid getOid()
Returns repository's oid.- Throws:
java.lang.IllegalStateException- if oid is undefined
-
getIdentifier
@NotNull public @NotNull VcsRepositoryIdentifier getIdentifier()
Returns identifier for this object.- Throws:
java.lang.IllegalStateException- if key is undefined
-
humanReadableType
public java.lang.String humanReadableType()
Description copied from class:RootEntityPropertiesBuilderEntity type that is shown to human.- Specified by:
humanReadableTypein classRootEntityPropertiesBuilder<E extends VcsRepositoryProperties>
-
humanReadableId
public java.lang.String humanReadableId()
Description copied from class:RootEntityPropertiesBuilderEntity type and id representation that is shown to human.- Specified by:
humanReadableIdin classRootEntityPropertiesBuilder<E extends VcsRepositoryProperties>
-
build
protected abstract E build() throws PropertiesValidationException
- Specified by:
buildin classEntityPropertiesBuilder<E extends VcsRepositoryProperties>- Throws:
PropertiesValidationException
-
-