This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ralf Ueberfuhr
committed
Jun 19, 2024
1 parent
d4aec2e
commit 9b42f89
Showing
10 changed files
with
112 additions
and
37 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
30 changes: 30 additions & 0 deletions
30
...mer-api-provider/src/main/java/de/schulung/sample/quarkus/boundary/CustomerDtoMapper.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,30 @@ | ||
package de.schulung.sample.quarkus.boundary; | ||
|
||
import de.schulung.sample.quarkus.domain.Customer; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "cdi") | ||
public interface CustomerDtoMapper { | ||
|
||
Customer map(CustomerDto source); | ||
|
||
CustomerDto map(Customer source); | ||
|
||
default String mapState(Customer.CustomerState source) { | ||
return null == source ? null : switch (source) { | ||
case ACTIVE -> "active"; | ||
case LOCKED -> "locked"; | ||
case DISABLED -> "disabled"; | ||
}; | ||
} | ||
|
||
default Customer.CustomerState mapState(String source) { | ||
return null == source ? null : switch (source) { | ||
case "active" -> Customer.CustomerState.ACTIVE; | ||
case "locked" -> Customer.CustomerState.LOCKED; | ||
case "disabled" -> Customer.CustomerState.DISABLED; | ||
default -> throw new IllegalArgumentException(source + " is not allowed here."); | ||
}; | ||
} | ||
|
||
} |
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
30 changes: 30 additions & 0 deletions
30
customer-api-provider/src/main/java/de/schulung/sample/quarkus/domain/Customer.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,30 @@ | ||
package de.schulung.sample.quarkus.domain; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.LocalDate; | ||
import java.util.UUID; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
public class Customer { | ||
|
||
private UUID uuid; | ||
@Size(min = 3, max = 100) | ||
@NotNull | ||
private String name; | ||
private LocalDate birthdate; | ||
@NotNull | ||
private CustomerState state = CustomerState.ACTIVE; | ||
|
||
public enum CustomerState { | ||
ACTIVE, LOCKED, DISABLED | ||
} | ||
|
||
|
||
} |
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
3 changes: 2 additions & 1 deletion
3
...uarkus/CustomerApiMockedServiceTests.java → ...undary/CustomerApiMockedServiceTests.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
2 changes: 1 addition & 1 deletion
2
...lung/sample/quarkus/CustomerApiTests.java → ...le/quarkus/boundary/CustomerApiTests.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
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