-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mate Karolyi
committed
Jul 7, 2023
1 parent
92b3c76
commit b0791bc
Showing
17 changed files
with
165 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...hexagonal/adapter/web/rest/customer/mapping/ChangeCustomerDetailsModelToDomainMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package hu.hirannor.hexagonal.adapter.web.rest.customer.mapping; | ||
|
||
import hu.hirannor.hexagonal.adapter.web.rest.customer.model.*; | ||
import hu.hirannor.hexagonal.domain.customer.*; | ||
import hu.hirannor.hexagonal.domain.customer.command.ChangeCustomerDetails; | ||
|
||
import java.util.function.Function; | ||
|
||
/** | ||
* Maps a {@link ChangeCustomerDetailsModel} model type to {@link ChangeCustomerDetails} domain type. | ||
* | ||
* @author Mate Karolyi | ||
*/ | ||
class ChangeCustomerDetailsModelToDomainMapper implements Function<ChangeCustomerDetailsModel, ChangeCustomerDetails> { | ||
|
||
private final String customerId; | ||
|
||
private final Function<GenderModel, Gender> mapGenderModelToDomain; | ||
private final Function<AddressModel, Address> mapAddressModelToDomain; | ||
|
||
ChangeCustomerDetailsModelToDomainMapper(final String customerId) { | ||
this( | ||
customerId, | ||
CustomerMappingFactory.createGenderModelToDomainMapper(), | ||
CustomerMappingFactory.createAddressModelToAddressMapper() | ||
); | ||
} | ||
|
||
ChangeCustomerDetailsModelToDomainMapper(final String customerId, | ||
final Function<GenderModel, Gender> mapGenderModelToDomain, | ||
final Function<AddressModel, Address> mapAddressModelToDomain) { | ||
this.customerId = customerId; | ||
this.mapGenderModelToDomain = mapGenderModelToDomain; | ||
this.mapAddressModelToDomain = mapAddressModelToDomain; | ||
} | ||
|
||
|
||
@Override | ||
public ChangeCustomerDetails apply(final ChangeCustomerDetailsModel model) { | ||
return new ChangeCustomerDetails.Builder() | ||
.customerId(CustomerId.from(customerId)) | ||
.fullName(FullName.from(model.getFirstName(), model.getLastName())) | ||
.gender(mapGenderModelToDomain.apply(model.getGender())) | ||
.birthDate(model.getBirthDate()) | ||
.address(mapAddressModelToDomain.apply(model.getAddress())) | ||
.email(EmailAddress.from(model.getEmailAddress())) | ||
.assemble(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
app/src/main/resources/adapter/persistence/dml/customers-demo-dml-1.0.0.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
logging: | ||
level: | ||
root: INFO | ||
file: | ||
path: logs | ||
|
||
spring: | ||
h2: | ||
|
Oops, something went wrong.