Initial source code
[oam/tr069-adapter.git] / acs / cpe / src / main / java / org / commscope / tr069adapter / acs / cpe / rpc / GetParameterAttributesResponse.java
diff --git a/acs/cpe/src/main/java/org/commscope/tr069adapter/acs/cpe/rpc/GetParameterAttributesResponse.java b/acs/cpe/src/main/java/org/commscope/tr069adapter/acs/cpe/rpc/GetParameterAttributesResponse.java
new file mode 100644 (file)
index 0000000..9e7e52a
--- /dev/null
@@ -0,0 +1,107 @@
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.acs.cpe.rpc;\r
+\r
+import java.io.Serializable;\r
+import java.util.Iterator;\r
+\r
+import javax.xml.soap.Name;\r
+import javax.xml.soap.SOAPBodyElement;\r
+import javax.xml.soap.SOAPElement;\r
+import javax.xml.soap.SOAPException;\r
+import javax.xml.soap.SOAPFactory;\r
+\r
+import org.commscope.tr069adapter.acs.cpe.TR069RPC;\r
+\r
+public class GetParameterAttributesResponse extends TR069RPC {\r
+\r
+  private static final long serialVersionUID = 5241691699448063027L;\r
+\r
+  /** Creates a new instance of GetParameterAttributes */\r
+  public GetParameterAttributesResponse() {\r
+    name = "GetParameterAttributesResponse";\r
+  }\r
+\r
+  protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {\r
+    logger.isDebugEnabled();\r
+  }\r
+\r
+  @SuppressWarnings({"rawtypes", "unused"})\r
+  protected void parseBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {\r
+    SOAPElement ml = getRequestChildElement(spf, body, "ParameterList");\r
+    int i = getArrayCount(spf, ml);\r
+    Iterator<SOAPElement> mlist = ml.getChildElements(spf.createName("ParameterAttributeStruct"));\r
+    attributes = new ParameterAttributeStruct[i];\r
+    Name nameKey = spf.createName("Name");\r
+    Name nameNotification = spf.createName("Notification");\r
+    Name nameString = spf.createName("string");\r
+    i = 0;\r
+    while (mlist.hasNext()) {\r
+      SOAPElement param = mlist.next();\r
+      attributes[i] = new ParameterAttributeStruct();\r
+      attributes[i].name = getRequestElement(param, nameKey);\r
+      attributes[i].notification = Integer.parseInt(getRequestElement(param, nameNotification));\r
+      // get acl array\r
+      SOAPElement elementAccessList = getRequestChildElement(spf, param, "AccessList");\r
+      int ii = getArrayCount(spf, elementAccessList);\r
+      attributes[i].accessList = new String[ii];\r
+\r
+      ii = 0;\r
+      Iterator<SOAPElement> iteratorAccessList = elementAccessList.getChildElements(nameString);\r
+      while (iteratorAccessList.hasNext()) {\r
+        attributes[i].accessList[ii++] = ((SOAPElement) iteratorAccessList.next()).getValue();\r
+      }\r
+      i++;\r
+    }\r
+\r
+  }\r
+\r
+  private ParameterAttributeStruct[] attributes;\r
+\r
+  public ParameterAttributeStruct[] getAttributes() {\r
+    return attributes;\r
+  }\r
+\r
+  public void setAttributes(ParameterAttributeStruct[] attributes) {\r
+    this.attributes = attributes;\r
+  }\r
+\r
+  public class ParameterAttributeStruct implements Serializable {\r
+\r
+    private static final long serialVersionUID = -5185719453218694220L;\r
+\r
+    ParameterAttributeStruct() {}\r
+\r
+    private String name;\r
+    private int notification;\r
+    private String[] accessList;\r
+\r
+    public String getName() {\r
+      return name;\r
+    }\r
+\r
+    public int getNotification() {\r
+      return notification;\r
+    }\r
+\r
+    public String[] getAccessList() {\r
+      return accessList;\r
+    }\r
+  }\r
+}\r