59ace723a4c0dc64d5361f43b6bdb8bceef8e1e3
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / commons / db-lib / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / db / primary / repository / BlueprintModelContentRepository.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.blueprintsprocessor.db.primary.repository
19
20 import org.jetbrains.annotations.NotNull
21 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
22 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
23 import org.springframework.data.jpa.repository.JpaRepository
24 import org.springframework.stereotype.Repository
25 import java.util.Optional
26
27 /**
28  * @param <T> Model
29  * @param <B> ModelContent
30  */
31 @Repository
32 interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent, String> {
33
34     /**
35      * This is a findById method
36      *
37      * @param id id
38      * @return Optional<T>
39      */
40     @NotNull
41     override fun findById(@NotNull id: String): Optional<BlueprintModelContent>
42
43     /**
44      * This is a findTopByBlueprintModelAndContentType method
45      *
46      * @param blueprintModel blueprintModel
47      * @param contentType contentType
48      * @return B?
49      */
50     fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
51             BlueprintModelContent?
52
53     /**
54      * This is a findByBlueprintModelAndContentType method
55      *
56      * @param blueprintModel blueprintModel
57      * @param contentType contentType
58      * @return List<B>
59      */
60     fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
61             List<BlueprintModelContent>
62
63     /**
64      * This is a findByBlueprintModel method
65      *
66      * @param blueprintModel T
67      * @return List<B>
68      */
69     fun findByBlueprintModel(blueprintModel: BlueprintModel): List<BlueprintModelContent>
70
71     /**
72      * This is a findByBlueprintModelAndContentTypeAndName method
73      *
74      * @param blueprintModel blueprintModel
75      * @param contentType contentType
76      * @param name name
77      * @return B?
78      */
79     fun findByBlueprintModelAndContentTypeAndName(
80         blueprintModel: BlueprintModel,
81         contentType: String,
82         name: String
83     ): BlueprintModelContent?
84
85     /**
86      * This is a deleteByMdeleteByBlueprintModelodelName method
87      *
88      * @param blueprintModel T
89      */
90     fun deleteByBlueprintModel(blueprintModel: BlueprintModel)
91
92     /**
93      * This is a deleteById method
94      *
95      * @param id id
96      */
97     override fun deleteById(@NotNull id: String)
98 }