BAEL-6572: Added mapping for id and test, based on review comment

This commit is contained in:
balasr3
2023-09-04 07:34:28 +05:30
parent c3141107b9
commit f0f66ceba9
2 changed files with 10 additions and 0 deletions
@@ -4,6 +4,7 @@ import java.time.Duration;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.UUID;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
@@ -20,6 +21,7 @@ public interface LicenseMapper {
@Mapping(target = "endDate", ignore = true)
@Mapping(target = "active", constant = "true")
@Mapping(target = "renewalRequired", conditionExpression = "java(isEndDateInTwoWeeks(licenseDto))", source = ".")
@Mapping(target = "id", expression = "java(setId())")
License toLicense(LicenseDto licenseDto);
@AfterMapping
@@ -40,4 +42,8 @@ public interface LicenseMapper {
.toDays() <= 14;
}
default UUID setId() {
return UUID.randomUUID();
}
}