Package com.skava.accounts.repository
Interface DocumentRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DocumentsEntity,
,Long> org.springframework.data.repository.Repository<DocumentsEntity,
Long>
public interface DocumentRepository
extends org.springframework.data.repository.CrudRepository<DocumentsEntity,Long>
The Interface DocumentRepository extends another CrudRepository which contains all default crud operations.
DocumentRepository contains customized methods definitions for the operations in Document entity.
- Author:
- Infosys Equinox
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Object to used to store the loaded documents without content -
Method Summary
Modifier and TypeMethodDescriptionboolean
existsByIdAndContractId
(long id, long contractId) Exists by id and accountIdd.boolean
existsByNameAndContractId
(String name, long contractId) findByContractId
(long contractId) findByIdAndContractId
(long id, Long contractId) Find DocumentsEntity by id and accountId.findDocumentsWithoutContent
(long contractId) find Documents WithoutContentMethods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
findByIdAndContractId
Find DocumentsEntity by id and accountId.- Parameters:
id
- the unique identifier of document.contractId
- It refers to the id of the contract which is a unique identifier. An contract should exists for the given contractId, and also the contract should be associated with the given document id.- Returns:
- the DocumentsEntity
-
existsByIdAndContractId
boolean existsByIdAndContractId(long id, long contractId) Exists by id and accountIdd.- Parameters:
id
- the unique identifier of document.contractId
- It refers to the id of the contract which is a unique identifier. An contract should exists for the given contractId, and also the contract should be associated with the given document id.- Returns:
- true, if successful
-
existsByNameAndContractId
- Parameters:
name
- the namecontractId
- teh contractId- Returns:
- boolean value
-
findByContractId
- Parameters:
contractId
- the contractId- Returns:
- list of
DocumentsEntity
-
findDocumentsWithoutContent
@Query(value="SELECT id, contract_id as contractId, name, type, url, updated_time as updatedTime, created_time as createdTime FROM documents where contract_id = ?1", nativeQuery=true) List<DocumentRepository.DocumentWithoutContent> findDocumentsWithoutContent(long contractId) find Documents WithoutContent- Parameters:
contractId
- It refers to the id of the contract which is a unique identifier. An contract should exists for the given contractId, and also the contract should be associated with the given document id.- Returns:
- list of Documents with out content
-