Class AweRestController

java.lang.Object
com.almis.awe.rest.controller.AweRestController

@RestController @RequestMapping("/api") public class AweRestController extends Object
REST API awe-rest for launching queries and maintains
  • Field Details

  • Constructor Details

    • AweRestController

      @Autowired public AweRestController(QueryService queryService, MaintainService maintainService, AweRequest request, JWTTokenService jwtTokenService, org.modelmapper.ModelMapper modelMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Autowired constructor
      Parameters:
      queryService - Query service
      maintainService - Maintain service
      request - the request
      jwtTokenService - JWT Token service
      modelMapper - the model mapper
  • Method Details

    • authenticate

      @PostMapping("/authenticate") public org.springframework.http.ResponseEntity<LoginResponse> authenticate(@Valid @RequestBody @Valid LoginRequest loginRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse)
      Authenticate service. Generate JWT Token for authentication
      Parameters:
      loginRequest - Login request
      httpServletResponse - response
      Returns:
      LoginResponse with jwt token info
    • launchQuery

      @PostMapping("/data/{queryId}") public org.springframework.http.ResponseEntity<AweRestResponse> launchQuery(@PathVariable String queryId, @RequestBody(required=false) RequestParameter parameters) throws AWException
      Request a query
      Parameters:
      queryId - Query id
      parameters - JSON parameters
      Returns:
      JSON response
      Throws:
      AWException - the AWE exception
    • launchPublicQuery

      @PostMapping("/public/data/{queryId}") public org.springframework.http.ResponseEntity<AweRestResponse> launchPublicQuery(@PathVariable String queryId, @RequestBody(required=false) RequestParameter parameters) throws AWException
      Launch a public query
      Parameters:
      queryId - Query id
      parameters - JSON parameters
      Returns:
      JSON response
      Throws:
      AWException - the AWE exception
    • launchMaintain

      @PostMapping("/maintain/{maintainId}") public org.springframework.http.ResponseEntity<AweRestResponse> launchMaintain(@PathVariable String maintainId, @RequestBody(required=false) RequestParameter parameters) throws AWException
      Launch a maintain
      Parameters:
      maintainId - Maintain id
      parameters - JSON parameters
      Returns:
      JSON response
      Throws:
      AWException - the AWE exception
    • launchMaintainMono

      @PostMapping("/maintain/async/{maintainId}") public reactor.core.publisher.Mono<AweRestResponse> launchMaintainMono(@PathVariable String maintainId, @RequestBody(required=false) RequestParameter parameters) throws AWException
      Launch a maintain
      Parameters:
      maintainId - Maintain id
      parameters - JSON parameters
      Returns:
      JSON response
      Throws:
      AWException - the AWE exception
    • launchPublicMaintain

      @PostMapping("/public/maintain/{maintainId}") public org.springframework.http.ResponseEntity<AweRestResponse> launchPublicMaintain(@PathVariable String maintainId, @RequestBody(required=false) RequestParameter parameters) throws AWException
      Launch a public maintain
      Parameters:
      maintainId - Maintain id
      parameters - JSON parameters
      Returns:
      JSON response
      Throws:
      AWException - AWE exception
    • handleException

      @ExceptionHandler(java.lang.Exception.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public AweRestResponse handleException(Exception exc)
      Handle rest error
      Parameters:
      exc - Exception to handle
      Returns:
      Rest response error
    • handleException

      @ExceptionHandler(AWException.class) @ResponseStatus(BAD_REQUEST) public AweRestResponse handleException(AWException exc)
      Handle Query or Maintain not defined error
      Parameters:
      exc - Exception to handle
      Returns:
      Response error
    • handleAuthenticationException

      @ExceptionHandler(org.springframework.security.core.AuthenticationException.class) @ResponseStatus(UNAUTHORIZED) public AweRestResponse handleAuthenticationException(Exception exc)
      Handle authentication error
      Parameters:
      exc - Exception to handle
      Returns:
      Response error