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
  • Method Details

    • findByIdAndContractId

      DocumentsEntity findByIdAndContractId(long id, Long contractId)
      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

      boolean existsByNameAndContractId(String name, long contractId)
      Parameters:
      name - the name
      contractId - teh contractId
      Returns:
      boolean value
    • findByContractId

      List<DocumentsEntity> findByContractId(long contractId)
      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