
001package ca.uhn.fhir.jpa.dao.data; 002 003import ca.uhn.fhir.jpa.entity.BulkImportJobEntity; 004import ca.uhn.fhir.jpa.entity.BulkImportJobFileEntity; 005import org.springframework.data.jpa.repository.JpaRepository; 006import org.springframework.data.jpa.repository.Query; 007import org.springframework.data.repository.query.Param; 008 009import java.util.List; 010import java.util.Optional; 011 012/* 013 * #%L 014 * HAPI FHIR JPA Server 015 * %% 016 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 017 * %% 018 * Licensed under the Apache License, Version 2.0 (the "License"); 019 * you may not use this file except in compliance with the License. 020 * You may obtain a copy of the License at 021 * 022 * http://www.apache.org/licenses/LICENSE-2.0 023 * 024 * Unless required by applicable law or agreed to in writing, software 025 * distributed under the License is distributed on an "AS IS" BASIS, 026 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 027 * See the License for the specific language governing permissions and 028 * limitations under the License. 029 * #L% 030 */ 031 032public interface IBulkImportJobFileDao extends JpaRepository<BulkImportJobFileEntity, Long>, IHapiFhirJpaRepository { 033 034 @Query("SELECT f FROM BulkImportJobFileEntity f WHERE f.myJob.myJobId = :jobId ORDER BY f.myFileSequence ASC") 035 List<BulkImportJobFileEntity> findAllForJob(@Param("jobId") String theJobId); 036 037 @Query("SELECT f FROM BulkImportJobFileEntity f WHERE f.myJob = :job AND f.myFileSequence = :fileIndex") 038 Optional<BulkImportJobFileEntity> findForJob(@Param("job") BulkImportJobEntity theJob, @Param("fileIndex") int theFileIndex); 039 040 @Query("SELECT f.myFileDescription FROM BulkImportJobFileEntity f WHERE f.myJob = :job AND f.myFileSequence = :fileIndex") 041 Optional<String> findFileDescriptionForJob(@Param("job") BulkImportJobEntity theJob, @Param("fileIndex") int theFileIndex); 042 043 @Query("SELECT f.myId FROM BulkImportJobFileEntity f WHERE f.myJob.myJobId = :jobId ORDER BY f.myFileSequence ASC") 044 List<Long> findAllIdsForJob(@Param("jobId") String theJobId); 045 046}