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   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.4.0,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.model;
25  
26  /**
27   * Configures one method for notifying users/developers when a
28   * build breaks.
29   * 
30   * @version $Revision$ $Date$
31   */
32  @SuppressWarnings( "all" )
33  public class Notifier
34      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
35  {
36  
37        //--------------------------/
38       //- Class/Member Variables -/
39      //--------------------------/
40  
41      /**
42       * The mechanism used to deliver notifications.
43       */
44      private String type = "mail";
45  
46      /**
47       * Whether to send notifications on error.
48       */
49      private boolean sendOnError = true;
50  
51      /**
52       * Whether to send notifications on failure.
53       */
54      private boolean sendOnFailure = true;
55  
56      /**
57       * Whether to send notifications on success.
58       */
59      private boolean sendOnSuccess = true;
60  
61      /**
62       * Whether to send notifications on warning.
63       */
64      private boolean sendOnWarning = true;
65  
66      /**
67       * 
68       *             
69       *             <b>Deprecated</b>. Where to send the
70       * notification to - eg email address.
71       *             
72       *           
73       */
74      private String address;
75  
76      /**
77       * Field configuration.
78       */
79      private java.util.Properties configuration;
80  
81      /**
82       * Field locations.
83       */
84      private java.util.Map<Object, InputLocation> locations;
85  
86      /**
87       * Field location.
88       */
89      private InputLocation location;
90  
91      /**
92       * Field typeLocation.
93       */
94      private InputLocation typeLocation;
95  
96      /**
97       * Field sendOnErrorLocation.
98       */
99      private InputLocation sendOnErrorLocation;
100 
101     /**
102      * Field sendOnFailureLocation.
103      */
104     private InputLocation sendOnFailureLocation;
105 
106     /**
107      * Field sendOnSuccessLocation.
108      */
109     private InputLocation sendOnSuccessLocation;
110 
111     /**
112      * Field sendOnWarningLocation.
113      */
114     private InputLocation sendOnWarningLocation;
115 
116     /**
117      * Field addressLocation.
118      */
119     private InputLocation addressLocation;
120 
121     /**
122      * Field configurationLocation.
123      */
124     private InputLocation configurationLocation;
125 
126 
127       //-----------/
128      //- Methods -/
129     //-----------/
130 
131     /**
132      * Method addConfiguration.
133      * 
134      * @param key a key object.
135      * @param value a value object.
136      */
137     public void addConfiguration( String key, String value )
138     {
139         getConfiguration().put( key, value );
140     } //-- void addConfiguration( String, String )
141 
142     /**
143      * Method clone.
144      * 
145      * @return Notifier
146      */
147     public Notifier clone()
148     {
149         try
150         {
151             Notifier copy = (Notifier) super.clone();
152 
153             if ( this.configuration != null )
154             {
155                 copy.configuration = (java.util.Properties) this.configuration.clone();
156             }
157 
158             if ( copy.locations != null )
159             {
160                 copy.locations = new java.util.LinkedHashMap( copy.locations );
161             }
162 
163             return copy;
164         }
165         catch ( java.lang.Exception ex )
166         {
167             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
168                 + " does not support clone()" ).initCause( ex );
169         }
170     } //-- Notifier clone()
171 
172     /**
173      * Get <b>Deprecated</b>. Where to send the notification to -
174      * eg email address.
175      * 
176      * @return String
177      */
178     public String getAddress()
179     {
180         return this.address;
181     } //-- String getAddress()
182 
183     /**
184      * Method getConfiguration.
185      * 
186      * @return Properties
187      */
188     public java.util.Properties getConfiguration()
189     {
190         if ( this.configuration == null )
191         {
192             this.configuration = new java.util.Properties();
193         }
194 
195         return this.configuration;
196     } //-- java.util.Properties getConfiguration()
197 
198     /**
199      * 
200      * 
201      * @param key a key object.
202      * @return InputLocation
203      */
204     public InputLocation getLocation( Object key )
205     {
206         if ( key instanceof String )
207         {
208             switch ( ( String ) key )
209             {
210                 case "" :
211                 {
212                     return this.location;
213                 }
214                 case "type" :
215                 {
216                     return typeLocation;
217                 }
218                 case "sendOnError" :
219                 {
220                     return sendOnErrorLocation;
221                 }
222                 case "sendOnFailure" :
223                 {
224                     return sendOnFailureLocation;
225                 }
226                 case "sendOnSuccess" :
227                 {
228                     return sendOnSuccessLocation;
229                 }
230                 case "sendOnWarning" :
231                 {
232                     return sendOnWarningLocation;
233                 }
234                 case "address" :
235                 {
236                     return addressLocation;
237                 }
238                 case "configuration" :
239                 {
240                     return configurationLocation;
241                 }
242                 default :
243                 {
244                     return getOtherLocation( key );
245                 }
246                 }
247             }
248             else
249             {
250                 return getOtherLocation( key );
251             }
252     } //-- InputLocation getLocation( Object )
253 
254     /**
255      * 
256      * 
257      * @param key a key object.
258      * @param location a location object.
259      */
260     public void setLocation( Object key, InputLocation location )
261     {
262         if ( key instanceof String )
263         {
264             switch ( ( String ) key )
265             {
266                 case "" :
267                 {
268                     this.location = location;
269                     return;
270                 }
271                 case "type" :
272                 {
273                     typeLocation = location;
274                     return;
275                 }
276                 case "sendOnError" :
277                 {
278                     sendOnErrorLocation = location;
279                     return;
280                 }
281                 case "sendOnFailure" :
282                 {
283                     sendOnFailureLocation = location;
284                     return;
285                 }
286                 case "sendOnSuccess" :
287                 {
288                     sendOnSuccessLocation = location;
289                     return;
290                 }
291                 case "sendOnWarning" :
292                 {
293                     sendOnWarningLocation = location;
294                     return;
295                 }
296                 case "address" :
297                 {
298                     addressLocation = location;
299                     return;
300                 }
301                 case "configuration" :
302                 {
303                     configurationLocation = location;
304                     return;
305                 }
306                 default :
307                 {
308                     setOtherLocation( key, location );
309                     return;
310                 }
311             }
312         }
313         else
314         {
315             setOtherLocation( key, location );
316         }
317     } //-- void setLocation( Object, InputLocation )
318 
319     /**
320      * 
321      * 
322      * @param key a key object.
323      * @param location a location object.
324      */
325     public void setOtherLocation( Object key, InputLocation location )
326     {
327         if ( location != null )
328         {
329             if ( this.locations == null )
330             {
331                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
332             }
333             this.locations.put( key, location );
334         }
335     } //-- void setOtherLocation( Object, InputLocation )
336 
337     /**
338      * 
339      * 
340      * @param key a key object.
341      * @return InputLocation
342      */
343     private InputLocation getOtherLocation( Object key )
344     {
345         return ( locations != null ) ? locations.get( key ) : null;
346     } //-- InputLocation getOtherLocation( Object )
347 
348     /**
349      * Get the mechanism used to deliver notifications.
350      * 
351      * @return String
352      */
353     public String getType()
354     {
355         return this.type;
356     } //-- String getType()
357 
358     /**
359      * Get whether to send notifications on error.
360      * 
361      * @return boolean
362      */
363     public boolean isSendOnError()
364     {
365         return this.sendOnError;
366     } //-- boolean isSendOnError()
367 
368     /**
369      * Get whether to send notifications on failure.
370      * 
371      * @return boolean
372      */
373     public boolean isSendOnFailure()
374     {
375         return this.sendOnFailure;
376     } //-- boolean isSendOnFailure()
377 
378     /**
379      * Get whether to send notifications on success.
380      * 
381      * @return boolean
382      */
383     public boolean isSendOnSuccess()
384     {
385         return this.sendOnSuccess;
386     } //-- boolean isSendOnSuccess()
387 
388     /**
389      * Get whether to send notifications on warning.
390      * 
391      * @return boolean
392      */
393     public boolean isSendOnWarning()
394     {
395         return this.sendOnWarning;
396     } //-- boolean isSendOnWarning()
397 
398     /**
399      * Set <b>Deprecated</b>. Where to send the notification to -
400      * eg email address.
401      * 
402      * @param address a address object.
403      */
404     public void setAddress( String address )
405     {
406         this.address = address;
407     } //-- void setAddress( String )
408 
409     /**
410      * Set extended configuration specific to this notifier goes
411      * here.
412      * 
413      * @param configuration a configuration object.
414      */
415     public void setConfiguration( java.util.Properties configuration )
416     {
417         this.configuration = configuration;
418     } //-- void setConfiguration( java.util.Properties )
419 
420     /**
421      * Set whether to send notifications on error.
422      * 
423      * @param sendOnError a sendOnError object.
424      */
425     public void setSendOnError( boolean sendOnError )
426     {
427         this.sendOnError = sendOnError;
428     } //-- void setSendOnError( boolean )
429 
430     /**
431      * Set whether to send notifications on failure.
432      * 
433      * @param sendOnFailure a sendOnFailure object.
434      */
435     public void setSendOnFailure( boolean sendOnFailure )
436     {
437         this.sendOnFailure = sendOnFailure;
438     } //-- void setSendOnFailure( boolean )
439 
440     /**
441      * Set whether to send notifications on success.
442      * 
443      * @param sendOnSuccess a sendOnSuccess object.
444      */
445     public void setSendOnSuccess( boolean sendOnSuccess )
446     {
447         this.sendOnSuccess = sendOnSuccess;
448     } //-- void setSendOnSuccess( boolean )
449 
450     /**
451      * Set whether to send notifications on warning.
452      * 
453      * @param sendOnWarning a sendOnWarning object.
454      */
455     public void setSendOnWarning( boolean sendOnWarning )
456     {
457         this.sendOnWarning = sendOnWarning;
458     } //-- void setSendOnWarning( boolean )
459 
460     /**
461      * Set the mechanism used to deliver notifications.
462      * 
463      * @param type a type object.
464      */
465     public void setType( String type )
466     {
467         this.type = type;
468     } //-- void setType( String )
469 
470 }