Removed depracated code and added Javadoc

This commit is contained in:
2021-03-22 14:52:32 +01:00
parent db1f5c0bf1
commit e3e45939e2
11 changed files with 36 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import javax.validation.ConstraintViolationException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
//TODO: Find usage and document or remove it
@ControllerAdvice @ControllerAdvice
public class MvcExceptionHandler { public class MvcExceptionHandler {

View File

@@ -4,6 +4,10 @@ import com.release11.klaus.model.MockedMessage;
import com.release11.klaus.model.MockedMessageDto; import com.release11.klaus.model.MockedMessageDto;
import org.mapstruct.*; import org.mapstruct.*;
/**
* Creates key value for redis entry
* @author Rafał Źukowicz
*/
@Mapper @Mapper
public interface MockedMessageMapper { public interface MockedMessageMapper {
@Mapping( target = "compositePrimaryKey", expression = "java(mockedMessageDto.getClientUUID() + \"_\"" + @Mapping( target = "compositePrimaryKey", expression = "java(mockedMessageDto.getClientUUID() + \"_\"" +

View File

@@ -6,6 +6,10 @@ import org.springframework.lang.Nullable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/**
* Pojo class for Event entity
* @author Rafał Żukowicz
*/
@Data @Data
@Builder @Builder
@ToString @ToString

View File

@@ -10,7 +10,8 @@ import java.time.LocalDateTime;
import java.util.UUID; import java.util.UUID;
/** /**
* Pojo for client request * Pojo for history query request. Contains information necessary to obtain {@link Event} list
* @author Rafał Żukowicz
*/ */
@Data @Data
@Builder @Builder

View File

@@ -14,6 +14,10 @@ import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
/**
* MockedMessage redis entity pojo
* @author Rafał Żukowicz
*/
@Data @Data
@ToString @ToString
@RedisHash("mockedMessage") @RedisHash("mockedMessage")

View File

@@ -10,9 +10,9 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
/** /**
* it appears that instance of this class contains info about mocked response * Alternative version of {@link MockedMessage} used in http body
* To which UUID it is bound, whats its id, the list of headers, type of content and message body, * @author Rafał Żukowicz
* as well as status it has to return. * @author Gabriel Modzelewski
*/ */
@Data @Data
@Builder @Builder
@@ -30,6 +30,7 @@ public class MockedMessageDto implements Serializable, Comparable<MockedMessageD
@HttpCode @HttpCode
private Integer httpStatus; private Integer httpStatus;
// TODO: Remove if no use
public MockedMessageDto(UUID clientUUID) { public MockedMessageDto(UUID clientUUID) {
this.clientUUID = clientUUID; this.clientUUID = clientUUID;
} }

View File

@@ -7,7 +7,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
//TODO: Find usage and document or remove it
@Target({ ElementType.FIELD}) @Target({ ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = HttpCodeValidation.class ) @Constraint(validatedBy = HttpCodeValidation.class )

View File

@@ -1,16 +1,14 @@
package com.release11.klaus.model.constraints; package com.release11.klaus.model.constraints;
import com.release11.klaus.repository.MockedResponseRepository;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext; import javax.validation.ConstraintValidatorContext;
import java.util.EnumSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
//TODO: Find usage and document or remove it
public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer> { public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer> {
private Set<Integer> allowedValues; private Set<Integer> allowedValues;

View File

@@ -9,6 +9,10 @@ import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* Event entity dao interface
* @author Rafał Żukowicz
*/
@Repository @Repository
@Transactional @Transactional
public interface EventRepository { public interface EventRepository {

View File

@@ -20,6 +20,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//TODO: Add javadoc
@Repository @Repository
@AllArgsConstructor @AllArgsConstructor
public class EventRepositoryImpl implements EventRepository { public class EventRepositoryImpl implements EventRepository {

View File

@@ -8,9 +8,19 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
/**
* Spring repository that allows to retrieve message list by key-uuid from redis database
* @author Rafał Żukowicz
*/
@Repository @Repository
@Transactional @Transactional
public interface MockedResponseRepository extends CrudRepository<MockedMessage, String> { public interface MockedResponseRepository extends CrudRepository<MockedMessage, String> {
/**
* Finds all messages by their uuid
* @param clientUUID the key-uuid of given set of messages
* @return list of {@link com.release11.klaus.model.MockedMessage}
*/
List<MockedMessage> findAllByClientUUID(UUID clientUUID); List<MockedMessage> findAllByClientUUID(UUID clientUUID);
// TODO: Remove if no use
MockedMessage getByCompositePrimaryKey(String compositePrimaryKey); MockedMessage getByCompositePrimaryKey(String compositePrimaryKey);
} }