Package sonia.scm.repository
Class Repository
java.lang.Object
sonia.scm.BasicPropertiesAware
sonia.scm.repository.Repository
- All Implemented Interfaces:
com.github.sdorra.ssp.PermissionObject
,Serializable
,Cloneable
,AuditLogEntity
,LastModifiedAware
,ModelObject
,PropertiesAware
,RepositoryCoordinates
,RepositoryPermissionHolder
,TypedObject
,Validateable
@IndexedType(namespaceScoped=true)
@StaticPermissions(value="repository",
permissions={"read","modify","delete","rename","healthCheck","pull","push","permissionRead","permissionWrite","archive","export"},
custom=true,
customGlobal=true,
guards=)
public class Repository
extends BasicPropertiesAware
implements ModelObject, com.github.sdorra.ssp.PermissionObject, RepositoryCoordinates, RepositoryPermissionHolder, AuditLogEntity
Source code repository.
- See Also:
-
Field Summary
Fields inherited from class sonia.scm.BasicPropertiesAware
properties
-
Constructor Summary
ConstructorsConstructorDescriptionThis constructor is used by JAXB.Repository
(String id, String type, String namespace, String name) Constructs a newRepository
.Repository
(String id, String type, String namespace, String name, String contact, String description, RepositoryPermission... permissions) Constructs a newRepository
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPermission
(RepositoryPermission newPermission) Adds a single permission to the current set of permissions for this object.clone()
void
copyProperties
(Repository repository) Copies all properties of theRepository
to the given one.boolean
Returns a contact email address of a person who is responsible for theRepository
.Returns a timestamp of the creation date of theRepository
.Returns a short description of theRepository
.Get the entity name which is used for the audit logReturns aList
ofHealthCheckFailure
s.getId()
Returns the unique id of the model objectReturns a timestamp of the last modified date.getName()
Returns the name of the repository.Returns the namespace of the repository.Returns a collection of all permissions for this object.getType()
Returns the type (hg, git, svn ...) of theRepository
.int
hashCode()
boolean
Returnstrue
, when the repository is marked as "archived".boolean
Returnstrue
if the repository is healthy.boolean
isValid()
Returns true if theRepository
is valid.boolean
removePermission
(RepositoryPermission permission) Removes a single permission from the current set of permissions for this object.void
setArchived
(boolean archived) Set this totrue
to mark the repository as "archived".void
setContact
(String contact) void
setCreationDate
(Long creationDate) void
setDescription
(String description) void
setHealthCheckFailures
(List<HealthCheckFailure> healthCheckFailures) void
void
setLastModified
(Long lastModified) void
void
setNamespace
(String namespace) void
setPermissions
(Collection<RepositoryPermission> permissions) Sets and therefore overwrites the permissions for this object.void
toString()
Methods inherited from class sonia.scm.BasicPropertiesAware
getProperties, getProperty, removeProperty, setProperties, setProperty
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface sonia.scm.repository.RepositoryPermissionHolder
findGroupPermission, findUserPermission
-
Constructor Details
-
Repository
public Repository()This constructor is used by JAXB. -
Repository
Constructs a newRepository
.- Parameters:
id
- id of theRepository
type
- type of theRepository
name
- name of theRepository
-
Repository
public Repository(String id, String type, String namespace, String name, String contact, String description, RepositoryPermission... permissions) Constructs a newRepository
.- Parameters:
id
- id of theRepository
type
- type of theRepository
name
- name of theRepository
namespace
- namespace of theRepository
contact
- email address of a person who is responsible for this repository.description
- a short description of the repositorypermissions
- permissions for specific users and groups.
-
-
Method Details
-
getContact
Returns a contact email address of a person who is responsible for theRepository
.- Returns:
- contact email address
-
getCreationDate
Returns a timestamp of the creation date of theRepository
.- Specified by:
getCreationDate
in interfaceModelObject
-
getDescription
Returns a short description of theRepository
. -
getHealthCheckFailures
- Returns:
List
ofHealthCheckFailure
s- Since:
- 1.36
-
getId
Description copied from interface:ModelObject
Returns the unique id of the model object- Specified by:
getId
in interfaceModelObject
- Specified by:
getId
in interfacecom.github.sdorra.ssp.PermissionObject
- Specified by:
getId
in interfaceRepositoryCoordinates
-
getLastModified
Description copied from interface:LastModifiedAware
Returns a timestamp of the last modified date.- Specified by:
getLastModified
in interfaceLastModifiedAware
-
getName
Description copied from interface:RepositoryCoordinates
Returns the name of the repository.- Specified by:
getName
in interfaceRepositoryCoordinates
-
getNamespace
Description copied from interface:RepositoryCoordinates
Returns the namespace of the repository.- Specified by:
getNamespace
in interfaceRepositoryCoordinates
-
getNamespaceAndName
-
getPermissions
Description copied from interface:RepositoryPermissionHolder
Returns a collection of all permissions for this object.- Specified by:
getPermissions
in interfaceRepositoryPermissionHolder
-
getType
Returns the type (hg, git, svn ...) of theRepository
.- Specified by:
getType
in interfaceTypedObject
-
isArchived
public boolean isArchived()Returnstrue
, when the repository is marked as "archived". An archived repository cannot be modified.- Since:
- 2.11.0
-
isHealthy
public boolean isHealthy()Returnstrue
if the repository is healthy.- Returns:
true
if the repository is healthy- Since:
- 1.36
-
isValid
public boolean isValid()Returns true if theRepository
is valid.- The namespace is valid
- The name is valid
- The type is not empty
- The contact is empty or contains a valid email address
- Specified by:
isValid
in interfaceValidateable
- Returns:
- true if the
Repository
is valid
-
setContact
-
setCreationDate
- Specified by:
setCreationDate
in interfaceModelObject
-
setDescription
-
setId
-
setLastModified
- Specified by:
setLastModified
in interfaceModelObject
-
setNamespace
-
setName
-
setPermissions
Description copied from interface:RepositoryPermissionHolder
Sets and therefore overwrites the permissions for this object.- Specified by:
setPermissions
in interfaceRepositoryPermissionHolder
- Parameters:
permissions
- The new permissions for this object.
-
addPermission
Description copied from interface:RepositoryPermissionHolder
Adds a single permission to the current set of permissions for this object.- Specified by:
addPermission
in interfaceRepositoryPermissionHolder
- Parameters:
newPermission
- The new permission that will be added to the existing permissions.
-
removePermission
Description copied from interface:RepositoryPermissionHolder
Removes a single permission from the current set of permissions for this object.- Specified by:
removePermission
in interfaceRepositoryPermissionHolder
- Parameters:
permission
- The permission that should be removed from the existing permissions.- Returns:
true
, if the given permission was part of the permissions for this object,false
otherwise.
-
setType
-
setArchived
public void setArchived(boolean archived) Set this totrue
to mark the repository as "archived". An archived repository cannot be modified.- Since:
- 2.11.0
-
setHealthCheckFailures
-
clone
-
copyProperties
Copies all properties of theRepository
to the given one.- Parameters:
repository
- the targetRepository
-
equals
- Overrides:
equals
in classBasicPropertiesAware
-
hashCode
public int hashCode()- Overrides:
hashCode
in classBasicPropertiesAware
-
toString
-
toFullString
-
getEntityName
Get the entity name which is used for the audit log- Specified by:
getEntityName
in interfaceAuditLogEntity
- Since:
- 2.43.0
-