Projects Repository

@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
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 " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun deleteProject(@Param(value = "author") userId: String, @Param(value = "id") projectId: String)
Method to execute the query to delete an existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE pg FROM " + PROJECTS_GROUPS_TABLE + " pg LEFT JOIN " + PROJECTS_KEY + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + "pg." + PROJECT_IDENTIFIER_KEY + " WHERE " + PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun deleteProjects(@Param(value = "author") userId: String)
Method to execute the query to delete the current list of projects of an user
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET " + NAME_KEY + "=:" + NAME_KEY + "," + PROJECT_DESCRIPTION_KEY + "=:" + PROJECT_DESCRIPTION_KEY + "," + PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY + "," + PROJECT_REPOSITORY_KEY + "=:" + PROJECT_REPOSITORY_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun editProject(@Param(value = "author") author: String, @Param(value = "id") projectId: String, @Param(value = "name") name: String, @Param(value = "project_description") description: String, @Param(value = "project_version") version: String, @Param(value = "project_repository") repository: String)
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET " + NAME_KEY + "=:" + NAME_KEY + "," + PROJECT_ICON_KEY + "=:" + PROJECT_ICON_KEY + "," + PROJECT_DESCRIPTION_KEY + "=:" + PROJECT_DESCRIPTION_KEY + "," + PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY + "," + PROJECT_REPOSITORY_KEY + "=:" + PROJECT_REPOSITORY_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun editProject(@Param(value = "author") author: String, @Param(value = "id") projectId: String, @Param(value = "name") name: String, @Param(value = "icon") icon: String, @Param(value = "project_description") description: String, @Param(value = "project_version") version: String, @Param(value = "project_repository") repository: String)
Method to execute the query to edit 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
@Query(value = "SELECT * FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getAuthoredProjects(@Param(value = "author") userId: String): List<Project>
Method to execute the query to select the list of a Project authored by the user id
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
@Query(value = "SELECT " + PROJECTS_KEY + ".*" + " FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY + " AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" + " WHERE " + PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " + PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY + " AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED'" + " AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getCompleteInDevelopmentProjectsList(@Param(value = "author") userId: String, @Param(value = "name") name: String, @Param(value = "filters") versions: Set<String>): List<Project>
Method to execute the query to select the list of a Project currently IN_DEVELOPMENT
Link copied to clipboard
@Query(value = "SELECT * FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " + PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getCompleteProjectsList(@Param(value = "author") userId: String, @Param(value = "name") name: String, @Param(value = "filters") versions: Set<String>): List<Project>
Method to execute the query to select the list of a Project
Link copied to clipboard
@Query(value = "SELECT " + PROJECTS_KEY + ".*" + " FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY + " AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" + " WHERE " + PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " + PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY + " AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED'" + " AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getInDevelopmentProjects(@Param(value = "author") userId: String, @Param(value = "name") name: String, @Param(value = "filters") versions: Set<String>, pageable: Pageable): List<Project>
Method to execute the query to select the list of a Project currently IN_DEVELOPMENT
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 + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " =:" + IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun getProject(@Param(value = "author") userId: String, @Param(value = "id") projectId: String): Project
Method to execute the query to select an existing Project
Link copied to clipboard
@Query(value = ""SELECT * FROM " + PROJECTS_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun getProjectById(@Param(value = "id") projectId: String): Project
Method to execute the query to select a Project by its id
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""SELECT " + GROUP_IDENTIFIER_KEY + " FROM " + PROJECTS_GROUPS_TABLE + " WHERE " + PROJECT_IDENTIFIER_KEY + "=:" + PROJECT_IDENTIFIER_KEY", nativeQuery = true )
abstract fun getProjectGroupsIds(@Param(value = "project_id") projectId: String): List<String>
Method to execute the query to select the list of a Group's id of a project
Link copied to clipboard
@Query(value = "SELECT * FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " + PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY + " AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND COALESCE(:" + FILTERS_KEY + ") IS NULL" + " OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getProjects(@Param(value = "author") userId: String, @Param(value = "name") name: String, @Param(value = "filters") versions: Set<String>, pageable: Pageable): List<Project>
Method to execute the query to select the list of a Project
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT INTO " + PROJECTS_KEY + "( " + AUTHOR_KEY + "," + IDENTIFIER_KEY + "," + NAME_KEY + "," + PROJECT_ICON_KEY + "," + CREATION_DATE_KEY + "," + PROJECT_DESCRIPTION_KEY + "," + PROJECT_VERSION_KEY + "," + PROJECT_REPOSITORY_KEY + ") VALUES " + "( " + ":" + AUTHOR_KEY + "," + ":" + IDENTIFIER_KEY + "," + ":" + NAME_KEY + "," + ":" + PROJECT_ICON_KEY + "," + ":" + CREATION_DATE_KEY + "," + ":" + PROJECT_DESCRIPTION_KEY + "," + ":" + PROJECT_VERSION_KEY + "," + ":" + PROJECT_REPOSITORY_KEY + ")", nativeQuery = true )
abstract fun insertProject(@Param(value = "author") author: String, @Param(value = "id") projectId: String, @Param(value = "name") name: String, @Param(value = "icon") icon: String, @Param(value = "creation_date") creationDate: Long, @Param(value = "project_description") description: String, @Param(value = "project_version") version: String, @Param(value = "project_repository") repository: String)
Method to execute the query to add a new Project
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE FROM " + PROJECTS_GROUPS_TABLE + " WHERE " + PROJECT_IDENTIFIER_KEY + "=:" + PROJECT_IDENTIFIER_KEY + " AND " + GROUP_IDENTIFIER_KEY + "=:" + GROUP_IDENTIFIER_KEY", nativeQuery = true )
abstract fun removeProjectGroup(@Param(value = "project_id") projectId: String, @Param(value = "group_id") groupId: String)
Method to execute the query to remove a group from a 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
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET " + PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun updateProjectVersion(@Param(value = "author") author: String, @Param(value = "id") projectId: String, @Param(value = "project_version") version: String)
Method to execute the query to update to the last published update project_version the project_version of the Project