com.atlassian.greenhopper.global
Class AbstractResultBuilder
java.lang.Object
com.atlassian.greenhopper.global.AbstractLoggable
com.atlassian.greenhopper.global.AbstractResultBuilder
- Direct Known Subclasses:
- CardColorHelper, ColumnEditHelper, CommentModelFactory, ControlChartModelFactory, CumulativeFlowChartModelFactory, ProjectHelper, QuickFilterHelper, RankHelper, RankHelper, RapidBoardViewModelFactory, RapidViewEditHelper, RapidViewFilterHelper, RapidViewHelper, RapidViewListHelper, ReleaseHelper, SavedFilterHelper, SubqueryHelper, SwimlaneHelper, ThirdPartyTabModelFactory, WelcomeHelper, WorkDataFactory
public class AbstractResultBuilder
- extends AbstractLoggable
Superclass for building "Result" type responses that can be handled automatically by GH.Ajax.
The way things work is as follows:
- ErrorCollection objects get passed in or are returned by service calls - The ErrorCollection is then passed into one of the builder methods,
together with a simple result object or a builder for complex ones - The ResultEntry is rendered into JSON - Inside GH.Ajax (JavaScript), the
error/success result is automatically processed (see Ajax.js for details)
- Author:
- ahennecke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractResultBuilder
public AbstractResultBuilder()
buildResult
protected <T> ResultEntry<T> buildResult(com.atlassian.crowd.embedded.api.User user,
ErrorCollection errors,
AbstractResultBuilder.SuccessBuilder<T> successBuilder)
- Build a Result with a complex (expensive to create) success object. The SuccessBuilder's build method will only be called if there are no
errors, so in an error case, the success object is not unnecessarily created.
- Parameters:
errors
- : The collected errors from the service call chainsuccessBuilder
- : Builds a success object in case there are no errors
- Returns:
- ResultEntry object with either errors or success object built by the builder
buildResult
protected <T> ResultEntry<T> buildResult(com.atlassian.crowd.embedded.api.User user,
ErrorCollection errors,
T successPayload)
- Build a Result with a simple success object. Simple here means "inexpensive to create".
- Parameters:
errors
- : The collected errors from the service call chainsuccessPayload
- : The object that gets attached to the Result, if there were no errors
- Returns:
- ResultEntry object with either errors or success payload
buildCombinedResult
protected <T> ResultEntry<T> buildCombinedResult(com.atlassian.crowd.embedded.api.User user,
ErrorCollection errors,
T successPayload)
- Build a Result with both error and success object. If there are no errors, the error property of the Result will be null. This is meant for
cases in which we need complete or partial success data to render a page, even if there were errors.
buildErrorOnlyResult
protected <T> ResultEntry<T> buildErrorOnlyResult(com.atlassian.crowd.embedded.api.User user,
ErrorCollection errors)
Copyright © 2007-2012 Atlassian. All Rights Reserved.