Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / controllerblueprints / modules / db-resources / src / main / kotlin / org / onap / ccsdk / cds / controllerblueprints / db / resources / repository / ModelContentRepository.kt
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  * Modifications Copyright © 2019 Bell Canada.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 package org.onap.ccsdk.cds.controllerblueprints.db.resources.repository
19
20 import org.jetbrains.annotations.NotNull
21 import java.util.Optional
22 import org.springframework.data.jpa.repository.JpaRepository
23 import org.springframework.data.repository.NoRepositoryBean
24
25 /**
26  * @param <T> Model
27  * @param <B> ModelContent
28  */
29 @NoRepositoryBean
30 interface ModelContentRepository<T, B> : JpaRepository<B, String> {
31
32     /**
33      * This is a findById method
34      *
35      * @param id id
36      * @return Optional<T>
37      */
38     @NotNull
39     override fun findById(@NotNull id: String): Optional<B>
40
41     /**
42      * This is a findTopByBlueprintModelAndContentType method
43      *
44      * @param blueprintModel blueprintModel
45      * @param contentType contentType
46      * @return B?
47      */
48     fun findTopByBlueprintModelAndContentType(blueprintModel: T, contentType: String): B?
49
50     /**
51      * This is a findByBlueprintModelAndContentType method
52      *
53      * @param blueprintModel blueprintModel
54      * @param contentType contentType
55      * @return List<B>
56      */
57     fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B>
58
59     /**
60      * This is a findByBlueprintModel method
61      *
62      * @param blueprintModel T
63      * @return List<B>
64      */
65     fun findByBlueprintModel(blueprintModel: T): List<B>
66
67     /**
68      * This is a findByBlueprintModelAndContentTypeAndName method
69      *
70      * @param blueprintModel blueprintModel
71      * @param contentType contentType
72      * @param name name
73      * @return B?
74      */
75     fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T, contentType: String, name: String): B?
76
77     /**
78      * This is a deleteByMdeleteByBlueprintModelodelName method
79      *
80      * @param blueprintModel T
81      */
82     fun deleteByBlueprintModel(blueprintModel: T)
83
84     /**
85      * This is a deleteById method
86      *
87      * @param id id
88      */
89     override fun deleteById(@NotNull id: String)
90
91 }