com.atlassian.jira.gadgets.system
Class AbstractResource

java.lang.Object
  extended by com.atlassian.jira.gadgets.system.AbstractResource
Direct Known Subclasses:
BugzillaIdSearchResource, FavouriteFiltersResource, IssueTableResource, ProjectGadgetResource, SearchQueryBackedResource

public abstract class AbstractResource
extends Object

Lightweight optional convenience base class for REST end points with commonly used methods.

Since:
v4.0

Constructor Summary
AbstractResource()
           
 
Method Summary
protected  javax.ws.rs.core.Response createErrorResponse(Collection<ValidationError> errors)
          Creates an error response using the given errors.
protected  javax.ws.rs.core.Response createIndexingUnavailableResponse(String message)
           
protected  javax.ws.rs.core.Response createValidationResponse(Collection<ValidationError> errors)
          Creates a response based on the given errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractResource

public AbstractResource()
Method Detail

createErrorResponse

protected javax.ws.rs.core.Response createErrorResponse(Collection<ValidationError> errors)
Creates an error response using the given errors.

Parameters:
errors - the errors to use for the error response. Should not be empty.
Returns:
the error response.

createIndexingUnavailableResponse

protected javax.ws.rs.core.Response createIndexingUnavailableResponse(String message)

createValidationResponse

protected javax.ws.rs.core.Response createValidationResponse(Collection<ValidationError> errors)
Creates a response based on the given errors. If there are no errors, the response will be NO_CONTENT (204). If there are errors, these will be used to return an error response. Many REST validate methods need to first build up a possibly empty collection of ValidationError and then just return the result of calling this method.

Parameters:
errors - the possibly empty collection of errors.
Returns:
a success response if the errors are empty, otherwise an error response based on these errors.


Copyright © 2002-2014 Atlassian. All Rights Reserved.