Remove mso-oof-adapter from SO
[so.git] / so-monitoring / so-monitoring-handler / src / main / java / org / onap / so / monitoring / model / ActivityInstanceDetail.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  * 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.monitoring.model;
21
22 import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual;
23
24 /**
25  * @author waqas.ikram@ericsson.com
26  *
27  */
28 public class ActivityInstanceDetail {
29     private final String activityId;
30     private final String activityName;
31     private final String activityType;
32     private final String processInstanceId;
33     private final String calledProcessInstanceId;
34     private final String startTime;
35     private final String endTime;
36     private final String durationInMilliseconds;
37
38     public ActivityInstanceDetail(final ActivityInstanceDetailBuilder builder) {
39         this.activityId = builder.activityId;
40         this.activityName = builder.activityName;
41         this.activityType = builder.activityType;
42         this.processInstanceId = builder.processInstanceId;
43         this.calledProcessInstanceId = builder.calledProcessInstanceId;
44         this.startTime = builder.startTime;
45         this.endTime = builder.endTime;
46         this.durationInMilliseconds = builder.durationInMilliseconds;
47     }
48
49     /**
50      * @return the activityId
51      */
52     public String getActivityId() {
53         return activityId;
54     }
55
56     /**
57      * @return the activityName
58      */
59     public String getActivityName() {
60         return activityName;
61     }
62
63     /**
64      * @return the activityType
65      */
66     public String getActivityType() {
67         return activityType;
68     }
69
70     /**
71      * @return the processInstanceId
72      */
73     public String getProcessInstanceId() {
74         return processInstanceId;
75     }
76
77     /**
78      * @return the calledProcessInstanceId
79      */
80     public String getCalledProcessInstanceId() {
81         return calledProcessInstanceId;
82     }
83
84     /**
85      * @return the startTime
86      */
87     public String getStartTime() {
88         return startTime;
89     }
90
91     /**
92      * @return the endTime
93      */
94     public String getEndTime() {
95         return endTime;
96     }
97
98     /**
99      * @return the durationInMillis
100      */
101     public String getDurationInMillis() {
102         return durationInMilliseconds;
103     }
104
105     @Override
106     public int hashCode() {
107         final int prime = 31;
108         int result = 1;
109         result = prime * result + ((activityId == null) ? 0 : activityId.hashCode());
110         result = prime * result + ((activityName == null) ? 0 : activityName.hashCode());
111         result = prime * result + ((activityType == null) ? 0 : activityType.hashCode());
112         result = prime * result + ((calledProcessInstanceId == null) ? 0 : calledProcessInstanceId.hashCode());
113         result = prime * result + ((durationInMilliseconds == null) ? 0 : durationInMilliseconds.hashCode());
114         result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
115         result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode());
116         result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
117         return result;
118     }
119
120     @Override
121     public boolean equals(final Object obj) {
122
123         if (obj instanceof ActivityInstanceDetail) {
124             final ActivityInstanceDetail other = (ActivityInstanceDetail) obj;
125             return isEqual(activityId, other.activityId) && isEqual(activityName, other.activityName)
126                     && isEqual(activityType, other.activityType) && isEqual(processInstanceId, other.processInstanceId)
127                     && isEqual(calledProcessInstanceId, other.calledProcessInstanceId)
128                     && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime)
129                     && isEqual(durationInMilliseconds, other.durationInMilliseconds);
130         }
131
132         return false;
133     }
134
135
136     public static final class ActivityInstanceDetailBuilder {
137
138         private String activityId;
139         private String activityName;
140         private String activityType;
141         private String processInstanceId;
142         private String calledProcessInstanceId;
143         private String startTime;
144         private String endTime;
145         private String durationInMilliseconds;
146
147         public ActivityInstanceDetailBuilder activityId(final String activityId) {
148             this.activityId = activityId;
149             return this;
150         }
151
152         public ActivityInstanceDetailBuilder activityName(final String activityName) {
153             this.activityName = activityName;
154             return this;
155         }
156
157         public ActivityInstanceDetailBuilder activityType(final String activityType) {
158             this.activityType = activityType;
159             return this;
160         }
161
162         public ActivityInstanceDetailBuilder processInstanceId(final String processInstanceId) {
163             this.processInstanceId = processInstanceId;
164             return this;
165         }
166
167         public ActivityInstanceDetailBuilder calledProcessInstanceId(final String calledProcessInstanceId) {
168             this.calledProcessInstanceId = calledProcessInstanceId;
169             return this;
170         }
171
172         public ActivityInstanceDetailBuilder startTime(final String startTime) {
173             this.startTime = startTime;
174             return this;
175         }
176
177         public ActivityInstanceDetailBuilder endTime(final String endTime) {
178             this.endTime = endTime;
179             return this;
180         }
181
182         public ActivityInstanceDetailBuilder durationInMilliseconds(final String durationInMilliseconds) {
183             this.durationInMilliseconds = durationInMilliseconds;
184             return this;
185         }
186
187         public ActivityInstanceDetail build() {
188             return new ActivityInstanceDetail(this);
189         }
190     }
191
192 }