|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.greenhopper.model.validation.ErrorCollection
public class ErrorCollection
A collection of errors that happen during the processing of a particular code flow. This will be passed back to the caller, rather than throwing exceptions. If the caller is a REST service, it will normally render the errors for the client to display. The ErrorCollection can contain two types of errors: - global errors : these are not bound to a particular context, and will normally be displayed on a neutral, central place on the page - contextual errors : these are bound to a particular context, and the client will decide where to show them (e.g. next to a form field)
Nested Class Summary | |
---|---|
static class |
ErrorCollection.ErrorItem
|
static class |
ErrorCollection.Reason
Copied from JIRA's ErrorCollection interface. |
Constructor Summary | |
---|---|
ErrorCollection()
|
|
ErrorCollection(com.atlassian.jira.util.ErrorCollection jiraErrors)
|
Method Summary | |
---|---|
ErrorCollection |
addAllErrors(ErrorCollection toAdd)
|
ErrorCollection |
addAllJiraErrors(com.atlassian.jira.util.ErrorCollection toAdd)
|
ErrorCollection |
addContextualError(ErrorCollection.Reason reason,
java.lang.String contextId,
java.lang.String messageKey,
java.lang.Object... params)
Add a contextual error. |
ErrorCollection |
addContextualError(java.lang.String contextId,
java.lang.String messageKey,
java.lang.Object... params)
Add a contextual error. |
ErrorCollection |
addError(ErrorCollection.Reason reason,
java.lang.String messageKey,
java.lang.Object... params)
Add a global error that is not bound to a particular context. |
ErrorCollection |
addError(java.lang.String messageKey,
java.lang.Object... params)
Add a global error that is not bound to a particular context. |
ErrorCollection |
addReason(ErrorCollection.Reason reason)
Add a reason why the function has not been performed. |
ErrorCollection |
addReasons(java.util.Set<ErrorCollection.Reason> reasons)
Add reasons why the function has not been performed. |
void |
addToGadgetValidationErrors(java.util.Collection<ValidationError> validationErrors,
java.lang.String fieldName)
|
ErrorCollection |
addWarning(java.lang.String messageKey,
java.lang.Object... params)
|
void |
checkErrors(I18n2 i18n)
Checks for errors and throws an exception if encountered. |
void |
clear()
|
java.util.List<ErrorCollection.ErrorItem> |
getContextualErrors(java.lang.String contextId)
Get all errors for a particular context |
ErrorCollection.Reason |
getDefinitiveReason()
Returns the definitive reason, if one exists. |
java.util.Set<java.lang.String> |
getErrorContextIds()
Get all contextIDs for which errors exist |
java.util.List<ErrorCollection.ErrorItem> |
getErrors()
|
java.util.List<ErrorCollection.ErrorItem> |
getGlobalErrors()
Get all errors that are not related to a context |
java.util.Set<ErrorCollection.Reason> |
getReasons()
A set of well known reasons why the function has not been performed. |
boolean |
hasErrors()
Check if there are any errors at all, global or contextual. |
boolean |
hasGlobalErrors()
Check if there are any global errors |
void |
logErrors(LoggerWrapper log)
|
void |
logWarns(LoggerWrapper log)
|
ErrorCollection |
setReasons(java.util.Set<ErrorCollection.Reason> reasons)
Set reasons why the function has not been performed. |
com.atlassian.jira.util.ErrorCollection |
toJiraErrorCollection(I18n2 i18n)
|
JiraCopiedRestErrorCollection |
toRestErrorCollection(I18n2 i18n)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ErrorCollection()
public ErrorCollection(com.atlassian.jira.util.ErrorCollection jiraErrors)
Method Detail |
---|
public boolean hasErrors()
public boolean hasGlobalErrors()
public ErrorCollection addContextualError(java.lang.String contextId, java.lang.String messageKey, java.lang.Object... params)
contextId
- : an ID that gives the caller an indication what context this error relates to. An Ajax client will use this to decide where on the page the error should be displayed.messageKey
- : the i18n message keyparams
- : to be passed to i18n
java.lang.IllegalArgumentException
- if messageKey is nullpublic ErrorCollection addContextualError(ErrorCollection.Reason reason, java.lang.String contextId, java.lang.String messageKey, java.lang.Object... params)
reason
- the reason for this errorcontextId
- : an ID that gives the caller an indication what context this error relates to. An Ajax client will use this to decide where on the page the error should be displayed.messageKey
- : the i18n message keyparams
- : to be passed to i18n
java.lang.IllegalArgumentException
- if messageKey is nullpublic ErrorCollection addError(java.lang.String messageKey, java.lang.Object... params)
messageKey
- : the i18n message keyparams
- : to be passed to i18n
java.lang.IllegalArgumentException
- if messageKey is nullpublic ErrorCollection addError(ErrorCollection.Reason reason, java.lang.String messageKey, java.lang.Object... params)
reason
- : the reason for this errormessageKey
- : the i18n message keyparams
- : to be passed to i18n
java.lang.IllegalArgumentException
- if messageKey is nullpublic ErrorCollection addWarning(java.lang.String messageKey, java.lang.Object... params)
public java.util.List<ErrorCollection.ErrorItem> getErrors()
public void clear()
public ErrorCollection addAllErrors(ErrorCollection toAdd)
public ErrorCollection addAllJiraErrors(com.atlassian.jira.util.ErrorCollection toAdd)
public com.atlassian.jira.util.ErrorCollection toJiraErrorCollection(I18n2 i18n)
public JiraCopiedRestErrorCollection toRestErrorCollection(I18n2 i18n)
public void addToGadgetValidationErrors(java.util.Collection<ValidationError> validationErrors, java.lang.String fieldName)
public java.util.List<ErrorCollection.ErrorItem> getContextualErrors(java.lang.String contextId)
public java.util.List<ErrorCollection.ErrorItem> getGlobalErrors()
public java.util.Set<java.lang.String> getErrorContextIds()
public ErrorCollection addReasons(java.util.Set<ErrorCollection.Reason> reasons)
reasons
- a set of well known reasons why the function has not been performed.public ErrorCollection addReason(ErrorCollection.Reason reason)
reason
- a well known reasons why the function has not been performed.public ErrorCollection setReasons(java.util.Set<ErrorCollection.Reason> reasons)
reasons
- a set of well known reasons why the function has not been performed.public java.util.Set<ErrorCollection.Reason> getReasons()
public ErrorCollection.Reason getDefinitiveReason()
public java.lang.String toString()
toString
in class java.lang.Object
public void checkErrors(I18n2 i18n)
public void logErrors(LoggerWrapper log)
public void logWarns(LoggerWrapper log)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |