AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-requests-db / src / main / java / org / openecomp / mso / requestsdb / RequestsDBHelper.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.mso.requestsdb;\r
22 \r
23 import org.openecomp.mso.logger.MsoLogger;\r
24 \r
25 public class RequestsDBHelper {\r
26                 \r
27         private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);    \r
28         private String className = this.getClass().getSimpleName() +" class\'s ";\r
29         private String methodName = ""; \r
30         private String classMethodMessage = "";\r
31         \r
32         /**\r
33          * This util method is to update the InfraRequest table to Complete\r
34          * @param msg - string, unique message for each caller\r
35          * @param requestId - string\r
36          * @param operationalEnvironmentId - string   \r
37          * @return void - nothing \r
38          * @throws Exception \r
39          */     \r
40         public void updateInfraSuccessCompletion(String msg, String requestId, String operationalEnvironmentId) {\r
41                 methodName = "updateInfraSuccessCompletion() method.";\r
42                 classMethodMessage = className + " " + methodName;              \r
43                 msoLogger.debug("Begin of " + classMethodMessage);\r
44                         \r
45                 RequestsDatabase requestDB = RequestsDatabase.getInstance();\r
46                 requestDB.updateInfraFinalStatus(requestId, "COMPLETE", "SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg,\r
47                                                                                 100L, null, "APIH");\r
48                 msoLogger.debug("End of " + classMethodMessage);                \r
49                 \r
50         }\r
51         \r
52         /**\r
53          * This util method is to update the InfraRequest table to Failure\r
54          * @param msg - string, unique message for each caller\r
55          * @param requestId - string\r
56          * @param operationalEnvironmentId - string   \r
57          * @return void - nothing \r
58          * @throws Exception \r
59          */     \r
60         public void updateInfraFailureCompletion(String msg, String requestId, String operationalEnvironmentId) {\r
61                 methodName = "updateInfraFailureCompletion() method.";\r
62                 classMethodMessage = className + " " + methodName;              \r
63                 msoLogger.debug("Begin of " + classMethodMessage);\r
64                 \r
65                 RequestsDatabase requestDB = RequestsDatabase.getInstance();\r
66                 requestDB.updateInfraFinalStatus(requestId, "FAILED", "FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg,\r
67                                                                                         100L, null, "APIH");\r
68                 msoLogger.debug("End of " + classMethodMessage);                \r
69                 \r
70         }       \r
71 }\r