Package com.almis.awe.rest.controller
Class AweRestController
java.lang.Object
com.almis.awe.rest.controller.AweRestController
REST API awe-rest for launching queries and maintains
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAweRestController
(QueryService queryService, MaintainService maintainService, AweRequest request, JWTTokenService jwtTokenService, org.modelmapper.ModelMapper modelMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<LoginResponse>
authenticate
(@Valid LoginRequest loginRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse) Authenticate service.Handle authentication errorHandle Query or Maintain not defined errorhandleException
(Exception exc) Handle rest errororg.springframework.http.ResponseEntity<AweRestResponse>
launchMaintain
(String maintainId, RequestParameter parameters) Launch a maintainreactor.core.publisher.Mono<AweRestResponse>
launchMaintainMono
(String maintainId, RequestParameter parameters) Launch a maintainorg.springframework.http.ResponseEntity<AweRestResponse>
launchPublicMaintain
(String maintainId, RequestParameter parameters) Launch a public maintainorg.springframework.http.ResponseEntity<AweRestResponse>
launchPublicQuery
(String queryId, RequestParameter parameters) Launch a public queryorg.springframework.http.ResponseEntity<AweRestResponse>
launchQuery
(String queryId, RequestParameter parameters) Request a query
-
Field Details
-
AWE_REST
- See Also:
-
-
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 servicemaintainService
- Maintain servicerequest
- the requestjwtTokenService
- JWT Token servicemodelMapper
- 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 requesthttpServletResponse
- 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 idparameters
- 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 idparameters
- 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 idparameters
- 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 idparameters
- 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 idparameters
- 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
-