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 public String operation;
36 public Instant start = Instant.now();
38 public String subRequestId;
39 public String outcome;
40 public String message;
42 public ControlLoopOperation() {
46 public ControlLoopOperation(ControlLoopOperation op) {
47 this.actor = op.actor;
48 this.operation = op.operation;
49 this.target = op.target;
50 this.start = op.start;
52 this.subRequestId = op.subRequestId;
53 this.outcome = op.outcome;
54 this.message = op.message;
57 public String toMessage() {
58 return "actor="+actor+",operation="+operation+",target="+target+",subRequestId="+subRequestId;
61 public String toHistory() {
62 return "actor="+actor+",operation="+operation+",target="+target+",start="+start+",end="+end+",subRequestId="+subRequestId+",outcome="+outcome+",message="+message;
66 public String toString() {
67 return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start="
68 + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message="
73 public int hashCode() {
76 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
77 result = prime * result + ((end == null) ? 0 : end.hashCode());
78 result = prime * result + ((message == null) ? 0 : message.hashCode());
79 result = prime * result + ((operation == null) ? 0 : operation.hashCode());
80 result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
81 result = prime * result + ((start == null) ? 0 : start.hashCode());
82 result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
83 result = prime * result + ((target == null) ? 0 : target.hashCode());
88 public boolean equals(Object obj) {
93 if (getClass() != obj.getClass())
95 ControlLoopOperation other = (ControlLoopOperation) obj;
97 if (other.actor != null)
99 } else if (!actor.equals(other.actor))
102 if (other.end != null)
104 } else if (!end.equals(other.end))
106 if (message == null) {
107 if (other.message != null)
109 } else if (!message.equals(other.message))
111 if (operation == null) {
112 if (other.operation != null)
114 } else if (!operation.equals(other.operation))
116 if (outcome == null) {
117 if (other.outcome != null)
119 } else if (!outcome.equals(other.outcome))
122 if (other.start != null)
124 } else if (!start.equals(other.start))
126 if (subRequestId == null) {
127 if (other.subRequestId != null)
129 } else if (!subRequestId.equals(other.subRequestId))
131 if (target == null) {
132 if (other.target != null)
134 } else if (!target.equals(other.target))