public interface

Repository

com.atlassian.stash.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
String NAME_REGEXP
String SLUG_REGEXP
Public Methods
@Nonnull String getHierarchyId()
Retrieves the unique identifier for the hierarchy of forks to which this repository belongs.
@Nullable Integer 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.

Constants

public static final String NAME_REGEXP

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

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

@Nullable public Integer 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.@return