Removed depracated code and added Javadoc
This commit is contained in:
@@ -6,7 +6,16 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Spring service interface for {@link com.release11.klaus.controller.EventController}
|
||||
* @author Rafał Żukowicz
|
||||
*/
|
||||
@Service
|
||||
public interface EtrackService {
|
||||
/**
|
||||
* Searches for {@link Event} objects between date brackets
|
||||
* @param eventsDto object containing required data for request
|
||||
* @return list of {@link Event}
|
||||
*/
|
||||
List<Event> getEventsByDateTimeAndBusinessKeys(EventRequestDto eventsDto);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Spring Service for {@link com.release11.klaus.controller.EventController}. Contains logic required for quering
|
||||
* the database for {@link Event} objects
|
||||
* @author Rafał Żukowicz
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@@ -19,6 +24,12 @@ public class EtrackServiceImpl implements EtrackService {
|
||||
|
||||
private final EventRepository eventRepository;
|
||||
|
||||
/**
|
||||
* Adds {@link BusinessKey} to {@link EventRequestDto}
|
||||
* in order to create query via{@link com.release11.klaus.repository.EventRepositoryImpl}
|
||||
* @param eventsDto object containing required data for request
|
||||
* @return list of {@link Event}
|
||||
*/
|
||||
@Override
|
||||
public List<Event> getEventsByDateTimeAndBusinessKeys(EventRequestDto eventsDto) {
|
||||
Map<BusinessKey, String> businessKeys = new HashMap<>();
|
||||
|
||||
@@ -7,6 +7,10 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Service interface for {@link com.release11.klaus.controller.KlausController} and {@link com.release11.klaus.controller.MockController}
|
||||
* @author Rafał Żukowicz
|
||||
*/
|
||||
@Service
|
||||
public interface KlausService {
|
||||
ResponseEntity<String> deleteMockedResponse(UUID clientUUID, int mockedResponseId);
|
||||
|
||||
@@ -18,6 +18,12 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Service for {@link com.release11.klaus.controller.KlausController} and {@link com.release11.klaus.controller.MockController}
|
||||
* Allows for performing CRUD operations on {@link MockedMessageDto}
|
||||
* @author Rafał Żukowicz
|
||||
* @author Gabriel Modzelewski
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@@ -26,6 +32,12 @@ public class KlausServiceImpl implements KlausService {
|
||||
private final MockedResponseRepository mockedResponseRepository;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* Removes message of given id in given key-uuid set
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @param mockedResponseId unique id of given message
|
||||
* @return confirmation and status 200 OK
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<String> deleteMockedResponse(UUID clientUUID, int mockedResponseId) {
|
||||
String key = clientUUID.toString() + "_" + mockedResponseId;
|
||||
@@ -35,6 +47,11 @@ public class KlausServiceImpl implements KlausService {
|
||||
new HttpHeaders(), HttpStatus.ACCEPTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all messages of given key-uuid
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @return List of {@link MockedMessageDto}
|
||||
*/
|
||||
@Override
|
||||
public List<MockedMessageDto> getAllMockedResponses(UUID clientUUID) {
|
||||
return mockedResponseRepository.findAllByClientUUID(clientUUID).stream()
|
||||
@@ -42,6 +59,13 @@ public class KlausServiceImpl implements KlausService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// TODO: check logic
|
||||
/**
|
||||
* Returns {@link MockedMessageDto} of given id and key-uuid. If message doesn't then empty message is returned
|
||||
* @param clientUUID the key-uuid of given set of messages
|
||||
* @param mockedResponseId unique id of given message
|
||||
* @return {@link MockedMessageDto} object
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public MockedMessageDto getMockedResponse(UUID clientUUID, int mockedResponseId){
|
||||
@@ -60,10 +84,15 @@ public class KlausServiceImpl implements KlausService {
|
||||
return mockedMessageDto;
|
||||
}
|
||||
|
||||
// TODO: Remove code of no use
|
||||
/**
|
||||
* Allows to modify mocked message. If message of given id and key-uuid doesn't exist a new entry is created
|
||||
* @param mockedMessageDto message to be saved
|
||||
* @return Confirmation and status 200 OK
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public ResponseEntity<String> setMockedResponse(MockedMessageDto mockedMessageDto) {
|
||||
|
||||
mockedResponseRepository.save(mockedMessageMapper.mockedMessageDtoToMockedMessage(mockedMessageDto));
|
||||
String s = objectMapper.writeValueAsString(mockedMessageDto);
|
||||
String s1 = mockedMessageDto.toString();
|
||||
|
||||
Reference in New Issue
Block a user