com.atlassian.bamboo.utils.error
Interface ErrorCollection

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractAdminRestAction, AbstractEntityPagerSupport, AbstractJiraRelatedAction, AbstractMigrationAction, AbstractNotificationBulkAction, AbstractPermissionAction, AbstractPluginConfigurationAction, AbstractRestPlanResults, AbstractSetupAction, AbstractViewCapabilitiesByType, AccessDeniedAction, AddCommentToBuildResults, AddLabelToBuildResults, AddNotificationBulkAction, AddRemoteAgent, AddSharedLocalBuilderCapability, AddSharedLocalCapability, AddSharedRemoteCapability, AddStageAction, AdminErrorAction, AdministerAction, AdminUpdateLicenseAction, AgentJsonProvider, AllBuildsRssFeedAction, AllElasticInstancesAction, AllowLicenseUpdateOrShowExpirationInfo, AvailableVariablesAction, Backup, BambooActionSupport, BambooAgentInstallerAction, BrowseGroupsAction, BuildActionSupport, BuildConfigurationSupport, BuildExpiryAction, BuildJsonProviderAction, BuildList, BuildResultsAction, BulkEditBuildPermissions, BulkPlanAction, CapabilityConfigurationSupport, ChainActionSupport, ChainJsonProviderAction, ChainResultsAction, ChangeForgottenPassword, ChangePassword, ConfigurationAction, ConfigureAgentCapability, ConfigureAgentDetails, ConfigureAgents, ConfigureAlias, ConfigureArtifactSubscription, ConfigureAutoFavouriteAction, ConfigureBuildArtifact, ConfigureBuildBuilder, ConfigureBuildDetails, ConfigureBuildMiscellaneousOptions, ConfigureBuildNotification, ConfigureBuildPermissions, ConfigureBuildRepository, ConfigureBuildRequirement, ConfigureBuildTasks, ConfigureCapability, ConfigureCapabilityKey, ConfigureChainNotification, ConfigureCloverPlugin, ConfigureConcurrentBuilds, ConfigureDatabaseAction, ConfigureElasticCapability, ConfigureElasticCloudAction, ConfigureElasticImageConfiguration, ConfigureElasticInstanceSchedule, ConfigureElasticInstanceSchedules, ConfigureGlobalBuildHangingDetection, ConfigureGlobalPermissions, ConfigureGlobalVariables, ConfigureGroup, ConfigureInstantMessagingServer, ConfigureJiraServer, ConfigureLog4jAction, ConfigureMailServer, ConfigureNotificationPreferences, ConfigurePerforceManager, ConfigurePlanDependencies, ConfigurePlanVariables, ConfigureProfile, ConfigureSecurity, ConfigureSharedCapability, ConfigureSharedLocalCapability, ConfigureSharedRemoteCapability, ConfigureSystemNotifications, ConfigureUser, ControlRemoteAgentsAvailability, CreateChain, CreateGlobalVariable, CreateInstantMessagingServer, CreateJob, CreatePlanVariable, CreateTask, CreateTasksChainWizard, CreateTasksJobWizard, CronExpressionGeneratorAction, DashboardSummaryAction, DeleteAllNotificationBulkAction, DeleteBuildFiles, DeleteBuilds, DeleteGlobalVariable, DeleteHgCacheDirectory, DeletePlan, DeletePlanResults, DeletePlanVariable, DeleteStageAction, DeleteTask, DescribeAgentAvailability, EditAgentCapability, EditChainDetails, EditCommentAction, EditElasticCapability, EditJiraIssues, EditLabelsAction, EditSharedCapability, EditTask, ErrorAction, ExecuteBuild, ExecuteRenameAgentCapability, Export, FilterCookieWriterAction, FinishSetupAction, FiveOhOh, ForgotPassword, GetBambooBuildNumber, GetBuildResultsDetails, GetFingerprintAction, GetLatestBuildResults, GetLatestBuildResultsForProject, GetLatestBuildsByUser, GetLatestUserBuilds, GetPkFileAction, GetProjectDetails, GetRecentlyCompletedBuildResultsForBuild, GetRecentlyCompletedBuildResultsForProject, GiveBamboonsFeedback, GlobalAdminAction, GotoAuthors, GotoBuildResult, Import, ImportMavenPlanAction, ImportMavenPlanCheckoutPomAction, ImportMavenPlanCreatePlanAction, LabelRssFeedAction, ListBuildNames, ListBuildResults, ListChainResults, ListJobsForChain, ListProjectNames, ListRunningInstances, LoadBitbucketRepositories, Login, Login, Logout, Logout, LogToServer, ManageCachesAction, ManageElasticInstancesAction, ManualBuildBulkAction, MoveBuilds, MoveJobAction, MoveStageAction, MoveTask, ParameterisedManualBuild, PlanActionSupport, PlanResultsAction, Profile, ReindexAction, RemoveBuildArtifacts, RemoveBuildError, RenameAgentCapability, ReorderBuild, RssFeedAction, SearchUserAction, SelectBuildConfigurationTab, SelectSetupStepAction, SetAgentBuildFilter, SetFavouriteAction, SetResultsFilter, SetupAdminUserAction, SetupDatabaseAction, SetupDatabaseConnectionAction, SetupDefaultsAction, SetupEmbeddedDatabaseAction, SetupGeneralConfiguration, SetupImportDataAction, SetupLicenseAction, SetupUpdateLicenseAction, ShowLatestBuildStatus, SignupUser, SimpleErrorCollection, StageAction, StartElasticAgents, StarterAction, StopAllElasticAgents, StopElasticAgents, StopPlan, SuspendBuild, SystemErrorList, SystemInfoAction, TriggerManualBuild, TriggerRemoteBuild, UpdateCvsModuleBulkAction, UpdateCvsRootCredentialsBulkAction, UpdateDefaultsLocalCapability, UpdateGlobalVariable, UpdateLicenseAction, UpdatePlanVariable, UpdateSvnCredentialsBulkAction, UpdateSvnUrlBulkAction, UpdateWebUrlBulkAction, UserPickerAction, ViewActivityLog, ViewAdministrators, ViewAgent, ViewAgentAdmin, ViewAgentDetailsAction, ViewAgentPlanMatrix, ViewAgents, ViewAuthor, ViewAuthorChart, ViewAuthors, ViewBambooInternals, ViewBuild, ViewBuildConfiguration, ViewBuildError, ViewBuilders, ViewBuildFiles, ViewBuildLogs, ViewBuildResults, ViewBuildResultsByJiraKey, ViewBuildResultsForLabelAction, ViewBuildResultsSuccessfulTests, ViewBuildResultsTable, ViewBuildResultsTableByPlans, ViewBuildResultsTests, ViewChainArtifacts, ViewChainAuditLog, ViewChainConfiguration, ViewChainLogs, ViewChainResult, ViewChainSummary, ViewChainTestResults, ViewCloverBuildResults, ViewCloverCoverageSummary, ViewCombinedByBuildNumberChart, ViewCombinedByTimePeriodChart, ViewElasticAgentHistoryAction, ViewElasticInstanceAction, ViewGadgetUrls, ViewGlobalAuditLogAction, ViewInstancesForConfigurationAction, ViewJdks, ViewJiraIssueForPlan, ViewJiraIssues, ViewLabels, ViewMaven2ChainSummary, ViewNextBuildResults, ViewOfflineAgents, ViewOfflineElasticAgentDetailsAction, ViewOfflineElasticAgentDetailsAdminAction, ViewPlanConfiguration, ViewPlanStatusByJiraKey, ViewPlanUpdates, ViewPreviousBuildResults, ViewProject, ViewReport, ViewReportChart, ViewRunningPlans, ViewTelemetryAction, ViewTestCaseAction, ViewTestCaseResultAction, ViewTestClassResultAction, ViewTestsSummary, ViewUserSummary

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(@NotNull
                        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 © 2011 Atlassian. All Rights Reserved.