230e67852caaedea7869c2eb4c17e4bba3308f20
[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
18
19 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
20 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
21 import org.onap.ccsdk.cds.blueprintsprocessor.functions.workflow.audit.db.BlueprintAuditStatusRepository
22 import org.onap.ccsdk.cds.blueprintsprocessor.functions.workflow.audit.db.BlueprintWorkflowAuditStatus
23 import org.slf4j.LoggerFactory
24 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
25 import org.springframework.stereotype.Service
26 import javax.annotation.PostConstruct
27
28 /**
29  * Workflow request and response details are persisted to database
30  */
31 @ConditionalOnProperty(
32     name = ["blueprintsprocessor.workflow.self-service-api.audit.storeEnable"],
33     havingValue = "false"
34 )
35 @Service
36 class NoStoreAuditService(
37     private val blueprintAuditStatusRepository: BlueprintAuditStatusRepository
38 ) : StoreAuditService {
39
40     private val log =
41         LoggerFactory.getLogger(NoStoreAuditService::class.toString())
42
43     @PostConstruct
44     fun init() {
45         log.info("Workflow Audit store is disabled")
46     }
47     /**
48      * store the blueprint workflow input details to database
49      * @param executionServiceInput {@link ExecutionServiceInput}
50      * @throws {@link BluePrintException}
51      */
52     override suspend fun storeExecutionInput(
53         executionServiceInput: ExecutionServiceInput
54     ): Long {
55         log.info(
56             "storeExecutionInput called not to store the Workflow action " +
57                 "input details "
58         )
59         val resturnId: Long = -1
60         return resturnId
61     }
62
63     /**
64      * store the blueprint workflow output to database
65      * @param auditStoreId
66      * @param correlationUUID
67      * @param executionServiceOutput {@link ExecutionServiceOutput}
68      * @throws {@link BluePrintException}
69      */
70     override suspend fun storeExecutionOutput(
71         auditStoreId: Long,
72         correlationUUID: String,
73         executionServiceOutput: ExecutionServiceOutput
74     ) {
75         log.info(
76             "storeExecutionOutput called not to store the Workflow action " +
77                 "output details correlationUUID $correlationUUID " +
78                 "auditStoreId $auditStoreId"
79         )
80     }
81
82     /**
83      * retrive workflow records based on request ID
84      * @param requestId
85      * @return list of {@link BlueprintWorkflowAuditStatus}
86      */
87     override suspend fun getWorkflowStatusByRequestId(
88         requestId: String
89     ): List<BlueprintWorkflowAuditStatus> {
90         log.info(
91             "getWorkflowStatusByRequestId placeholer , this doesn't return " +
92                 "any records"
93         )
94
95         var results: List<BlueprintWorkflowAuditStatus> = ArrayList<BlueprintWorkflowAuditStatus>()
96         return results
97     }
98
99     /**
100      * Retrive workflow records based on request ID and sub request ID
101      * @param requestId
102      * @param subRequestId
103      * @return list of {@link BlueprintWorkflowAuditStatus}
104      */
105     override suspend fun getWorkflowStatusByRequestIdAndSubRequestId(
106         requestId: String,
107         subRequestId: String
108     ): List<BlueprintWorkflowAuditStatus> {
109         log.info(
110             "getWorkflowStatusByRequestIdAndSubRequestId  placeholer , this doesn't return  " +
111                 "any records"
112         )
113
114         var results: List<BlueprintWorkflowAuditStatus> = ArrayList<BlueprintWorkflowAuditStatus>()
115
116         return results
117     }
118 }