public interface

Repository

com.atlassian.bitbucket.repository.Repository

Class Overview

Describes a repository within the system.

Summary

Nested Classes
enum Repository.State Enumerates the possible states for a given repository
Constants
int MAX_NAME_LENGTH The maximum number of characters of a repository's name
int NAME_MAX_SIZE This constant is deprecated. in 4.11 for removal in 5.0. Use MAX_NAME_LENGTH instead
String NAME_REGEXP
int SLUG_MAX_SIZE
String SLUG_REGEXP
Public Methods
@Nonnull String getHierarchyId()
Retrieves the unique identifier for the hierarchy of forks to which this repository belongs.
int getId()
Retrieves the repository's ID, which represents its primary key.
@Nonnull @RequiredString String getName()
Retrieves the repository's name, which is guaranteed to be unique within its project but not within the system at large.
@Nullable Repository getOrigin()
Retrieves the repository from which this repository was forked, if any.
@Nonnull Project getProject()
Retrieves the project to which this repository belongs.
@Nonnull @RequiredString String getScmId()
Retrieves the unique identifier for the SCM used by this repository.
@Nonnull @RequiredString String getSlug()
Retrieves the "slug" for this repository, which is a URL-friendly variant of its name.
@Nonnull Repository.State getState()
Retrieves the repository's current state.
@Nonnull String getStatusMessage()
Retrieves the status message for the repository's current state.
boolean isFork()
Retrieves a flag indicating whether this repository is a fork of another repository.
boolean isForkable()
Retrieves a flag indicating whether this repository may be forked.
boolean isPublic()
Retrieves a flag indicating whether this repository is public.

Constants

public static final int MAX_NAME_LENGTH

The maximum number of characters of a repository's name

Constant Value: 128 (0x00000080)

public static final int NAME_MAX_SIZE

This constant is deprecated.
in 4.11 for removal in 5.0. Use MAX_NAME_LENGTH instead

Constant Value: 128 (0x00000080)

public static final String NAME_REGEXP

Constant Value: "[\p{Alnum}][\w\-\. ]*"

public static final int SLUG_MAX_SIZE

Constant Value: 128 (0x00000080)

public static final String SLUG_REGEXP

Constant Value: "[\p{Alnum}][\w\-\.]*"

Public Methods

@Nonnull public String getHierarchyId ()

Retrieves the unique identifier for the hierarchy of forks to which this repository belongs. Every repository will be a member of a hierarchy, even if the hierarchy only contains that one repository. This allows logical grouping of repositories and their forks, regardless of how many layers of forks there may be.

Returns
  • this repository's hierarchy identifier

public int getId ()

Retrieves the repository's ID, which represents its primary key.

Returns
  • the repository's ID

@Nonnull @RequiredString public String getName ()

Retrieves the repository's name, which is guaranteed to be unique within its project but not within the system at large.

Returns
  • the repository's name

@Nullable public Repository getOrigin ()

Retrieves the repository from which this repository was forked, if any. For top-level repositories, this value will be null.

Note: Even when a repository's origin is null, it will still have a hierarchy ID. If the repository is ever forked, its forks will inherit the same hierarchy ID.

Returns
  • the repository's origin, if it is a fork

@Nonnull public Project getProject ()

Retrieves the project to which this repository belongs.

Note: If this repository is a fork, it's origin repository may belong to a different project.

Returns
  • the project to which this repository belongs

@Nonnull @RequiredString public String getScmId ()

Retrieves the unique identifier for the SCM used by this repository.

Returns
  • the unique identifier of the repository's SCM
See Also

@Nonnull @RequiredString public String getSlug ()

Retrieves the "slug" for this repository, which is a URL-friendly variant of its name. Each repository's slug is guaranteed to be unique within its project, but not within the system at large.

Returns
  • the repository's slug

@Nonnull public Repository.State getState ()

Retrieves the repository's current state.

Returns
  • the repository's state

@Nonnull public String getStatusMessage ()

Retrieves the status message for the repository's current state.

Returns
  • the repository's status message

public boolean isFork ()

Retrieves a flag indicating whether this repository is a fork of another repository. When true, the repository will always have an origin.

Note: Even repositories that are not forks, and have not been used as the origin of a fork, still exist in a hierarchy; the hierarchy just consists of a single repository.

Returns
  • true if this repository is a fork; otherwise, false

public boolean isForkable ()

Retrieves a flag indicating whether this repository may be forked. This flag is orthogonal to isFork(). It is possible to create a fork from a fork, if the repository is configured so, just as it may not be possible to create forks from some top-level repositories.

If forking is disabled at the system level, even repositories which are configured to allow forking (where this flag is true) may not be forked.

Returns
  • true if the repository may be forked

public boolean isPublic ()

Retrieves a flag indicating whether this repository is public.

Note, this flag is taken into account when calculating whether this repository is accessible to unauthenticated users but is not the definitive answer. For a definitive answer, use isPubliclyAccessible.

Returns
  • true if the repository has been marked as public, false otherwise