vgritsenko 2003/02/02 15:25:12 Modified: src/java/org/apache/cocoon/components/notification SimpleNotifyingBean.java Log: align code, add addExtraDescriptions method Revision Changes Path 1.9 +187 -185 xml-cocoon2/src/java/org/apache/cocoon/components/notification/SimpleNotifyingBean.java Index: SimpleNotifyingBean.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/SimpleNotifyingBean.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SimpleNotifyingBean.java 31 Jan 2003 22:51:30 -0000 1.8 +++ SimpleNotifyingBean.java 2 Feb 2003 23:25:12 -0000 1.9 @@ -59,192 +59,194 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @version CVS $Id$ */ - public class SimpleNotifyingBean implements Notifying { - /** - * The type of the notification. Examples can be "warning" or "error" - */ - private String type = "unknown"; - - /** - * The title of the notification. - */ - private String title = ""; - - /** - * The source that generates the notification. - */ - private String source = ""; - - /** - * The sender of the notification. - */ - private String sender = ""; - - /** - * The notification itself. - */ - private String message = "Message not known."; - - /** - * A more detailed description of the notification. - */ - private String description = "No details available."; - - /** - * A HashMap containing extra notifications - */ - private HashMap extraDescriptions = new HashMap(); + /** + * The type of the notification. Examples can be "warning" or "error" + */ + private String type = "unknown"; + + /** + * The title of the notification. + */ + private String title = ""; + + /** + * The source that generates the notification. + */ + private String source = ""; + + /** + * The sender of the notification. + */ + private String sender = ""; + + /** + * The notification itself. + */ + private String message = "Message not known."; + + /** + * A more detailed description of the notification. + */ + private String description = "No details available."; + + /** + * A HashMap containing extra notifications + */ + private Map extraDescriptions = new HashMap(); + public SimpleNotifyingBean() { - this.sender = "unknown"; - setSource(this.getClass().getName()); - setTitle("Generic notification"); - } - - public SimpleNotifyingBean(Object sender) { - this.sender = sender.getClass().getName(); - setSource(this.getClass().getName()); - setTitle("Generic notification"); - } - - /** - * Sets the Type of the SimpleNotifyingBean object - * - *@param type The new Type value - */ - public void setType(String type) { - this.type = type; - } - - /** - * Sets the Title of the SimpleNotifyingBean object - * - *@param title The new Title value - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Sets the Source of the SimpleNotifyingBean object - * - *@param source The new Source value - */ - public void setSource(String source) { - this.source = source; - } - - /** - * Sets the Sender of the SimpleNotifyingBean object - * - *@param sender The new sender value - */ - private void setSender(Object sender) { - this.sender = sender.getClass().getName(); - } - - /** - * Sets the Sender of the SimpleNotifyingBean object - * - *@param sender The new sender value - */ - private void setSender(String sender) { - this.sender = sender; - } - - /** - * Sets the Message of the SimpleNotifyingBean object - * - *@param message The new Message value - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * Sets the Description of the SimpleNotifyingBean object - * - *@param description The new Description value - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Sets the ExtraDescriptions of the SimpleNotifyingBean object - * - *@param extraDescriptions The new ExtraDescriptions value - */ - public void addExtraDescription(String extraDescriptionDescription, - String extraDescription) { - this.extraDescriptions.put(extraDescriptionDescription, extraDescription); - } - - /** - * replaces the ExtraDescriptions of the SimpleNotifyingBean object - */ - protected void replaceExtraDescriptions(Map extraDescriptions) { - this.extraDescriptions = new HashMap(extraDescriptions); - } - - /** - * replaces the ExtraDescriptions of the SimpleNotifyingBean object - */ - protected void replaceExtraDescriptions(HashMap extraDescriptions) { - this.extraDescriptions = extraDescriptions; - } - - /** - * Gets the Type of the SimpleNotifyingBean object - */ - public String getType() { - return type; - } - - /** - * Gets the Title of the SimpleNotifyingBean object - */ - public String getTitle() { - return title; - } - - /** - * Gets the Source of the SimpleNotifyingBean object - */ - public String getSource() { - return source; - } - - /** - * Gets the Sender of the SimpleNotifyingBean object - */ - public String getSender() { - return sender; - } - - /** - * Gets the Message of the SimpleNotifyingBean object - */ - public String getMessage() { - return message; - } - - /** - * Gets the Description of the SimpleNotifyingBean object - */ - public String getDescription() { - return description; - } - - /** - * Gets the ExtraDescriptions of the SimpleNotifyingBean object - */ - public Map getExtraDescriptions() { - return extraDescriptions; - } + this.sender = "unknown"; + setSource(this.getClass().getName()); + setTitle("Generic notification"); + } + + public SimpleNotifyingBean(Object sender) { + this.sender = sender.getClass().getName(); + setSource(this.getClass().getName()); + setTitle("Generic notification"); + } + + /** + * Sets the Type of the SimpleNotifyingBean object + * + * @param type The new Type value + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the Title of the SimpleNotifyingBean object + * + * @param title The new Title value + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Sets the Source of the SimpleNotifyingBean object + * + * @param source The new Source value + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + * @param sender The new sender value + private void setSender(Object sender) { + this.sender = sender.getClass().getName(); + } + */ + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + * @param sender The new sender value + private void setSender(String sender) { + this.sender = sender; + } + */ + + /** + * Sets the Message of the SimpleNotifyingBean object + * + * @param message The new Message value + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Sets the Description of the SimpleNotifyingBean object + * + * @param description The new Description value + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Adds the ExtraDescription to the SimpleNotifyingBean object + * + * @param extraDescriptionDescription The additional ExtraDescription name + * @param extraDescription The additional ExtraDescription value + */ + public void addExtraDescription(String extraDescriptionDescription, + String extraDescription) { + this.extraDescriptions.put(extraDescriptionDescription, extraDescription); + } + + /** + * Replaces the ExtraDescriptions of the SimpleNotifyingBean object + */ + protected void replaceExtraDescriptions(Map extraDescriptions) { + this.extraDescriptions = extraDescriptions; + } + + /** + * Adds the ExtraDescriptions to the SimpleNotifyingBean object + */ + protected void addExtraDescriptions(Map extraDescriptions) { + if (this.extraDescriptions == null) { + replaceExtraDescriptions(extraDescriptions); + } else { + this.extraDescriptions.putAll(extraDescriptions); + } + } + + /** + * Gets the Type of the SimpleNotifyingBean object + */ + public String getType() { + return type; + } + + /** + * Gets the Title of the SimpleNotifyingBean object + */ + public String getTitle() { + return title; + } + + /** + * Gets the Source of the SimpleNotifyingBean object + */ + public String getSource() { + return source; + } + + /** + * Gets the Sender of the SimpleNotifyingBean object + */ + public String getSender() { + return sender; + } + + /** + * Gets the Message of the SimpleNotifyingBean object + */ + public String getMessage() { + return message; + } + + /** + * Gets the Description of the SimpleNotifyingBean object + */ + public String getDescription() { + return description; + } + + /** + * Gets the ExtraDescriptions of the SimpleNotifyingBean object + */ + public Map getExtraDescriptions() { + return extraDescriptions; + } } - - -
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]