001package ca.uhn.fhir.jpa.dao.data;
002
003import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobStatusEnum;
004import ca.uhn.fhir.jpa.entity.BulkImportJobEntity;
005import org.springframework.data.domain.Pageable;
006import org.springframework.data.domain.Slice;
007import org.springframework.data.jpa.repository.JpaRepository;
008import org.springframework.data.jpa.repository.Query;
009import org.springframework.data.repository.query.Param;
010
011import java.util.Optional;
012
013/*
014 * #%L
015 * HAPI FHIR JPA Server
016 * %%
017 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
018 * %%
019 * Licensed under the Apache License, Version 2.0 (the "License");
020 * you may not use this file except in compliance with the License.
021 * You may obtain a copy of the License at
022 *
023 * http://www.apache.org/licenses/LICENSE-2.0
024 *
025 * Unless required by applicable law or agreed to in writing, software
026 * distributed under the License is distributed on an "AS IS" BASIS,
027 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
028 * See the License for the specific language governing permissions and
029 * limitations under the License.
030 * #L%
031 */
032
033public interface IBulkImportJobDao extends JpaRepository<BulkImportJobEntity, Long>, IHapiFhirJpaRepository {
034
035        @Query("SELECT j FROM BulkImportJobEntity j WHERE j.myJobId = :jobid")
036        Optional<BulkImportJobEntity> findByJobId(@Param("jobid") String theUuid);
037
038        @Query("SELECT j FROM BulkImportJobEntity j WHERE j.myStatus = :status")
039        Slice<BulkImportJobEntity> findByStatus(Pageable thePage, @Param("status") BulkImportJobStatusEnum theStatus);
040}