
001package ca.uhn.fhir.jpa.dao.data; 002 003import ca.uhn.fhir.context.FhirVersionEnum; 004import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionResourceEntity; 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 011/* 012 * #%L 013 * HAPI FHIR JPA Server 014 * %% 015 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 016 * %% 017 * Licensed under the Apache License, Version 2.0 (the "License"); 018 * you may not use this file except in compliance with the License. 019 * You may obtain a copy of the License at 020 * 021 * http://www.apache.org/licenses/LICENSE-2.0 022 * 023 * Unless required by applicable law or agreed to in writing, software 024 * distributed under the License is distributed on an "AS IS" BASIS, 025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 026 * See the License for the specific language governing permissions and 027 * limitations under the License. 028 * #L% 029 */ 030 031public interface INpmPackageVersionResourceDao extends JpaRepository<NpmPackageVersionResourceEntity, Long>, IHapiFhirJpaRepository { 032 033 @Query("SELECT e FROM NpmPackageVersionResourceEntity e WHERE e.myResourceType = :resourceType AND e.myFhirVersion = :fhirVersion AND e.myPackageVersion.myCurrentVersion = true") 034 Slice<NpmPackageVersionResourceEntity> findCurrentVersionByResourceType(Pageable thePage, @Param("fhirVersion") FhirVersionEnum theFhirVersion, @Param("resourceType") String theResourceType); 035 036 @Query("SELECT e FROM NpmPackageVersionResourceEntity e WHERE e.myCanonicalUrl = :url AND e.myFhirVersion = :fhirVersion AND e.myPackageVersion.myCurrentVersion = true") 037 Slice<NpmPackageVersionResourceEntity> findCurrentVersionByCanonicalUrl(Pageable thePage, @Param("fhirVersion") FhirVersionEnum theFhirVersion, @Param("url") String theCanonicalUrl); 038 039 @Query("SELECT e FROM NpmPackageVersionResourceEntity e WHERE e.myCanonicalUrl = :url AND e.myCanonicalVersion = :version AND e.myFhirVersion = :fhirVersion AND e.myPackageVersion.myCurrentVersion = true") 040 Slice<NpmPackageVersionResourceEntity> findCurrentVersionByCanonicalUrlAndVersion(Pageable theOf, @Param("fhirVersion") FhirVersionEnum theFhirVersion, @Param("url") String theCanonicalUrl, @Param("version") String theCanonicalVersion); 041}