View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.to;
20  
21  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
22  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
23  import java.util.ArrayList;
24  import java.util.HashMap;
25  import java.util.List;
26  import java.util.Map;
27  import javax.ws.rs.PathParam;
28  import org.apache.commons.lang3.builder.EqualsBuilder;
29  import org.apache.commons.lang3.builder.HashCodeBuilder;
30  import org.apache.syncope.common.lib.types.TraceLevel;
31  
32  public class NotificationTO implements EntityTO {
33  
34      private static final long serialVersionUID = -6145117115632592612L;
35  
36      private String key;
37  
38      private final List<String> events = new ArrayList<>();
39  
40      private final Map<String, String> abouts = new HashMap<>();
41  
42      private String recipientsFIQL;
43  
44      private final List<String> staticRecipients = new ArrayList<>();
45  
46      private String recipientAttrName;
47  
48      private boolean selfAsRecipient;
49  
50      private String recipientsProvider;
51  
52      private String sender;
53  
54      private String subject;
55  
56      private String template;
57  
58      private TraceLevel traceLevel;
59  
60      private boolean active;
61  
62      public Map<String, String> getAbouts() {
63          return abouts;
64      }
65  
66      @JacksonXmlElementWrapper(localName = "events")
67      @JacksonXmlProperty(localName = "event")
68      public List<String> getEvents() {
69          return events;
70      }
71  
72      @JacksonXmlElementWrapper(localName = "staticRecipients")
73      @JacksonXmlProperty(localName = "staticRecipient")
74      public List<String> getStaticRecipients() {
75          return staticRecipients;
76      }
77  
78      @Override
79      public String getKey() {
80          return key;
81      }
82  
83      @PathParam("key")
84      @Override
85      public void setKey(final String key) {
86          this.key = key;
87      }
88  
89      public String getRecipientsFIQL() {
90          return recipientsFIQL;
91      }
92  
93      public void setRecipientsFIQL(final String recipientsFIQL) {
94          this.recipientsFIQL = recipientsFIQL;
95      }
96  
97      public String getRecipientAttrName() {
98          return recipientAttrName;
99      }
100 
101     public void setRecipientAttrName(final String recipientAttrName) {
102         this.recipientAttrName = recipientAttrName;
103     }
104 
105     public boolean isSelfAsRecipient() {
106         return selfAsRecipient;
107     }
108 
109     public void setSelfAsRecipient(final boolean selfAsRecipient) {
110         this.selfAsRecipient = selfAsRecipient;
111     }
112 
113     public String getRecipientsProvider() {
114         return recipientsProvider;
115     }
116 
117     public void setRecipientsProvider(final String recipientsProvider) {
118         this.recipientsProvider = recipientsProvider;
119     }
120 
121     public String getSender() {
122         return sender;
123     }
124 
125     public void setSender(final String sender) {
126         this.sender = sender;
127     }
128 
129     public String getSubject() {
130         return subject;
131     }
132 
133     public void setSubject(final String subject) {
134         this.subject = subject;
135     }
136 
137     public String getTemplate() {
138         return template;
139     }
140 
141     public void setTemplate(final String template) {
142         this.template = template;
143     }
144 
145     public TraceLevel getTraceLevel() {
146         return traceLevel;
147     }
148 
149     public void setTraceLevel(final TraceLevel traceLevel) {
150         this.traceLevel = traceLevel;
151     }
152 
153     public boolean isActive() {
154         return active;
155     }
156 
157     public void setActive(final boolean active) {
158         this.active = active;
159     }
160 
161     @Override
162     public int hashCode() {
163         return new HashCodeBuilder().
164                 append(key).
165                 append(events).
166                 append(abouts).
167                 append(recipientsFIQL).
168                 append(staticRecipients).
169                 append(recipientAttrName).
170                 append(selfAsRecipient).
171                 append(recipientsProvider).
172                 append(sender).
173                 append(subject).
174                 append(template).
175                 append(traceLevel).
176                 append(active).
177                 build();
178     }
179 
180     @Override
181     public boolean equals(final Object obj) {
182         if (this == obj) {
183             return true;
184         }
185         if (obj == null) {
186             return false;
187         }
188         if (getClass() != obj.getClass()) {
189             return false;
190         }
191         final NotificationTO other = (NotificationTO) obj;
192         return new EqualsBuilder().
193                 append(key, other.key).
194                 append(events, other.events).
195                 append(abouts, other.abouts).
196                 append(recipientsFIQL, other.recipientsFIQL).
197                 append(staticRecipients, other.staticRecipients).
198                 append(recipientAttrName, other.recipientAttrName).
199                 append(selfAsRecipient, other.selfAsRecipient).
200                 append(recipientsProvider, other.recipientsProvider).
201                 append(sender, other.sender).
202                 append(subject, other.subject).
203                 append(template, other.template).
204                 append(traceLevel, other.traceLevel).
205                 append(active, other.active).
206                 build();
207     }
208 }