2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.controlloop;
24 import java.io.Serializable;
25 import java.time.Instant;
27 public class ControlLoopOperation implements Serializable {
29 private static final long serialVersionUID = 8662706581293017099L;
32 private String operation;
33 private String target;
34 private Instant start = Instant.now();
36 private String subRequestId;
37 private String outcome;
38 private String message;
40 public ControlLoopOperation() {
45 * Construct an instance from an existing instance.
47 * @param op the existing instance
49 public ControlLoopOperation(ControlLoopOperation op) {
54 this.actor = op.actor;
55 this.operation = op.operation;
56 this.target = op.target;
57 this.start = op.start;
59 this.subRequestId = op.subRequestId;
60 this.outcome = op.outcome;
61 this.message = op.message;
64 public String toMessage() {
65 return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",subRequestId=" + subRequestId;
68 public String toHistory() {
69 return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",start=" + start + ",end=" + end
70 + ",subRequestId=" + subRequestId + ",outcome=" + outcome + ",message=" + message;
73 public String getActor() {
77 public void setActor(String actor) {
81 public String getOperation() {
85 public void setOperation(String operation) {
86 this.operation = operation;
89 public String getTarget() {
93 public void setTarget(String target) {
97 public Instant getStart() {
101 public void setStart(Instant start) {
105 public Instant getEnd() {
109 public void setEnd(Instant end) {
113 public String getSubRequestId() {
117 public void setSubRequestId(String subRequestId) {
118 this.subRequestId = subRequestId;
121 public String getOutcome() {
125 public void setOutcome(String outcome) {
126 this.outcome = outcome;
129 public String getMessage() {
133 public void setMessage(String message) {
134 this.message = message;
138 public String toString() {
139 return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start="
140 + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message="
145 public int hashCode() {
146 final int prime = 31;
148 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
149 result = prime * result + ((end == null) ? 0 : end.hashCode());
150 result = prime * result + ((message == null) ? 0 : message.hashCode());
151 result = prime * result + ((operation == null) ? 0 : operation.hashCode());
152 result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
153 result = prime * result + ((start == null) ? 0 : start.hashCode());
154 result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
155 result = prime * result + ((target == null) ? 0 : target.hashCode());
160 public boolean equals(Object obj) {
167 if (getClass() != obj.getClass()) {
170 ControlLoopOperation other = (ControlLoopOperation) obj;
172 if (other.actor != null) {
175 } else if (!actor.equals(other.actor)) {
179 if (other.end != null) {
182 } else if (!end.equals(other.end)) {
185 if (message == null) {
186 if (other.message != null) {
189 } else if (!message.equals(other.message)) {
192 if (operation == null) {
193 if (other.operation != null) {
196 } else if (!operation.equals(other.operation)) {
199 if (outcome == null) {
200 if (other.outcome != null) {
203 } else if (!outcome.equals(other.outcome)) {
207 if (other.start != null) {
210 } else if (!start.equals(other.start)) {
213 if (subRequestId == null) {
214 if (other.subRequestId != null) {
217 } else if (!subRequestId.equals(other.subRequestId)) {
220 if (target == null) {
221 if (other.target != null) {
224 } else if (!target.equals(other.target)) {