2 * Copyright (C) 2019 Bell Canada.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
18 import org.springframework.data.jpa.repository.JpaRepository
19 import org.springframework.data.jpa.repository.Query
20 import org.springframework.data.repository.query.Param
21 import org.springframework.stereotype.Repository
22 import javax.transaction.Transactional
25 interface ResourceResolutionRepository : JpaRepository<ResourceResolution, String> {
28 value = "SELECT * FROM RESOURCE_RESOLUTION WHERE resolution_key = :key AND blueprint_name = :blueprintName AND blueprint_version = :blueprintVersion AND artifact_name = :artifactName AND name = :name ORDER BY occurrence DESC, creation_date DESC LIMIT 1",
31 fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndName(
32 @Param("key")key: String,
33 @Param("blueprintName")blueprintName: String,
34 @Param("blueprintVersion")blueprintVersion: String,
35 @Param("artifactName")artifactName: String,
36 @Param("name")name: String
37 ): ResourceResolution?
39 fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
40 resolutionKey: String,
41 blueprintName: String,
42 blueprintVersion: String,
43 artifactPrefix: String
44 ): List<ResourceResolution>
46 fun findByBlueprintNameAndBlueprintVersionAndResourceIdAndResourceType(
47 blueprintName: String,
48 blueprintVersion: String,
51 ): List<ResourceResolution>
53 fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
54 blueprintName: String?,
55 blueprintVersion: String?,
57 resolutionKey: String,
59 ): List<ResourceResolution>
61 fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
62 blueprintName: String?,
63 blueprintVersion: String?,
68 ): List<ResourceResolution>
71 fun deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
72 blueprintName: String?,
73 blueprintVersion: String?,