refs 3483: TDM - improve the quality of the error messages for Rules
Task-Url: https://support.d4science.org/issues/3483 Fixed Share Rules messages error git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-share-widget@128128 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
668b6ca043
commit
975f69ca22
|
@ -1,31 +1,43 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-7-0" date="2015-07-03">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-8-0"
|
||||
date="2016-05-01">
|
||||
<Change>Fixed tabular resource share [Ticket #3483]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-7-0"
|
||||
date="2015-07-03">
|
||||
<Change>Updated dependencies</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-6-0" date="2015-04-30">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-6-0"
|
||||
date="2015-04-30">
|
||||
<Change>Updated dependency</Change>
|
||||
<Change>Added share for rules</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-5-0" date="2015-02-16">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-5-0"
|
||||
date="2015-02-16">
|
||||
<Change>Updated to GWT 2.6.1</Change>
|
||||
<Change>Updated to GXT 3.1.1</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-4-0" date="2014-10-31">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-4-0"
|
||||
date="2014-10-31">
|
||||
<Change>Added template share</Change>
|
||||
<Change>Fixed Final and Lock errors</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-3-0" date="2014-09-12">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-3-0"
|
||||
date="2014-09-12">
|
||||
<Change>Updated share for groups</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-2-0" date="2014-07-04">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-2-0"
|
||||
date="2014-07-04">
|
||||
<Change>Added SecurityException</Change>
|
||||
<Change>Added share for groups</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-1-0" date="2014-06-05">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-1-0"
|
||||
date="2014-06-05">
|
||||
<Change>Updated Share</Change>
|
||||
<Change>Updated Pom</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-0-0" date="2014-04-04">
|
||||
<Changeset component="org.gcube.portlets-user.tabular-data-share-widget.1-0-0"
|
||||
date="2014-04-04">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-share-widget</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<version>1.8.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<name>tabular-data-share-widget</name>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<CredentialModel> listAlreadySharedContact = new ArrayList<CredentialModel>();
|
||||
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<Void>() {
|
||||
|
@ -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 {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue