From c0bba37ae6fce7b8b98a402dc8e2eb4e6b99782c Mon Sep 17 00:00:00 2001 From: vthglyk Date: Thu, 26 Apr 2018 16:17:29 +0300 Subject: [PATCH] Initialize sharingDate of Federated Resource --- .../cloud/model/internal/FederatedResource.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 5e736e2..b37f7ae 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 @@ -106,14 +106,19 @@ 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()); + shareToNewFederation(federationId, barteringStatus, + cloudResource.getFederationInfo().getSharingInformation().get(federationId).getSharingDate()); else - resourceSharingInformation.setSharingDate(new Date()); + shareToNewFederation(federationId, barteringStatus, new Date()); + + } + + public void shareToNewFederation(String federationId, Boolean barteringStatus, Date sharingDate) { + ResourceSharingInformation resourceSharingInformation = new ResourceSharingInformation(); + resourceSharingInformation.setBartering(barteringStatus); + resourceSharingInformation.setSharingDate(sharingDate); cloudResource.getFederationInfo().getSharingInformation().put(federationId, resourceSharingInformation);