com.atlassian.jira.util
Class AbstractMessageSet

java.lang.Object
  extended by com.atlassian.jira.util.AbstractMessageSet
All Implemented Interfaces:
MessageSet
Direct Known Subclasses:
ListOrderedMessageSetImpl, MessageSetImpl

public abstract class AbstractMessageSet
extends Object
implements MessageSet

Base class for the message set.

Since:
v3.13

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.MessageSet
MessageSet.MessageLink
 
Constructor Summary
protected AbstractMessageSet(Map errors, Map warnings, Set errorsInEnglish, Set warningsInEnglish)
           
 
Method Summary
 void addErrorMessage(String errorMessage)
          Adds an error message.
 void addErrorMessage(String errorMessage, MessageSet.MessageLink link)
          Adds an error message and associates a link with the error.
 void addErrorMessageInEnglish(String errorMessage)
          Adds an error message in English.
 void addMessageSet(MessageSet messageSet)
          Will concatenate this message set with the provided message set.
 void addWarningMessage(String warningMessage)
          Adds a warning message.
 void addWarningMessage(String warningMessage, MessageSet.MessageLink link)
          Adds a warning message and associates a link with the warning.
 void addWarningMessageInEnglish(String warningMessage)
          Adds a warning message in English.
 Set getErrorMessages()
           
 Set getErrorMessagesInEnglish()
          Returns a unique set of all the English error messages.
 MessageSet.MessageLink getLinkForError(String errorMsg)
           
 MessageSet.MessageLink getLinkForWarning(String warningMsg)
           
 Set getWarningMessages()
           
 Set getWarningMessagesInEnglish()
          Returns a unique set of all the English warning messages.
 boolean hasAnyErrors()
          Returns true if there are error messages, false otherwise.
 boolean hasAnyMessages()
          Returns true if there are messages of any type, false otherwise.
 boolean hasAnyWarnings()
          Returns true if there are warning messages, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessageSet

protected AbstractMessageSet(Map errors,
                             Map warnings,
                             Set errorsInEnglish,
                             Set warningsInEnglish)
Method Detail

getErrorMessages

public Set getErrorMessages()
Specified by:
getErrorMessages in interface MessageSet
Returns:
a unique set of error messages, these messages are separate from the warning messages, never null.

getErrorMessagesInEnglish

public Set getErrorMessagesInEnglish()
Description copied from interface: MessageSet
Returns a unique set of all the English error messages.

Specified by:
getErrorMessagesInEnglish in interface MessageSet
Returns:
a unique set of all the English error messages.
See Also:
MessageSet.addErrorMessageInEnglish(String)

getWarningMessages

public Set getWarningMessages()
Specified by:
getWarningMessages in interface MessageSet
Returns:
a unique set of warning messages, these messages are separate from the error messages, never null.

getWarningMessagesInEnglish

public Set getWarningMessagesInEnglish()
Description copied from interface: MessageSet
Returns a unique set of all the English warning messages.

Specified by:
getWarningMessagesInEnglish in interface MessageSet
Returns:
a unique set of all the English warning messages.
See Also:
MessageSet.addWarningMessageInEnglish(String)

hasAnyErrors

public boolean hasAnyErrors()
Description copied from interface: MessageSet
Returns true if there are error messages, false otherwise.

Specified by:
hasAnyErrors in interface MessageSet
Returns:
true if there are error messages, false otherwise.

hasAnyWarnings

public boolean hasAnyWarnings()
Description copied from interface: MessageSet
Returns true if there are warning messages, false otherwise.

Specified by:
hasAnyWarnings in interface MessageSet
Returns:
true if there are warning messages, false otherwise.

hasAnyMessages

public boolean hasAnyMessages()
Description copied from interface: MessageSet
Returns true if there are messages of any type, false otherwise. That is, it will return true if hasAnyErrors() is true or hasAnyWarnings() is true.

Specified by:
hasAnyMessages in interface MessageSet
Returns:
true if there are messages of any type, false otherwise.

getLinkForError

public MessageSet.MessageLink getLinkForError(String errorMsg)
Specified by:
getLinkForError in interface MessageSet
Parameters:
errorMsg - the unique error message
Returns:
the MessageLink that is associated with the error, if one exists, null otherwise.

getLinkForWarning

public MessageSet.MessageLink getLinkForWarning(String warningMsg)
Specified by:
getLinkForWarning in interface MessageSet
Parameters:
warningMsg - the unique warning message
Returns:
the MessageLink that is associated with the warning, if one exists, null otherwise.

addMessageSet

public void addMessageSet(MessageSet messageSet)
Description copied from interface: MessageSet
Will concatenate this message set with the provided message set. All new errors and warnings will be added to the existing errors and warnings.

Specified by:
addMessageSet in interface MessageSet
Parameters:
messageSet - contains the new errors and warnings to add to this set.

addErrorMessage

public void addErrorMessage(String errorMessage)
Description copied from interface: MessageSet
Adds an error message.

Specified by:
addErrorMessage in interface MessageSet
Parameters:
errorMessage - the message to add.

addErrorMessage

public void addErrorMessage(String errorMessage,
                            MessageSet.MessageLink link)
Description copied from interface: MessageSet
Adds an error message and associates a link with the error.

Specified by:
addErrorMessage in interface MessageSet
Parameters:
errorMessage - the message to add.
link - the link to show the users associated with this error.

addErrorMessageInEnglish

public void addErrorMessageInEnglish(String errorMessage)
Description copied from interface: MessageSet
Adds an error message in English.

This is useful when the MessageSet.addErrorMessage(String) method is used to add translated messages, and you want to be able to get a set of the messages in English as well. Eg, in the Project Import we show the translated messages on screen during validation, and log the English versions in case Atlassian Support needs to read the logs later.

Specified by:
addErrorMessageInEnglish in interface MessageSet
Parameters:
errorMessage - the message to add.
See Also:
MessageSet.addErrorMessage(String), MessageSet.addWarningMessageInEnglish(String)

addWarningMessage

public void addWarningMessage(String warningMessage)
Description copied from interface: MessageSet
Adds a warning message.

Specified by:
addWarningMessage in interface MessageSet
Parameters:
warningMessage - the message to add.

addWarningMessage

public void addWarningMessage(String warningMessage,
                              MessageSet.MessageLink link)
Description copied from interface: MessageSet
Adds a warning message and associates a link with the warning.

Specified by:
addWarningMessage in interface MessageSet
Parameters:
warningMessage - the message to add.
link - the link to show the users associated with this warning.

addWarningMessageInEnglish

public void addWarningMessageInEnglish(String warningMessage)
Description copied from interface: MessageSet
Adds a warning message in English.

This is useful when the MessageSet.addWarningMessage(String) method is used to add translated messages, and you want to be able to get a set of the messages in English as well. Eg, in the Project Import we show the translated messages on screen during validation, and log the English versions in case Atlassian Support needs to read the logs later.

Specified by:
addWarningMessageInEnglish in interface MessageSet
Parameters:
warningMessage - the message to add.
See Also:
MessageSet.addWarningMessage(String), MessageSet.addErrorMessageInEnglish(String)


Copyright © 2002-2008 Atlassian. All Rights Reserved.