2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ============LICENSE_END=========================================================
24 package org.onap.appc.design.dbervices;
26 import org.onap.appc.design.services.util.DesignServiceConstants;
28 import com.att.eelf.configuration.EELFLogger;
29 import com.att.eelf.configuration.EELFManager;
31 public class DbResponseProcessor {
33 private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class);
34 public String parseResponse(String dbresposne, String action) throws Exception {
36 log.info("Starting Parsing the response for action :[" + action + "]\n data:[" + dbresposne +"]" );
39 case DesignServiceConstants.GETDESIGNS:
40 response = getDesignsResponse(dbresposne);
42 case DesignServiceConstants.GETAPPCTIMESTAMPUTC:
43 response = getAppcTimestampResponse(dbresposne);
45 case DesignServiceConstants.ADDINCART:
46 response = getAddInCartResponse(dbresposne);
48 case DesignServiceConstants.GETARTIFACTREFERENCE:
49 response= getArtifactReferenceResponse(dbresposne);
51 case DesignServiceConstants.GETARTIFACT:
52 response= getArtifactResponse(dbresposne);
54 case DesignServiceConstants.GETGUIREFERENCE:
55 response= getGuiReferenceResponse(dbresposne);
57 case DesignServiceConstants.GETSTATUS:
58 response= getStatusResponse(dbresposne);
60 case DesignServiceConstants.UPLOADARTIFACT:
61 response= getsetStatusResponse(dbresposne);
63 case DesignServiceConstants.SETPROTOCOLREFERENCE:
64 response= getsetStatusResponse(dbresposne);
66 case DesignServiceConstants.SETINCART:
67 response= getsetStatusResponse(dbresposne);
70 log.error("Action " + action + " Not Supported by response Parser");
71 throw new Exception(" Action " + action + " not found while processing request ");
78 private String getArtifactResponse(String dbresposne) {
79 // TODO Auto-generated method stub
83 private String getsetStatusResponse(String dbresposne) {
84 // TODO Auto-generated method stub
88 private String getStatusResponse(String dbresposne) {
89 log.info("Returning reposne from Response Parser " + dbresposne);
93 private String getGuiReferenceResponse(String dbresposne) {
94 // TODO Auto-generated method stub
98 private String getArtifactReferenceResponse(String dbresposne) {
99 // TODO Auto-generated method stub
103 private String getAddInCartResponse(String dbresposne) {
104 // TODO Auto-generated method stub
108 private String getDesignsResponse(String dbresposne) {
113 private String getAppcTimestampResponse(String dbresposne) {
114 log.info("getAppcTimestampResponse:[" + dbresposne +"]" );