2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.policy.controlloop;
 
  23 import java.io.Serializable;
 
  24 import java.util.UUID;
 
  26 import com.google.gson.annotations.SerializedName;
 
  28 public abstract class ControlLoopEvent implements Serializable {
 
  30     private static final long serialVersionUID = 2391252138583119195L;
 
  32     @SerializedName("closedLoopControlName")
 
  33     private String closedLoopControlName;
 
  35     @SerializedName("version")
 
  36     private String version = "1.0.2";
 
  38     @SerializedName("requestID")
 
  39     private UUID requestId;
 
  41     @SerializedName("closedLoopEventClient")
 
  42     private String closedLoopEventClient;
 
  44     @SerializedName("target_type")
 
  45     private ControlLoopTargetType targetType;
 
  47     @SerializedName("target")
 
  48     private String target;
 
  50     @SerializedName("from")
 
  53     @SerializedName("policyScope")
 
  54     private String policyScope;
 
  56     @SerializedName("policyName")
 
  57     private String policyName;
 
  59     @SerializedName("policyVersion")
 
  60     private String policyVersion;
 
  62     @SerializedName("closedLoopEventStatus")
 
  63     private ControlLoopEventStatus closedLoopEventStatus;
 
  65     @SerializedName("payload")
 
  66     private String payload;
 
  68     public ControlLoopEvent() {
 
  73      * Construct an instace from an existing instance.
 
  75      * @param event the existing instance
 
  77     public ControlLoopEvent(ControlLoopEvent event) {
 
  81         this.closedLoopControlName = event.closedLoopControlName;
 
  82         this.requestId = event.requestId;
 
  83         this.closedLoopEventClient = event.closedLoopEventClient;
 
  84         this.targetType = event.targetType;
 
  85         this.target = event.target;
 
  86         this.from = event.from;
 
  87         this.policyScope = event.policyScope;
 
  88         this.policyName = event.policyName;
 
  89         this.policyVersion = event.policyVersion;
 
  90         this.closedLoopEventStatus = event.closedLoopEventStatus;
 
  91         this.payload = event.payload;
 
  94     public boolean isEventStatusValid() {
 
  95         return this.closedLoopEventStatus != null;
 
  98     public String getClosedLoopControlName() {
 
  99         return closedLoopControlName;
 
 102     public void setClosedLoopControlName(String closedLoopControlName) {
 
 103         this.closedLoopControlName = closedLoopControlName;
 
 106     public String getVersion() {
 
 110     public void setVersion(String version) {
 
 111         this.version = version;
 
 114     public UUID getRequestId() {
 
 118     public void setRequestId(UUID requestId) {
 
 119         this.requestId = requestId;
 
 122     public String getClosedLoopEventClient() {
 
 123         return closedLoopEventClient;
 
 126     public void setClosedLoopEventClient(String closedLoopEventClient) {
 
 127         this.closedLoopEventClient = closedLoopEventClient;
 
 130     public ControlLoopTargetType getTargetType() {
 
 134     public void setTargetType(ControlLoopTargetType targetType) {
 
 135         this.targetType = targetType;
 
 138     public String getTarget() {
 
 142     public void setTarget(String target) {
 
 143         this.target = target;
 
 146     public String getFrom() {
 
 150     public void setFrom(String from) {
 
 154     public String getPolicyScope() {
 
 158     public void setPolicyScope(String policyScope) {
 
 159         this.policyScope = policyScope;
 
 162     public String getPolicyName() {
 
 166     public void setPolicyName(String policyName) {
 
 167         this.policyName = policyName;
 
 170     public String getPolicyVersion() {
 
 171         return policyVersion;
 
 174     public void setPolicyVersion(String policyVersion) {
 
 175         this.policyVersion = policyVersion;
 
 178     public ControlLoopEventStatus getClosedLoopEventStatus() {
 
 179         return closedLoopEventStatus;
 
 182     public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
 
 183         this.closedLoopEventStatus = closedLoopEventStatus;
 
 186     public String getPayload() {
 
 190     public void setPayload(String payload) {
 
 191         this.payload = payload;