Update license header in appc-inbound files
[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-2018 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  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.design.dbervices;
25
26 import org.onap.appc.design.services.util.DesignServiceConstants;
27
28 import com.att.eelf.configuration.EELFLogger;
29 import com.att.eelf.configuration.EELFManager;
30
31 public class DbResponseProcessor {
32
33     private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class);
34     public String parseResponse(String dbresposne, String action) throws Exception {
35         
36         log.info("Starting Parsing the response for action : " + action +  "\n data "  + dbresposne );
37         String response ;         
38         switch (action) {
39         case DesignServiceConstants.GETDESIGNS:
40             response =  getDesignsResponse(dbresposne);
41             break;
42         case DesignServiceConstants.ADDINCART:
43             response =  getAddInCartResponse(dbresposne);
44             break ;
45         case DesignServiceConstants.GETARTIFACTREFERENCE:
46             response=  getArtifactReferenceResponse(dbresposne);
47             break;
48         case DesignServiceConstants.GETARTIFACT:
49             response=  getArtifactResponse(dbresposne);
50             break;
51         case DesignServiceConstants.GETGUIREFERENCE:
52             response=  getGuiReferenceResponse(dbresposne);
53             break;
54         case DesignServiceConstants.GETSTATUS:
55             response=  getStatusResponse(dbresposne);
56             break;
57         case DesignServiceConstants.UPLOADARTIFACT:
58             response=  getsetStatusResponse(dbresposne);
59             break;    
60         case DesignServiceConstants.SETPROTOCOLREFERENCE:
61             response=  getsetStatusResponse(dbresposne);
62             break;    
63         case DesignServiceConstants.SETINCART:
64             response=  getsetStatusResponse(dbresposne);
65             break;    
66         default: 
67             log.error("Action " + action + " Not Supported by response Parser");
68             throw new Exception(" Action " + action + " not found while processing request ");            
69
70         }        
71         return response;            
72
73     }
74
75     private String getArtifactResponse(String dbresposne) {
76         // TODO Auto-generated method stub
77         return dbresposne;
78     }
79
80     private String getsetStatusResponse(String dbresposne) {
81         // TODO Auto-generated method stub
82         return null;
83     }
84
85     private String getStatusResponse(String dbresposne) {
86         log.info("Returning reposne from Response Parser " + dbresposne);
87         return dbresposne;
88     }
89
90     private String getGuiReferenceResponse(String dbresposne) {
91         // TODO Auto-generated method stub
92         return null;
93     }
94
95     private String getArtifactReferenceResponse(String dbresposne) {
96         // TODO Auto-generated method stub
97         return null;
98     }
99
100     private String getAddInCartResponse(String dbresposne) {
101         // TODO Auto-generated method stub
102         return null;
103     }
104
105     private String getDesignsResponse(String dbresposne) {
106         return dbresposne;
107         
108     }
109 }