8e7304654ef663471307e4764c912d47645928ad
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2021 Aarna Networks, Inc.
3  *           All rights reserved.
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.functions.workflow.audit.db
18
19 import org.springframework.data.jpa.repository.JpaRepository
20 import org.springframework.stereotype.Repository
21 import javax.transaction.Transactional
22
23 /**
24  * JPA repository managing {@link BlueprintWorkflowAuditStatus} table.
25  */
26 @Repository
27 interface BlueprintAuditStatusRepository :
28     JpaRepository<BlueprintWorkflowAuditStatus, String> {
29
30     /**
31      * retireve records based on primary key ID.
32      * @param id
33      * @return {@link BlueprintWorkflowAuditStatus}
34      */
35     fun findById(id: Long): BlueprintWorkflowAuditStatus
36
37     /**
38      * retrieve records based on request ID
39      * @param requestId
40      * @return list {@link BlueprintWorkflowAuditStatus}
41      */
42     fun findByRequestId(
43         requestId: String
44     ): List<BlueprintWorkflowAuditStatus>
45
46     /**
47      * retrieve records based on request ID and subrequest ID
48      * @param requestId
49      * @param subRequestId
50      * @return list {@link BlueprintWorkflowAuditStatus}
51      */
52     fun findByRequestIdAndSubRequestId(
53         requestId: String,
54         subRequestId: String
55     ): List<BlueprintWorkflowAuditStatus>
56
57     /**
58      * retrieve records based on request id, blueprint name , blueprint version
59      * @param requestId
60      * @param blueprintName
61      * @param blueprintVersion
62      * @return {@link BlueprintWorkflowAuditStatus}
63      */
64     fun findByRequestIdAndBlueprintNameAndBlueprintVersion(
65         requestId: String,
66         blueprintName: String?,
67         blueprintVersion: String?
68     ): BlueprintWorkflowAuditStatus
69
70     /**
71      * retrieve records based on request id, blueprint name , blueprint version
72      * @return {@link BlueprintWorkflowAuditStatus}
73      */
74     fun findByOriginatorIdAndRequestIdAndSubRequestIdAndWorkflowNameAndBlueprintNameAndBlueprintVersion(
75         originatorId: String,
76         requestId: String?,
77         subRequestId: String?,
78         workflowName: String,
79         blueprintName: String?,
80         blueprintVersion: String?
81     ): BlueprintWorkflowAuditStatus
82
83     /**
84      * retrieve records based on request id, subrequest, originator, workflow,
85      * blueprint version, blueprint Name
86      * @return {@link BlueprintWorkflowAuditStatus}
87      */
88     fun findByIdAndOriginatorIdAndRequestIdAndSubRequestIdAndWorkflowNameAndBlueprintNameAndBlueprintVersion(
89         id: Long,
90         originatorId: String,
91         requestId: String?,
92         subRequestId: String?,
93         workflowName: String,
94         blueprintName: String?,
95         blueprintVersion: String?
96     ): BlueprintWorkflowAuditStatus
97
98     @Transactional
99     fun deleteByIdAndBlueprintNameAndBlueprintVersionAndOriginatorIdAndRequestIdAndSubRequestId(
100         id: Long,
101         blueprintName: String?,
102         blueprintVersion: String?,
103         originatorId: String,
104         requestId: String?,
105         subRequestId: String?
106     )
107 }