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.ArrayList;
\r
22 import java.util.List;
\r
24 import javax.xml.soap.SOAPBodyElement;
\r
25 import javax.xml.soap.SOAPElement;
\r
26 import javax.xml.soap.SOAPException;
\r
27 import javax.xml.soap.SOAPFactory;
\r
29 import org.commscope.tr069adapter.acs.cpe.TR069RPC;
\r
31 public class SetParameterAttributes extends TR069RPC {
\r
33 private static final long serialVersionUID = 1L;
\r
35 public SetParameterAttributes() {
\r
36 name = "SetParameterAttributes";
\r
37 attrs = new ArrayList<>();
\r
40 public void addAttribute(String name, boolean notificationChange, int notification,
\r
41 boolean accessListChange, String[] accessList) {
\r
42 attrs.add(new SetParameterAttributesStruct(name, notificationChange, notification,
\r
43 accessListChange, accessList));
\r
46 protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
\r
47 SOAPElement elm = body.addChildElement(spf.createName("ParameterList"));
\r
48 elm.setAttribute(SOAP_ARRAY_TYPE, "cwmp:SetParameterAttributesStruct[" + attrs.size() + "]");
\r
49 int c = attrs.size();
\r
50 for (int i = 0; i < c; i++) {
\r
51 SOAPElement param = elm.addChildElement("SetParameterAttributesStruct");
\r
52 param.addChildElement("Name").setValue(attrs.get(i).getName());
\r
53 param.addChildElement("NotificationChange")
\r
54 .setValue(b2s(attrs.get(i).isNotificationChange()));
\r
55 param.addChildElement("Notification")
\r
56 .setValue(String.valueOf(attrs.get(i).getNotification()));
\r
58 param.addChildElement("AccessListChange").setValue(b2s(attrs.get(i).isAccessListChange()));
\r
60 SOAPElement al = param.addChildElement(spf.createName("AccessList"));
\r
61 if (null != attrs.get(i).getAccessList()) {
\r
62 String[] acl = attrs.get(i).getAccessList();
\r
66 al.setAttribute(SOAP_ARRAY_TYPE, "xsd:string[" + ca + "]");
\r
67 for (int i2 = 0; i2 < ca; i2++) {
\r
68 SOAPElement acle = al.addChildElement("string");
\r
69 acle.setValue(acl[i2]);
\r
70 acle.setAttribute(XSI_TYPE, XSD_STRING);
\r
77 protected void parseBody(SOAPBodyElement body, SOAPFactory f) throws SOAPException {
\r
78 logger.isDebugEnabled();
\r
81 private List<SetParameterAttributesStruct> attrs;
\r