044e1ca2bdfcee5585d56062dbb11a9127bacb7a
[vfc/nfvo/driver/vnfm/svnfm.git] / nokiav2 / driver / src / main / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / nokia / vnfm / notification / ProcessedNotification.java
1 /*
2  * Copyright 2016-2017, Nokia Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification;
17
18 import com.nokia.cbam.lcm.v32.model.OperationStatus;
19
20 import java.util.Objects;
21
22 /**
23  * Represents a notification successfully processed by the {@link LifecycleChangeNotificationManager}
24  */
25 class ProcessedNotification {
26     private String operationExecutionId;
27     //do not remove field the {@link LifecycleChangeNotificationManager} uses the equals
28     // method to compare notifications
29     private OperationStatus status;
30
31     ProcessedNotification(String operationExecutionId, OperationStatus status) {
32         this.operationExecutionId = operationExecutionId;
33         this.status = status;
34     }
35
36     /**
37      * @return the identifier of the operation
38      */
39     public String getOperationExecutionId() {
40         return operationExecutionId;
41     }
42
43     /**
44      * @param operationExecutionId the identifier of the operation
45      */
46     public void setOperationExecutionId(String operationExecutionId) {
47         this.operationExecutionId = operationExecutionId;
48     }
49
50     /**
51      * @return the status of the operation
52      */
53     public OperationStatus getStatus() {
54         return status;
55     }
56
57     /**
58      * @param status the status of the operation
59      */
60     public void setStatus(OperationStatus status) {
61         this.status = status;
62     }
63
64     @Override
65     public boolean equals(Object o) {
66         if (this == o) return true;
67         if (o == null || getClass() != o.getClass()) return false;
68         ProcessedNotification that = (ProcessedNotification) o;
69         return Objects.equals(operationExecutionId, that.operationExecutionId) &&
70                 status == that.status;
71     }
72
73     @Override
74     public int hashCode() {
75         return Objects.hash(operationExecutionId, status);
76     }
77
78     @Override
79     public String toString() {
80         return "ProcessedNotification{" +
81                 "operationExecutionId=" + operationExecutionId + '"' +
82                 ", status=" + status +
83                 '}';
84     }
85 }