Removed depracated code and added Javadoc
This commit is contained in:
@@ -1,30 +1,17 @@
|
||||
package com.release11.klaus.controller;
|
||||
|
||||
import com.release11.klaus.model.Event;
|
||||
import com.release11.klaus.model.EventRequestDto;
|
||||
import com.release11.klaus.service.EtrackService;
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
* Class responds to request asking about history of messages.
|
||||
* It's the REST api for {@link com.release11.klaus.model.Event}
|
||||
*
|
||||
* @author Gabriel Modzelewski
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -33,6 +20,14 @@ import java.util.UUID;
|
||||
public class EventController {
|
||||
private final EtrackService service;
|
||||
|
||||
/**
|
||||
* Returns the list of Events in given time bracket.
|
||||
* The list of objects is received via {@link EventRequestDto}, which contains time brackets,
|
||||
* as well as the key - uuid.
|
||||
*
|
||||
* @param event EventRequestDto object that contains data needed to query the database
|
||||
* @return list of Event's
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity getHistory(@RequestBody EventRequestDto event){
|
||||
return new ResponseEntity(service.getEventsByDateTimeAndBusinessKeys(event), HttpStatus.OK);
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,8 +20,13 @@ import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
* A class responds to generated message uri's requests.
|
||||
* It deletes or fetches the requested message
|
||||
* This controller is responsible for returning the data of given mocked message. The content is made of usual
|
||||
* http parameters like: body, status, headers etc.
|
||||
* Basicly the api is responsible for what a client is looking for - a mocked server response.
|
||||
* Important note: {@link TrackingClient} use is to create logs - the history.
|
||||
*
|
||||
* @author Gabriel Modzelewski
|
||||
* @author Rafał Żukowicz
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@@ -32,7 +36,13 @@ public class KlausController {
|
||||
|
||||
private final KlausService klausService;
|
||||
|
||||
|
||||
/**
|
||||
* Deletes message of given id via client request
|
||||
*
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @param mockedResponseId unique id of given message
|
||||
* @return after deletion the confirmation is send with status 200 OK
|
||||
*/
|
||||
@DeleteMapping(value = "/delete/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity<String> deleteMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId){
|
||||
@@ -43,6 +53,13 @@ public class KlausController {
|
||||
return new ResponseEntity<>("message has been deleted", HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full list of messages. It's used by javascript on the client side to initialize homepage
|
||||
* with data from the database.
|
||||
*
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @return responds with 200 OK and list of {@link MockedMessageDto}
|
||||
*/
|
||||
@GetMapping(value = "/getAll/{clientUUID}")
|
||||
public ResponseEntity<String> getAllMockedResponses(@PathVariable UUID clientUUID){
|
||||
TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "getAllMockedResponse",
|
||||
@@ -51,6 +68,16 @@ public class KlausController {
|
||||
return new ResponseEntity<>(mockedMessages.toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* It's one of the most important features - the bread and butter of the Mocked Service. It's link that allows
|
||||
* to receive mocked response from the server and use it to mock!
|
||||
*
|
||||
* @param requestEntity Logs the data of request
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @param mockedResponseId unique id of given message
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/get/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity getMockedResponse(RequestEntity<String> requestEntity,
|
||||
@PathVariable UUID clientUUID,
|
||||
|
||||
Reference in New Issue
Block a user