2 * ============LICENSE_START========================================================================
\r
3 * ONAP : tr-069-adapter
\r
4 * =================================================================================================
\r
5 * Copyright (C) 2020 CommScope Inc Intellectual Property.
\r
6 * =================================================================================================
\r
7 * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
\r
8 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
\r
9 * may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
\r
14 * either express or implied. See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
16 * ===============LICENSE_END=======================================================================
\r
19 package org.commscope.tr069adapter.acs.cpe.rpc;
\r
21 import java.util.Map;
\r
22 import java.util.Map.Entry;
\r
24 import javax.xml.soap.SOAPBodyElement;
\r
25 import javax.xml.soap.SOAPException;
\r
26 import javax.xml.soap.SOAPFactory;
\r
28 import org.commscope.tr069adapter.acs.cpe.TR069RPC;
\r
30 public class GetParameterValuesResponse extends TR069RPC {
\r
32 private static final long serialVersionUID = 6927206690856966492L;
\r
34 /** Creates a new instance of GetParameterValuesResponse */
\r
35 public GetParameterValuesResponse() {
\r
36 name = "GetParameterValuesResponse";
\r
39 protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
\r
40 logger.isDebugEnabled();
\r
43 protected void parseBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
\r
44 values = parseParamList(body, spf);
\r
47 private Map<String, String> values;
\r
49 public Integer getParamInt(String name) {
\r
50 String v = values.get(name);
\r
53 return Integer.parseInt(v);
\r
54 } catch (NumberFormatException e) {
\r
55 logger.error("Exception while getParamInt detail {}", e.toString());
\r
61 public Integer getParamInt(String name, int defaultValue) {
\r
62 Integer value = getParamInt(name);
\r
63 return (value != null) ? value : defaultValue;
\r
66 public String getParam(String name) {
\r
67 return values.get(name);
\r
70 public String getParam(String name, String defaultValue) {
\r
71 String value = getParam(name);
\r
72 return (value != null) ? value : defaultValue;
\r
75 public Map<String, String> getValues() {
\r
79 public void setValues(Map<String, String> values) {
\r
80 this.values = values;
\r
84 public String toString() {
\r
85 StringBuilder b = new StringBuilder(1024);
\r
86 for (Entry<String, String> e : values.entrySet()) {
\r
87 b.append(e.getKey());
\r
89 b.append(e.getValue());
\r
92 return b.toString();
\r