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 TypeMethodDescriptionvoidaddPermission(RepositoryPermission newPermission) Adds a single permission to the current set of permissions for this object.clone()voidcopyProperties(Repository repository) Copies all properties of theRepositoryto the given one.booleanReturns 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 aListofHealthCheckFailures.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.inthashCode()booleanReturnstrue, when the repository is marked as "archived".booleanReturnstrueif the repository is healthy.booleanisValid()Returns true if theRepositoryis valid.booleanremovePermission(RepositoryPermission permission) Removes a single permission from the current set of permissions for this object.voidsetArchived(boolean archived) Set this totrueto mark the repository as "archived".voidsetContact(String contact) voidsetCreationDate(Long creationDate) voidsetDescription(String description) voidsetHealthCheckFailures(List<HealthCheckFailure> healthCheckFailures) voidvoidsetLastModified(Long lastModified) voidvoidsetNamespace(String namespace) voidsetPermissions(Collection<RepositoryPermission> permissions) Sets and therefore overwrites the permissions for this object.voidtoString()Methods inherited from class sonia.scm.BasicPropertiesAware
getProperties, getProperty, removeProperty, setProperties, setPropertyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 theRepositorytype- type of theRepositoryname- 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 theRepositorytype- type of theRepositoryname- name of theRepositorynamespace- namespace of theRepositorycontact- 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:
getCreationDatein interfaceModelObject
-
getDescription
Returns a short description of theRepository. -
getHealthCheckFailures
- Returns:
ListofHealthCheckFailures- Since:
- 1.36
-
getId
Description copied from interface:ModelObjectReturns the unique id of the model object- Specified by:
getIdin interfaceModelObject- Specified by:
getIdin interfacecom.github.sdorra.ssp.PermissionObject- Specified by:
getIdin interfaceRepositoryCoordinates
-
getLastModified
Description copied from interface:LastModifiedAwareReturns a timestamp of the last modified date.- Specified by:
getLastModifiedin interfaceLastModifiedAware
-
getName
Description copied from interface:RepositoryCoordinatesReturns the name of the repository.- Specified by:
getNamein interfaceRepositoryCoordinates
-
getNamespace
Description copied from interface:RepositoryCoordinatesReturns the namespace of the repository.- Specified by:
getNamespacein interfaceRepositoryCoordinates
-
getNamespaceAndName
-
getPermissions
Description copied from interface:RepositoryPermissionHolderReturns a collection of all permissions for this object.- Specified by:
getPermissionsin interfaceRepositoryPermissionHolder
-
getType
Returns the type (hg, git, svn ...) of theRepository.- Specified by:
getTypein 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()Returnstrueif the repository is healthy.- Returns:
trueif the repository is healthy- Since:
- 1.36
-
isValid
public boolean isValid()Returns true if theRepositoryis 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:
isValidin interfaceValidateable- Returns:
- true if the
Repositoryis valid
-
setContact
-
setCreationDate
- Specified by:
setCreationDatein interfaceModelObject
-
setDescription
-
setId
-
setLastModified
- Specified by:
setLastModifiedin interfaceModelObject
-
setNamespace
-
setName
-
setPermissions
Description copied from interface:RepositoryPermissionHolderSets and therefore overwrites the permissions for this object.- Specified by:
setPermissionsin interfaceRepositoryPermissionHolder- Parameters:
permissions- The new permissions for this object.
-
addPermission
Description copied from interface:RepositoryPermissionHolderAdds a single permission to the current set of permissions for this object.- Specified by:
addPermissionin interfaceRepositoryPermissionHolder- Parameters:
newPermission- The new permission that will be added to the existing permissions.
-
removePermission
Description copied from interface:RepositoryPermissionHolderRemoves a single permission from the current set of permissions for this object.- Specified by:
removePermissionin 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,falseotherwise.
-
setType
-
setArchived
public void setArchived(boolean archived) Set this totrueto mark the repository as "archived". An archived repository cannot be modified.- Since:
- 2.11.0
-
setHealthCheckFailures
-
clone
-
copyProperties
Copies all properties of theRepositoryto the given one.- Parameters:
repository- the targetRepository
-
equals
- Overrides:
equalsin classBasicPropertiesAware
-
hashCode
public int hashCode()- Overrides:
hashCodein classBasicPropertiesAware
-
toString
-
toFullString
-
getEntityName
Get the entity name which is used for the audit log- Specified by:
getEntityNamein interfaceAuditLogEntity- Since:
- 2.43.0
-