Interface SPersistentEntity

    • 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
      • 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)
      • 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 in schedulePersisting(ConfigAction) or scheduleRemove(ConfigAction) methods to describe the performed action.
        Parameters:
        user - user who performs operation, or null if operation is performed by the system
        description - 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