diff --git a/src/main/java/eu/h2020/symbiote/cloud/model/internal/FederatedResource.java b/src/main/java/eu/h2020/symbiote/cloud/model/internal/FederatedResource.java index 70b4028..5e736e2 100644 --- a/src/main/java/eu/h2020/symbiote/cloud/model/internal/FederatedResource.java +++ b/src/main/java/eu/h2020/symbiote/cloud/model/internal/FederatedResource.java @@ -9,6 +9,7 @@ import org.springframework.data.annotation.Id; import org.springframework.data.annotation.PersistenceConstructor; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -107,6 +108,13 @@ public void clearPrivateInfo() { public void shareToNewFederation(String federationId, Boolean barteringStatus) { ResourceSharingInformation resourceSharingInformation = new ResourceSharingInformation(); resourceSharingInformation.setBartering(barteringStatus); + + if (cloudResource.getFederationInfo().getSharingInformation().get(federationId) != null && + cloudResource.getFederationInfo().getSharingInformation().get(federationId).getSharingDate() != null) + resourceSharingInformation.setSharingDate(cloudResource.getFederationInfo().getSharingInformation().get(federationId).getSharingDate()); + else + resourceSharingInformation.setSharingDate(new Date()); + cloudResource.getFederationInfo().getSharingInformation().put(federationId, resourceSharingInformation); federations.add(federationId);