org.shaker.dwu
Class BugMail

java.lang.Object
  |
  +--org.shaker.dwu.BugMail
Direct Known Subclasses:
BugzillaMail, HTMLMail, PlainTextMail

public abstract class BugMail
extends java.lang.Object

The basic abstract mail representation of a BugProfile. A BugMail is the formatted representation of a BugProfile; every BugProfile contains it.

Author:
Philipp Bartsch (codeshaker@gmx.net), GPL License

Field Summary
protected static java.lang.String DATE
          Date key
protected static java.lang.String ERROR_CLASS
          Error class key
protected static java.lang.String MAIL_TO
          Recipient key
protected static java.lang.String MESSAGE
          Message key
protected static java.lang.String NEW_LINE
          OS depended line break
protected static java.lang.String P_NAME
          Product name key
protected static java.lang.String P_VERSION
          (Product) Version key
protected static java.lang.String SEND_FORMAT
          The mail format
protected static java.lang.String STACK_TRACE
          Stacktrace key
protected static java.lang.String USER_COMMENT
          User comment key
 
Constructor Summary
BugMail()
           
 
Method Summary
protected abstract  java.lang.String getMailBody()
          Exports the related BugProfile properties into a format dependend mail body.
protected abstract  java.lang.String getMimeType()
          Returns the MIME type of the mail body delivered by generateContent().
protected abstract  java.lang.String getSubjectLine()
          Returns a format dependend subject line for the mail message.
protected abstract  boolean isSatisfied()
          Returns true, if the underlying format has enough informations for a valid transmission.
protected static boolean isStandardKey(java.lang.String key)
          Returns true, if the given key is one of the known basic properties.
protected static java.lang.String replace_impl(java.lang.String string, java.lang.String subString, java.lang.String newString)
          Replaces all occurences of subString with newString in string.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

STACK_TRACE

protected static final java.lang.String STACK_TRACE
Stacktrace key

ERROR_CLASS

protected static final java.lang.String ERROR_CLASS
Error class key

USER_COMMENT

protected static final java.lang.String USER_COMMENT
User comment key

MAIL_TO

protected static final java.lang.String MAIL_TO
Recipient key

MESSAGE

protected static final java.lang.String MESSAGE
Message key

DATE

protected static final java.lang.String DATE
Date key

P_VERSION

protected static final java.lang.String P_VERSION
(Product) Version key

P_NAME

protected static final java.lang.String P_NAME
Product name key

SEND_FORMAT

protected static final java.lang.String SEND_FORMAT
The mail format

NEW_LINE

protected static final java.lang.String NEW_LINE
OS depended line break
Constructor Detail

BugMail

public BugMail()
Method Detail

isSatisfied

protected abstract boolean isSatisfied()
Returns true, if the underlying format has enough informations for a valid transmission. Special formats like Bugzilla need at least some informations to generate a valid bug submission and this methods checks, if all "dependencies" are satisfied. If not, the special format gets abandoned and the default mail format is generated and send to the address specified by alt_recipients in common.settings.
Attention: if the custom format equals the default format and this format can`t be satisfied, text format will be used! Otherwise, you would create a infinite loop.
Returns:
true, if this format has all needed informations

getMimeType

protected abstract java.lang.String getMimeType()
Returns the MIME type of the mail body delivered by generateContent(). Is used by the preview and the Message object.
Returns:
the mime type
See Also:
the content generation method

getSubjectLine

protected abstract java.lang.String getSubjectLine()
Returns a format dependend subject line for the mail message.
Returns:
the subject line

getMailBody

protected abstract java.lang.String getMailBody()
Exports the related BugProfile properties into a format dependend mail body.
Returns:
the mail body

isStandardKey

protected static final boolean isStandardKey(java.lang.String key)
Returns true, if the given key is one of the known basic properties.
Parameters:
key - a property key
Returns:
boolean flag

replace_impl

protected static java.lang.String replace_impl(java.lang.String string,
                                               java.lang.String subString,
                                               java.lang.String newString)
Replaces all occurences of subString with newString in string.
Parameters:
string - the current string
subString - the replaced string
newString - the new token
Returns:
the custom string