diff --git a/distro/changelog.xml b/distro/changelog.xml
index 2a79547..65df1ff 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -1,31 +1,43 @@
-
+
+ Fixed tabular resource share [Ticket #3483]
+
+
Updated dependencies
-
+
Updated dependency
Added share for rules
-
+
Updated to GWT 2.6.1
Updated to GXT 3.1.1
-
+
Added template share
Fixed Final and Lock errors
-
+
Updated share for groups
-
+
Added SecurityException
Added share for groups
-
+
Updated Share
Updated Pom
-
+
First Release
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 48668e1..aefe9e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
4.0.0
org.gcube.portlets.user
tabular-data-share-widget
- 1.7.0-SNAPSHOT
+ 1.8.0-SNAPSHOT
tabular-data-share-widget
diff --git a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/RuleShare.java b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/RuleShare.java
index c8ff967..9118646 100644
--- a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/RuleShare.java
+++ b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/RuleShare.java
@@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareRule;
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
import org.gcube.portlets.user.td.sharewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
@@ -36,10 +37,9 @@ public class RuleShare {
private RuleDescriptionData ruleDescriptionData;
private ShareRule shareRule;
- public RuleShare(RuleDescriptionData ruleData, EventBus eventBus) {
+ public RuleShare(UserInfo userInfo, RuleDescriptionData ruleData, EventBus eventBus) {
this.ruleDescriptionData=ruleData;
this.eventBus = eventBus;
-
shareWindow();
}
diff --git a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/ShareWidgetEntry.java b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/ShareWidgetEntry.java
index 098966e..8b79c80 100644
--- a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/ShareWidgetEntry.java
+++ b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/ShareWidgetEntry.java
@@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.sharewidget.client;
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
@@ -9,15 +10,22 @@ import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
+/**
+ *
+ * @author Giancarlo Panichi
+ * email: g.panichi@isti.cnr.it
+ *
+ */
public class ShareWidgetEntry implements EntryPoint {
public void onModuleLoad() {
TRId trId=new TRId("1");
EventBus eventBus=new SimpleEventBus();
+ UserInfo userInfo=new UserInfo();
@SuppressWarnings("unused")
- TRShare trShare=new TRShare(trId,eventBus);
+ TRShare trShare=new TRShare(userInfo,trId,eventBus);
Log.info("Hello!");
}
}
diff --git a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java
index 35056ff..019b27e 100644
--- a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java
+++ b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java
@@ -9,6 +9,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
+import org.gcube.portlets.user.td.sharewidget.client.util.InfoMessageBox;
import org.gcube.portlets.user.td.sharewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
@@ -28,6 +30,8 @@ import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
+import com.sencha.gxt.widget.core.client.event.HideEvent;
+import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
@@ -41,11 +45,13 @@ public class TRShare {
private EventBus eventBus;
private TabResource tabResource;
private ShareTabResource shareInfo;
+ private UserInfo userInfo;
+ private boolean isOwner;
- public TRShare(TRId trId, EventBus eventBus) {
+ public TRShare(UserInfo userInfo, TRId trId, EventBus eventBus) {
this.trId = trId;
this.eventBus = eventBus;
-
+ this.userInfo=userInfo;
retrieveInfo();
}
@@ -57,9 +63,7 @@ public class TRShare {
public void onSuccess(TabResource result) {
Log.info("Retrived TR: " + result.getTrId());
- tabResource = result;
- shareWindow();
-
+ checkOwner(result);
}
public void onFailure(Throwable caught) {
@@ -87,6 +91,27 @@ public class TRShare {
});
}
+
+ private void checkOwner(TabResource tabResource){
+ this.tabResource = tabResource;
+ if(userInfo.getUsername().compareTo(tabResource.getOwnerLogin())!=0){
+ isOwner=false;
+ final InfoMessageBox d = new InfoMessageBox("Attention", "In order to share a Tabular Resource you must be the owner of the Tabular Resource. "
+ + "You are not the owner of this Tabular Resource!");
+ d.addHideHandler(new HideHandler() {
+
+ public void onHide(HideEvent event) {
+ shareWindow();
+ }
+ });
+ d.show();
+ } else {
+ isOwner=true;
+ shareWindow();
+ }
+
+ }
+
/**
* Call Window
*/
@@ -123,6 +148,7 @@ public class TRShare {
}
});
+ sharingWindow.enableConfirmButton(isOwner);
}
diff --git a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TemplateShare.java b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TemplateShare.java
index 975b0ad..bcc7225 100644
--- a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TemplateShare.java
+++ b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TemplateShare.java
@@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTemplate;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
import org.gcube.portlets.user.td.sharewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
@@ -36,22 +37,22 @@ public class TemplateShare {
private TemplateData templateData;
private ShareTemplate shareTemplate;
- public TemplateShare(TemplateData templateData, EventBus eventBus) {
- this.templateData=templateData;
+ public TemplateShare(UserInfo userInfo, TemplateData templateData,
+ EventBus eventBus) {
+ this.templateData = templateData;
this.eventBus = eventBus;
- shareWindow();
- }
+ shareWindow();
-
-
+ }
/**
* Call Window
*/
protected void shareWindow() {
- FileModel file = new FileModel(String.valueOf(templateData.getId()), templateData.getName(), false);
+ FileModel file = new FileModel(String.valueOf(templateData.getId()),
+ templateData.getName(), false);
List listAlreadySharedContact = new ArrayList();
for (Contacts contacts : templateData.getContacts()) {
@@ -91,7 +92,7 @@ public class TemplateShare {
cred.isGroup());
listContacts.add(cont);
}
- shareTemplate=new ShareTemplate(templateData,listContacts);
+ shareTemplate = new ShareTemplate(templateData, listContacts);
TDGWTServiceAsync.INSTANCE.setShareTemplate(shareTemplate,
new AsyncCallback() {
@@ -103,7 +104,8 @@ public class TemplateShare {
} else {
Log.debug("Share Error: "
+ caught.getLocalizedMessage());
- UtilsGXT3.alert("Error sharing template",
+ UtilsGXT3.alert(
+ "Error sharing template",
"Error sharing template: "
+ caught.getLocalizedMessage());
}
@@ -114,10 +116,12 @@ public class TemplateShare {
+ shareTemplate.getTemplateData().getId());
UtilsGXT3.info("Shared", "Template is shared");
/*
- ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
- ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
- ChangeTableRequestType.SHARE, trId, why);
- eventBus.fireEvent(changeTableRequestEvent);*/
+ * ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
+ * ChangeTableRequestEvent changeTableRequestEvent = new
+ * ChangeTableRequestEvent(
+ * ChangeTableRequestType.SHARE, trId, why);
+ * eventBus.fireEvent(changeTableRequestEvent);
+ */
}
@@ -125,6 +129,4 @@ public class TemplateShare {
}
-
-
}
\ No newline at end of file