Host
Services
Repository
The HostServicesRepository interface
is useful to manage the queries of the BrownieHostService
Author
N7ghtm4r3 - Tecknobit
See also
JpaRepository
Functions
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
)
Query used to count the services related to
a host
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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
)
Query used to edit an existing service
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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
)
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 + ")"
)
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
)
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
)
Query used to remove a service
Link copied to clipboard
Link copied to clipboard
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
)
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
)
Query used to update a service status and
its pid