ref #10586: Enable SDMX export operation for DataSet only for the tables already shared with the whole VRE
https://support.d4science.org/issues/10586 Added share git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@160454 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4ee0743fac
commit
4067beae1b
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.18.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.19.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.18.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.19.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.18.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.19.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-19-0"
|
||||||
|
date="2017-12-13">
|
||||||
|
<Change>Enable SDMX export operation for DataSet only for the tables
|
||||||
|
already shared with the whole VRE [ticket #10586]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-18-0"
|
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-18-0"
|
||||||
date="2017-07-01">
|
date="2017-07-01">
|
||||||
<Change>Added excel parameter for Template export [ticket #8781]</Change>
|
<Change>Added excel parameter for Template export [ticket #8781]
|
||||||
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-17-0"
|
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-17-0"
|
||||||
date="2017-06-12">
|
date="2017-06-12">
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>tabular-data-gwt-service</artifactId>
|
<artifactId>tabular-data-gwt-service</artifactId>
|
||||||
<version>2.18.0-SNAPSHOT</version>
|
<version>2.19.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>tabular-data-gwt-service</name>
|
<name>tabular-data-gwt-service</name>
|
||||||
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
|
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
|
||||||
|
|
|
@ -4435,6 +4435,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
|
||||||
director.setOperationExecutionBuilder(opExC);
|
director.setOperationExecutionBuilder(opExC);
|
||||||
break;
|
break;
|
||||||
case DATASET:
|
case DATASET:
|
||||||
|
shareDatasetWithVRE(httpRequest, serviceCredentials, service, exportSession);
|
||||||
|
|
||||||
OpExecution4SDMXDatasetExport opExD = new OpExecution4SDMXDatasetExport(httpRequest, serviceCredentials,
|
OpExecution4SDMXDatasetExport opExD = new OpExecution4SDMXDatasetExport(httpRequest, serviceCredentials,
|
||||||
service, exportSession);
|
service, exportSession);
|
||||||
director.setOperationExecutionBuilder(opExD);
|
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> 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<SharingEntity> 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
|
@Override
|
||||||
public String startSDMXTemplateExport(SDMXTemplateExportSession sdmxTemplateExportSession)
|
public String startSDMXTemplateExport(SDMXTemplateExportSession sdmxTemplateExportSession)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
|
|
Loading…
Reference in New Issue