Host Services Repository

@Repository
interface HostServicesRepository : JpaRepository<T, ID>

The HostServicesRepository interface is useful to manage the queries of the BrownieHostService

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
Link copied to clipboard
@Query(value = ""SELECT COUNT(*) FROM " + SERVICES_KEY + _WHERE_ + "( " + "MATCH(" + NAME_KEY + "," + PID_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " + "OR :" + KEYWORDS_KEY + " = ''" + ") " + "AND " + STATUS_KEY + " IN (:" + STATUSES_KEY + ") " + "AND " + HOST_IDENTIFIER_KEY + "=:" + HOST_IDENTIFIER_KEY", nativeQuery = true )
abstract fun countServices(@Param(value = "host_id") hostId: String, @Param(value = "keywords") keywords: String, @Param(value = "statuses") statuses: List<String>): Long
Query used to count the services related to a host
Link copied to clipboard
abstract fun delete(entity: T)
Link copied to clipboard
abstract fun deleteAll(entities: Iterable<out T>)
Link copied to clipboard
abstract fun deleteAllById(ids: Iterable<out ID>)
Link copied to clipboard
abstract fun deleteAllByIdInBatch(ids: Iterable<ID>)
Link copied to clipboard
abstract fun deleteAllInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun deleteById(id: ID)
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<T>)
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + SERVICES_KEY + " SET " + NAME_KEY + "=:" + NAME_KEY + "," + SERVICE_PATH_KEY + "=:" + SERVICE_PATH_KEY + _WHERE_ + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun editService(@Param(value = "id") serviceId: String, @Param(value = "name") serviceName: String, @Param(value = "service_path") servicePath: String)
Query used to edit an existing service
Link copied to clipboard
abstract fun <S : T?> exists(example: Example<S>): Boolean
Link copied to clipboard
abstract fun existsById(id: ID): Boolean
Link copied to clipboard
abstract fun <S : T?> findAll(example: Example<S>): List<S>
abstract fun findAll(): Iterable<T>
abstract fun findAll(): List<T>
abstract fun findAll(pageable: Pageable): Page<T>
abstract fun <S : T?> findAll(example: Example<S>): Iterable<S>
abstract fun <S : T?> findAll(example: Example<S>, pageable: Pageable): Page<S>
Link copied to clipboard
abstract fun findAllById(ids: Iterable<ID>): Iterable<T>
abstract fun findAllById(ids: Iterable<ID>): List<T>
Link copied to clipboard
abstract fun <S : T?, R> findBy(example: Example<S>, queryFunction: (FluentQuery.FetchableFluentQuery<S>) -> R): R
Link copied to clipboard
abstract fun findById(id: ID): Optional<T>
Link copied to clipboard
abstract fun <S : T?> findOne(example: Example<S>): Optional<S>
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Query(value = ""SELECT * FROM " + SERVICES_KEY + _WHERE_ + "( " + "MATCH(" + NAME_KEY + "," + PID_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " + "OR :" + KEYWORDS_KEY + " = ''" + ") " + "AND " + STATUS_KEY + " IN (:" + STATUSES_KEY + ") " + "AND " + HOST_IDENTIFIER_KEY + "=:" + HOST_IDENTIFIER_KEY", nativeQuery = true )
abstract fun getServices(@Param(value = "host_id") hostId: String, @Param(value = "keywords") keywords: String, @Param(value = "statuses") statuses: List<String>, pageable: Pageable): List<BrownieHostService>
Query used to count the services related to a host
Link copied to clipboard
@Query(value = "SELECT new com.tecknobit.brownie.services.hostservices.dtos.CurrentServiceStatus(" + "s." + IDENTIFIER_KEY + "," + "s." + STATUS_KEY + "," + "s." + PID_KEY + ") FROM BrownieHostService s" + _WHERE_ + "s." + IDENTIFIER_KEY + " IN (:" + SERVICES_KEY + ")" )
abstract fun getServicesStatus(@Param(value = "services") services: List<String>): List<CurrentServiceStatus>
Query used to retrieve the current status of the specified services
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + SERVICES_KEY + " SET " + STATUS_KEY + "='STOPPED'," + PID_KEY + "='-1'" + _WHERE_ + HOST_IDENTIFIER_KEY + "=:" + HOST_IDENTIFIER_KEY + " AND " + PID_KEY + "=:" + PID_KEY", nativeQuery = true )
abstract fun markServiceAsStopped(@Param(value = "host_id") hostId: String, @Param(value = "pid") pid: Long)
Query used to mark a service as STOPPED
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE FROM " + SERVICES_KEY + _WHERE_ + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun removeService(@Param(value = "id") serviceId: String)
Query used to remove a service
Link copied to clipboard
abstract fun <S : T?> save(entity: S): S
Link copied to clipboard
abstract fun <S : T?> saveAll(entities: Iterable<S>): Iterable<S>
abstract fun <S : T?> saveAll(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAllAndFlush(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAndFlush(entity: S): S
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT INTO " + SERVICES_KEY + " (" + IDENTIFIER_KEY + "," + NAME_KEY + "," + STATUS_KEY + "," + INSERTION_DATE_KEY + "," + HOST_IDENTIFIER_KEY + "," + SERVICE_PATH_KEY + ") VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + NAME_KEY + "," + ":" + STATUS_KEY + "," + ":" + INSERTION_DATE_KEY + "," + ":" + HOST_IDENTIFIER_KEY + "," + ":" + SERVICE_PATH_KEY + ")", nativeQuery = true )
abstract fun storeService(@Param(value = "id") serviceId: String, @Param(value = "name") serviceName: String, @Param(value = "status") status: String, @Param(value = "insertion_date") insertionDate: Long, @Param(value = "host_id") hostId: String, @Param(value = "service_path") servicePath: String)
Query used to store a new service
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + SERVICES_KEY + " SET " + STATUS_KEY + "=:" + STATUS_KEY + "," + PID_KEY + "=:" + PID_KEY + _WHERE_ + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun updateServiceStatus(@Param(value = "id") serviceId: String, @Param(value = "status") status: String, @Param(value = "pid") pid: Long)
Query used to update a service status and its pid