com.atlassian.jira.util
Interface ErrorCollection

All Known Implementing Classes:
JiraWebActionSupport, SimpleErrorCollection

public interface ErrorCollection

A very simple interface to collect errors. This is typically used during form validation for collecting field validation errors (use addError(String, String)), and general errors (addErrorMessage(String)) that aren't field-specific (eg. permission problems).


Method Summary
 void addError(String field, String message)
          Add a field-specific error message.
 void addErrorCollection(ErrorCollection errors)
          Populate this ErrorCollection with general and field-specific errors.
 void addErrorMessage(String message)
          Add error message relating to system state (not field-specific).
 void addErrorMessages(Collection errorMessages)
          Append new error messages to those already collected.
 void addErrors(Map errors)
          Append new field-specific errors to those already collected.
 Collection getErrorMessages()
          Get all non field-specific error messages.
 Map getErrors()
          Get all field-specific errors.
 Collection getFlushedErrorMessages()
          Get error messages, then get rid of them.
 boolean hasAnyErrors()
          Whether any errors (of any type - field-specific or otherwise) have been collected.
 void setErrorMessages(Collection errorMessages)
          Populate this ErrorCollection with a new set of messages (existing errors are lost).
 

Method Detail

addError

public void addError(String field,
                     String message)
Add a field-specific error message.

Parameters:
field - Field name, eg. "assignee"
message - Error message.

addErrorMessage

public void addErrorMessage(String message)
Add error message relating to system state (not field-specific).

Parameters:
message - Error message.

getErrorMessages

public Collection getErrorMessages()
Get all non field-specific error messages.

Returns:
Collection of error Strings.

setErrorMessages

public void setErrorMessages(Collection errorMessages)
Populate this ErrorCollection with a new set of messages (existing errors are lost).

Parameters:
errorMessages - List of error message Strings.

getFlushedErrorMessages

public Collection getFlushedErrorMessages()
Get error messages, then get rid of them.

Returns:
The (now cleared) error messages.

getErrors

public Map getErrors()
Get all field-specific errors.

Returns:
Map of String: String pairs, eg. {"assignee": "Assignee is required"}

addErrorCollection

public void addErrorCollection(ErrorCollection errors)
Populate this ErrorCollection with general and field-specific errors.

Parameters:
errors - ErrorCollection whose errors/messages we obtain.

addErrorMessages

public void addErrorMessages(Collection errorMessages)
Append new error messages to those already collected.

Parameters:
errorMessages - Collection of error strings.

addErrors

public void addErrors(Map errors)
Append new field-specific errors to those already collected.

Parameters:
errors - of String: String pairs, eg. {"assignee": "Assignee is required"}

hasAnyErrors

public boolean hasAnyErrors()
Whether any errors (of any type - field-specific or otherwise) have been collected.



Copyright © 2002-2006 Atlassian. All Rights Reserved.