Skip to content
Snippets Groups Projects
Commit d29cc735 authored by Tobias Bruns's avatar Tobias Bruns
Browse files

OZG-6988 rename data types

parent 82a00a07
No related branches found
No related tags found
1 merge request!3Ozg 6988 add reporting
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
Showing with 26 additions and 20 deletions
...@@ -287,6 +287,7 @@ ...@@ -287,6 +287,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<!--
<configuration> <configuration>
<image> <image>
<name>${imageName}:${imageTag}</name> <name>${imageName}:${imageTag}</name>
...@@ -317,7 +318,7 @@ ...@@ -317,7 +318,7 @@
</additionalProperties> </additionalProperties>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>-->
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
...@@ -327,7 +328,7 @@ ...@@ -327,7 +328,7 @@
<!-- <path>--> <!-- <path>-->
<!-- <groupId>org.mapstruct</groupId>--> <!-- <groupId>org.mapstruct</groupId>-->
<!-- <artifactId>mapstruct-processor</artifactId>--> <!-- <artifactId>mapstruct-processor</artifactId>-->
<!-- <version>${mapstruct-processor.version}</version>--> <!-- <version>${mapstruct.version}</version>-->
<!-- </path>--> <!-- </path>-->
<!-- <path>--> <!-- <path>-->
<!-- <groupId>org.projectlombok</groupId>--> <!-- <groupId>org.projectlombok</groupId>-->
...@@ -339,6 +340,11 @@ ...@@ -339,6 +340,11 @@
<!-- <artifactId>lombok-mapstruct-binding</artifactId>--> <!-- <artifactId>lombok-mapstruct-binding</artifactId>-->
<!-- <version>${lombok-mapstruct-binding.version}</version>--> <!-- <version>${lombok-mapstruct-binding.version}</version>-->
<!-- </path>--> <!-- </path>-->
<!-- <path>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-configuration-processor</artifactId>-->
<!-- <version>3.3.6</version>-->
<!-- </path>-->
<!-- </annotationProcessorPaths>--> <!-- </annotationProcessorPaths>-->
<!-- </configuration>--> <!-- </configuration>-->
</plugin> </plugin>
......
...@@ -19,17 +19,17 @@ import lombok.Singular; ...@@ -19,17 +19,17 @@ import lombok.Singular;
import lombok.extern.jackson.Jacksonized; import lombok.extern.jackson.Jacksonized;
@Document("settings") @Document("settings")
@TypeAlias("fieldMapping") @TypeAlias("aggregationMapping")
@Jacksonized @Jacksonized
@Builder @Builder
@Getter @Getter
public class ReportingSetting { public class AggregationMapping {
@Id @Id
@JsonIgnore @JsonIgnore
private String id; private String id;
@Builder.Default @Builder.Default
private String name = "fieldMapping"; private String name = "aggregationMapping";
@Valid @Valid
private FormIdentifierDto formIdentifier; private FormIdentifierDto formIdentifier;
......
...@@ -11,5 +11,5 @@ public interface AggregationMappingMapper { ...@@ -11,5 +11,5 @@ public interface AggregationMappingMapper {
@Mapping(target = "fieldMapping", ignore = true) @Mapping(target = "fieldMapping", ignore = true)
@Mapping(target = "fieldMappings", source = "mappings") @Mapping(target = "fieldMappings", source = "mappings")
AggregationMappingDto toMapping(ReportingSetting setting); AggregationMappingDto toMapping(AggregationMapping setting);
} }
...@@ -11,7 +11,7 @@ import lombok.RequiredArgsConstructor; ...@@ -11,7 +11,7 @@ import lombok.RequiredArgsConstructor;
@DtoService(SettingConstants.AGGREGATION_MANAGER) @DtoService(SettingConstants.AGGREGATION_MANAGER)
class ReportingAggregationManagerSettingDTOService implements SettingDtoService { class ReportingAggregationManagerSettingDTOService implements SettingDtoService {
private final ReportingSettingRepository repository; private final AggregationMappingRepository repository;
private final AggregationMappingMapper mapper; private final AggregationMappingMapper mapper;
@Override @Override
...@@ -19,7 +19,7 @@ class ReportingAggregationManagerSettingDTOService implements SettingDtoService ...@@ -19,7 +19,7 @@ class ReportingAggregationManagerSettingDTOService implements SettingDtoService
return mapToDto(repository.findAll().stream()); return mapToDto(repository.findAll().stream());
} }
ReportingSettingDto mapToDto(Stream<ReportingSetting> settings) { ReportingSettingDto mapToDto(Stream<AggregationMapping> settings) {
return ReportingSettingDto.builder() return ReportingSettingDto.builder()
.aggregationMappings(settings.map(mapper::toMapping).toList()) .aggregationMappings(settings.map(mapper::toMapping).toList())
.build(); .build();
......
...@@ -7,8 +7,8 @@ import org.springframework.data.mongodb.repository.Query; ...@@ -7,8 +7,8 @@ import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource @RepositoryRestResource
interface ReportingSettingRepository extends MongoRepository<ReportingSetting, String> { interface AggregationMappingRepository extends MongoRepository<AggregationMapping, String> {
@Override @Override
@Query("{'_class': 'fieldMapping'}") @Query("{'_class': 'aggregationMapping'}")
List<ReportingSetting> findAll(); List<AggregationMapping> findAll();
} }
...@@ -2,10 +2,10 @@ package de.ozgcloud.admin.reporting; ...@@ -2,10 +2,10 @@ package de.ozgcloud.admin.reporting;
import java.util.UUID; import java.util.UUID;
import de.ozgcloud.admin.reporting.ReportingSetting.FieldMapping; import de.ozgcloud.admin.reporting.AggregationMapping.FieldMapping;
import de.ozgcloud.admin.reporting.ReportingSettingDto.FormIdentifierDto; import de.ozgcloud.admin.reporting.ReportingSettingDto.FormIdentifierDto;
class ReportingSettingTestFactory { class AggregationMappingTestFactory {
public static final String ID = UUID.randomUUID().toString(); public static final String ID = UUID.randomUUID().toString();
public static final String FORM_ENGINE_NAME = "A12"; public static final String FORM_ENGINE_NAME = "A12";
...@@ -14,12 +14,12 @@ class ReportingSettingTestFactory { ...@@ -14,12 +14,12 @@ class ReportingSettingTestFactory {
public static final String SOURCE_PATH = "name"; public static final String SOURCE_PATH = "name";
public static final String TARGET_PATH = "antragsteller.name"; public static final String TARGET_PATH = "antragsteller.name";
public static ReportingSetting create() { public static AggregationMapping create() {
return createBuilder().build(); return createBuilder().build();
} }
public static ReportingSetting.ReportingSettingBuilder createBuilder() { public static AggregationMapping.AggregationMappingBuilder createBuilder() {
return ReportingSetting.builder() return AggregationMapping.builder()
.id(UUID.randomUUID().toString()) .id(UUID.randomUUID().toString())
.formIdentifier(FormIdentifierDto.builder() .formIdentifier(FormIdentifierDto.builder()
.formEngineName(FORM_ENGINE_NAME) .formEngineName(FORM_ENGINE_NAME)
......
...@@ -21,7 +21,7 @@ class ReportingAggregationManagerSettingDTOServiceTest { ...@@ -21,7 +21,7 @@ class ReportingAggregationManagerSettingDTOServiceTest {
class TestMapToDto { class TestMapToDto {
@Test @Test
void shouldCreateDto() { void shouldCreateDto() {
var dto = service.mapToDto(Stream.of(ReportingSettingTestFactory.create())); var dto = service.mapToDto(Stream.of(AggregationMappingTestFactory.create()));
assertThat(dto).usingRecursiveComparison().isEqualTo(ReportingSettingDtoTestFactory.create()); assertThat(dto).usingRecursiveComparison().isEqualTo(ReportingSettingDtoTestFactory.create());
} }
......
package de.ozgcloud.admin.reporting; package de.ozgcloud.admin.reporting;
import static de.ozgcloud.admin.reporting.ReportingSettingTestFactory.*; import static de.ozgcloud.admin.reporting.AggregationMappingTestFactory.*;
import de.ozgcloud.admin.reporting.ReportingSettingDto.AggregationMappingDto; import de.ozgcloud.admin.reporting.ReportingSettingDto.AggregationMappingDto;
import de.ozgcloud.admin.reporting.ReportingSettingDto.FieldMappingDto; import de.ozgcloud.admin.reporting.ReportingSettingDto.FieldMappingDto;
......
...@@ -14,7 +14,7 @@ import de.ozgcloud.common.test.DataITCase; ...@@ -14,7 +14,7 @@ import de.ozgcloud.common.test.DataITCase;
class ReportingSettingRepositoryITCase { class ReportingSettingRepositoryITCase {
@Autowired @Autowired
private ReportingSettingRepository repository; private AggregationMappingRepository repository;
@Autowired @Autowired
private MongoOperations operations; private MongoOperations operations;
...@@ -26,7 +26,7 @@ class ReportingSettingRepositoryITCase { ...@@ -26,7 +26,7 @@ class ReportingSettingRepositoryITCase {
@Test @Test
void shouldLoadOnlyFieldMapping() { void shouldLoadOnlyFieldMapping() {
operations.save(ReportingSettingTestFactory.create()); operations.save(AggregationMappingTestFactory.create());
operations.save(SettingTestFactory.create()); operations.save(SettingTestFactory.create());
var result = repository.findAll(); var result = repository.findAll();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment