2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.time.Instant;
26 public class ControlLoopOperation implements Serializable {
31 private static final long serialVersionUID = 8662706581293017099L;
34 private String operation;
35 private String target;
36 private Instant start = Instant.now();
38 private String subRequestId;
39 private String outcome;
40 private String message;
42 public ControlLoopOperation() {
46 public ControlLoopOperation(ControlLoopOperation op) {
51 this.actor = op.actor;
52 this.operation = op.operation;
53 this.target = op.target;
54 this.start = op.start;
56 this.subRequestId = op.subRequestId;
57 this.outcome = op.outcome;
58 this.message = op.message;
61 public String toMessage() {
62 return "actor="+actor+",operation="+operation+",target="+target+",subRequestId="+subRequestId;
65 public String toHistory() {
66 return "actor="+actor+",operation="+operation+",target="+target+",start="+start+",end="+end+",subRequestId="+subRequestId+",outcome="+outcome+",message="+message;
69 public String getActor() {
73 public void setActor(String actor) {
77 public String getOperation() {
81 public void setOperation(String operation) {
82 this.operation = operation;
85 public String getTarget() {
89 public void setTarget(String target) {
93 public Instant getStart() {
97 public void setStart(Instant start) {
101 public Instant getEnd() {
105 public void setEnd(Instant end) {
109 public String getSubRequestId() {
113 public void setSubRequestId(String subRequestId) {
114 this.subRequestId = subRequestId;
117 public String getOutcome() {
121 public void setOutcome(String outcome) {
122 this.outcome = outcome;
125 public String getMessage() {
129 public void setMessage(String message) {
130 this.message = message;
134 public String toString() {
135 return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start="
136 + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message="
141 public int hashCode() {
142 final int prime = 31;
144 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
145 result = prime * result + ((end == null) ? 0 : end.hashCode());
146 result = prime * result + ((message == null) ? 0 : message.hashCode());
147 result = prime * result + ((operation == null) ? 0 : operation.hashCode());
148 result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
149 result = prime * result + ((start == null) ? 0 : start.hashCode());
150 result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
151 result = prime * result + ((target == null) ? 0 : target.hashCode());
156 public boolean equals(Object obj) {
161 if (getClass() != obj.getClass())
163 ControlLoopOperation other = (ControlLoopOperation) obj;
165 if (other.actor != null)
167 } else if (!actor.equals(other.actor))
170 if (other.end != null)
172 } else if (!end.equals(other.end))
174 if (message == null) {
175 if (other.message != null)
177 } else if (!message.equals(other.message))
179 if (operation == null) {
180 if (other.operation != null)
182 } else if (!operation.equals(other.operation))
184 if (outcome == null) {
185 if (other.outcome != null)
187 } else if (!outcome.equals(other.outcome))
190 if (other.start != null)
192 } else if (!start.equals(other.start))
194 if (subRequestId == null) {
195 if (other.subRequestId != null)
197 } else if (!subRequestId.equals(other.subRequestId))
199 if (target == null) {
200 if (other.target != null)
202 } else if (!target.equals(other.target))