9d6d9d8eacb42e05ff595f06cf8405502ea96a6f
[sdc.git] / common / onap-tosca-datatype / src / main / java / org / onap / sdc / tosca / datatypes / model / Trigger.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.sdc.tosca.datatypes.model;
22
23 public class Trigger {
24
25     private String description;
26     private String event_type;
27     private TimeInterval schedule;
28     private EventFilter target_filter;
29     private Condition condition;
30     private Object action;
31
32     @Override
33     public int hashCode() {
34         int result = getDescription() != null ? getDescription().hashCode() : 0;
35         result = 31 * result + getEvent_type().hashCode();
36         result = 31 * result + (getSchedule() != null ? getSchedule().hashCode() : 0);
37         result = 31 * result + (getTarget_filter() != null ? getTarget_filter().hashCode() : 0);
38         result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0);
39         result = 31 * result + getAction().hashCode();
40         return result;
41     }
42
43     @Override
44     public boolean equals(Object o) {
45         if (this == o) {
46             return true;
47         }
48         if (!(o instanceof Trigger)) {
49             return false;
50         }
51
52         Trigger trigger = (Trigger) o;
53
54         if (getDescription() != null ? !getDescription().equals(trigger.getDescription()) :
55                     trigger.getDescription() != null) {
56             return false;
57         }
58         if (!getEvent_type().equals(trigger.getEvent_type())) {
59             return false;
60         }
61         if (getSchedule() != null ? !getSchedule().equals(trigger.getSchedule()) : trigger.getSchedule() != null) {
62             return false;
63         }
64         if (getTarget_filter() != null ? !getTarget_filter().equals(trigger.getTarget_filter()) :
65                     trigger.getTarget_filter() != null) {
66             return false;
67         }
68         if (getCondition() != null ? !getCondition().equals(trigger.getCondition()) : trigger.getCondition() != null) {
69             return false;
70         }
71         return getAction().equals(trigger.getAction());
72     }
73
74     public String getDescription() {
75         return description;
76     }
77
78     public void setDescription(String description) {
79         this.description = description;
80     }
81
82     public String getEvent_type() {
83         return event_type;
84     }
85
86     public void setEvent_type(String eventType) {
87         this.event_type = eventType;
88     }
89
90     public TimeInterval getSchedule() {
91         return schedule;
92     }
93
94     public void setSchedule(TimeInterval schedule) {
95         this.schedule = schedule;
96     }
97
98     public EventFilter getTarget_filter() {
99         return target_filter;
100     }
101
102     public void setTarget_filter(EventFilter targetFilter) {
103         this.target_filter = targetFilter;
104     }
105
106     public Condition getCondition() {
107         return condition;
108     }
109
110     public void setCondition(Condition condition) {
111         this.condition = condition;
112     }
113
114     public Object getAction() {
115
116         return action;
117     }
118
119     public void setAction(Object action) {
120         this.action = action;
121     }
122 }