summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl/events
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/model-impl/events')
-rw-r--r--controlloop/common/model-impl/events/pom.xml41
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java259
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java64
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java303
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java96
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java380
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java56
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java68
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java24
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java26
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java86
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java85
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java7
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java188
14 files changed, 886 insertions, 797 deletions
diff --git a/controlloop/common/model-impl/events/pom.xml b/controlloop/common/model-impl/events/pom.xml
index f3d56f67b..97b686e4e 100644
--- a/controlloop/common/model-impl/events/pom.xml
+++ b/controlloop/common/model-impl/events/pom.xml
@@ -43,4 +43,45 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>onap-java-style</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <!-- Use Google Java Style Guide:
+ https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
+ with minor changes -->
+ <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+ <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
+ <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+ <includeResources>true</includeResources>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <includeTestResources>true</includeTestResources>
+ <excludes>
+ </excludes>
+ <consoleOutput>true</consoleOutput>
+ <failOnViolation>true</failOnViolation>
+ <violationSeverity>warning</violationSeverity>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>0.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
index 1d85ccb77..d3f1786c7 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,130 +24,135 @@ import java.io.Serializable;
import java.util.UUID;
public abstract class ControlLoopEvent implements Serializable {
-
- private static final long serialVersionUID = 2391252138583119195L;
-
- private String closedLoopControlName;
- private String version = "1.0.2";
- private UUID requestID;
- private String closedLoopEventClient;
- private ControlLoopTargetType targetType;
- private String target;
- private String from;
- private String policyScope;
- private String policyName;
- private String policyVersion;
- private ControlLoopEventStatus closedLoopEventStatus;
-
- public ControlLoopEvent() {
-
- }
-
- public ControlLoopEvent(ControlLoopEvent event) {
- if (event == null) {
- return;
- }
- this.closedLoopControlName = event.closedLoopControlName;
- this.requestID = event.requestID;
- this.closedLoopEventClient = event.closedLoopEventClient;
- this.targetType = event.targetType;
- this.target = event.target;
- this.from = event.from;
- this.policyScope = event.policyScope;
- this.policyName = event.policyName;
- this.policyVersion = event.policyVersion;
- this.closedLoopEventStatus = event.closedLoopEventStatus;
- }
-
- public boolean isEventStatusValid() {
- return this.closedLoopEventStatus != null;
- }
-
- public String getClosedLoopControlName() {
- return closedLoopControlName;
- }
-
- public void setClosedLoopControlName(String closedLoopControlName) {
- this.closedLoopControlName = closedLoopControlName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public UUID getRequestID() {
- return requestID;
- }
-
- public void setRequestID(UUID requestID) {
- this.requestID = requestID;
- }
-
- public String getClosedLoopEventClient() {
- return closedLoopEventClient;
- }
-
- public void setClosedLoopEventClient(String closedLoopEventClient) {
- this.closedLoopEventClient = closedLoopEventClient;
- }
-
- public ControlLoopTargetType getTargetType() {
- return targetType;
- }
-
- public void setTargetType(ControlLoopTargetType targetType) {
- this.targetType = targetType;
- }
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getFrom() {
- return from;
- }
-
- public void setFrom(String from) {
- this.from = from;
- }
-
- public String getPolicyScope() {
- return policyScope;
- }
-
- public void setPolicyScope(String policyScope) {
- this.policyScope = policyScope;
- }
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- public String getPolicyVersion() {
- return policyVersion;
- }
-
- public void setPolicyVersion(String policyVersion) {
- this.policyVersion = policyVersion;
- }
-
- public ControlLoopEventStatus getClosedLoopEventStatus() {
- return closedLoopEventStatus;
- }
-
- public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
- this.closedLoopEventStatus = closedLoopEventStatus;
- }
+
+ private static final long serialVersionUID = 2391252138583119195L;
+
+ private String closedLoopControlName;
+ private String version = "1.0.2";
+ private UUID requestId;
+ private String closedLoopEventClient;
+ private ControlLoopTargetType targetType;
+ private String target;
+ private String from;
+ private String policyScope;
+ private String policyName;
+ private String policyVersion;
+ private ControlLoopEventStatus closedLoopEventStatus;
+
+ public ControlLoopEvent() {
+
+ }
+
+ /**
+ * Construct an instace from an existing instance.
+ *
+ * @param event the existing instance
+ */
+ public ControlLoopEvent(ControlLoopEvent event) {
+ if (event == null) {
+ return;
+ }
+ this.closedLoopControlName = event.closedLoopControlName;
+ this.requestId = event.requestId;
+ this.closedLoopEventClient = event.closedLoopEventClient;
+ this.targetType = event.targetType;
+ this.target = event.target;
+ this.from = event.from;
+ this.policyScope = event.policyScope;
+ this.policyName = event.policyName;
+ this.policyVersion = event.policyVersion;
+ this.closedLoopEventStatus = event.closedLoopEventStatus;
+ }
+
+ public boolean isEventStatusValid() {
+ return this.closedLoopEventStatus != null;
+ }
+
+ public String getClosedLoopControlName() {
+ return closedLoopControlName;
+ }
+
+ public void setClosedLoopControlName(String closedLoopControlName) {
+ this.closedLoopControlName = closedLoopControlName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getClosedLoopEventClient() {
+ return closedLoopEventClient;
+ }
+
+ public void setClosedLoopEventClient(String closedLoopEventClient) {
+ this.closedLoopEventClient = closedLoopEventClient;
+ }
+
+ public ControlLoopTargetType getTargetType() {
+ return targetType;
+ }
+
+ public void setTargetType(ControlLoopTargetType targetType) {
+ this.targetType = targetType;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getPolicyScope() {
+ return policyScope;
+ }
+
+ public void setPolicyScope(String policyScope) {
+ this.policyScope = policyScope;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public String getPolicyVersion() {
+ return policyVersion;
+ }
+
+ public void setPolicyVersion(String policyVersion) {
+ this.policyVersion = policyVersion;
+ }
+
+ public ControlLoopEventStatus getClosedLoopEventStatus() {
+ return closedLoopEventStatus;
+ }
+
+ public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
+ this.closedLoopEventStatus = closedLoopEventStatus;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java
index ed726201a..f439e70ab 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,35 +21,39 @@
package org.onap.policy.controlloop;
public enum ControlLoopEventStatus {
- ONSET("ONSET"),
- ABATED("ABATED")
- ;
-
- private String status;
-
- private ControlLoopEventStatus(String status) {
- this.status = status;
- }
+ ONSET("ONSET"), ABATED("ABATED");
- @Override
- public String toString() {
- return this.status;
- }
-
- public static ControlLoopEventStatus toStatus(String status) {
- if (ONSET.status.equalsIgnoreCase(status)) {
- return ONSET;
- }
- if (ABATED.status.equalsIgnoreCase(status)) {
- return ABATED;
- }
- //
- // In case DCAE uses the old abatement
- //
- if ("abatement".equalsIgnoreCase(status)) {
- return ABATED;
- }
- return null;
- }
+ private String status;
+
+ private ControlLoopEventStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return this.status;
+ }
+
+ /**
+ * Convert a String status to a ControlLoopEventStatus.
+ *
+ * @param status the String status
+ * @return the ControlLoopEventStatus
+ */
+ public static ControlLoopEventStatus toStatus(String status) {
+ if (ONSET.status.equalsIgnoreCase(status)) {
+ return ONSET;
+ }
+ if (ABATED.status.equalsIgnoreCase(status)) {
+ return ABATED;
+ }
+ //
+ // In case DCAE uses the old abatement
+ //
+ if ("abatement".equalsIgnoreCase(status)) {
+ return ABATED;
+ }
+ return null;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java
index 8e7a50fac..8c670fe9e 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,157 +29,162 @@ import java.util.UUID;
public abstract class ControlLoopNotification implements Serializable {
- private static final long serialVersionUID = 7538596984567127915L;
-
- private String closedLoopControlName;
- private String version = "1.0.2";
- private UUID requestID;
- private String closedLoopEventClient;
- private ControlLoopTargetType targetType;
- private String target;
- private String from;
- private String policyScope;
- private String policyName;
- private String policyVersion;
- private ControlLoopNotificationType notification;
- private String message;
- private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC);
- private Integer opsCLTimer;
- private List<ControlLoopOperation> history = new LinkedList<>();
-
- public ControlLoopNotification() {
-
- }
-
- public ControlLoopNotification(ControlLoopEvent event) {
- if (event == null) {
- return;
- }
-
- this.setClosedLoopControlName(event.getClosedLoopControlName());
- this.setRequestID(event.getRequestID());
- this.setClosedLoopEventClient(event.getClosedLoopEventClient());
- this.setTargetType(event.getTargetType());
- this.setTarget(event.getTarget());
- }
-
- public String getClosedLoopControlName() {
- return closedLoopControlName;
- }
-
- public void setClosedLoopControlName(String closedLoopControlName) {
- this.closedLoopControlName = closedLoopControlName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public UUID getRequestID() {
- return requestID;
- }
-
- public void setRequestID(UUID requestID) {
- this.requestID = requestID;
- }
-
- public String getClosedLoopEventClient() {
- return closedLoopEventClient;
- }
-
- public void setClosedLoopEventClient(String closedLoopEventClient) {
- this.closedLoopEventClient = closedLoopEventClient;
- }
-
- public ControlLoopTargetType getTargetType() {
- return targetType;
- }
-
- public void setTargetType(ControlLoopTargetType targetType) {
- this.targetType = targetType;
- }
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getFrom() {
- return from;
- }
-
- public void setFrom(String from) {
- this.from = from;
- }
-
- public String getPolicyScope() {
- return policyScope;
- }
-
- public void setPolicyScope(String policyScope) {
- this.policyScope = policyScope;
- }
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- public String getPolicyVersion() {
- return policyVersion;
- }
-
- public void setPolicyVersion(String policyVersion) {
- this.policyVersion = policyVersion;
- }
-
- public ControlLoopNotificationType getNotification() {
- return notification;
- }
-
- public void setNotification(ControlLoopNotificationType notification) {
- this.notification = notification;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public ZonedDateTime getNotificationTime() {
- return notificationTime;
- }
+ private static final long serialVersionUID = 7538596984567127915L;
+
+ private String closedLoopControlName;
+ private String version = "1.0.2";
+ private UUID requestId;
+ private String closedLoopEventClient;
+ private ControlLoopTargetType targetType;
+ private String target;
+ private String from;
+ private String policyScope;
+ private String policyName;
+ private String policyVersion;
+ private ControlLoopNotificationType notification;
+ private String message;
+ private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC);
+ private Integer opsClTimer;
+ private List<ControlLoopOperation> history = new LinkedList<>();
+
+ public ControlLoopNotification() {
+
+ }
+
+ /**
+ * Construct an instance.
+ *
+ * @param event the event
+ */
+ public ControlLoopNotification(ControlLoopEvent event) {
+ if (event == null) {
+ return;
+ }
+
+ this.setClosedLoopControlName(event.getClosedLoopControlName());
+ this.setRequestId(event.getRequestId());
+ this.setClosedLoopEventClient(event.getClosedLoopEventClient());
+ this.setTargetType(event.getTargetType());
+ this.setTarget(event.getTarget());
+ }
+
+ public String getClosedLoopControlName() {
+ return closedLoopControlName;
+ }
+
+ public void setClosedLoopControlName(String closedLoopControlName) {
+ this.closedLoopControlName = closedLoopControlName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getClosedLoopEventClient() {
+ return closedLoopEventClient;
+ }
+
+ public void setClosedLoopEventClient(String closedLoopEventClient) {
+ this.closedLoopEventClient = closedLoopEventClient;
+ }
+
+ public ControlLoopTargetType getTargetType() {
+ return targetType;
+ }
+
+ public void setTargetType(ControlLoopTargetType targetType) {
+ this.targetType = targetType;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getPolicyScope() {
+ return policyScope;
+ }
+
+ public void setPolicyScope(String policyScope) {
+ this.policyScope = policyScope;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public String getPolicyVersion() {
+ return policyVersion;
+ }
+
+ public void setPolicyVersion(String policyVersion) {
+ this.policyVersion = policyVersion;
+ }
+
+ public ControlLoopNotificationType getNotification() {
+ return notification;
+ }
+
+ public void setNotification(ControlLoopNotificationType notification) {
+ this.notification = notification;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ZonedDateTime getNotificationTime() {
+ return notificationTime;
+ }
- public void setNotificationTime(ZonedDateTime notificationTime) {
- this.notificationTime = notificationTime;
- }
+ public void setNotificationTime(ZonedDateTime notificationTime) {
+ this.notificationTime = notificationTime;
+ }
- public Integer getOpsCLTimer() {
- return opsCLTimer;
- }
+ public Integer getOpsClTimer() {
+ return opsClTimer;
+ }
- public void setOpsCLTimer(Integer opsCLTimer) {
- this.opsCLTimer = opsCLTimer;
- }
+ public void setOpsClTimer(Integer opsClTimer) {
+ this.opsClTimer = opsClTimer;
+ }
- public List<ControlLoopOperation> getHistory() {
- return history;
- }
+ public List<ControlLoopOperation> getHistory() {
+ return history;
+ }
- public void setHistory(List<ControlLoopOperation> history) {
- this.history = history;
- }
+ public void setHistory(List<ControlLoopOperation> history) {
+ this.history = history;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java
index 29f53c8fa..9f5a41d39 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,53 +21,53 @@
package org.onap.policy.controlloop;
public enum ControlLoopNotificationType {
- ACTIVE("ACTIVE"),
- REJECTED("REJECTED"),
- OPERATION("OPERATION"),
- OPERATION_SUCCESS("OPERATION: SUCCESS"),
- OPERATION_FAILURE("OPERATION: FAILURE"),
- FINAL_FAILURE("FINAL: FAILURE"),
- FINAL_SUCCESS("FINAL: SUCCESS"),
- FINAL_OPENLOOP("FINAL: OPENLOOP")
- ;
-
- private String type;
-
- private ControlLoopNotificationType(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return this.type;
- }
+ ACTIVE("ACTIVE"), REJECTED("REJECTED"), OPERATION("OPERATION"), OPERATION_SUCCESS(
+ "OPERATION: SUCCESS"), OPERATION_FAILURE("OPERATION: FAILURE"), FINAL_FAILURE(
+ "FINAL: FAILURE"), FINAL_SUCCESS("FINAL: SUCCESS"), FINAL_OPENLOOP("FINAL: OPENLOOP");
- public static ControlLoopNotificationType toType(String type) {
- if (ACTIVE.toString().equals(type)) {
- return ACTIVE;
- }
- if (REJECTED.toString().equals(type)) {
- return REJECTED;
- }
- if (OPERATION.toString().equals(type)) {
- return OPERATION;
- }
- if (OPERATION_SUCCESS.toString().equals(type)) {
- return OPERATION_SUCCESS;
- }
- if (OPERATION_FAILURE.toString().equals(type)) {
- return OPERATION_FAILURE;
- }
- if (FINAL_FAILURE.toString().equals(type)) {
- return FINAL_FAILURE;
- }
- if (FINAL_SUCCESS.toString().equals(type)) {
- return FINAL_SUCCESS;
- }
- if (FINAL_OPENLOOP.toString().equals(type)) {
- return FINAL_OPENLOOP;
- }
- return null;
- }
+ private String type;
+
+ private ControlLoopNotificationType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
+
+ /**
+ * Convert a String type to a ControlLoopNotificationType.
+ *
+ * @param type the String type
+ * @return the ControlLoopNotificationType
+ */
+ public static ControlLoopNotificationType toType(String type) {
+ if (ACTIVE.toString().equals(type)) {
+ return ACTIVE;
+ }
+ if (REJECTED.toString().equals(type)) {
+ return REJECTED;
+ }
+ if (OPERATION.toString().equals(type)) {
+ return OPERATION;
+ }
+ if (OPERATION_SUCCESS.toString().equals(type)) {
+ return OPERATION_SUCCESS;
+ }
+ if (OPERATION_FAILURE.toString().equals(type)) {
+ return OPERATION_FAILURE;
+ }
+ if (FINAL_FAILURE.toString().equals(type)) {
+ return FINAL_FAILURE;
+ }
+ if (FINAL_SUCCESS.toString().equals(type)) {
+ return FINAL_SUCCESS;
+ }
+ if (FINAL_OPENLOOP.toString().equals(type)) {
+ return FINAL_OPENLOOP;
+ }
+ return null;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java
index d024b7cec..3ef731687 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,183 +25,205 @@ import java.time.Instant;
public class ControlLoopOperation implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 8662706581293017099L;
-
- private String actor;
- private String operation;
- private String target;
- private Instant start = Instant.now();
- private Instant end;
- private String subRequestId;
- private String outcome;
- private String message;
-
- public ControlLoopOperation() {
-
- }
-
- public ControlLoopOperation(ControlLoopOperation op) {
- if (op == null) {
- return;
- }
-
- this.actor = op.actor;
- this.operation = op.operation;
- this.target = op.target;
- this.start = op.start;
- this.end = op.end;
- this.subRequestId = op.subRequestId;
- this.outcome = op.outcome;
- this.message = op.message;
- }
-
- public String toMessage() {
- return "actor="+actor+",operation="+operation+",target="+target+",subRequestId="+subRequestId;
- }
-
- public String toHistory() {
- return "actor="+actor+",operation="+operation+",target="+target+",start="+start+",end="+end+",subRequestId="+subRequestId+",outcome="+outcome+",message="+message;
- }
-
- public String getActor() {
- return actor;
- }
-
- public void setActor(String actor) {
- this.actor = actor;
- }
-
- public String getOperation() {
- return operation;
- }
-
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public Instant getStart() {
- return start;
- }
-
- public void setStart(Instant start) {
- this.start = start;
- }
-
- public Instant getEnd() {
- return end;
- }
-
- public void setEnd(Instant end) {
- this.end = end;
- }
-
- public String getSubRequestId() {
- return subRequestId;
- }
-
- public void setSubRequestId(String subRequestId) {
- this.subRequestId = subRequestId;
- }
-
- public String getOutcome() {
- return outcome;
- }
-
- public void setOutcome(String outcome) {
- this.outcome = outcome;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start="
- + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message="
- + message + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((actor == null) ? 0 : actor.hashCode());
- result = prime * result + ((end == null) ? 0 : end.hashCode());
- result = prime * result + ((message == null) ? 0 : message.hashCode());
- result = prime * result + ((operation == null) ? 0 : operation.hashCode());
- result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
- result = prime * result + ((start == null) ? 0 : start.hashCode());
- result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
- result = prime * result + ((target == null) ? 0 : target.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ControlLoopOperation other = (ControlLoopOperation) obj;
- if (actor == null) {
- if (other.actor != null)
- return false;
- } else if (!actor.equals(other.actor))
- return false;
- if (end == null) {
- if (other.end != null)
- return false;
- } else if (!end.equals(other.end))
- return false;
- if (message == null) {
- if (other.message != null)
- return false;
- } else if (!message.equals(other.message))
- return false;
- if (operation == null) {
- if (other.operation != null)
- return false;
- } else if (!operation.equals(other.operation))
- return false;
- if (outcome == null) {
- if (other.outcome != null)
- return false;
- } else if (!outcome.equals(other.outcome))
- return false;
- if (start == null) {
- if (other.start != null)
- return false;
- } else if (!start.equals(other.start))
- return false;
- if (subRequestId == null) {
- if (other.subRequestId != null)
- return false;
- } else if (!subRequestId.equals(other.subRequestId))
- return false;
- if (target == null) {
- if (other.target != null)
- return false;
- } else if (!target.equals(other.target))
- return false;
- return true;
- }
+ private static final long serialVersionUID = 8662706581293017099L;
+
+ private String actor;
+ private String operation;
+ private String target;
+ private Instant start = Instant.now();
+ private Instant end;
+ private String subRequestId;
+ private String outcome;
+ private String message;
+
+ public ControlLoopOperation() {
+
+ }
+
+ /**
+ * Construct an instance from an existing instance.
+ *
+ * @param op the existing instance
+ */
+ public ControlLoopOperation(ControlLoopOperation op) {
+ if (op == null) {
+ return;
+ }
+
+ this.actor = op.actor;
+ this.operation = op.operation;
+ this.target = op.target;
+ this.start = op.start;
+ this.end = op.end;
+ this.subRequestId = op.subRequestId;
+ this.outcome = op.outcome;
+ this.message = op.message;
+ }
+
+ public String toMessage() {
+ return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",subRequestId=" + subRequestId;
+ }
+
+ public String toHistory() {
+ return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",start=" + start + ",end=" + end
+ + ",subRequestId=" + subRequestId + ",outcome=" + outcome + ",message=" + message;
+ }
+
+ public String getActor() {
+ return actor;
+ }
+
+ public void setActor(String actor) {
+ this.actor = actor;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public Instant getStart() {
+ return start;
+ }
+
+ public void setStart(Instant start) {
+ this.start = start;
+ }
+
+ public Instant getEnd() {
+ return end;
+ }
+
+ public void setEnd(Instant end) {
+ this.end = end;
+ }
+
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
+
+ public String getOutcome() {
+ return outcome;
+ }
+
+ public void setOutcome(String outcome) {
+ this.outcome = outcome;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String toString() {
+ return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start="
+ + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message="
+ + message + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((actor == null) ? 0 : actor.hashCode());
+ result = prime * result + ((end == null) ? 0 : end.hashCode());
+ result = prime * result + ((message == null) ? 0 : message.hashCode());
+ result = prime * result + ((operation == null) ? 0 : operation.hashCode());
+ result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
+ result = prime * result + ((start == null) ? 0 : start.hashCode());
+ result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
+ result = prime * result + ((target == null) ? 0 : target.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ControlLoopOperation other = (ControlLoopOperation) obj;
+ if (actor == null) {
+ if (other.actor != null) {
+ return false;
+ }
+ } else if (!actor.equals(other.actor)) {
+ return false;
+ }
+ if (end == null) {
+ if (other.end != null) {
+ return false;
+ }
+ } else if (!end.equals(other.end)) {
+ return false;
+ }
+ if (message == null) {
+ if (other.message != null) {
+ return false;
+ }
+ } else if (!message.equals(other.message)) {
+ return false;
+ }
+ if (operation == null) {
+ if (other.operation != null) {
+ return false;
+ }
+ } else if (!operation.equals(other.operation)) {
+ return false;
+ }
+ if (outcome == null) {
+ if (other.outcome != null) {
+ return false;
+ }
+ } else if (!outcome.equals(other.outcome)) {
+ return false;
+ }
+ if (start == null) {
+ if (other.start != null) {
+ return false;
+ }
+ } else if (!start.equals(other.start)) {
+ return false;
+ }
+ if (subRequestId == null) {
+ if (other.subRequestId != null) {
+ return false;
+ }
+ } else if (!subRequestId.equals(other.subRequestId)) {
+ return false;
+ }
+ if (target == null) {
+ if (other.target != null) {
+ return false;
+ }
+ } else if (!target.equals(other.target)) {
+ return false;
+ }
+ return true;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java
index f957808d1..0bdc5cace 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,31 +24,31 @@ import java.util.UUID;
public class ControlLoopOperationWrapper {
- private UUID requestID;
- private ControlLoopOperation operation;
-
- public ControlLoopOperationWrapper() {
-
- }
-
- public ControlLoopOperationWrapper(UUID requestID, ControlLoopOperation operation) {
- this.requestID = requestID;
- this.operation = operation;
- }
-
- public UUID getRequestID() {
- return requestID;
- }
-
- public void setRequestID(UUID requestID) {
- this.requestID = requestID;
- }
-
- public ControlLoopOperation getOperation() {
- return operation;
- }
-
- public void setOperation(ControlLoopOperation operation) {
- this.operation = operation;
- }
+ private UUID requestId;
+ private ControlLoopOperation operation;
+
+ public ControlLoopOperationWrapper() {
+
+ }
+
+ public ControlLoopOperationWrapper(UUID requestId, ControlLoopOperation operation) {
+ this.requestId = requestId;
+ this.operation = operation;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ public ControlLoopOperation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(ControlLoopOperation operation) {
+ this.operation = operation;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
index 747dc7607..4782654fc 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,37 +21,39 @@
package org.onap.policy.controlloop;
public enum ControlLoopTargetType {
- VM("VM"),
- VF("VF"),
- VFC("VFC"),
- VNF("VNF")
- ;
-
- private String type;
-
- private ControlLoopTargetType(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return this.type;
- }
-
- public static ControlLoopTargetType toType(String type) {
- if (VM.toString().equals(type)) {
- return VM;
- }
- if (VF.toString().equals(type)) {
- return VF;
- }
- if (VFC.toString().equals(type)) {
- return VFC;
- }
- if (VNF.toString().equals(type)) {
- return VNF;
- }
+ VM("VM"), VF("VF"), VFC("VFC"), VNF("VNF");
- return null;
- }
+ private String type;
+
+ private ControlLoopTargetType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
+
+ /**
+ * Convert a String type to a ControlLoopTargetType.
+ *
+ * @param type the String type
+ * @return the ControlLoopTargetType
+ */
+ public static ControlLoopTargetType toType(String type) {
+ if (VM.toString().equals(type)) {
+ return VM;
+ }
+ if (VF.toString().equals(type)) {
+ return VF;
+ }
+ if (VFC.toString().equals(type)) {
+ return VFC;
+ }
+ if (VNF.toString().equals(type)) {
+ return VNF;
+ }
+
+ return null;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java
index 12ced939e..4cae5ca5d 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,15 +21,19 @@
package org.onap.policy.controlloop;
public class PhysicalControlLoopEvent extends ControlLoopEvent {
- private static final long serialVersionUID = -7282930271094849487L;
+ private static final long serialVersionUID = -7282930271094849487L;
- public PhysicalControlLoopEvent() {
- }
+ public PhysicalControlLoopEvent() {}
- public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) {
- super(event);
- if (event == null) {
- return;
- }
- }
+ /**
+ * Construct an instance from an existing instance.
+ *
+ * @param event the existing instance
+ */
+ public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) {
+ super(event);
+ if (event == null) {
+ return;
+ }
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java
index 9c63665ae..5dbc7f498 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,16 +21,20 @@
package org.onap.policy.controlloop;
public class PhysicalControlLoopNotification extends ControlLoopNotification {
- private static final long serialVersionUID = 8105197217140032892L;
-
- public PhysicalControlLoopNotification() {
- }
+ private static final long serialVersionUID = 8105197217140032892L;
- public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) {
- super(event);
- if (event == null) {
- return;
- }
- }
+ public PhysicalControlLoopNotification() {}
+
+ /**
+ * Construct an instance from an existing instance.
+ *
+ * @param event the existing instance
+ */
+ public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) {
+ super(event);
+ if (event == null) {
+ return;
+ }
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java
index b5ce27112..ec4fc47dd 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,59 +20,61 @@
package org.onap.policy.controlloop;
+import com.google.gson.annotations.SerializedName;
+
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
-import com.google.gson.annotations.SerializedName;
-
public class VirtualControlLoopEvent extends ControlLoopEvent {
- /**
- *
- */
- private static final long serialVersionUID = -5752405682246066226L;
- private Instant closedLoopAlarmStart;
- private Instant closedLoopAlarmEnd;
- @SerializedName("AAI")
- private Map<String, String> aai = new HashMap<>();
+ private static final long serialVersionUID = -5752405682246066226L;
+ private Instant closedLoopAlarmStart;
+ private Instant closedLoopAlarmEnd;
+ @SerializedName("AAI")
+ private Map<String, String> aai = new HashMap<>();
+
+ public VirtualControlLoopEvent() {}
- public VirtualControlLoopEvent() {
- }
- public VirtualControlLoopEvent(VirtualControlLoopEvent event) {
- super(event);
- if (event == null) {
- return;
- }
- if (event.aai != null) {
- this.aai = new HashMap<>(event.aai);
- }
- this.closedLoopAlarmStart = event.closedLoopAlarmStart;
- this.closedLoopAlarmEnd = event.closedLoopAlarmEnd;
- }
+ /**
+ * Construct an instance from an existing instance.
+ *
+ * @param event the existing instance
+ */
+ public VirtualControlLoopEvent(VirtualControlLoopEvent event) {
+ super(event);
+ if (event == null) {
+ return;
+ }
+ if (event.aai != null) {
+ this.aai = new HashMap<>(event.aai);
+ }
+ this.closedLoopAlarmStart = event.closedLoopAlarmStart;
+ this.closedLoopAlarmEnd = event.closedLoopAlarmEnd;
+ }
- public Instant getClosedLoopAlarmStart() {
- return closedLoopAlarmStart;
- }
+ public Instant getClosedLoopAlarmStart() {
+ return closedLoopAlarmStart;
+ }
- public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) {
- this.closedLoopAlarmStart = closedLoopAlarmStart;
- }
+ public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) {
+ this.closedLoopAlarmStart = closedLoopAlarmStart;
+ }
- public Instant getClosedLoopAlarmEnd() {
- return closedLoopAlarmEnd;
- }
+ public Instant getClosedLoopAlarmEnd() {
+ return closedLoopAlarmEnd;
+ }
- public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) {
- this.closedLoopAlarmEnd = closedLoopAlarmEnd;
- }
+ public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) {
+ this.closedLoopAlarmEnd = closedLoopAlarmEnd;
+ }
- public Map<String, String> getAAI() {
- return aai;
- }
+ public Map<String, String> getAai() {
+ return aai;
+ }
- public void setAAI(Map<String, String> aai) {
- this.aai = aai;
- }
+ public void setAai(Map<String, String> aai) {
+ this.aai = aai;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java
index 72d88df92..acb81f8ba 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,60 +20,61 @@
package org.onap.policy.controlloop;
+import com.google.gson.annotations.SerializedName;
+
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
-import com.google.gson.annotations.SerializedName;
-
public class VirtualControlLoopNotification extends ControlLoopNotification {
- /**
- *
- */
- private static final long serialVersionUID = 5354756047932144017L;
+ private static final long serialVersionUID = 5354756047932144017L;
- @SerializedName("AAI")
- private Map<String, String> aai = new HashMap<>();
- private Instant closedLoopAlarmStart;
- private Instant closedLoopAlarmEnd;
+ @SerializedName("AAI")
+ private Map<String, String> aai = new HashMap<>();
+ private Instant closedLoopAlarmStart;
+ private Instant closedLoopAlarmEnd;
- public VirtualControlLoopNotification() {
- }
+ public VirtualControlLoopNotification() {}
- public VirtualControlLoopNotification(VirtualControlLoopEvent event) {
- super(event);
- if (event == null) {
- return;
- }
- if (event.getAAI() != null) {
- this.setAAI(new HashMap<>(event.getAAI()));
- }
- this.closedLoopAlarmStart = event.getClosedLoopAlarmStart();
- this.closedLoopAlarmEnd = event.getClosedLoopAlarmEnd();
- }
+ /**
+ * Construct an instance.
+ *
+ * @param event the event
+ */
+ public VirtualControlLoopNotification(VirtualControlLoopEvent event) {
+ super(event);
+ if (event == null) {
+ return;
+ }
+ if (event.getAai() != null) {
+ this.setAai(new HashMap<>(event.getAai()));
+ }
+ this.closedLoopAlarmStart = event.getClosedLoopAlarmStart();
+ this.closedLoopAlarmEnd = event.getClosedLoopAlarmEnd();
+ }
- public Map<String, String> getAAI() {
- return aai;
- }
+ public Map<String, String> getAai() {
+ return aai;
+ }
- public void setAAI(Map<String, String> aAI) {
- this.aai = aAI;
- }
+ public void setAai(Map<String, String> aai) {
+ this.aai = aai;
+ }
- public Instant getClosedLoopAlarmStart() {
- return closedLoopAlarmStart;
- }
+ public Instant getClosedLoopAlarmStart() {
+ return closedLoopAlarmStart;
+ }
- public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) {
- this.closedLoopAlarmStart = closedLoopAlarmStart;
- }
+ public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) {
+ this.closedLoopAlarmStart = closedLoopAlarmStart;
+ }
- public Instant getClosedLoopAlarmEnd() {
- return closedLoopAlarmEnd;
- }
+ public Instant getClosedLoopAlarmEnd() {
+ return closedLoopAlarmEnd;
+ }
- public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) {
- this.closedLoopAlarmEnd = closedLoopAlarmEnd;
- }
+ public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) {
+ this.closedLoopAlarmEnd = closedLoopAlarmEnd;
+ }
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java
index d62dc0276..ab93f5e9b 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java
@@ -25,7 +25,7 @@ import java.io.Serializable;
public class ControlLoopParams implements Serializable {
private static final long serialVersionUID = 970755684770982776L;
-
+
private String closedLoopControlName;
private String controlLoopYaml;
private String policyName;
@@ -36,6 +36,11 @@ public class ControlLoopParams implements Serializable {
super();
}
+ /**
+ * Construct an instance from an existing instance.
+ *
+ * @param params the existing instance
+ */
public ControlLoopParams(ControlLoopParams params) {
this.closedLoopControlName = params.closedLoopControlName;
this.controlLoopYaml = params.controlLoopYaml;
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java
index d2a51f770..864b31726 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,15 @@
package org.onap.policy.controlloop.util;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
import java.lang.reflect.Type;
import java.time.Instant;
import java.time.ZonedDateTime;
@@ -30,102 +39,87 @@ import org.onap.policy.controlloop.ControlLoopTargetType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-
public final class Serialization {
- private Serialization() {
- }
-
- public static class NotificationTypeAdapter implements JsonSerializer<ControlLoopNotificationType>, JsonDeserializer<ControlLoopNotificationType> {
- @Override
- public JsonElement serialize(ControlLoopNotificationType src, Type typeOfSrc,
- JsonSerializationContext context) {
- return new JsonPrimitive(src.toString());
- }
-
- @Override
- public ControlLoopNotificationType deserialize(JsonElement json, Type typeOfT,
- JsonDeserializationContext context) {
- return ControlLoopNotificationType.toType(json.getAsString());
- }
- }
-
- public static class TargetTypeAdapter implements JsonSerializer<ControlLoopTargetType>, JsonDeserializer<ControlLoopTargetType> {
- @Override
- public JsonElement serialize(ControlLoopTargetType src, Type typeOfSrc,
- JsonSerializationContext context) {
- return new JsonPrimitive(src.toString());
- }
-
- @Override
- public ControlLoopTargetType deserialize(JsonElement json, Type typeOfT,
- JsonDeserializationContext context) {
- return ControlLoopTargetType.toType(json.getAsString());
- }
- }
-
- public static class GSONUTCAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> {
- private static final Logger logger = LoggerFactory.getLogger(GSONUTCAdapter.class);
- public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx");
-
- @Override
- public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) {
- try {
- return ZonedDateTime.parse(element.getAsString(), format);
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
- @Override
- public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) {
- return new JsonPrimitive(datetime.format(format));
- }
- }
-
- public static class GSONInstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> {
-
- @Override
- public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
- return Instant.ofEpochMilli(json.getAsLong());
- }
-
- @Override
- public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) {
- return new JsonPrimitive(src.toEpochMilli());
- }
-
- }
-
- public static final Gson gson = new GsonBuilder().disableHtmlEscaping()
- .registerTypeAdapter(ZonedDateTime.class, new GSONUTCAdapter())
- .registerTypeAdapter(Instant.class, new GSONInstantAdapter())
- .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter())
- .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter())
- .create();
-
-
- public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
- .setPrettyPrinting()
- .registerTypeAdapter(ZonedDateTime.class, new GSONUTCAdapter())
- .registerTypeAdapter(Instant.class, new GSONInstantAdapter())
- .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter())
- .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter())
- .create();
-
- public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping()
- .setPrettyPrinting()
- .registerTypeAdapter(ZonedDateTime.class, new GSONUTCAdapter())
- .registerTypeAdapter(Instant.class, new GSONInstantAdapter())
- .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter())
- .create();
+ private Serialization() {}
+
+ public static class NotificationTypeAdapter
+ implements JsonSerializer<ControlLoopNotificationType>, JsonDeserializer<ControlLoopNotificationType> {
+ @Override
+ public JsonElement serialize(ControlLoopNotificationType src, Type typeOfSrc,
+ JsonSerializationContext context) {
+ return new JsonPrimitive(src.toString());
+ }
+
+ @Override
+ public ControlLoopNotificationType deserialize(JsonElement json, Type typeOfT,
+ JsonDeserializationContext context) {
+ return ControlLoopNotificationType.toType(json.getAsString());
+ }
+ }
+
+ public static class TargetTypeAdapter
+ implements JsonSerializer<ControlLoopTargetType>, JsonDeserializer<ControlLoopTargetType> {
+ @Override
+ public JsonElement serialize(ControlLoopTargetType src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.toString());
+ }
+
+ @Override
+ public ControlLoopTargetType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return ControlLoopTargetType.toType(json.getAsString());
+ }
+ }
+
+ public static class GsonUtcAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> {
+ private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class);
+ public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx");
+
+ @Override
+ public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) {
+ try {
+ return ZonedDateTime.parse(element.getAsString(), format);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ @Override
+ public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) {
+ return new JsonPrimitive(datetime.format(format));
+ }
+ }
+
+ public static class GsonInstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> {
+
+ @Override
+ public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return Instant.ofEpochMilli(json.getAsLong());
+ }
+
+ @Override
+ public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.toEpochMilli());
+ }
+
+ }
+
+ public static final Gson gson =
+ new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter())
+ .registerTypeAdapter(Instant.class, new GsonInstantAdapter())
+ .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter())
+ .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create();
+
+
+ public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter())
+ .registerTypeAdapter(Instant.class, new GsonInstantAdapter())
+ .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter())
+ .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create();
+
+ public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter())
+ .registerTypeAdapter(Instant.class, new GsonInstantAdapter())
+ .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create();
}