Reformat sdnr devicemanager to ONAP code style
[ccsdk/features.git] / sdnr / wt / devicemanager / provider / src / main / java / org / onap / ccsdk / features / sdnr / wt / devicemanager / eventdatahandler / ODLEventListenerHandler.java
index 9f1b2b2..68177d3 100644 (file)
@@ -41,10 +41,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Responsible class for documenting changes in the ODL itself. The occurence of such an event is
- * documented in the database and to clients. Specific example here is the registration or
- * deregistration of a netconf device. This service has an own eventcounter to apply to the ONF
- * Coremodel netconf behaviour.
+ * Responsible class for documenting changes in the ODL itself. The occurence of such an event is documented in the
+ * database and to clients. Specific example here is the registration or deregistration of a netconf device. This
+ * service has an own eventcounter to apply to the ONF Coremodel netconf behaviour.
  *
  * Important: Websocket notification must be the last action.
  *
@@ -96,16 +95,17 @@ public class ODLEventListenerHandler implements EventHandlingService {
 
     /**
      * A registration of a mountpoint occured, that is in connect state
+     * 
      * @param registrationName of device (mountpoint name)
      * @param nNode with mountpoint data
      */
     @Override
     public void registration(String registrationName, NetconfNode nNode) {
 
-        ObjectCreationNotificationXml cNotificationXml =
-                new ObjectCreationNotificationXml(ownKeyName, popEvntNumber(),
-                        InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
-        NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
+        ObjectCreationNotificationXml cNotificationXml = new ObjectCreationNotificationXml(ownKeyName, popEvntNumber(),
+                InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
+        NetworkElementConnectionEntity e =
+                NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
         LOG.debug("registration networkelement-connection for {} with status {}", registrationName, e.getStatus());
 
         // Write first to prevent missing entries
@@ -116,15 +116,18 @@ public class ODLEventListenerHandler implements EventHandlingService {
 
     /**
      * mountpoint created, connection state not connected
-        * @param mountpointNodeName uuid that is nodeId or mountpointId
-        * @param netconfNode
-        */
-       public void mountpointCreatedIndication(String mountpointNodeName, NetconfNode netconfNode) {
-               LOG.debug("mountpoint create indication for {}", mountpointNodeName);
-               this.registration(mountpointNodeName, netconfNode);
-       }
+     * 
+     * @param mountpointNodeName uuid that is nodeId or mountpointId
+     * @param netconfNode
+     */
+    public void mountpointCreatedIndication(String mountpointNodeName, NetconfNode netconfNode) {
+        LOG.debug("mountpoint create indication for {}", mountpointNodeName);
+        this.registration(mountpointNodeName, netconfNode);
+    }
+
     /**
      * After registration
+     * 
      * @param mountpointNodeName uuid that is nodeId or mountpointId
      * @param deviceType according to assessement
      */
@@ -132,38 +135,41 @@ public class ODLEventListenerHandler implements EventHandlingService {
     public void connectIndication(String mountpointNodeName, NetworkElementDeviceType deviceType) {
 
         // Write first to prevent missing entries
-        LOG.debug("updating networkelement-connection devicetype for {} with {}",mountpointNodeName, deviceType);
-        NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType);
+        LOG.debug("updating networkelement-connection devicetype for {} with {}", mountpointNodeName, deviceType);
+        NetworkElementConnectionEntity e =
+                NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType);
         databaseService.updateNetworkConnectionDeviceType(e, mountpointNodeName);
 
         AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
-                popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()),
-                mountpointNodeName, "deviceType", deviceType.name());
+                popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), mountpointNodeName,
+                "deviceType", deviceType.name());
         webSocketService.sendViaWebsockets(mountpointNodeName, notificationXml);
     }
 
     /**
      * mountpoint state changed
-        * @param mountpointNodeName
-        * @param netconfNode
-        */
-       public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) {
-               LOG.debug("mountpoint state changed indication for {}", mountpointNodeName);
-               ConnectionStatus csts = netconfNode.getConnectionStatus();
-               this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(),
+     * 
+     * @param mountpointNodeName
+     * @param netconfNode
+     */
+    public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) {
+        LOG.debug("mountpoint state changed indication for {}", mountpointNodeName);
+        ConnectionStatus csts = netconfNode.getConnectionStatus();
+        this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(),
                 csts != null ? csts.getName() : "null", netconfNode);
-               
-       }
+
+    }
+
     /**
      * A deregistration of a mountpoint occured.
+     * 
      * @param registrationName Name of the event that is used as key in the database.
      */
     @Override
     public void deRegistration(String registrationName) {
 
-        ObjectDeletionNotificationXml dNotificationXml =
-                new ObjectDeletionNotificationXml(ownKeyName, popEvntNumber(),
-                        InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
+        ObjectDeletionNotificationXml dNotificationXml = new ObjectDeletionNotificationXml(ownKeyName, popEvntNumber(),
+                InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
 
         // Write first to prevent missing entries
         databaseService.removeNetworkConnection(registrationName);
@@ -174,14 +180,17 @@ public class ODLEventListenerHandler implements EventHandlingService {
 
     /**
      * Mountpoint state changed .. from connected -> connecting or unable-to-connect or vis-e-versa.
+     * 
      * @param registrationName Name of the event that is used as key in the database.
      */
     @Override
-    public void updateRegistration(String registrationName, String attribute, String attributeNewValue, NetconfNode nNode) {
+    public void updateRegistration(String registrationName, String attribute, String attributeNewValue,
+            NetconfNode nNode) {
         AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
-                popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()),
-                registrationName, attribute, attributeNewValue);
-        NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
+                popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName,
+                attribute, attributeNewValue);
+        NetworkElementConnectionEntity e =
+                NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
         LOG.debug("updating networkelement-connection for {} with status {}", registrationName, e.getStatus());
 
         databaseService.updateNetworkConnection22(e, registrationName);
@@ -220,8 +229,8 @@ public class ODLEventListenerHandler implements EventHandlingService {
         LOG.debug("Got startComplete");
         EventlogBuilder eventlogBuilder = new EventlogBuilder();
         eventlogBuilder.setNodeId(ownKeyName).setTimestamp(new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp()))
-        .setObjectId(objectId).setAttributeName(msg).setNewValue(value).setCounter(popEvntNumber())
-        .setSourceType(SourceType.Controller);
+                .setObjectId(objectId).setAttributeName(msg).setNewValue(value).setCounter(popEvntNumber())
+                .setSourceType(SourceType.Controller);
         databaseService.writeEventLog(eventlogBuilder.build());
 
     }
@@ -258,8 +267,6 @@ public class ODLEventListenerHandler implements EventHandlingService {
         return eventNumber++;
     }
 
-       
 
-       
 
 }