Package sk.iway.iwcm.doc
Interface DocHistoryRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DocHistory,,Long> org.springframework.data.jpa.repository.JpaRepository<DocHistory,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<DocHistory>,org.springframework.data.repository.ListCrudRepository<DocHistory,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<DocHistory,,Long> org.springframework.data.repository.PagingAndSortingRepository<DocHistory,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<DocHistory>,org.springframework.data.repository.Repository<DocHistory,Long>
@Repository
public interface DocHistoryRepository
extends org.springframework.data.jpa.repository.JpaRepository<DocHistory,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<DocHistory>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T extends Object> -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByIdPublicable(Long historyId, boolean publicable) intdeleteDeletableById(Long historyId, int docId, boolean cleanup, Date now) Rechecks publication and approval state when deleting a version of the authorized page.voiddeleteHistoryOnPublish(List<Integer> historyIds, int authorId) findByDocIdAndPublishStartDateBetween(Integer docId, Date publishStartDateFrom, Date publishStartDateTo) findByDocIdInActual(List<Integer> docIds) findGroupIdById(Long id) findMaxHistoryId(int docId) findMaxHistoryId(int docId, boolean actual) findOldHistoryIds(int docId, int historyId) findOldHistoryIds(int docId, Long historyId, boolean publicable, int authorId) findPendingByGroupId(int groupId) Returns scheduled versions, approval requests and the latest unapproved draft, excluding deleted versions.getHisotryIdsByDocIdIn(Integer docIds) getPublicableByDocIdIn(Integer docIds) voidrejectDocHistory(String awaitingApprove, Integer disapprovedBy, Integer historyId) voidupdateActual(boolean actual, int[] historyIds) voidupdateActual(boolean actual, List<Integer> historyIds) voidupdateActualHistory(boolean actual, String awaitingApprove, List<Integer> historyIds) voidupdateAwaitingApprove(String awaitingApprove, Integer docId) voidupdatePublicableAndActual(boolean publicable, boolean actual, int approvedBy, boolean available, int historyId) voidupdateVirtualPath(Long historyId, String virtualPath) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, updateMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByDocIdAndPublicableTrueOrderByIdDesc
-
findByPublicableTrue
List<DocHistory> findByPublicableTrue() -
findByDocIdAndPublishStartDateBetween
List<DocHistory> findByDocIdAndPublishStartDateBetween(Integer docId, Date publishStartDateFrom, Date publishStartDateTo) -
findOldHistoryIds
-
deleteHistoryOnPublish
-
deleteByIdPublicable
@Transactional @Modifying @Query("DELETE FROM DocHistory WHERE id = :historyIds AND publicable = :publicable") void deleteByIdPublicable(@Param("historyIds") Long historyId, @Param("publicable") boolean publicable) -
deleteDeletableById
@Transactional @Modifying @Query("DELETE FROM DocHistory dh WHERE dh.id = :historyId AND dh.docId = :docId AND (dh.actual IS NULL OR dh.actual = false) AND (dh.awaitingApprove IS NULL OR dh.awaitingApprove = \'\') AND (:cleanup = true OR (dh.publicable = true AND dh.publishStartDate > :now))") int deleteDeletableById(@Param("historyId") Long historyId, @Param("docId") int docId, @Param("cleanup") boolean cleanup, @Param("now") Date now) Rechecks publication and approval state when deleting a version of the authorized page. -
findOldHistoryIds
-
updateActualHistory
-
updateActual
-
rejectDocHistory
@Transactional @Modifying @Query("UPDATE DocHistory SET awaitingApprove = :awaitingApprove, disapprovedBy = :disapprovedBy, syncStatus = 1 WHERE id = :historyId") void rejectDocHistory(@Param("awaitingApprove") String awaitingApprove, @Param("disapprovedBy") Integer disapprovedBy, @Param("historyId") Integer historyId) -
updateAwaitingApprove
-
findMaxHistoryId
-
findMaxHistoryId
@Query(value="SELECT max(history_id) AS max FROM documents_history WHERE doc_id=?", nativeQuery=true) Integer findMaxHistoryId(int docId) -
findGroupIdById
-
findByDocIdInActual
@Query("SELECT dh FROM DocHistory dh WHERE dh.docId IN :docIds AND dh.actual = 1") List<DocHistory> findByDocIdInActual(@Param("docIds") List<Integer> docIds) -
findTopByDocIdOrderBySaveDateDesc
-
updateActual
@Transactional @Modifying @Query("UPDATE DocHistory dh SET dh.actual = :actual WHERE dh.id IN :historyIds") void updateActual(@Param("actual") boolean actual, @Param("historyIds") int[] historyIds) -
updatePublicableAndActual
@Transactional @Modifying @Query("UPDATE DocHistory dh SET dh.publicable = :publicable, dh.actual = :actual, dh.approvedBy = :approvedBy, dh.syncStatus = 1, dh.available = :available WHERE dh.id = :historyId") void updatePublicableAndActual(@Param("publicable") boolean publicable, @Param("actual") boolean actual, @Param("approvedBy") int approvedBy, @Param("available") boolean available, @Param("historyId") int historyId) -
getPublicableByDocIdIn
-
getHisotryIdsByDocIdIn
-
getPublicableThatAreNotAwaitingToApprove
@Query("SELECT dh FROM DocHistory dh WHERE dh.publicable = true AND ( dh.awaitingApprove IS NULL OR dh.awaitingApprove = \'\' ) AND dh.publishStartDate IS NOT NULL") Optional<List<DocHistory>> getPublicableThatAreNotAwaitingToApprove() -
findPendingByGroupId
@Query("SELECT dh FROM DocHistory dh WHERE dh.groupId = :groupId AND (dh.isDelete IS NULL OR dh.isDelete = false) AND (dh.publicable = true OR (dh.awaitingApprove IS NOT NULL AND dh.awaitingApprove <> \'\') OR (dh.actual = false AND dh.approvedBy = -1 AND (dh.disapprovedBy IS NULL OR dh.disapprovedBy <= 0) AND dh.id = (SELECT MAX(latest.id) FROM DocHistory latest WHERE latest.docId = dh.docId)))") List<DocHistory> findPendingByGroupId(@Param("groupId") int groupId) Returns scheduled versions, approval requests and the latest unapproved draft, excluding deleted versions. -
updateVirtualPath
-