com.atlassian.bamboo.utils.error
Interface ErrorCollection

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractConfigurationAction, AbstractConfigureCapability, AbstractEntityPagerSupport, AbstractLicenseAction, AbstractPermissionAction, AbstractPluginConfigurationAction, AbstractSetupAction, AbstractSetupDatabaseAction, AccessDeniedAction, AddCommentToBuildResults, AddLabelToBuildResults, AddRemoteAgent, AdminErrorAction, AdministerAction, AgentServerActionSupport, Backup, BambooActionSupport, BambooAgentInstallerAction, BrowseGroupsAction, BuildActionSupport, BuildConfigurationSupport, BuildExpiryAction, BuildList, BuildResultsAction, BuildResultsFilterList, BulkEditBuildPermissions, BulkPlanAction, CancelBuild, CapabilityConfigurationSupport, ChangePassword, ConfigurationAction, ConfigureAgentCapability, ConfigureAgentDetails, ConfigureAgents, configureAutoFavouriteAction, ConfigureBuildArtifact, ConfigureBuildBuilder, ConfigureBuildDependencies, ConfigureBuilder, ConfigureBuildNotification, ConfigureBuildPermissions, ConfigureBuildPostAction, ConfigureBuildRepository, ConfigureBuildRequirement, ConfigureCapability, ConfigureCapabilityKey, ConfigureDatabaseAction, ConfigureGlobalPermissions, ConfigureGlobalVariables, ConfigureGroup, ConfigureInstantMessagingServer, ConfigureJdk, ConfigureJiraServer, ConfigureMailServer, ConfigureProfile, ConfigureSecurity, ConfigureSharedCapability, ConfigureSharedLocalCapability, ConfigureSharedRemoteCapability, ConfigureUser, ControlRemoteAgentsAvailability, CreateBuild, DeleteBuildFiles, DeleteBuildResults, DeleteBuilds, EditAgentCapability, EditCommentAction, EditLabelsAction, EditProjectPlanName, EditSharedCapability, ErrorAction, ExecuteBuild, ExecuteRenameAgentCapability, Export, FilterCookieWriterAction, FinishSetupAction, FiveOhOh, ForgotPassword, GetBambooBuildNumber, GetBuildResultsDetails, GetFingerprintAction, GetLatestBuildResults, GetLatestBuildResultsForProject, GetLatestBuildsByUser, GetLatestUserBuilds, GetPackageAction, GetProjectDetails, GetRecentlyCompletedBuildResultsForBuild, GetRecentlyCompletedBuildResultsForProject, GetResourceAction, GetResourcesAction, GlobalAdminAction, GlobalCreatePlanAction, GotoAuthors, GotoBuildResult, Import, LabelRssFeedAction, LicenseAction, ListBuildNames, ListProjectNames, Login, Login, Logout, Logout, LogToServer, MoveBuilds, Profile, ReindexAction, RemoveBuildArtifacts, RemoveBuildError, RenameAgentCapability, ResolveURLAction, SaveConfig, SaveNewProject, SearchUserAction, SelectSetupStepAction, SetFavouriteAction, SetResultsFilter, SetupDataAction, SetupDatabaseAction, SetupDatabaseConnectionAction, SetupDatasourceDatabaseAction, SetupEmbeddedDatabaseAction, SetupImportDataAction, SetupLicenseAction, SetupPathsAction, SetupStandardDatabaseAction, ShowLatestBuildStatus, SignupUser, SimpleErrorCollection, StarterAction, SuspendBuild, SystemErrorList, SystemInfoAction, TriggerManualBuild, TriggerRemoteBuild, UpdateLicenseAction, UserPickerAction, ValidateBuildWizard, ViewAdministrators, ViewAgent, ViewAgentAdmin, ViewAgentPlanMatrix, ViewAgents, ViewAuditLog, ViewAuthor, ViewAuthorChart, ViewAuthorFailuresChart, ViewAuthors, ViewBuild, ViewBuildActivityLog, ViewBuildConfiguration, ViewBuildError, ViewBuildFiles, ViewBuildLogs, ViewBuildResults, ViewBuildResultsByJiraKey, ViewBuildResultsForLabelAction, ViewBuildResultsSuccessfulTests, ViewBuildResultsTable, ViewBuildResultsTests, ViewCloverCoverageSummary, ViewCombinedByBuildNumberChart, ViewCombinedByTimePeriodChart, ViewCurrentRunningBuild, ViewJiraIssues, ViewLabels, ViewNextBuildResults, ViewPlanUpdates, ViewPreviousBuildResults, ViewProject, ViewRecentlyCompletedBuilds, ViewReport, ViewReportChart, ViewTelemetryAction, ViewTestCaseAction, ViewTestCaseResultAction, ViewTestClassResultAction, ViewTestsSummary, WelcomeWizard, WelcomeWizard1

public interface ErrorCollection
extends java.io.Serializable

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(java.lang.String field, java.lang.String message)
          Add a field-specific error message.
 void addError(java.lang.String prefix, java.lang.String field, java.lang.String message)
          Adds a new form validation error with a given prefix.
 void addErrorCollection(ErrorCollection errors)
          Populate this ErrorCollection with general and field-specific errors.
 void addErrorMessage(java.lang.String message)
          Add error message relating to system state (not field-specific).
 java.lang.String addErrorMessage(java.lang.String message, java.lang.Exception e)
           
 void addErrorMessages(java.util.Collection<java.lang.String> errorMessages)
          Append new error messages to those already collected.
 void addErrors(java.util.Map<java.lang.String,?> errors)
          Append new field-specific errors to those already collected.
 java.util.Collection<java.lang.String> getErrorMessages()
          Get all non field-specific error messages.
 java.util.Map<java.lang.String,java.lang.String> getErrors()
          Get all field-specific errors.
 java.util.Map<java.lang.String,java.lang.String> getFieldErrors()
           
 java.util.Collection<java.lang.String> getFlushedErrorMessages()
          Get error messages, then get rid of them.
 int getTotalErrors()
           
 boolean hasAnyErrors()
          Whether any errors (of any type - field-specific or otherwise) have been collected.
 void setErrorMessages(java.util.Collection<java.lang.String> errorMessages)
          Populate this ErrorCollection with a new set of messages (existing errors are lost).
 

Method Detail

addError

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

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

addError

void addError(java.lang.String prefix,
              java.lang.String field,
              java.lang.String message)
Adds a new form validation error with a given prefix. ie. prefix of "builder.ant" and field "target" will result in a key of "builder.ant.target"

Parameters:
prefix - The prefix of the field in . form
field - The id of the form element in error
message - The error message to display to the user

addErrorMessage

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

Parameters:
message - Error message.

addErrorMessage

java.lang.String addErrorMessage(java.lang.String message,
                                 java.lang.Exception e)

getErrorMessages

java.util.Collection<java.lang.String> getErrorMessages()
Get all non field-specific error messages.

Returns:
Collection of error Strings.

setErrorMessages

void setErrorMessages(java.util.Collection<java.lang.String> errorMessages)
Populate this ErrorCollection with a new set of messages (existing errors are lost).

Parameters:
errorMessages - List of error message Strings.

getFlushedErrorMessages

java.util.Collection<java.lang.String> getFlushedErrorMessages()
Get error messages, then get rid of them.

Returns:
The (now cleared) error messages.

getErrors

java.util.Map<java.lang.String,java.lang.String> getErrors()
Get all field-specific errors.

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

addErrorCollection

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

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

addErrorMessages

void addErrorMessages(java.util.Collection<java.lang.String> errorMessages)
Append new error messages to those already collected.

Parameters:
errorMessages - Collection of error strings.

addErrors

void addErrors(java.util.Map<java.lang.String,?> errors)
Append new field-specific errors to those already collected.

Parameters:
errors - A Map from String field names, to String error messages, or Collections of String error messages.

hasAnyErrors

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

Returns:
true if there are errors; false otherwise.

getFieldErrors

java.util.Map<java.lang.String,java.lang.String> getFieldErrors()

getTotalErrors

int getTotalErrors()


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.