diff --git a/.classpath b/.classpath
index a5ed0e6..7b61c02 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,12 @@
-
+
-
+
@@ -33,5 +33,5 @@
-
+
diff --git a/distro/changelog.xml b/distro/changelog.xml
index cb02d2b..543251f 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -1,7 +1,13 @@
+
+ Enable SDMX export operation for DataSet only for the tables
+ already shared with the whole VRE [ticket #10586]
+
- Added excel parameter for Template export [ticket #8781]
+ Added excel parameter for Template export [ticket #8781]
+
diff --git a/pom.xml b/pom.xml
index 540593b..3081f37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
4.0.0
org.gcube.portlets.user
tabular-data-gwt-service
- 2.18.0-SNAPSHOT
+ 2.19.0-SNAPSHOT
tabular-data-gwt-service
tabular-data-gwt-service allows communication between the GUI and services
diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java
index d750909..af966f7 100644
--- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java
@@ -4435,6 +4435,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
director.setOperationExecutionBuilder(opExC);
break;
case DATASET:
+ shareDatasetWithVRE(httpRequest, serviceCredentials, service, exportSession);
+
OpExecution4SDMXDatasetExport opExD = new OpExecution4SDMXDatasetExport(httpRequest, serviceCredentials,
service, exportSession);
director.setOperationExecutionBuilder(opExD);
@@ -4474,6 +4476,54 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
}
+ private void shareDatasetWithVRE(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
+ TabularDataService service, SDMXExportSession exportSession) throws TDGWTServiceException {
+ try {
+ TabularResourceId tabularResourceId = new TabularResourceId(
+ Long.valueOf(exportSession.getTabResource().getTrId().getId()));
+ TabularResource tr = service.getTabularResource(tabularResourceId);
+
+ ArrayList contacts = retrieveShareInfo(tr);
+ boolean shared = false;
+ for (Contacts contact : contacts) {
+ if (contact.isGroup() && (contact.getId().compareTo(serviceCredentials.getScope()) == 0
+ || contact.getLogin().compareTo(serviceCredentials.getScope()) == 0)) {
+ shared = true;
+ }
+ }
+
+ if (!shared) {
+ Contacts vreContact = new Contacts(serviceCredentials.getScope(), serviceCredentials.getScope(), true);
+ contacts.add(vreContact);
+
+ List users = new ArrayList<>();
+ for (Contacts cont : contacts) {
+ SharingEntity sharingEntity;
+ if (cont.isGroup()) {
+ sharingEntity = SharingEntity.group(cont.getLogin());
+ } else {
+ sharingEntity = SharingEntity.user(cont.getLogin());
+ }
+ users.add(sharingEntity);
+ }
+ SharingEntity[] usersArray = users.toArray(new SharingEntity[0]);
+
+ logger.debug("Share with Users: " + users);
+ service.share(tabularResourceId, usersArray);
+ }
+
+ } catch (TDGWTServiceException e) {
+ throw e;
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ ResourceBundle messages = getResourceBundle(httpRequest);
+ throw new TDGWTServiceException(messages.getString(TDGWTServiceMessagesConstants.securityExceptionRights));
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new TDGWTServiceException("Error sharing tabular resource with VRE on service!");
+ }
+ }
+
@Override
public String startSDMXTemplateExport(SDMXTemplateExportSession sdmxTemplateExportSession)
throws TDGWTServiceException {