Bump upstream dependencies to Ca
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / utils / TapiListener.java
index c1e598d56c3eedb100449b28852d51580e6fb2eb..ee0d4a3b5bd70c1087b71b72471e5a2d75a96902 100644 (file)
@@ -7,16 +7,16 @@
  */
 package org.opendaylight.transportpce.tapi.utils;
 
-import java.util.Collection;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.ServiceInterfacePoints;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.service._interface.points.ServiceEndPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev230728.ServiceInterfacePoints;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev230728.service._interface.points.ServiceEndPoint;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -26,15 +26,15 @@ public class TapiListener implements DataTreeChangeListener<ServiceInterfacePoin
     private static final Logger LOG = LoggerFactory.getLogger(TapiListener.class);
 
     @Override
-    public void onDataTreeChanged(@NonNull Collection<DataTreeModification<ServiceInterfacePoints>> changes) {
+    public void onDataTreeChanged(@NonNull List<DataTreeModification<ServiceInterfacePoints>> changes) {
         LOG.info("onDataTreeChanged in TapiListener");
         for (DataTreeModification<ServiceInterfacePoints> change : changes) {
             DataObjectModification<ServiceInterfacePoints> rootSIP = change.getRootNode();
-            switch (rootSIP.getModificationType()) {
+            switch (rootSIP.modificationType()) {
                 case WRITE:
                     LOG.info("onDataTreeChanged in TapiListener : WRITE");
-                    ServiceInterfacePoints data = rootSIP.getDataAfter();
-                    List<ServiceEndPoint> listSEP = data.getServiceEndPoint();
+                    ServiceInterfacePoints data = rootSIP.dataAfter();
+                    List<ServiceEndPoint> listSEP = new ArrayList<>(data.getServiceEndPoint().values());
                     MappingUtils.deleteMap();
                     for (ServiceEndPoint sep : listSEP) {
                         MappingUtils.addMapSEP(sep);
@@ -44,12 +44,12 @@ public class TapiListener implements DataTreeChangeListener<ServiceInterfacePoin
                 case SUBTREE_MODIFIED:
                     LOG.info("onDataTreeChanged in TapiListener : SUBTREE_MODIFIED");
                     Iterator<? extends DataObjectModification<? extends DataObject>> iterator = rootSIP
-                        .getModifiedChildren().iterator();
+                        .getModifiedChildren(ServiceEndPoint.class).iterator();
                     while (iterator.hasNext()) {
                         DataObjectModification<? extends DataObject> dom = iterator.next();
                         // to delete existing child entry
-                        if (dom.getDataAfter() == null) {
-                            DataObject dataObject = dom.getDataBefore();
+                        if (dom.dataAfter() == null) {
+                            DataObject dataObject = dom.dataBefore();
                             ServiceEndPoint sep = null;
                             sep = (ServiceEndPoint) dataObject;
                             Uuid uuid = sep.getUuid();
@@ -59,10 +59,10 @@ public class TapiListener implements DataTreeChangeListener<ServiceInterfacePoin
                         }
 
                         // to add new child entry
-                        if (dom.getDataType().toString().compareTo("interface org.opendaylight.yang.gen.v1.urn.opendayl"
+                        if (dom.dataType().toString().compareTo("interface org.opendaylight.yang.gen.v1.urn.opendayl"
                             + "ight.params.xml.ns.yang.tapi.rev180928.service._interface.points.ServiceEndPoint") == 0
-                            && dom.getDataBefore() == null) {
-                            DataObject dataObject = dom.getDataAfter();
+                            && dom.dataBefore() == null) {
+                            DataObject dataObject = dom.dataAfter();
                             ServiceEndPoint sep = null;
                             sep = (ServiceEndPoint) dataObject;
                             MappingUtils.addMapSEP(sep);