Package jetbrains.buildServer.serverSide
Interface SPersistentEntity
-
- All Known Subinterfaces:
BuildTypeIdentity
,BuildTypeTemplate
,RemoteBuildType
,SBuildType
,SProject
,SVcsRoot
public interface SPersistentEntity
Represents an entity which configuration can be write to a configuration file.- Since:
- 8.0
- Author:
- Leonid Bushuev from JetBrains
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ConfigAction
createConfigAction(SUser user, java.lang.String description)
Creates a config action instance associated with this entity and having the specified description.java.lang.String
getConfigId()
Returns the entity's config identifier.java.io.File
getConfigurationFile()
Returns the configuration file where this entity instance is persisted (or will be persisted to).java.io.File
getConfigurationFile(java.io.File projectsDir)
Returns the configuration file where this entity is persisted in custom projects directoryjava.lang.String
getExternalId()
Returns the external identifier.java.lang.String
getName()
Returns the name of the entity.SPersistentEntity
getParent()
The parent entity.ReadOnlyReason
getReadOnlyReason()
PersistentEntityVersion
getVersion()
Returns version of this entity which can be used to check if the entity was edited or persisted.boolean
isReadOnly()
default boolean
isVirtual()
void
markPersisted(long expectedEditId)
Marks entity as persistedvoid
persist()
Persists this entity instance onto disk.void
persist(ConfigAction cause)
Persists this entity on disk.void
remove()
Removes this entity.PersistTask
schedulePersisting(java.lang.String reason)
Schedules background persisting of this entity settings.PersistTask
schedulePersisting(ConfigAction cause)
Schedules background persisting of this project settings.PersistTask
scheduleRemove(ConfigAction cause)
Schedules remove of this persistent entity.
-
-
-
Method Detail
-
getConfigId
@NotNull java.lang.String getConfigId()
Returns the entity's config identifier. Config identifier uniquely identifies the entity across different TeamCity servers and can't be modified in contrast to external identifier.- Since:
- 9.0
-
getExternalId
@NotNull java.lang.String getExternalId()
Returns the external identifier.- Returns:
- the external identifier.
-
getName
java.lang.String getName()
Returns the name of the entity.- Returns:
- see above.
-
persist
void persist() throws PersistFailedException
Persists this entity instance onto disk. Should be called each time when settings are changed, otherwise the changes will be lost after the server restart.- Throws:
PersistFailedException
- if persisting failed
-
persist
void persist(@NotNull ConfigAction cause) throws PersistFailedException
Persists this entity on disk.- Parameters:
cause
- an action which caused persisting- Throws:
PersistFailedException
- if persisting failed- Since:
- 9.0
-
schedulePersisting
@NotNull PersistTask schedulePersisting(@NotNull ConfigAction cause) throws PersistFailedException
Schedules background persisting of this project settings.- Parameters:
cause
- an action which caused persisting- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException
- if failed to schedule the operation- Since:
- 2020.1
- See Also:
schedulePersisting(String)
-
schedulePersisting
@NotNull PersistTask schedulePersisting(@NotNull java.lang.String reason) throws PersistFailedException
Schedules background persisting of this entity settings.- Parameters:
reason
- provides a reason why persist operation was called- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException
- if failed to schedule the operation- Since:
- 2020.1
- See Also:
schedulePersisting(ConfigAction)
-
scheduleRemove
@NotNull PersistTask scheduleRemove(@NotNull ConfigAction cause) throws PersistFailedException, ReadOnlyEntityException
Schedules remove of this persistent entity. Returns task which can be used to wait for the operation to complete.- Parameters:
cause
- reason of the remove- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException
- if failed to schedule the operationReadOnlyEntityException
- Since:
- 2020.2
-
remove
void remove() throws ReadOnlyEntityException
Removes this entity.This method also makes all changes (related to removing the entity) on the disk and in the database. There is no need to call the persist() after this method.
- Throws:
ReadOnlyEntityException
- Since:
- 8.0
-
getConfigurationFile
@NotNull java.io.File getConfigurationFile()
Returns the configuration file where this entity instance is persisted (or will be persisted to).- Returns:
- see above.
-
getConfigurationFile
@NotNull java.io.File getConfigurationFile(@NotNull java.io.File projectsDir)
Returns the configuration file where this entity is persisted in custom projects directory- Parameters:
projectsDir
- path to teamcity projects directory- Returns:
- see above
-
getParent
@Nullable SPersistentEntity getParent()
The parent entity.- Returns:
- see above.
-
getVersion
@NotNull PersistentEntityVersion getVersion()
Returns version of this entity which can be used to check if the entity was edited or persisted.- Returns:
- see above
-
markPersisted
void markPersisted(long expectedEditId)
Marks entity as persisted- Parameters:
expectedEditId
- expected editId in the end of persist. The entity will be marked as unedited if expected editId is the same as actual, ie. the entity wasn't edited while persist was running
-
createConfigAction
@NotNull ConfigAction createConfigAction(@Nullable SUser user, @NotNull java.lang.String description)
Creates a config action instance associated with this entity and having the specified description. The config action object can be used inschedulePersisting(ConfigAction)
orscheduleRemove(ConfigAction)
methods to describe the performed action.- Parameters:
user
- user who performs operation, or null if operation is performed by the systemdescription
- description to set to the config action object- Returns:
- new config action
- Since:
- 2020.2
-
isReadOnly
boolean isReadOnly()
- Returns:
- true if this entity settings are in read only mode
- Since:
- 2021.1
-
getReadOnlyReason
@Nullable ReadOnlyReason getReadOnlyReason()
- Returns:
- reason why this entity settings are in read only state or null if they are not read only
- Since:
- 2021.1
-
isVirtual
default boolean isVirtual()
- Returns:
- true if this entity is auto-generated and can be regenerated or removed by the server at any point of time,
see also
SProject.isVirtual()
- Since:
- 2023.11
-
-