add DomainSetup-HostingAssets for new BookingItem via created-event #111

Merged
hsh-michaelhoennig merged 31 commits from add-hsoting-asset-to-booking-item-resource-and-created-event into master 2024-10-08 11:48:35 +02:00
Showing only changes of commit 6868d15718 - Show all commits

View File

@ -1680,18 +1680,13 @@ public class ImportHostingAssets extends BaseOfficeDataImport {
final var relatedProject = domainSetup.getSubHostingAssets().stream() final var relatedProject = domainSetup.getSubHostingAssets().stream()
.map(ha -> ha.getAssignedToAsset() != null ? ha.getAssignedToAsset().getRelatedProject() : null) .map(ha -> ha.getAssignedToAsset() != null ? ha.getAssignedToAsset().getRelatedProject() : null)
.findAny().orElseThrow(); .findAny().orElseThrow();
final var targetUnixUser = domainSetup.getSubHostingAssets().stream()
.filter(subAsset -> subAsset.getType() == DOMAIN_HTTP_SETUP)
.map(domainHttpSetup -> domainHttpSetup.getAssignedToAsset().getIdentifier())
.findAny().orElse(null);
final var bookingItem = HsBookingItemRealEntity.builder() final var bookingItem = HsBookingItemRealEntity.builder()
.type(HsBookingItemType.DOMAIN_SETUP) .type(HsBookingItemType.DOMAIN_SETUP)
.caption("BI " + domainSetup.getIdentifier()) .caption("BI " + domainSetup.getIdentifier())
.project((HsBookingProjectRealEntity) relatedProject) .project((HsBookingProjectRealEntity) relatedProject)
//.validity(toPostgresDateRange(created, cancelled)) //.validity(toPostgresDateRange(created, cancelled))
.resources(Map.ofEntries( .resources(Map.ofEntries(
entry("domainName", domainSetup.getIdentifier()), entry("domainName", domainSetup.getIdentifier())
entry("targetUnixUser", targetUnixUser)
)) ))
.build(); .build();
domainSetup.setBookingItem(bookingItem); domainSetup.setBookingItem(bookingItem);