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.config.snapshots.db
18 import org.springframework.data.jpa.repository.JpaRepository
19 import org.springframework.stereotype.Repository
20 import javax.transaction.Transactional
23 * JPA repository managing the underlying ResourceConfigSnapshot table.
25 * @author Serge Simard
29 interface ResourceConfigSnapshotRepository : JpaRepository<ResourceConfigSnapshot, String> {
31 fun findByResourceIdAndResourceTypeAndStatus(
34 status: ResourceConfigSnapshot.Status
35 ): ResourceConfigSnapshot?
38 fun deleteByResourceIdAndResourceTypeAndStatus(
41 status: ResourceConfigSnapshot.Status
45 * Finds all ResourceConfigSnapshot for a given resourceId and status as search criterias,
46 * ordering the resulting list in reverse chronological order.
48 * @param resourceId a resource identifier, e.g. CLLI1234555
49 * @param status RUNNING or CANDIDATE
51 * @return A list of entries are found returns a list of ConfigSnapshot.
52 * If no entries are found, this method returns an empty list.
54 fun findByResourceIdAndStatusOrderByCreatedDateDesc(
56 status: ResourceConfigSnapshot.Status
57 ): List<ResourceConfigSnapshot>?
60 * Finds all ResourceConfigSnapshot for a given resourceId,
61 * ordering the resulting list in reverse chronological order.
63 * @param resourceId a resource identifier, e.g. CLLI1234555
65 * @return A list of entries are found returns a list of ConfigSnapshot.
66 * If no entries are found, this method returns an empty list.
68 fun findByResourceIdOrderByCreatedDateDesc(
70 ): List<ResourceConfigSnapshot>?
73 * Finds all ResourceConfigSnapshot for a given resourceType and status as search criterias,
74 * ordering the resulting list in reverse chronological order.
76 * @param resourceType a resource type name, e.g full_config
77 * @param status RUNNING or CANDIDATE
79 * @return A list of entries are found returns a list of ConfigSnapshot.
80 * If no entries are found, this method returns an empty list.
82 fun findByResourceTypeAndStatusOrderByCreatedDateDesc(
84 status: ResourceConfigSnapshot.Status
85 ): List<ResourceConfigSnapshot>?
88 * Finds all ResourceConfigSnapshot for a given resourceType,
89 * ordering the resulting list in reverse chronological order.
91 * @param resourceType a resource type name, e.g full_config
93 * @return A list of entries are found returns a list of ConfigSnapshot.
94 * If no entries are found, this method returns an empty list.
96 fun findByResourceTypeOrderByCreatedDateDesc(
98 ): List<ResourceConfigSnapshot>?