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