From 5014160113749a9f6d50e8cffde9bc417f2306d0 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 24 Sep 2024 13:04:39 +0200 Subject: [PATCH] add targetUnixUser to import --- .../hsadminng/hs/migration/ImportHostingAssets.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java index 9d73ac89..634ba207 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java @@ -1680,13 +1680,19 @@ public class ImportHostingAssets extends BaseOfficeDataImport { final var relatedProject = domainSetup.getSubHostingAssets().stream() .map(ha -> ha.getAssignedToAsset() != null ? ha.getAssignedToAsset().getRelatedProject() : null) .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() .type(HsBookingItemType.DOMAIN_SETUP) .caption("BI " + domainSetup.getIdentifier()) .project((HsBookingProjectRealEntity) relatedProject) //.validity(toPostgresDateRange(created, cancelled)) .resources(Map.ofEntries( - entry("domainName", domainSetup.getIdentifier()))) + entry("domainName", domainSetup.getIdentifier()), + entry("targetUnixUser", targetUnixUser) + )) .build(); domainSetup.setBookingItem(bookingItem); bookingItems.put(nextAvailableBookingItemId(), bookingItem);