2 * ============LICENSE_START=======================================================
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
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.
20 * ============LICENSE_END=========================================================
23 package org.onap.appc.design.dbervices;
25 import org.onap.appc.design.services.util.DesignServiceConstants;
27 import com.att.eelf.configuration.EELFLogger;
28 import com.att.eelf.configuration.EELFManager;
30 public class DbResponseProcessor {
32 private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class);
33 public String parseResponse(String dbresponse, String action) throws Exception {
35 log.info("Starting Parsing the response for action :[" + action + "]\ndata:[" + dbresponse + "]");
38 case DesignServiceConstants.GETDESIGNS:
39 response = getDesignsResponse(dbresponse);
41 case DesignServiceConstants.GETAPPCTIMESTAMPUTC:
42 response = getAppcTimestampResponse(dbresponse);
44 case DesignServiceConstants.ADDINCART:
45 response = getAddInCartResponse(dbresponse);
47 case DesignServiceConstants.GETARTIFACTREFERENCE:
48 response = getArtifactReferenceResponse(dbresponse);
50 case DesignServiceConstants.GETARTIFACT:
51 response = getArtifactResponse(dbresponse);
53 case DesignServiceConstants.GETGUIREFERENCE:
54 response = getGuiReferenceResponse(dbresponse);
56 case DesignServiceConstants.GETSTATUS:
57 response = getStatusResponse(dbresponse);
59 case DesignServiceConstants.UPLOADARTIFACT:
60 response = getSetStatusResponse(dbresponse);
62 case DesignServiceConstants.SETPROTOCOLREFERENCE:
63 response = getSetStatusResponse(dbresponse);
65 case DesignServiceConstants.SETINCART:
66 response = getSetStatusResponse(dbresponse);
68 case DesignServiceConstants.UPLOADADMINARTIFACT:
69 response = getSetStatusResponse(dbresponse);
71 case DesignServiceConstants.CHECKVNF:
72 response = getStatusResponse(dbresponse);
74 case DesignServiceConstants.RETRIEVEVNFPERMISSIONS:
75 response = getStatusResponse(dbresponse);
77 case DesignServiceConstants.SAVEVNFPERMISSIONS:
78 response = getRetrieveVnfPermissionsResponse(dbresponse);
81 log.error("Action " + action + " Not Supported by Response Parser");
82 throw new Exception("Action " + action + " not found while processing request");
89 private String getArtifactResponse(String dbresponse) {
90 // TODO Auto-generated method stub
94 private String getSetStatusResponse(String dbresponse) {
95 // TODO Auto-generated method stub
99 private String getStatusResponse(String dbresponse) {
100 log.info("Returning response from Response Parser " + dbresponse);
104 private String getGuiReferenceResponse(String dbresponse) {
105 // TODO Auto-generated method stub
109 private String getArtifactReferenceResponse(String dbresponse) {
110 // TODO Auto-generated method stub
114 private String getAddInCartResponse(String dbresponse) {
115 // TODO Auto-generated method stub
119 private String getDesignsResponse(String dbresponse) {
123 private String getAppcTimestampResponse(String dbresponse) {
124 log.info("getAppcTimestampResponse:[" + dbresponse +"]" );
128 private String getRetrieveVnfPermissionsResponse(String dbresponse) {
129 log.info("Returning response from Response Parser " + dbresponse);