Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@100280 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-30 10:42:05 +00:00
parent f9a1f03b6a
commit a6fb69823a
1 changed files with 57 additions and 27 deletions

View File

@ -6,6 +6,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData; import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
@ -117,9 +119,7 @@ public class TabularResourceProperties extends FramedPanel {
retrieveLicencesList(); retrieveLicencesList();
} }
public void addTabularResource() { public void addTabularResource() {
trFieldSet = new FieldSet(); trFieldSet = new FieldSet();
trFieldSet.setHeadingText("Tabular Resource"); trFieldSet.setHeadingText("Tabular Resource");
@ -180,7 +180,6 @@ public class TabularResourceProperties extends FramedPanel {
storeCombo = new ListStore<LicenceData>(propsLicenceData.id()); storeCombo = new ListStore<LicenceData>(propsLicenceData.id());
storeCombo.addAll(licencesList); storeCombo.addAll(licencesList);
comboLicences = new ComboBox<LicenceData>(storeCombo, comboLicences = new ComboBox<LicenceData>(storeCombo,
propsLicenceData.licence()); propsLicenceData.licence());
comboLicences.setMinListWidth(250); comboLicences.setMinListWidth(250);
@ -292,6 +291,7 @@ public class TabularResourceProperties extends FramedPanel {
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"Error retrieving licences."); "Error retrieving licences.");
} }
} }
public void onSuccess(ArrayList<LicenceData> result) { public void onSuccess(ArrayList<LicenceData> result) {
@ -313,7 +313,7 @@ public class TabularResourceProperties extends FramedPanel {
dateField.setValue(tabResource.getDate()); dateField.setValue(tabResource.getDate());
typeField.setValue(tabResource.getTrId().getTabularResourceType()); typeField.setValue(tabResource.getTrId().getTabularResourceType());
rightField.setValue(tabResource.getRight()); rightField.setValue(tabResource.getRight());
validFromField.clear(); validFromField.clear();
if (tabResource.getValidFrom() == null if (tabResource.getValidFrom() == null
|| tabResource.getValidFrom().isEmpty()) { || tabResource.getValidFrom().isEmpty()) {
@ -329,7 +329,7 @@ public class TabularResourceProperties extends FramedPanel {
e.printStackTrace(); e.printStackTrace();
} }
} }
validUntilToField.clear(); validUntilToField.clear();
if (tabResource.getValidUntilTo() == null if (tabResource.getValidUntilTo() == null
|| tabResource.getValidUntilTo().isEmpty()) { || tabResource.getValidUntilTo().isEmpty()) {
@ -452,12 +452,18 @@ public class TabularResourceProperties extends FramedPanel {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error retrienving properties: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert( UtilsGXT3.alert("Error Locked",
"Error", caught.getLocalizedMessage());
"Error retrienving properties: " } else {
+ caught.getLocalizedMessage()); Log.error("Error retrienving properties: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrienving properties: "
+ caught.getLocalizedMessage());
}
} }
} }
@ -480,11 +486,17 @@ public class TabularResourceProperties extends FramedPanel {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error retrienving Share Informations: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error Locked",
"Error retrienving Share Informations: " caught.getLocalizedMessage());
+ caught.getLocalizedMessage()); } else {
Log.error("Error retrienving Share Informations: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrienving Share Informations: "
+ caught.getLocalizedMessage());
}
} }
} }
@ -506,12 +518,17 @@ public class TabularResourceProperties extends FramedPanel {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error retrienving Last Table: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert( UtilsGXT3.alert("Error Locked",
"Error", caught.getLocalizedMessage());
"Error retrienving Last Table: " } else {
+ caught.getLocalizedMessage()); Log.error("Error retrienving Last Table: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrienving Last Table: "
+ caught.getLocalizedMessage());
}
} }
} }
@ -581,11 +598,24 @@ public class TabularResourceProperties extends FramedPanel {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error Setting Tabular Resoruce Properties: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error Locked",
"Error setting tabular resource properties: " caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.error("Error Setting Tabular Resoruce Properties: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3
.alert("Error",
"Error setting tabular resource properties: "
+ caught.getLocalizedMessage());
}
}
} }
} }