APPC CDT Future timestamp issue fix -new HTTP req
[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.GETAPPCTIMESTAMPUTC:
43             response = getAppcTimestampResponse(dbresposne);
44             break;
45         case DesignServiceConstants.ADDINCART:
46             response =  getAddInCartResponse(dbresposne);
47             break ;
48         case DesignServiceConstants.GETARTIFACTREFERENCE:
49             response=  getArtifactReferenceResponse(dbresposne);
50             break;
51         case DesignServiceConstants.GETARTIFACT:
52             response=  getArtifactResponse(dbresposne);
53             break;
54         case DesignServiceConstants.GETGUIREFERENCE:
55             response=  getGuiReferenceResponse(dbresposne);
56             break;
57         case DesignServiceConstants.GETSTATUS:
58             response=  getStatusResponse(dbresposne);
59             break;
60         case DesignServiceConstants.UPLOADARTIFACT:
61             response=  getsetStatusResponse(dbresposne);
62             break;    
63         case DesignServiceConstants.SETPROTOCOLREFERENCE:
64             response=  getsetStatusResponse(dbresposne);
65             break;    
66         case DesignServiceConstants.SETINCART:
67             response=  getsetStatusResponse(dbresposne);
68             break;    
69         default: 
70             log.error("Action " + action + " Not Supported by response Parser");
71             throw new Exception(" Action " + action + " not found while processing request ");            
72
73         }        
74         return response;            
75
76     }
77
78     private String getArtifactResponse(String dbresposne) {
79         // TODO Auto-generated method stub
80         return dbresposne;
81     }
82
83     private String getsetStatusResponse(String dbresposne) {
84         // TODO Auto-generated method stub
85         return null;
86     }
87
88     private String getStatusResponse(String dbresposne) {
89         log.info("Returning reposne from Response Parser " + dbresposne);
90         return dbresposne;
91     }
92
93     private String getGuiReferenceResponse(String dbresposne) {
94         // TODO Auto-generated method stub
95         return null;
96     }
97
98     private String getArtifactReferenceResponse(String dbresposne) {
99         // TODO Auto-generated method stub
100         return null;
101     }
102
103     private String getAddInCartResponse(String dbresposne) {
104         // TODO Auto-generated method stub
105         return null;
106     }
107
108     private String getDesignsResponse(String dbresposne) {
109         return dbresposne;
110         
111     }
112
113     private String getAppcTimestampResponse(String dbresposne) {
114         log.info("getAppcTimestampResponse:["  + dbresposne +"]" );
115         return dbresposne;
116     }
117 }