merged with trunk
This commit is contained in:
parent
44027d88f8
commit
2239c3f357
|
@ -56,11 +56,7 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
||||||
|
|
||||||
private final List<SyncCompletedNotificationListner> syncEventsListeners = new ArrayList<SyncCompletedNotificationListner>();
|
private final List<SyncCompletedNotificationListner> syncEventsListeners = new ArrayList<SyncCompletedNotificationListner>();
|
||||||
|
|
||||||
public static final String MISSING_THREDDS_ADMIN_RIGHTS = "It seems you are not authorized to create a configuration towards THREDDS Catalogue. Request it to the VRE manager or the portal administrator.";
|
private Map<String, GatewayRolesThredds> mapScopeThreddsRoles = null;
|
||||||
|
|
||||||
public static final String MISSING_THREDDS_PUBLISHER_RIGHTS = "It seems you are not authorized to run a syncronization task towards THREDDS Catalogue. Request it to the VRE manager or the portal administrator.";
|
|
||||||
|
|
||||||
public static final String MISSING_THREDDS_RIGHTS = "It seems you are not authorized to interact with the facility 'Sync with THREDDS'. Request authorization to the VRE manager or the portal administrator.";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
|
@ -152,7 +148,7 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Modal box = new Modal(true);
|
final Modal box = new Modal(true);
|
||||||
box.setTitle("Checking configurations...");
|
box.setTitle("Checking authorizations and configurations...");
|
||||||
final HorizontalPanel hpLoader = new HorizontalPanel();
|
final HorizontalPanel hpLoader = new HorizontalPanel();
|
||||||
LoaderIcon loader = new LoaderIcon("Checking authorizations and folder configurations...");
|
LoaderIcon loader = new LoaderIcon("Checking authorizations and folder configurations...");
|
||||||
hpLoader.add(loader);
|
hpLoader.add(loader);
|
||||||
|
@ -161,6 +157,8 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
||||||
//LAOADING ROLES
|
//LAOADING ROLES
|
||||||
WsThreddsWidget.wsThreddsSyncService.getScopesWithThreddsRolesForLoggedUser(new AsyncCallback<Map<String,GatewayRolesThredds>>() {
|
WsThreddsWidget.wsThreddsSyncService.getScopesWithThreddsRolesForLoggedUser(new AsyncCallback<Map<String,GatewayRolesThredds>>() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
hpLoader.clear();
|
hpLoader.clear();
|
||||||
|
@ -173,76 +171,57 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Map<String, GatewayRolesThredds> result) {
|
public void onSuccess(Map<String, GatewayRolesThredds> result) {
|
||||||
try {
|
GWT.log("Returned Map(Scope,Role): "+result);
|
||||||
hpLoader.clear();
|
mapScopeThreddsRoles = result;
|
||||||
hpLoader.setVisible(false);
|
|
||||||
}catch (Exception e) {
|
|
||||||
//Silent
|
|
||||||
}
|
|
||||||
|
|
||||||
if(result!=null) {
|
//at least one THREDDS rights is assigned
|
||||||
|
GWT.log("Performing isItemSynched: "+folder.getFolderId());
|
||||||
GWT.log("Returned Map(Scope,Role): "+result);
|
WsThreddsWidget.wsThreddsSyncService.isItemSynched(folder.getFolderId(), new AsyncCallback<WsThreddsSynchFolderDescriptor>() {
|
||||||
final boolean isThreddsPubliser = result.containsValue(GatewayRolesThredds.DATA_EDITOR);
|
|
||||||
final boolean isThreddsAdmin = result.containsValue(GatewayRolesThredds.DATA_MANAGER);
|
@Override
|
||||||
|
public void onSuccess(WsThreddsSynchFolderDescriptor result) {
|
||||||
//no rights assigned
|
try {
|
||||||
if(!isThreddsAdmin && !isThreddsPubliser) {
|
hpLoader.clear();
|
||||||
showMissingRights(box);
|
hpLoader.setVisible(false);
|
||||||
return;
|
}catch (Exception e) {
|
||||||
|
//Silent
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
box.hide();
|
||||||
|
//GWT.log("WsThreddsSynchFolderDescriptor result: "+result);
|
||||||
|
viewManager.showThreddsFolderInfo(folder, result, mapScopeThreddsRoles);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//at least one THREDDS rights is assigned
|
|
||||||
GWT.log("Performing isItemSynched: "+folder.getFolderId());
|
|
||||||
WsThreddsWidget.wsThreddsSyncService.isItemSynched(folder.getFolderId(), new AsyncCallback<WsThreddsSynchFolderDescriptor>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(WsThreddsSynchFolderDescriptor result) {
|
public void onFailure(Throwable caught) {
|
||||||
box.hide();
|
box.hide();
|
||||||
//GWT.log("WsThreddsSynchFolderDescriptor result: "+result);
|
|
||||||
viewManager.showThreddsFolderInfo(folder, result, isThreddsAdmin, isThreddsPubliser);
|
|
||||||
|
|
||||||
|
if(caught instanceof WorkspaceFolderLocked){
|
||||||
|
viewManager.showMonitorSyncToFolder(folder,syncEventsListeners);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
viewManager.cancelMonitor(folder);
|
||||||
public void onFailure(Throwable caught) {
|
Window.alert(caught.getMessage());
|
||||||
box.hide();
|
}
|
||||||
|
});
|
||||||
if(caught instanceof WorkspaceFolderLocked){
|
|
||||||
viewManager.showMonitorSyncToFolder(folder,syncEventsListeners);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
viewManager.cancelMonitor(folder);
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else {
|
|
||||||
//no rights detected
|
|
||||||
showMissingRights(box);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
box.show();
|
box.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMissingRights(Modal box) {
|
// private void showMissingRights(Modal box) {
|
||||||
Alert alert = new Alert();
|
// Alert alert = new Alert();
|
||||||
alert.setType(AlertType.WARNING);
|
// alert.setType(AlertType.WARNING);
|
||||||
alert.setText(MISSING_THREDDS_RIGHTS);
|
// alert.setText(MISSING_THREDDS_RIGHTS);
|
||||||
alert.setClose(false);
|
// alert.setClose(false);
|
||||||
box.add(alert);
|
// box.add(alert);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void performFolderUnSync(final WsFolder folder) {
|
private void performFolderUnSync(final WsFolder folder) {
|
||||||
GWT.log("Performing doSyncFolder on: "+folder);
|
GWT.log("Performing doSyncFolder on: "+folder);
|
||||||
|
|
Loading…
Reference in New Issue