public interface

Repository

implements Watchable
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
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.
@Nonnull @Deprecated Set<Watcher> getWatchers()
This method is deprecated. in 5.10 to be removed in 6.0. Use search(WatcherSearchRequest, PageRequest) instead
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.
[Expand]
Inherited Methods
From interface com.atlassian.bitbucket.watcher.Watchable

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 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

@Nonnull @Deprecated public Set<Watcher> getWatchers ()

This method is deprecated.
in 5.10 to be removed in 6.0. Use search(WatcherSearchRequest, PageRequest) instead

This method will always produce an empty set of watchers regardless of the actual number of users watching the repository. It is only here for API compatibility and will be removed in the next major release.

Returns
  • an empty set

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