Notes Repository

@Repository
interface NotesRepository : JpaRepository<T, ID>

The NotesRepository interface is useful to manage the queries for the notes

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT INTO " + NOTES_KEY + " (" + IDENTIFIER_KEY + "," + AUTHOR_KEY + "," + CONTENT_NOTE_KEY + "," + CREATION_DATE_KEY + "," + MARKED_AS_DONE_KEY + "," + MARKED_AS_DONE_BY_KEY + "," + MARKED_AS_DONE_DATE_KEY + "," + UPDATE_KEY + ") " + "VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + AUTHOR_KEY + "," + ":" + CONTENT_NOTE_KEY + "," + ":" + CREATION_DATE_KEY + "," + "false," + "NULL," + "-1," + ":" + UPDATE_KEY + ")", nativeQuery = true )
abstract fun addChangeNote(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String, @Param(value = "content_note") contentNote: String, @Param(value = "creation_date") creationDate: Long, @Param(value = "project_update") updateId: String)
Method to execute the query to add a new change note
Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT INTO " + NOTES_KEY + " (" + IDENTIFIER_KEY + "," + AUTHOR_KEY + "," + CONTENT_NOTE_KEY + "," + CREATION_DATE_KEY + "," + MARKED_AS_DONE_KEY + "," + MARKED_AS_DONE_BY_KEY + "," + MARKED_AS_DONE_DATE_KEY + ")" + "VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + AUTHOR_KEY + "," + ":" + CONTENT_NOTE_KEY + "," + ":" + CREATION_DATE_KEY + "," + "false," + "NULL," + "-1" + ")", nativeQuery = true )
abstract fun createNote(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String, @Param(value = "content_note") contentNote: String, @Param(value = "creation_date") creationDate: Long)
Method to execute the query to create a new Note
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
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + "=:" + UPDATE_KEY", nativeQuery = true )
abstract fun deleteChangeNote(@Param(value = "project_update") updateId: String, @Param(value = "id") noteId: String)
Method to execute the query to delete a change note
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<T>)
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun deleteNote(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String)
Method to execute the query to delete a Note
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + NOTES_KEY + " SET " + CONTENT_NOTE_KEY + "=:" + CONTENT_NOTE_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun editNote(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String, @Param(value = "content_note") contentNote: String)
Method to execute the query to edit an existing Note
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
@Query(value = ""SELECT * FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun getNote(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String): Note
Method to execute the query to select a Note by its id
Link copied to clipboard
@Query(value = ""SELECT * FROM " + NOTES_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + "=:" + UPDATE_KEY", nativeQuery = true )
abstract fun getNoteByUpdate(@Param(value = "project_update") updateId: String, @Param(value = "id") noteId: String): Note
Method to execute the query to select a Note of an ProjectUpdate
Link copied to clipboard
@Query(value = "SELECT * FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + UPDATE_KEY + " IS NULL ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getNotes(@Param(value = "author") authorId: String, pageable: Pageable): List<Note>
@Query(value = "SELECT * FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + UPDATE_KEY + " IS NULL" + " AND " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getNotes(@Param(value = "author") authorId: String, @Param(value = "marked_as_done") markedAsDone: Boolean, pageable: Pageable): List<Note>
Method to execute the query to select the list of a Note
Link copied to clipboard
@Query(value = "SELECT COUNT(*) FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + UPDATE_KEY + " IS NULL", nativeQuery = true )
abstract fun getNotesCount(@Param(value = "author") authorId: String): Long
@Query(value = "SELECT COUNT(*) FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + " AND " + UPDATE_KEY + " IS NULL", nativeQuery = true )
abstract fun getNotesCount(@Param(value = "author") authorId: String, @Param(value = "marked_as_done") markedAsDone: Boolean): Long
Method to execute the query to select the number of the notes
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + NOTES_KEY + " SET " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + "," + MARKED_AS_DONE_BY_KEY + "=:" + MARKED_AS_DONE_BY_KEY + "," + MARKED_AS_DONE_DATE_KEY + "=:" + MARKED_AS_DONE_DATE_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + "=:" + UPDATE_KEY", nativeQuery = true )
abstract fun manageChangeNoteStatus(@Param(value = "project_update") updateId: String, @Param(value = "id") noteId: String, @Param(value = "marked_as_done") markedAsDone: Boolean, @Param(value = "marked_as_done_by") marker: String, @Param(value = "marked_as_done_date") markedAsDoneDate: Long)
Method to execute the query to manage the status of a change note
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + NOTES_KEY + " SET " + MARKED_AS_DONE_KEY + "=:" + MARKED_AS_DONE_KEY + "," + MARKED_AS_DONE_BY_KEY + "= NULL," + MARKED_AS_DONE_DATE_KEY + "=:" + MARKED_AS_DONE_DATE_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + AUTHOR_KEY + "=:" + AUTHOR_KEY", nativeQuery = true )
abstract fun manageNoteStatus(@Param(value = "author") authorId: String, @Param(value = "id") noteId: String, @Param(value = "marked_as_done") markedAsDone: Boolean, @Param(value = "marked_as_done_date") markedAsDoneDate: Long)
Method to execute the query to manage the status of a Note
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "DELETE FROM " + NOTES_KEY + " WHERE " + AUTHOR_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + " IS NULL", nativeQuery = true )
abstract fun removeUserConstraints(@Param(value = "id") userId: String)
Method to execute the query to remove the constraints between PandoroUser deleted and Note
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 " + NOTES_KEY + " SET " + AUTHOR_KEY + "= NULL" + " WHERE " + AUTHOR_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + " IS NOT NULL", nativeQuery = true )
abstract fun setGroupNotesAuthorAfterUserDeletion(@Param(value = "id") userId: String)
Method to execute the query to remove the constraints between PandoroUser deleted and the author of the Note
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "UPDATE " + NOTES_KEY + " SET " + MARKED_AS_DONE_BY_KEY + "= NULL" + " WHERE " + MARKED_AS_DONE_BY_KEY + "=:" + IDENTIFIER_KEY + " AND " + UPDATE_KEY + " IS NOT NULL", nativeQuery = true )
abstract fun setGroupNotesMarkerAfterUserDeletion(@Param(value = "id") userId: String)
Method to execute the query to remove the constraints between PandoroUser deleted and the marker of the Note