Class BaseController
- java.lang.Object
-
- org.ehrbase.rest.ehrscape.controller.BaseController
-
- Direct Known Subclasses:
CompositionController,EhrController,QueryController,TemplateController
public abstract class BaseController extends Object
This base controller implements the basic functionality for all specific controllers. This includes error handling and utils.
-
-
Constructor Summary
Constructors Constructor Description BaseController()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Map<String,Map<String,String>>add2MetaMap(Map<String,Map<String,String>> metaMap, String key, String value)protected org.springframework.http.ResponseEntity<Map<String,String>>createErrorResponse(String message, org.springframework.http.HttpStatus status)protected StringgetBaseEnvLinkURL()org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(Exception e)Fallback error handler.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(IllegalArgumentException e)Deprecated.Throw a more specific exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(UnmarshalException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(BadGatewayException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(DuplicateObjectException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(GeneralRequestProcessingException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(InternalServerException e)Handler for less specific internal errororg.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(InvalidApiParameterException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(ObjectNotFoundException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(StateConflictException e)Handler for project-custom exception.org.springframework.http.ResponseEntity<Map<String,String>>restErrorHandler(org.springframework.web.bind.MissingServletRequestParameterException e)This handler catches the exception automatically generated and thrown by the framework, when specified parameters are not present or matching.
-
-
-
Method Detail
-
add2MetaMap
public Map<String,Map<String,String>> add2MetaMap(Map<String,Map<String,String>> metaMap, String key, String value)
-
getBaseEnvLinkURL
protected String getBaseEnvLinkURL()
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.DuplicateObjectException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(DuplicateObjectException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@Deprecated @ExceptionHandler(java.lang.IllegalArgumentException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(IllegalArgumentException e)
Deprecated.Throw a more specific exception.Handler for broad and general Java standard exception IllegalArgumentException. Shall be replaced with a more specific exception like InvalidApiParameterException in backend code with time.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.GeneralRequestProcessingException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(GeneralRequestProcessingException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.InvalidApiParameterException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(InvalidApiParameterException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.springframework.web.bind.MissingServletRequestParameterException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(org.springframework.web.bind.MissingServletRequestParameterException e)
This handler catches the exception automatically generated and thrown by the framework, when specified parameters are not present or matching.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.ObjectNotFoundException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(ObjectNotFoundException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(java.rmi.UnmarshalException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(UnmarshalException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.StateConflictException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(StateConflictException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.InternalServerException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(InternalServerException e)
Handler for less specific internal error- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(org.ehrbase.api.exception.BadGatewayException.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(BadGatewayException e)
Handler for project-custom exception.- Returns:
- ResponseEntity
-
restErrorHandler
@ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity<Map<String,String>> restErrorHandler(Exception e)
Fallback error handler.- Returns:
- ResponseEntity
-
-