Skip to content

Commit

Permalink
Initialize sharingDate of Federated Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
vthglyk committed Apr 26, 2018
1 parent 397476e commit 1d214f8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1d214f8

Please sign in to comment.