Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok committed Oct 21, 2023
1 parent 605523e commit 77fbc14
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public class SepulkaServiceImpl implements SepulkaService {
@Override
public RegistrationResponse register(RegistrationRequest request) {
var now = LocalDateTime.now();
var sepulkaCreated = mapper.toServer(request)
var sepulkaCreated = mapper.toState(request)
.internalId(randomUUID())
.revision(0)
.createdAt(now)
.updatedAt(now)
.build();
var sepulkaSaved = dao.add(sepulkaCreated);
return mapper.toClient(sepulkaSaved).build();
return mapper.toMessage(sepulkaSaved).build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@Mapper
public interface SepulkaMapper {
AggregateState.Builder toServer(RegistrationRequest request);
AggregateState.Builder toState(RegistrationRequest request);

RegistrationResponse.Builder toClient(AggregateState state);
RegistrationResponse.Builder toMessage(AggregateState state);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

public abstract class MessagingDomain {
@Builder
public record MessagingProps(
@NonNull MessagingDomain.ProtocolProps protocolProps, @NonNull MessagingDomain.MappingProps mappingProps) {}
public record MessagingProps(@NonNull ProtocolProps protocolProps, @NonNull MappingProps mappingProps) {}

@Builder
public record ProtocolProps(@NonNull Set<MessagingProtocolMode> protocolModes) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
public abstract class MessagingDomainEg {
public static MessagingProps.Builder messagingProps() {
return MessagingProps.builder()
.protocolProps(messagingProtocolProps().build())
.mappingProps(messageMappingProps().build());
.protocolProps(protocolProps().build())
.mappingProps(mappingProps().build());
}

public static ProtocolProps.Builder messagingProtocolProps() {
public static ProtocolProps.Builder protocolProps() {
return MessagingDomain.ProtocolProps.builder().protocolModes(Set.of(HTTP));
}

public static MappingProps.Builder messageMappingProps() {
public static MappingProps.Builder mappingProps() {
return MappingProps.builder().mappingModes(Set.of(SPRING_MVC));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ MessagingPropsMapper messagingPropsMapper() {
}

@Bean
MessagingDomain.MessagingProps messagingProps(PropsKeeper keeper, EdgeValidator validator, MessagingPropsMapper mapper) {
MessagingDomain.MessagingProps messagingProps(
PropsKeeper keeper, EdgeValidator validator, MessagingPropsMapper mapper) {
var propsEdge = keeper.read("bezmen.messaging", MessagingEdge.MessagingProps.class);
validator.validate(propsEdge);
LOG.info("Read {}", propsEdge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public abstract class StorageDomain {
@Builder
public record StorageProps(@NonNull StorageDomain.ProtocolProps protocolProps, @NonNull StorageDomain.MappingProps mappingProps) {}
public record StorageProps(@NonNull ProtocolProps protocolProps, @NonNull MappingProps mappingProps) {}

@Builder
public record ProtocolProps(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
public abstract class StorageDomainEg {
public static StorageProps.Builder storageProps() {
return StorageProps.builder()
.protocolProps(storageProtocolProps().build())
.mappingProps(stateMappingProps().build());
.protocolProps(protocolProps().build())
.mappingProps(mappingProps().build());
}

public static StorageProps.Builder storageProps(StorageMappingMode mappingMode, StorageProtocolMode protocolMode) {
return storageProps()
.protocolProps(storageProtocolProps(protocolMode).build())
.mappingProps(stateMappingProps(mappingMode).build());
.protocolProps(protocolProps(protocolMode).build())
.mappingProps(mappingProps(mappingMode).build());
}

public static MappingProps.Builder stateMappingProps() {
public static MappingProps.Builder mappingProps() {
return MappingProps.builder().mappingMode(SPRING_DATA);
}

public static MappingProps.Builder stateMappingProps(StorageMappingMode mode) {
return stateMappingProps().mappingMode(mode);
public static MappingProps.Builder mappingProps(StorageMappingMode mode) {
return mappingProps().mappingMode(mode);
}

public static ProtocolProps.Builder storageProtocolProps() {
public static ProtocolProps.Builder protocolProps() {
return ProtocolProps.builder()
.protocolMode(H2)
.h2Props(H2Props.builder()
Expand All @@ -45,7 +45,7 @@ public static ProtocolProps.Builder storageProtocolProps() {
.build());
}

public static StorageDomain.ProtocolProps.Builder storageProtocolProps(StorageProtocolMode mode) {
return storageProtocolProps().protocolMode(mode);
public static ProtocolProps.Builder protocolProps(StorageProtocolMode mode) {
return protocolProps().protocolMode(mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
public abstract class StorageEdgeEg {
public static StorageProps storageProps() {
var propsEdge = new StorageProps();
propsEdge.setMapping(stateMappingProps());
propsEdge.setProtocol(storageProtocolProps());
propsEdge.setMapping(mappingProps());
propsEdge.setProtocol(protocolProps());
return propsEdge;
}

public static MappingProps stateMappingProps() {
var propsEdge = new StorageEdge.MappingProps();
public static MappingProps mappingProps() {
var propsEdge = new MappingProps();
propsEdge.setMode(SPRING_DATA.name());
return propsEdge;
}

public static ProtocolProps storageProtocolProps() {
public static ProtocolProps protocolProps() {
var propsEdge = new ProtocolProps();
propsEdge.setMode(H2.name());
return propsEdge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
public interface StoragePropsMapper extends EdgeMapper {
@Mapping(source = "protocol", target = "protocolProps")
@Mapping(source = "mapping", target = "mappingProps")
StorageDomain.StorageProps toServer(StorageEdge.StorageProps propsEdge);
StorageDomain.StorageProps toDomain(StorageEdge.StorageProps propsEdge);

@Mapping(source = "mode", target = "protocolMode")
@Mapping(source = "h2", target = "h2Props")
@Mapping(source = "postgres", target = "postgresProps")
StorageDomain.ProtocolProps toServer(StorageEdge.ProtocolProps propsEdge);
StorageDomain.ProtocolProps toDomain(StorageEdge.ProtocolProps propsEdge);

@Mapping(source = "mode", target = "mappingMode")
StorageDomain.MappingProps toServer(StorageEdge.MappingProps propsEdge);
StorageDomain.MappingProps toDomain(StorageEdge.MappingProps propsEdge);

default StorageProtocolMode toProtocolMode(String mode) {
return StorageProtocolMode.valueOf(mode.toUpperCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ StorageProps storageProps(PropsKeeper keeper, EdgeValidator validator, StoragePr
var propsEdge = keeper.read("bezmen.storage", StorageEdge.StorageProps.class);
validator.validate(propsEdge);
LOG.info("Read {}", propsEdge);
return mapper.toServer(propsEdge);
return mapper.toDomain(propsEdge);
}
}

0 comments on commit 77fbc14

Please sign in to comment.