Change code in appc dispatcher for new LCMs in R6
[appc.git] / appc-inbound / appc-design-services / provider / src / main / java / org / onap / appc / design / dbervices / DbResponseProcessor.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.appc.design.dbervices;
24
25 import org.onap.appc.design.services.util.DesignServiceConstants;
26
27 import com.att.eelf.configuration.EELFLogger;
28 import com.att.eelf.configuration.EELFManager;
29
30 public class DbResponseProcessor {
31
32     private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class);
33     public String parseResponse(String dbresponse, String action) throws Exception {
34
35         log.info("Starting Parsing the response for action :[" + action +  "]\ndata:[" + dbresponse + "]");
36         String response;
37         switch (action) {
38         case DesignServiceConstants.GETDESIGNS:
39             response = getDesignsResponse(dbresponse);
40             break;
41         case DesignServiceConstants.GETAPPCTIMESTAMPUTC:
42             response = getAppcTimestampResponse(dbresponse);
43             break;
44         case DesignServiceConstants.ADDINCART:
45             response = getAddInCartResponse(dbresponse);
46             break;
47         case DesignServiceConstants.GETARTIFACTREFERENCE:
48             response = getArtifactReferenceResponse(dbresponse);
49             break;
50         case DesignServiceConstants.GETARTIFACT:
51             response = getArtifactResponse(dbresponse);
52             break;
53         case DesignServiceConstants.GETGUIREFERENCE:
54             response = getGuiReferenceResponse(dbresponse);
55             break;
56         case DesignServiceConstants.GETSTATUS:
57             response = getStatusResponse(dbresponse);
58             break;
59         case DesignServiceConstants.UPLOADARTIFACT:
60             response = getSetStatusResponse(dbresponse);
61             break;
62         case DesignServiceConstants.SETPROTOCOLREFERENCE:
63             response = getSetStatusResponse(dbresponse);
64             break;
65         case DesignServiceConstants.SETINCART:
66             response = getSetStatusResponse(dbresponse);
67             break;
68         case DesignServiceConstants.UPLOADADMINARTIFACT:
69             response = getSetStatusResponse(dbresponse);
70             break;
71         case DesignServiceConstants.CHECKVNF:
72             response = getStatusResponse(dbresponse);
73             break;
74         case DesignServiceConstants.RETRIEVEVNFPERMISSIONS:
75             response = getStatusResponse(dbresponse);
76             break;
77         case DesignServiceConstants.SAVEVNFPERMISSIONS:
78             response = getRetrieveVnfPermissionsResponse(dbresponse);
79             break;
80         default:
81             log.error("Action " + action + " Not Supported by Response Parser");
82             throw new Exception("Action " + action + " not found while processing request");
83
84         }
85         return response;
86
87     }
88
89     private String getArtifactResponse(String dbresponse) {
90         // TODO Auto-generated method stub
91         return dbresponse;
92     }
93
94     private String getSetStatusResponse(String dbresponse) {
95         // TODO Auto-generated method stub
96         return null;
97     }
98
99     private String getStatusResponse(String dbresponse) {
100         log.info("Returning response from Response Parser " + dbresponse);
101         return dbresponse;
102     }
103
104     private String getGuiReferenceResponse(String dbresponse) {
105         // TODO Auto-generated method stub
106         return null;
107     }
108
109     private String getArtifactReferenceResponse(String dbresponse) {
110         // TODO Auto-generated method stub
111         return null;
112     }
113
114     private String getAddInCartResponse(String dbresponse) {
115         // TODO Auto-generated method stub
116         return null;
117     }
118
119     private String getDesignsResponse(String dbresponse) {
120         return dbresponse;
121     }
122
123     private String getAppcTimestampResponse(String dbresponse) {
124         log.info("getAppcTimestampResponse:[" + dbresponse +"]" );
125         return dbresponse;
126     }
127
128     private String getRetrieveVnfPermissionsResponse(String dbresponse) {
129         log.info("Returning response from Response Parser " + dbresponse);
130         return dbresponse;
131     }
132
133 }