ProjectsRepository

@Service
@Repository
interface ProjectsRepository : JpaRepository<T, ID>

The ProjectsRepository interface is useful to manage the queries for the projects

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + PROJECTS_KEY + " (" + IDENTIFIER_KEY + "," + LOGO_URL_KEY + "," + NAME_KEY + "," + AUTHOR_KEY + " )" + " VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + LOGO_URL_KEY + "," + ":" + NAME_KEY + "," + ":" + AUTHOR_KEY + ")", nativeQuery = true)
abstract fun addProject(@Param(value = "id") projectId: String, @Param(value = "logo_url") logoUrl: String, @Param(value = "name") name: String, @Param(value = "author") author: String)
Method to execute the query to add a new Project
Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
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 = ""DELETE FROM " + PROJECTS_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun deleteProject(@Param(value = "id") projectId: String)
Method to execute the query to delete an existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET " + NAME_KEY + "=:" + NAME_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun editProject(@Param(value = "id") projectId: String, @Param(value = "name") name: String)
Method to execute the query to edit an existing Project
@Modifying(clearAutomatically = true)
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET " + NAME_KEY + "=:" + NAME_KEY + "," + LOGO_URL_KEY + "=:" + LOGO_URL_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun editProject(@Param(value = "id") projectId: String, @Param(value = "logo_url") logoUrl: String, @Param(value = "name") name: String)
Method to execute the query to add an existing Project
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
@Query(value = ""SELECT * FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " INNER JOIN " + PROJECT_MEMBERS_TABLE + " AS " + PROJECT_MEMBERS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + PROJECT_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " WHERE " + PROJECT_MEMBERS_TABLE + "." + MEMBER_IDENTIFIER_KEY + "=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun getProject(@Param(value = "id") projectId: String, @Param(value = "author") userId: String): Project
Method to execute the query to get an existing Project if the user is authorized
Link copied to clipboard
@Query(value = ""SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " INNER JOIN " + PROJECT_MEMBERS_TABLE + " AS " + PROJECT_MEMBERS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + PROJECT_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " WHERE " + MEMBER_IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun getProjects(@Param(value = "id") userId: String): List<Project>
Method to execute the query to get the list of Project where the user who made the request is a member
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + PROJECT_MEMBERS_TABLE + " (" + IDENTIFIER_KEY + "," + MEMBER_IDENTIFIER_KEY + " )" + " VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + MEMBER_IDENTIFIER_KEY + ")", nativeQuery = true)
abstract fun joinMember(@Param(value = "id") projectId: String, @Param(value = "member_id") memberId: String)
Method to execute the query to join a new member in an existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + PROJECT_TESTERS_TABLE + " (" + PROJECT_IDENTIFIER_KEY + "," + MEMBER_IDENTIFIER_KEY + " )" + " VALUES (" + ":" + PROJECT_IDENTIFIER_KEY + "," + ":" + MEMBER_IDENTIFIER_KEY + ")", nativeQuery = true)
abstract fun markMemberAsTester(@Param(value = "project_id") projectId: String, @Param(value = "member_id") memberId: String)
Method to execute the query to mark a member as Tester
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""DELETE FROM " + PROJECT_MEMBERS_TABLE + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true)
abstract fun removeAllMembers(@Param(value = "id") projectId: String)
Method to execute the query to remove all the members from an existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""DELETE FROM " + PROJECT_TESTERS_TABLE + " WHERE " + PROJECT_IDENTIFIER_KEY + "=:" + PROJECT_IDENTIFIER_KEY", nativeQuery = true)
abstract fun removeAllTesters(@Param(value = "project_id") projectId: String)
Method to execute the query to remove all testers from a Project
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""DELETE FROM " + PROJECT_MEMBERS_TABLE + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + MEMBER_IDENTIFIER_KEY + "=:" + MEMBER_IDENTIFIER_KEY", nativeQuery = true)
abstract fun removeMember(@Param(value = "id") projectId: String, @Param(value = "member_id") memberId: String)
Method to execute the query to remove a member from an existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""DELETE FROM " + PROJECT_TESTERS_TABLE + " WHERE " + PROJECT_IDENTIFIER_KEY + "=:" + PROJECT_IDENTIFIER_KEY + " AND " + MEMBER_IDENTIFIER_KEY + "=:" + MEMBER_IDENTIFIER_KEY", nativeQuery = true)
abstract fun removeTester(@Param(value = "project_id") projectId: String, @Param(value = "member_id") memberId: String)
Method to execute the query to remove a tester from an existing Project
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