Handled ProcessNotFoundException
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-thredds-sync-widget@165000 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e9ae76e295
commit
2e43561c98
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsthreddssync.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SyncCompletedNotification.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 13, 2018
|
||||||
|
*/
|
||||||
|
public class SyncCompletedNotification {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface SyncCompletedNotificationListner.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 13, 2018
|
||||||
|
*/
|
||||||
|
public interface SyncCompletedNotificationListner{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On sync completed.
|
||||||
|
*
|
||||||
|
* @param folder the folder
|
||||||
|
*/
|
||||||
|
void onSyncCompleted(WsFolder folder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On sync error.
|
||||||
|
*
|
||||||
|
* @param folder the folder
|
||||||
|
*/
|
||||||
|
void onSyncError(WsFolder folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface HasWsSyncNotificationListner.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 13, 2018
|
||||||
|
*/
|
||||||
|
public interface HasWsSyncNotificationListner {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the sync completed listner.
|
||||||
|
*
|
||||||
|
* @param listner the listner
|
||||||
|
*/
|
||||||
|
public void addSyncCompletedListner(SyncCompletedNotificationListner listner);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package org.gcube.portlets.widgets.wsthreddssync.client;
|
package org.gcube.portlets.widgets.wsthreddssync.client;
|
||||||
|
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||||
|
import org.gcube.portlets.widgets.wsthreddssync.client.SyncCompletedNotification.HasWsSyncNotificationListner;
|
||||||
|
import org.gcube.portlets.widgets.wsthreddssync.client.SyncCompletedNotification.SyncCompletedNotificationListner;
|
||||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEvent;
|
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEvent;
|
||||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEventHandler;
|
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEventHandler;
|
||||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.ShowMonitorSyncStatusEvent;
|
import org.gcube.portlets.widgets.wsthreddssync.client.event.ShowMonitorSyncStatusEvent;
|
||||||
|
@ -27,7 +30,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Feb 14, 2018
|
* Feb 14, 2018
|
||||||
*/
|
*/
|
||||||
public class WsThreddsWidget {
|
public class WsThreddsWidget implements HasWsSyncNotificationListner {
|
||||||
|
|
||||||
/** The ws thredds sync service. */
|
/** The ws thredds sync service. */
|
||||||
public static final ThreddsWorkspaceSyncServiceAsync wsThreddsSyncService = ThreddsWorkspaceSyncServiceAsync.Util.getInstance();
|
public static final ThreddsWorkspaceSyncServiceAsync wsThreddsSyncService = ThreddsWorkspaceSyncServiceAsync.Util.getInstance();
|
||||||
|
@ -37,6 +40,8 @@ public class WsThreddsWidget {
|
||||||
|
|
||||||
private WsThreddsWidgetViewManager viewManager = new WsThreddsWidgetViewManager();
|
private WsThreddsWidgetViewManager viewManager = new WsThreddsWidgetViewManager();
|
||||||
|
|
||||||
|
private WsFolder currentFolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -85,6 +90,7 @@ public class WsThreddsWidget {
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public void showSyncFolderInfo(final WsFolder folder) throws Exception {
|
public void showSyncFolderInfo(final WsFolder folder) throws Exception {
|
||||||
|
this.currentFolder = folder;
|
||||||
|
|
||||||
if(folder==null || folder.getFolderId()==null)
|
if(folder==null || folder.getFolderId()==null)
|
||||||
throw new Exception("Invalid parameter folder null");
|
throw new Exception("Invalid parameter folder null");
|
||||||
|
@ -117,8 +123,14 @@ public class WsThreddsWidget {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
viewManager.cancelMonitor(folder);
|
|
||||||
box.hide();
|
box.hide();
|
||||||
|
|
||||||
|
if(caught instanceof WorkspaceFolderLocked){
|
||||||
|
viewManager.showMonitorSyncToFolder(folder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
viewManager.cancelMonitor(folder);
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
Window.alert(caught.getMessage());
|
Window.alert(caught.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -136,7 +148,7 @@ public class WsThreddsWidget {
|
||||||
* @param config the config
|
* @param config the config
|
||||||
*/
|
*/
|
||||||
private void performFolderSync(final WsFolder folder, WsThreddsSynchFolderConfiguration config) {
|
private void performFolderSync(final WsFolder folder, WsThreddsSynchFolderConfiguration config) {
|
||||||
|
this.currentFolder = folder;
|
||||||
GWT.log("Performing doSyncFolder on: "+folder);
|
GWT.log("Performing doSyncFolder on: "+folder);
|
||||||
final Modal box = new Modal(true);
|
final Modal box = new Modal(true);
|
||||||
box.setTitle("Starting synchronization...");
|
box.setTitle("Starting synchronization...");
|
||||||
|
@ -167,4 +179,15 @@ public class WsThreddsWidget {
|
||||||
});
|
});
|
||||||
box.show();
|
box.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.widgets.wsthreddssync.client.SyncCompletedNotification.HasWsSyncNotificationListner#addSyncCompletedListner(org.gcube.portlets.widgets.wsthreddssync.client.SyncCompletedNotification.SyncCompletedNotificationListner)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addSyncCompletedListner(SyncCompletedNotificationListner listner) {
|
||||||
|
|
||||||
|
listner.onSyncCompleted(currentFolder);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsthreddssync.client.dialog;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsthreddssync.client.resource.Icons;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class PanelConfirmBuilder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 13, 2018
|
||||||
|
*/
|
||||||
|
public abstract class PanelConfirmBuilder {
|
||||||
|
|
||||||
|
private DockPanel dock = new DockPanel();
|
||||||
|
private Button yesButton;
|
||||||
|
private VerticalPanel vpContainer;
|
||||||
|
private ImageResource loading = Icons.ICONS.loading();
|
||||||
|
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||||
|
private Button noButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click no button.
|
||||||
|
*/
|
||||||
|
public abstract void onClickNoButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click yes button.
|
||||||
|
*/
|
||||||
|
public abstract void onClickYesButton();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new panel confirm builder.
|
||||||
|
*
|
||||||
|
* @param img the img
|
||||||
|
* @param caption the caption
|
||||||
|
* @param text the text
|
||||||
|
*/
|
||||||
|
public PanelConfirmBuilder(Image img, String caption, String text, AlertType type) {
|
||||||
|
dock.setSpacing(4);
|
||||||
|
dock.setWidth("100%");
|
||||||
|
// setHeading(caption);
|
||||||
|
|
||||||
|
yesButton = new Button("Yes");
|
||||||
|
|
||||||
|
yesButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
onClickYesButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
noButton = new Button("No");
|
||||||
|
|
||||||
|
noButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
onClickNoButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
vpContainer = new VerticalPanel();
|
||||||
|
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
|
||||||
|
Alert txt = new Alert(text);
|
||||||
|
txt.setType(type);
|
||||||
|
txt.setClose(false);
|
||||||
|
vpContainer.add(txt);
|
||||||
|
hpButtons = new HorizontalPanel();
|
||||||
|
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
|
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
|
||||||
|
hpButtons.setSpacing(3);
|
||||||
|
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
|
||||||
|
hpButtons.add(yesButton);
|
||||||
|
hpButtons.add(noButton);
|
||||||
|
|
||||||
|
dock.add(hpButtons, DockPanel.SOUTH);
|
||||||
|
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
|
||||||
|
|
||||||
|
if (img != null)
|
||||||
|
dock.add(img, DockPanel.WEST);
|
||||||
|
|
||||||
|
dock.add(vpContainer, DockPanel.CENTER);
|
||||||
|
// add(dock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
public void loader(String message){
|
||||||
|
try{
|
||||||
|
dock.remove(hpButtons);
|
||||||
|
}catch(Exception e){}
|
||||||
|
vpContainer.clear();
|
||||||
|
HorizontalPanel hpMask = new HorizontalPanel();
|
||||||
|
hpMask.add(new Image(loading));
|
||||||
|
HTML html = new HTML(message);
|
||||||
|
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
|
||||||
|
hpMask.add(html);
|
||||||
|
vpContainer.add(hpMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the to center panel.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
*/
|
||||||
|
public void addToCenterPanel(Widget w) {
|
||||||
|
vpContainer.add(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dock.
|
||||||
|
*
|
||||||
|
* @return the dock
|
||||||
|
*/
|
||||||
|
public DockPanel getPanel() {
|
||||||
|
return dock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the yes button.
|
||||||
|
*
|
||||||
|
* @return the yes button
|
||||||
|
*/
|
||||||
|
public Button getYesButton() {
|
||||||
|
return yesButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the no button.
|
||||||
|
*
|
||||||
|
* @return the no button
|
||||||
|
*/
|
||||||
|
public Button getNoButton() {
|
||||||
|
return noButton;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.wsthreddssync.client.rpc;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope;
|
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope;
|
||||||
|
@ -27,10 +28,10 @@ public interface ThreddsWorkspaceSyncService extends RemoteService {
|
||||||
*
|
*
|
||||||
* @param folderId the folder id
|
* @param folderId the folder id
|
||||||
* @return the ws thredds synch folder descriptor
|
* @return the ws thredds synch folder descriptor
|
||||||
* @throws ItemNotSynched the item not synched
|
* @throws WorkspaceFolderLocked the workspace folder locked
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws ItemNotSynched, Exception;
|
WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws WorkspaceFolderLocked, Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do sync folder.
|
* Do sync folder.
|
||||||
|
|
|
@ -25,7 +25,9 @@ import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.shared.GWT;
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
@ -138,6 +140,13 @@ public class WsThreddsWidgetViewManager {
|
||||||
box.hide();
|
box.hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmHanlder(CONFIRM_VALUE confirm, Command command) {
|
||||||
|
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(monitorView==null) {
|
if(monitorView==null) {
|
||||||
|
@ -176,9 +185,7 @@ public class WsThreddsWidgetViewManager {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
cancelMonitor(folder);
|
cancelMonitor(folder);
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
//SHOW MESSAGE ON ERROR
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,6 +243,18 @@ public class WsThreddsWidgetViewManager {
|
||||||
box.hide();
|
box.hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmHanlder(CONFIRM_VALUE confirm, Command command) {
|
||||||
|
|
||||||
|
if(confirm.equals(CONFIRM_VALUE.YES)){
|
||||||
|
box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(command!=null)
|
||||||
|
command.execute();
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateThreddsConfigurationView createThreddsConfiguration = new CreateThreddsConfigurationView(folder.getFolderId()) {
|
CreateThreddsConfigurationView createThreddsConfiguration = new CreateThreddsConfigurationView(folder.getFolderId()) {
|
||||||
|
@ -260,6 +279,31 @@ public class WsThreddsWidgetViewManager {
|
||||||
panelView.setError(visible, error);
|
panelView.setError(visible, error);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConfirm(boolean visible, String msg) {
|
||||||
|
|
||||||
|
Command yes = new Command() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
submitHandler();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Command no = new Command() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
panelView.setConfirm(false, "", null, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
panelView.setConfirm(visible, msg, yes, no);
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panelView.addViewAsWidget(createThreddsConfiguration);
|
panelView.addViewAsWidget(createThreddsConfiguration);
|
||||||
|
@ -291,6 +335,13 @@ public class WsThreddsWidgetViewManager {
|
||||||
public void closeHandler() {
|
public void closeHandler() {
|
||||||
box.hide();
|
box.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmHanlder(CONFIRM_VALUE confirm, Command command) {
|
||||||
|
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
boolean isCreateConfiguration = folderDescriptor==null?true:false;
|
boolean isCreateConfiguration = folderDescriptor==null?true:false;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsthreddssync.client.dialog.PanelConfirmBuilder;
|
||||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.LoaderIcon;
|
import org.gcube.portlets.widgets.wsthreddssync.client.view.LoaderIcon;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
@ -12,6 +13,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
@ -34,6 +36,14 @@ public abstract class AbstractViewDialogBox extends Composite {
|
||||||
/** The default width. */
|
/** The default width. */
|
||||||
public static int DEFAULT_WIDTH = 500;
|
public static int DEFAULT_WIDTH = 500;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum CONFIRM_VALUE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 13, 2018
|
||||||
|
*/
|
||||||
|
public static enum CONFIRM_VALUE {YES, NO}
|
||||||
/**
|
/**
|
||||||
* The Interface AbstractViewDialogBoxUiBinder.
|
* The Interface AbstractViewDialogBoxUiBinder.
|
||||||
*
|
*
|
||||||
|
@ -71,11 +81,22 @@ public abstract class AbstractViewDialogBox extends Composite {
|
||||||
/** The alert info. */
|
/** The alert info. */
|
||||||
protected Alert alertInfo = new Alert();
|
protected Alert alertInfo = new Alert();
|
||||||
|
|
||||||
|
|
||||||
|
protected PanelConfirmBuilder confirmBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close handler.
|
* Close handler.
|
||||||
*/
|
*/
|
||||||
public abstract void closeHandler();
|
public abstract void closeHandler();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm hanlder.
|
||||||
|
*
|
||||||
|
* @param confirm the confirm
|
||||||
|
*/
|
||||||
|
public abstract void confirmHanlder(CONFIRM_VALUE confirm, Command command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because this class has a default constructor, it can
|
* Because this class has a default constructor, it can
|
||||||
* be used as a binder template. In other words, it can be used in other
|
* be used as a binder template. In other words, it can be used in other
|
||||||
|
@ -141,8 +162,17 @@ public abstract class AbstractViewDialogBox extends Composite {
|
||||||
* @param text the text
|
* @param text the text
|
||||||
*/
|
*/
|
||||||
public void showLoading(boolean visible, String text){
|
public void showLoading(boolean visible, String text){
|
||||||
|
|
||||||
|
try{
|
||||||
|
validator_field.remove(loaderIcon);
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
loaderIcon.setVisible(visible);
|
loaderIcon.setVisible(visible);
|
||||||
loaderIcon.setText(text);
|
loaderIcon.setText(text);
|
||||||
|
|
||||||
|
validator_field.add(loaderIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,8 +183,17 @@ public abstract class AbstractViewDialogBox extends Composite {
|
||||||
* @param error the error
|
* @param error the error
|
||||||
*/
|
*/
|
||||||
public void setError(boolean visible, String error) {
|
public void setError(boolean visible, String error) {
|
||||||
|
|
||||||
|
try{
|
||||||
|
validator_field.remove(alertError);
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
alertError.setVisible(visible);
|
alertError.setVisible(visible);
|
||||||
alertError.setText(error==null?"":error);
|
alertError.setText(error==null?"":error);
|
||||||
|
|
||||||
|
validator_field.add(alertError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,12 +201,58 @@ public abstract class AbstractViewDialogBox extends Composite {
|
||||||
* Sets the error.
|
* Sets the error.
|
||||||
*
|
*
|
||||||
* @param visible the visible
|
* @param visible the visible
|
||||||
* @param error the error
|
* @param msg the msg
|
||||||
*/
|
*/
|
||||||
public void setInfo(boolean visible, String msg) {
|
public void setInfo(boolean visible, String msg) {
|
||||||
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
validator_field.remove(alertInfo);
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
alertInfo.setVisible(visible);
|
alertInfo.setVisible(visible);
|
||||||
alertInfo.setText(msg==null?"":msg);
|
alertInfo.setText(msg==null?"":msg);
|
||||||
|
|
||||||
|
validator_field.add(alertInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the confirm.
|
||||||
|
*
|
||||||
|
* @param visible the visible
|
||||||
|
* @param msg the msg
|
||||||
|
*/
|
||||||
|
public void setConfirm(boolean visible, String msg, final Command yes, final Command no){
|
||||||
|
|
||||||
|
try{
|
||||||
|
validator_field.remove(confirmBuilder.getPanel());
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(visible){
|
||||||
|
|
||||||
|
confirmBuilder = new PanelConfirmBuilder(null, null, msg, AlertType.WARNING) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickYesButton() {
|
||||||
|
|
||||||
|
confirmHanlder(CONFIRM_VALUE.YES, yes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickNoButton() {
|
||||||
|
|
||||||
|
confirmHanlder(CONFIRM_VALUE.NO, no);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
validator_field.add(confirmBuilder.getPanel());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,16 @@ public abstract class CreateThreddsConfigurationView extends Composite {
|
||||||
public abstract void setError(boolean visible, String error);
|
public abstract void setError(boolean visible, String error);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the confirm.
|
||||||
|
*
|
||||||
|
* @param visible the visible
|
||||||
|
* @param msg the msg
|
||||||
|
*/
|
||||||
|
public abstract void setConfirm(boolean visible, String msg);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because this class has a default constructor, it can
|
* Because this class has a default constructor, it can
|
||||||
* be used as a binder template. In other words, it can be used in other
|
* be used as a binder template. In other words, it can be used in other
|
||||||
|
@ -349,7 +359,7 @@ public abstract class CreateThreddsConfigurationView extends Composite {
|
||||||
|
|
||||||
if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){
|
if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){
|
||||||
cg_folder_name.setType(ControlGroupType.WARNING);
|
cg_folder_name.setType(ControlGroupType.WARNING);
|
||||||
setError(true, "The Catalogue Entry is required");
|
setConfirm(true, "The Catalogue Entry is empty. Do you want continue anyway?");
|
||||||
return false;
|
return false;
|
||||||
}else if(field_folder_name.getValue().startsWith("/")){
|
}else if(field_folder_name.getValue().startsWith("/")){
|
||||||
cg_folder_name.setType(ControlGroupType.ERROR);
|
cg_folder_name.setType(ControlGroupType.ERROR);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||||
|
@ -165,9 +166,10 @@ public class SyncronizeWithThredds {
|
||||||
* @param userToken the user token
|
* @param userToken the user token
|
||||||
* @return the th sync folder descriptor
|
* @return the th sync folder descriptor
|
||||||
* @throws ItemNotSynched the item not synched
|
* @throws ItemNotSynched the item not synched
|
||||||
|
* @throws WorkspaceFolderLocked the workspace folder locked
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public ThSyncFolderDescriptor checkItemSynched(String folderId, String scope, String userToken) throws ItemNotSynched, Exception{
|
public ThSyncFolderDescriptor checkItemSynched(String folderId, String scope, String userToken) throws ItemNotSynched, WorkspaceFolderLocked, Exception{
|
||||||
|
|
||||||
setContextParameters(scope, userToken);
|
setContextParameters(scope, userToken);
|
||||||
return workspaceThreddsSynchronize.checkItemSynched(folderId);
|
return workspaceThreddsSynchronize.checkItemSynched(folderId);
|
||||||
|
@ -212,9 +214,8 @@ public class SyncronizeWithThredds {
|
||||||
* @param scope the scope
|
* @param scope the scope
|
||||||
* @param userToken the user token
|
* @param userToken the user token
|
||||||
* @param targetToken the target token
|
* @param targetToken the target token
|
||||||
* @return
|
|
||||||
* @return the available catalogues by token
|
* @return the available catalogues by token
|
||||||
* @throws Exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public List<ThCatalogueBean> getAvailableCataloguesByToken(String scope, String userToken, String targetToken) throws Exception {
|
public List<ThCatalogueBean> getAvailableCataloguesByToken(String scope, String userToken, String targetToken) throws Exception {
|
||||||
setContextParameters(scope, userToken);
|
setContextParameters(scope, userToken);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||||
|
@ -216,7 +217,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
|
||||||
* @see org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService#isItemSynched(java.lang.String)
|
* @see org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService#isItemSynched(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws Exception{
|
public WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws WorkspaceFolderLocked, Exception{
|
||||||
|
|
||||||
logger.debug("Performing isItemSynched for foldeId: "+folderId);
|
logger.debug("Performing isItemSynched for foldeId: "+folderId);
|
||||||
|
|
||||||
|
@ -241,6 +242,11 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
|
||||||
} catch (ItemNotSynched e) {
|
} catch (ItemNotSynched e) {
|
||||||
logger.info("The folderId: "+folderId +" is not synched, returning null FolderDescriptor");
|
logger.info("The folderId: "+folderId +" is not synched, returning null FolderDescriptor");
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
} catch (WorkspaceFolderLocked e) {
|
||||||
|
logger.warn(e.getMessage() +", sending exception to client...");
|
||||||
|
throw new WorkspaceFolderLocked(e.getFolderId(), e.getMessage());
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.info("Error on isItemSynched for folderId: "+folderId, e);
|
logger.info("Error on isItemSynched for folderId: "+folderId, e);
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
|
|
Loading…
Reference in New Issue