diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java index 2f97d61..befab9b 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java @@ -5,7 +5,7 @@ import java.util.List; import org.gcube.portal.wssynclibrary.shared.ItemNotSynched; import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean; import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor; @@ -58,7 +58,7 @@ public interface ThreddsWorkspaceSyncService extends RemoteService { * @return the list of vr es for logged user * @throws Exception the exception */ - List getListOfVREsForLoggedUser() throws Exception; + List getListOfScopesForLoggedUser() throws Exception; /** * Gets the available catalogues for scope. diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java index 76d3312..6ca34f0 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java @@ -4,7 +4,7 @@ import java.util.List; import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean; import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor; @@ -83,13 +83,14 @@ public interface ThreddsWorkspaceSyncServiceAsync void monitorSyncStatus(String folderId, AsyncCallback callback); + /** - * Gets the list of vr es for logged user. + * Gets the list of scopes for logged user. * * @param callback the callback - * @return the list of vr es for logged user + * @return the list of scopes for logged user */ - void getListOfVREsForLoggedUser(AsyncCallback> callback); + void getListOfScopesForLoggedUser(AsyncCallback> callback); /** * Gets the available catalogues for scope. diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/FormatUtil.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/FormatUtil.java index 2e7df80..955b0ec 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/FormatUtil.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/FormatUtil.java @@ -1,5 +1,7 @@ package org.gcube.portlets.widgets.wsthreddssync.client.view; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; + // TODO: Auto-generated Javadoc /** * The Class FormatUtil. @@ -9,11 +11,11 @@ package org.gcube.portlets.widgets.wsthreddssync.client.view; */ public class FormatUtil { - + /** * Truncate a string and add an ellipsis ('...') to the end if it exceeds the * specified length. - * + * * @param value the string to truncate * @param len the maximum length to allow before truncating * @return the converted text @@ -24,8 +26,8 @@ public class FormatUtil { } return value; } - - + + /** * Gets the folder title. * @@ -36,5 +38,20 @@ public class FormatUtil { public static String getFolderTitle(String folderName, int maxSize){ String title = folderName!=null&&folderName.length()>0?folderName:""; return FormatUtil.ellipse(title, maxSize); - } + } + + + /** + * To scope value. + * + * @param gcubeScope the gcube scope + * @return the string + */ + public static String toScopeValue(GcubeScope gcubeScope){ + + if(gcubeScope==null) + return null; + + return "("+gcubeScope.getScopeType()+") "+gcubeScope.getScopeTitle(); + } } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java index 181aa2d..2502ca4 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java @@ -177,6 +177,8 @@ public class WsThreddsWidgetViewManager { public void onFailure(Throwable caught) { cancelMonitor(folder); + //SHOW MESSAGE ON ERROR + } @Override @@ -249,7 +251,7 @@ public class WsThreddsWidgetViewManager { remotePath = remotePath.isEmpty()?getFolderName():remotePath+"/"+getFolderName(); conf.setRemotePath(remotePath); conf.setCatalogName(catalogueSelected.getName()); - conf.setTheVRE(getSelectedVRE()); + conf.setSelectedScope(getSelectedScope()); WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, conf)); } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java index 20ce4c1..c04c734 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java @@ -8,7 +8,8 @@ import java.util.Map; import org.gcube.portal.wssynclibrary.shared.thredds.ThCatalogueBean; import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.client.view.FormatUtil; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.ControlGroup; @@ -63,7 +64,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { @UiField - ListBox field_select_vre; + ListBox field_select_scope; @UiField Button butt_create_new_catalogue; @@ -107,7 +108,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { private String folderId; /** The map VR es. */ - private Map mapVREs = new HashMap(); + private Map mapScopes = new HashMap(); private Map> mapCatalogueNames = new HashMap>(); @@ -164,34 +165,36 @@ public abstract class CreateThreddsConfigurationView extends Composite { cg_catalogue_name.getElement().getStyle().setMarginTop(20, Unit.PX); - field_select_vre.addChangeHandler(new ChangeHandler() { + field_select_scope.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { - String scope = field_select_vre.getSelectedItemText(); - GWT.log("Selected VRE: "+scope); - loadCatalogueNamesForScope(scope); + //String scope = field_select_scope.getSelectedItemText(); + String value = field_select_scope.getSelectedValue(); + GWT.log("Selected SCOPE: "+value); + loadCatalogueNamesForScope(value); } }); - WsThreddsWidget.wsThreddsSyncService.getListOfVREsForLoggedUser(new AsyncCallback>() { + WsThreddsWidget.wsThreddsSyncService.getListOfScopesForLoggedUser(new AsyncCallback>() { @Override - public void onSuccess(List result) { + public void onSuccess(List result) { - for (GcubeVRE gcubeVRE : result) { - mapVREs.put(gcubeVRE.getVreScope(), gcubeVRE); - field_select_vre.addItem(gcubeVRE.getVreScope(), gcubeVRE.getVreName()); + for (GcubeScope gcubeScope : result) { + String toValue = FormatUtil.toScopeValue(gcubeScope); + mapScopes.put(gcubeScope.getScopeName(), gcubeScope); + field_select_scope.addItem(toValue, gcubeScope.getScopeName()); } if(result.size()>0){ - field_select_vre.setSelectedValue(result.get(0).getVreName()); + field_select_scope.setSelectedValue(result.get(0).getScopeName()); //field_select_vre.setSelectedIndex(0); //field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource);); - DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_vre); + DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope); } } @@ -269,7 +272,6 @@ public abstract class CreateThreddsConfigurationView extends Composite { * Adds the catalogue name for current scope. * * @param catalogueName the catalogue name - * @param folderName the folder name. Can be a relative Path */ private void addCatalogueNameForCurrentScope(String catalogueName) { @@ -346,7 +348,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { } if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){ - cg_folder_name.setType(ControlGroupType.ERROR); + cg_folder_name.setType(ControlGroupType.WARNING); setError(true, "The Catalogue Entry is required"); return false; }else if(field_folder_name.getValue().startsWith("/")){ @@ -398,15 +400,16 @@ public abstract class CreateThreddsConfigurationView extends Composite { } + /** - * Gets the unit description. + * Gets the selected scope. * - * @return the unit description + * @return the selected scope */ - public GcubeVRE getSelectedVRE(){ - String item = field_select_vre.getSelectedItemText(); - String text = field_select_vre.getSelectedValue(); - return mapVREs.get(item); + public GcubeScope getSelectedScope(){ + //String item = field_select_scope.getSelectedItemText(); + String text = field_select_scope.getSelectedValue(); + return mapScopes.get(text); } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml index 6909cb2..005f508 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml @@ -12,10 +12,10 @@ - Publish in the VRE + Publish in the Scope - + diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java index cfb16eb..2823701 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java @@ -9,7 +9,8 @@ import org.gcube.portal.wssynclibrary.shared.thredds.ThProcessDescriptor; import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor; import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.client.view.FormatUtil; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor; @@ -61,23 +62,23 @@ public abstract class ShowThreddsFolderInfoView extends Composite { TextBox field_folder_status; @UiField - ListBox field_select_vre; + ListBox field_select_scope; @UiField TextBox field_catalogue_name; - + @UiField TextBox field_remote_path; @UiField TextBox field_folder_path; - - + + @UiField TextBox field_folder_locked; - + /*@UiField TextBox field_last_sync; @@ -90,32 +91,40 @@ public abstract class ShowThreddsFolderInfoView extends Composite { @UiField ControlGroup cg_remote_path; - + @UiField HTMLPanel form_unit_fields; - + @UiField Pager pager; - + /** The folder id. */ private String folderId; - + /** The map VR es. */ - private Map mapVREs = new HashMap(); + private Map mapScopes = new HashMap(); private boolean isCreateConfiguration; - - + + + /** + * The Enum SUBMIT_ACTION. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Mar 12, 2018 + */ public static enum SUBMIT_ACTION {CREATE_UPDATE_CONFIGURATION, DO_SYNC}; - + /** * Submit handler. + * + * @param action the action */ public abstract void submitHandler(SUBMIT_ACTION action); - + /** * Sets the error. * @@ -123,7 +132,7 @@ public abstract class ShowThreddsFolderInfoView extends Composite { * @param error the error */ public abstract void setError(boolean visible, String error); - + /** * Because this class has a default constructor, it can @@ -144,52 +153,52 @@ public abstract class ShowThreddsFolderInfoView extends Composite { this.isCreateConfiguration = isCreateConfiguration; initWidget(uiBinder.createAndBindUi(this)); - + pager.getLeft().addClickHandler(new ClickHandler() { - + @Override public void onClick(ClickEvent event) { setError(false, ""); submitHandler(SUBMIT_ACTION.CREATE_UPDATE_CONFIGURATION); } }); - + pager.getRight().addClickHandler(new ClickHandler() { - + @Override public void onClick(ClickEvent event) { setError(false, ""); //boolean isValid = validateSubmit(); //if(isValid) submitHandler(SUBMIT_ACTION.DO_SYNC); - + } }); - + if(isCreateConfiguration) { - WsThreddsWidget.wsThreddsSyncService.getListOfVREsForLoggedUser(new AsyncCallback>() { - + WsThreddsWidget.wsThreddsSyncService.getListOfScopesForLoggedUser(new AsyncCallback>() { + @Override - public void onSuccess(List result) { - - - for (GcubeVRE gcubeVRE : result) { - mapVREs.put(gcubeVRE.getVreScope(), gcubeVRE); - field_select_vre.addItem(gcubeVRE.getVreScope(), gcubeVRE.getVreName()); - + public void onSuccess(List result) { + + for (GcubeScope gcubeScope : result) { + String toValue = FormatUtil.toScopeValue(gcubeScope); + mapScopes.put(gcubeScope.getScopeName(), gcubeScope); + field_select_scope.addItem(toValue, gcubeScope.getScopeName()); + } } - + @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub - + } }); } } - + /** * Update view to result. * @@ -197,60 +206,66 @@ public abstract class ShowThreddsFolderInfoView extends Composite { * @param syncFolderDesc the sync folder desc */ public void updateViewToResult(WsFolder folder, WsThreddsSynchFolderDescriptor syncFolderDesc) { - - this.field_select_vre.clear(); - + + this.field_select_scope.clear(); + if(syncFolderDesc==null) { pager.getRight().setVisible(false); return; } - + if(syncFolderDesc.getSyncStatus()!=null) { this.field_folder_status.setValue(syncFolderDesc.getSyncStatus().toString()); } - - if(syncFolderDesc.getSelectedVRE()!=null) { - this.field_select_vre.addItem(syncFolderDesc.getSelectedVRE().getVreScope(), syncFolderDesc.getSelectedVRE().getVreName()); - this.field_select_vre.setValue(0, syncFolderDesc.getSelectedVRE().getVreName()); - this.field_select_vre.setSelectedValue(syncFolderDesc.getSelectedVRE().getVreName()); + + if(syncFolderDesc.getSelectedScope()!=null) { + String toValue = FormatUtil.toScopeValue(syncFolderDesc.getSelectedScope()); + this.field_select_scope.addItem(toValue, syncFolderDesc.getSelectedScope().getScopeName()); + this.field_select_scope.setValue(0, syncFolderDesc.getSelectedScope().getScopeName()); + this.field_select_scope.setSelectedValue(syncFolderDesc.getSelectedScope().getScopeName()); } - + ThSyncFolderDescriptor sfd = syncFolderDesc.getServerFolderDescriptor(); if(sfd!=null) { - + this.field_folder_path.setValue(sfd.getFolderPath()); this.field_folder_path.setTitle(sfd.getFolderPath()); this.field_folder_locked.setValue(sfd.isLocked()+""); - + ThSynchFolderConfiguration config = sfd.getConfiguration(); - + if(config!=null) { this.field_catalogue_name.setValue(config.getToCreateCatalogName()); this.field_catalogue_name.setTitle(config.getToCreateCatalogName()); this.field_remote_path.setValue(config.getRemotePath()); this.field_remote_path.setTitle(config.getRemotePath()); } - + ThProcessDescriptor lpd = sfd.getLocalProcessDescriptor(); if(lpd!=null) { //this.field_last_sync.setValue(DateTimeFormat.getFormat(DATE_FORMAT_YYYY_MM_DD_HH_MM_SS).format(new Date(lpd.getLaunchTime()))); ThSynchFolderConfiguration sc = lpd.getSynchConfiguration(); if(sc!=null) { - + //this.field_select_vre.setValue(sc.get, value); - + } } } } - + + /** + * Checks if is creates the configuration. + * + * @return true, if is creates the configuration + */ public boolean isCreateConfiguration() { return isCreateConfiguration; } - - + + /** * Validate submit. * @@ -259,19 +274,19 @@ public abstract class ShowThreddsFolderInfoView extends Composite { protected boolean validateSubmit() { cg_catalogue_name.setType(ControlGroupType.NONE); cg_remote_path.setType(ControlGroupType.NONE); - + if(field_catalogue_name.getValue()==null || field_catalogue_name.getValue().isEmpty()){ cg_catalogue_name.setType(ControlGroupType.ERROR); setError(true, "Unit Title field is required"); return false; } - + if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){ cg_remote_path.setType(ControlGroupType.ERROR); setError(true, "Folder Name field is required"); return false; } - + return true; } @@ -284,7 +299,7 @@ public abstract class ShowThreddsFolderInfoView extends Composite { public String getRemotePath() { return field_remote_path.getValue(); } - + /** * Gets the catalogue name. * @@ -293,24 +308,35 @@ public abstract class ShowThreddsFolderInfoView extends Composite { public String getCatalogueName(){ return field_catalogue_name.getValue(); } - - + + + /** - * Gets the unit description. + * Gets the selected scope. * - * @return the unit description + * @return the selected scope */ - public GcubeVRE getSelectedVRE(){ - String item = field_select_vre.getSelectedItemText(); - String text = field_select_vre.getSelectedValue(); - return mapVREs.get(item); + public GcubeScope getSelectedScope(){ + //String item = field_select_scope.getSelectedItemText(); + String scope = field_select_scope.getSelectedValue(); + return mapScopes.get(scope); } + /** + * Gets the pager. + * + * @return the pager + */ public Pager getPager() { return pager; } - + + /** + * Gets the main panel. + * + * @return the main panel + */ public HTMLPanel getMainPanel(){ return form_unit_fields; } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.ui.xml index 8cdc7b7..b7221d2 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.ui.xml @@ -40,9 +40,9 @@ - Published in the VRE + Published in the Scope - + diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/BeanConverter.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/BeanConverter.java index 1afedf0..9535990 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/BeanConverter.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/BeanConverter.java @@ -2,11 +2,13 @@ package org.gcube.portlets.widgets.wsthreddssync.server; import static org.gcube.common.authorization.client.Constants.authorizationService; +import org.apache.commons.lang.StringUtils; import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status; import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor; import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScopeType; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor; import org.slf4j.Logger; @@ -21,9 +23,9 @@ import org.slf4j.LoggerFactory; * Feb 16, 2018 */ public class BeanConverter { - + private static Logger logger = LoggerFactory.getLogger(BeanConverter.class); - + /** * To ws thredds folder config. * @@ -32,34 +34,69 @@ public class BeanConverter { * @return the ws thredds synch folder descriptor */ public static WsThreddsSynchFolderDescriptor toWsThreddsFolderConfig(ThSyncFolderDescriptor t, Sync_Status theStatus) { - + if(t==null) return null; - + WsThreddsSynchFolderDescriptor ws = new WsThreddsSynchFolderDescriptor(); ws.setServerFolderDescriptor(t); ws.setSyncStatus(theStatus); - - //FROM TARGET TOKEN TO SCOPE + + //FROM TARGET TOKEN TO SCOPE //t.getConfiguration().getTargetToken() - + if(t.getConfiguration().getTargetToken()!=null) { try { AuthorizationEntry entry = authorizationService().get(t.getConfiguration().getTargetToken()); String scope = entry.getContext(); - GcubeVRE selectedVRE = new GcubeVRE(scope, scope); - ws.setSelectedVRE(selectedVRE); - logger.debug("Resolved VRE: "+selectedVRE +" from token"); + GcubeScope selectedScope = new GcubeScope(toScopeTitle(scope), scope, toGcubeScope(scope)); + ws.setSelectedScope(selectedScope); + logger.debug("Resolved SCOPE: "+selectedScope +" from token"); }catch (Exception e) { // TODO: handle exception } } - - + + return ws; - - }; + + } + + public static String toScopeTitle(String scope){ + + if(scope==null || scope.isEmpty()) + return null; + + return scope.substring(scope.lastIndexOf("/")+1, scope.length()); + + } + + + + /** + * To gcube scope. + * + * @param scopeName the scope name + * @return the gcube scope type + */ + public static GcubeScopeType toGcubeScope(String scopeName){ + + if(scopeName==null) + return null; + + int count = StringUtils.countMatches(scopeName, "/"); + + if(count==1) + return GcubeScopeType.ROOT; + else if(count==2) + return GcubeScopeType.VO; + else if(count==3) + return GcubeScopeType.VRE; + + return null; + + } /** * To th synch folder configuration. @@ -69,17 +106,17 @@ public class BeanConverter { * @return the th synch folder configuration */ public static ThSynchFolderConfiguration toThSynchFolderConfiguration(WsThreddsSynchFolderConfiguration t, String targetScopeUserToken) { - + if(t==null) return null; - + ThSynchFolderConfiguration ts = new ThSynchFolderConfiguration(); ts.setFilter(t.getFilter()); ts.setRemotePath(t.getRemotePath()); ts.setTargetToken(targetScopeUserToken); ts.setToCreateCatalogName(t.getCatalogName()); return ts; - + }; } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SessionUtil.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SessionUtil.java deleted file mode 100644 index d97567c..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SessionUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.gcube.portlets.widgets.wsthreddssync.server; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpSession; - -import org.gcube.portlets.widgets.wsthreddssync.shared.TransferOnThreddsReport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SessionUtil { - - private static Logger logger = LoggerFactory.getLogger(SessionUtil.class); - - public static final String FOLDER_SYNCRONIZE_WITH_THREDDS = "Folder_Syncronize_With_Thredds"; - - /** - * Sets the folder publishing on thredds. - * - * @param session the session - * @param report the report - */ - public static void setTransferPublishingOnThredds(HttpSession session, TransferOnThreddsReport report){ - - Map map = getMapTransferPublishingOnThredds(session); - - if(map!=null) - map.put(report.getTransferId(), report); - } - - - /** - * Gets the folder publishing on thredds. - * - * @param session the session - * @return the folder publishing on thredds - */ - public static Map getMapTransferPublishingOnThredds(HttpSession session){ - - Map map = null; - try{ - - map = (Map) session.getAttribute(FOLDER_SYNCRONIZE_WITH_THREDDS); - - if(map==null){ - logger.info("Creating new map to trace syncronize with thredds... "); - map = new HashMap(); - session.setAttribute(FOLDER_SYNCRONIZE_WITH_THREDDS, map); - } - - }catch (Exception e) { - logger.error("an error occurred instancing PropertySpecialFolderReader ",e); - } - - return map; - - } - - - /** - * Ge transfer publishing on thredds for id. - * - * @param session the session - * @param transferId the transfer id - * @return the transfer on thredds report - */ - public static TransferOnThreddsReport geTransferPublishingOnThreddsForId(HttpSession session, String transferId){ - - Map map = getMapTransferPublishingOnThredds(session); - - if(map!=null){ - return map.get(transferId); - } - - return null; - - } - - - /** - * Prints the as sys out. - * - * @param txt the txt - */ - public static void printAsSysOut(String txt) { - - System.out.println(txt); - } - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java index ced1fc5..3536099 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java @@ -11,7 +11,8 @@ import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor; import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus; import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService; -import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScope; +import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeScopeType; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration; import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor; import org.gcube.vomanagement.usermanagement.GroupManager; @@ -101,7 +102,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem String targetScopeUserToken = null; ThSynchFolderConfiguration config = null; if(clientConfig!=null) { - targetScopeUserToken = PortalContext.getConfiguration().getCurrentUserToken(clientConfig.getTheVRE().getVreScope(), user.getUsername()); + targetScopeUserToken = PortalContext.getConfiguration().getCurrentUserToken(clientConfig.getSelectedScope().getScopeName(), user.getUsername()); config = BeanConverter.toThSynchFolderConfiguration(clientConfig, targetScopeUserToken); logger.debug("Creating server config "+config); } @@ -158,20 +159,22 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem * @throws Exception the exception */ @Override - public List getListOfVREsForLoggedUser() throws Exception{ + public List getListOfScopesForLoggedUser() throws Exception{ logger.debug("getListOfVREsForLoggedUser...: "); - SessionUtil.printAsSysOut("\n\n\n\n getListOfVREsForLoggedUser"); + //SessionUtil.printAsSysOut("\n\n\n\n getListOfVREsForLoggedUser"); //PortalContextInfo context = WsUtil.getPortalContext(this.getThreadLocalRequest()); GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest()); long userId = user.getUserId(); // Instanciate the manager GroupManager groupManager = new LiferayGroupManager(); - List listOfVres = new ArrayList(); + List listOfVres = new ArrayList(); if (!isWithinPortal()){ - listOfVres.add(new GcubeVRE("devVRE", "/gcube/devsec/devVRE")); - listOfVres.add(new GcubeVRE("NextNext", "/gcube/devNext/NextNext")); + listOfVres.add(new GcubeScope("devVRE", "/gcube/devsec/devVRE", GcubeScopeType.VRE)); + listOfVres.add(new GcubeScope("NextNext", "/gcube/devNext/NextNext", GcubeScopeType.VRE)); + listOfVres.add(new GcubeScope("/gcube/devNext", "/gcube/devNext", GcubeScopeType.VO)); + listOfVres.add(new GcubeScope("/gcube", "/gcube", GcubeScopeType.ROOT)); return listOfVres; } @@ -179,10 +182,20 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem List listOfGroups = groupManager.listGroupsByUser(userId); for (GCubeGroup gCubeGroup : listOfGroups) { + GcubeScopeType scopeType=null; if(groupManager.isVRE(gCubeGroup.getGroupId())){ - GcubeVRE gcubeVRE = new GcubeVRE(gCubeGroup.getGroupName(), groupManager.getInfrastructureScope(gCubeGroup.getGroupId())); + scopeType = GcubeScopeType.VRE; + }else if(groupManager.isVO(gCubeGroup.getGroupId())){ + scopeType = GcubeScopeType.VO; + }else if(groupManager.isRootVO(gCubeGroup.getGroupId())){ + scopeType = GcubeScopeType.ROOT; + } + + if(scopeType!=null){ + GcubeScope gcubeVRE = new GcubeScope(gCubeGroup.getGroupName(), groupManager.getInfrastructureScope(gCubeGroup.getGroupId()), scopeType); listOfVres.add(gcubeVRE); } + } } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScope.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScope.java new file mode 100644 index 0000000..ee841b5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScope.java @@ -0,0 +1,127 @@ +package org.gcube.portlets.widgets.wsthreddssync.shared; + + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + + +// TODO: Auto-generated Javadoc +/** + * The Class GcubeVRE. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Feb 14, 2018 + */ +public class GcubeScope implements Serializable, IsSerializable{ + + + /** + * + */ + private static final long serialVersionUID = -6427520549519606384L; + + + private GcubeScopeType scopeType; + + + private String scopeTitle; + + + private String scopeName; + + /** + * Instantiates a new gcube VRE. + */ + public GcubeScope() { + + } + + /** + * Instantiates a new gcube scope. + * + * @param scopeTitle the scope title + * @param scopeName the scope name + * @param scopeType the scope type + */ + public GcubeScope(String scopeTitle, String scopeName, GcubeScopeType scopeType) { + + super(); + this.scopeTitle = scopeTitle; + this.scopeName = scopeName; + this.scopeType = scopeType; + } + + + /** + * @return the scopeType + */ + public GcubeScopeType getScopeType() { + + return scopeType; + } + + + /** + * @return the scopeTitle + */ + public String getScopeTitle() { + + return scopeTitle; + } + + + /** + * @return the scopeName + */ + public String getScopeName() { + + return scopeName; + } + + + /** + * @param scopeType the scopeType to set + */ + public void setScopeType(GcubeScopeType scopeType) { + + this.scopeType = scopeType; + } + + + /** + * @param scopeTitle the scopeTitle to set + */ + public void setScopeTitle(String scopeTitle) { + + this.scopeTitle = scopeTitle; + } + + + /** + * @param scopeName the scopeName to set + */ + public void setScopeName(String scopeName) { + + this.scopeName = scopeName; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + + StringBuilder builder = new StringBuilder(); + builder.append("GcubeScope [scopeType="); + builder.append(scopeType); + builder.append(", scopeTitle="); + builder.append(scopeTitle); + builder.append(", scopeName="); + builder.append(scopeName); + builder.append("]"); + return builder.toString(); + } + + +} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScopeType.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScopeType.java new file mode 100644 index 0000000..2232214 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeScopeType.java @@ -0,0 +1,19 @@ +/** + * + */ +package org.gcube.portlets.widgets.wsthreddssync.shared; + + + +/** + * The Enum GcubeScopeType. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Mar 12, 2018 + */ +public enum GcubeScopeType { + + ROOT, + VO, + VRE +} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeVRE.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeVRE.java deleted file mode 100644 index 295f965..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GcubeVRE.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.gcube.portlets.widgets.wsthreddssync.shared; - - -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - - -// TODO: Auto-generated Javadoc -/** - * The Class GcubeVRE. - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * Feb 14, 2018 - */ -public class GcubeVRE implements Serializable, IsSerializable{ - - - /** - * - */ - private static final long serialVersionUID = -6427520549519606384L; - - /** The vre name. */ - private String vreName; - - /** The vre scope. */ - private String vreScope; - - /** - * Instantiates a new gcube VRE. - */ - public GcubeVRE() { - - } - - /** - * Instantiates a new gcube VRE. - * - * @param vreName the vre name - * @param vreScope the vre scope - */ - public GcubeVRE(String vreName, String vreScope) { - - super(); - this.vreName = vreName; - this.vreScope = vreScope; - } - - /** - * Gets the vre name. - * - * @return the vreName - */ - public String getVreName() { - - return vreName; - } - - - /** - * Gets the vre scope. - * - * @return the vreScope - */ - public String getVreScope() { - - return vreScope; - } - - - /** - * Sets the vre name. - * - * @param vreName the vreName to set - */ - public void setVreName(String vreName) { - - this.vreName = vreName; - } - - - /** - * Sets the vre scope. - * - * @param vreScope the vreScope to set - */ - public void setVreScope(String vreScope) { - - this.vreScope = vreScope; - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("GcubeVRE [vreName="); - builder.append(vreName); - builder.append(", vreScope="); - builder.append(vreScope); - builder.append("]"); - return builder.toString(); - } - - - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferOnThreddsReport.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferOnThreddsReport.java deleted file mode 100644 index cafebf3..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferOnThreddsReport.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * - */ -package org.gcube.portlets.widgets.wsthreddssync.shared; - -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - - -// TODO: Auto-generated Javadoc -/** - * The Class TransferOnThreddsReport. - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * Feb 7, 2018 - */ -public class TransferOnThreddsReport implements Serializable, IsSerializable{ - - /** - * - */ - private static final long serialVersionUID = 326492579557983L; - - /** The transfer id. */ - private String transferId; - - /** The folder id. */ - private String folderId; - - /** The on error. */ - private Boolean onError = false; - - /** The report message. */ - private String reportMessage = null; - - /** The report created on workspace. */ - private Boolean reportCreatedOnWorkspace = false; - - /** - * Instantiates a new transfer on thredds report. - */ - public TransferOnThreddsReport() { - - } - - /** - * Instantiates a new transfer on thredds report. - * - * @param transferId the transfer id - * @param folderId the folder id - * @param onError the on error - * @param reportMessage the report message - */ - public TransferOnThreddsReport(String transferId, String folderId, Boolean onError, String reportMessage) { - - this.transferId = transferId; - this.folderId = folderId; - this.onError = onError; - this.reportMessage = reportMessage; - } - - /** - * Sets the report created on workspace. - * - * @param reportCreatedOnWorkspace the reportCreated to set - */ - public void setReportCreatedOnWorkspace(Boolean reportCreatedOnWorkspace) { - - this.reportCreatedOnWorkspace = reportCreatedOnWorkspace; - } - - - /** - * Checks if is transferring report available. - * - * @return the boolean - */ - public Boolean isTransferringReportAvailable() { - - return reportCreatedOnWorkspace; - } - - - /** - * Gets the transfer id. - * - * @return the transferId - */ - public String getTransferId() { - - return transferId; - } - - - /** - * Gets the folder id. - * - * @return the folderId - */ - public String getFolderId() { - - return folderId; - } - - - /** - * Gets the on error. - * - * @return the onError - */ - public Boolean isOnError() { - - return onError; - } - - - /** - * Sets the transfer id. - * - * @param transferId the transferId to set - */ - public void setTransferId(String transferId) { - - this.transferId = transferId; - } - - - /** - * Sets the folder id. - * - * @param folderId the folderId to set - */ - public void setFolderId(String folderId) { - - this.folderId = folderId; - } - - - /** - * Sets the on error. - * - * @param onError the onError to set - */ - public void setOnError(Boolean onError) { - - this.onError = onError; - } - - - - - - /** - * Gets the report message. - * - * @return the reportMessage - */ - public String getReportMessage() { - - return reportMessage; - } - - - /** - * Sets the report message. - * - * @param reportMessage the reportMessage to set - */ - public void setReportMessage(String reportMessage) { - - this.reportMessage = reportMessage; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("TransferOnThreddsReport [transferId="); - builder.append(transferId); - builder.append(", folderId="); - builder.append(folderId); - builder.append(", onError="); - builder.append(onError); - builder.append(", reportMessage="); - builder.append(reportMessage); - builder.append(", reportCreated="); - builder.append(reportCreatedOnWorkspace); - builder.append("]"); - return builder.toString(); - } - - - - - - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferToThreddsProperty.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferToThreddsProperty.java deleted file mode 100644 index b2f34f4..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/TransferToThreddsProperty.java +++ /dev/null @@ -1,232 +0,0 @@ -/** - * - */ -package org.gcube.portlets.widgets.wsthreddssync.shared; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; - - - - -// TODO: Auto-generated Javadoc -/** - * The Class TransferToThreddsProperty. - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * Feb 7, 2018 - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlRootElement -public class TransferToThreddsProperty implements Serializable{ - - - /** The folder id. */ - private String folderId; - - /** The catalogue name. */ - private String catalogueName; - - /** The vre name. */ - private String vreName; - - /** The vre scope. */ - private String vreScope; - - /** The metadata folder id. */ - private String metadataFolderId; - - /** The metadata folder name. */ - private String metadataFolderName; - - - /** - * Instantiates a new transfering to thredds property. - */ - public TransferToThreddsProperty() { - - } - - /** - * Instantiates a new transfering to thredds property. - * - * @param folderId the folder id - * @param catalogueName the catalogue name - * @param vreName the vre name - * @param vreScope the vre scope - * @param metadataFolderId the metadata folder id - * @param metadataFolderName the metadata folder name - */ - public TransferToThreddsProperty( - String folderId, String catalogueName, String vreName, - String vreScope, String metadataFolderId, String metadataFolderName) { - - super(); - this.folderId = folderId; - this.catalogueName = catalogueName; - this.vreName = vreName; - this.vreScope = vreScope; - this.metadataFolderId = metadataFolderId; - this.metadataFolderName = metadataFolderName; - } - - - /** - * Gets the folder id. - * - * @return the folderId - */ - public String getFolderId() { - - return folderId; - } - - - /** - * Gets the catalogue name. - * - * @return the catalogueName - */ - public String getCatalogueName() { - - return catalogueName; - } - - - /** - * Gets the vre name. - * - * @return the vreName - */ - public String getVreName() { - - return vreName; - } - - - /** - * Gets the vre scope. - * - * @return the vreScope - */ - public String getVreScope() { - - return vreScope; - } - - - /** - * Gets the metadata folder id. - * - * @return the metadataFolderId - */ - public String getMetadataFolderId() { - - return metadataFolderId; - } - - - /** - * Gets the metadata folder name. - * - * @return the metadataFolderName - */ - public String getMetadataFolderName() { - - return metadataFolderName; - } - - - /** - * Sets the folder id. - * - * @param folderId the folderId to set - */ - public void setFolderId(String folderId) { - - this.folderId = folderId; - } - - - /** - * Sets the catalogue name. - * - * @param catalogueName the catalogueName to set - */ - public void setCatalogueName(String catalogueName) { - - this.catalogueName = catalogueName; - } - - - /** - * Sets the vre name. - * - * @param vreName the vreName to set - */ - public void setVreName(String vreName) { - - this.vreName = vreName; - } - - - /** - * Sets the vre scope. - * - * @param vreScope the vreScope to set - */ - public void setVreScope(String vreScope) { - - this.vreScope = vreScope; - } - - - /** - * Sets the metadata folder id. - * - * @param metadataFolderId the metadataFolderId to set - */ - public void setMetadataFolderId(String metadataFolderId) { - - this.metadataFolderId = metadataFolderId; - } - - - /** - * Sets the metadata folder name. - * - * @param metadataFolderName the metadataFolderName to set - */ - public void setMetadataFolderName(String metadataFolderName) { - - this.metadataFolderName = metadataFolderName; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("TransferToThreddsProperty [folderId="); - builder.append(folderId); - builder.append(", catalogueName="); - builder.append(catalogueName); - builder.append(", vreName="); - builder.append(vreName); - builder.append(", vreScope="); - builder.append(vreScope); - builder.append(", metadataFolderId="); - builder.append(metadataFolderId); - builder.append(", metadataFolderName="); - builder.append(metadataFolderName); - builder.append("]"); - return builder.toString(); - } - - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderConfiguration.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderConfiguration.java index 0403a60..f612064 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderConfiguration.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderConfiguration.java @@ -13,48 +13,47 @@ import org.gcube.portal.wssynclibrary.shared.thredds.Status; * Feb 16, 2018 */ public class WsThreddsSynchFolderConfiguration implements Serializable{ - + /** - * + * */ private static final long serialVersionUID = -1140248888970305126L; /** The remote path. */ private String remotePath; - - private GcubeVRE theSelectedVRE; + + private GcubeScope selectedScope; /** The filter. */ private String filter; /** The to create catalog name. */ private String catalogName; - + private Status status; //just for serialization - - + + /** * Instantiates a new ws thredds synch folder configuration. */ public WsThreddsSynchFolderConfiguration() { // TODO Auto-generated constructor stub } - - + + /** * Instantiates a new ws thredds synch folder configuration. * * @param remotePath the remote path - * @param theVRE the the VRE + * @param theVRE the the vre * @param filter the filter * @param catalogName the catalog name - * @param serverConf the server conf */ - public WsThreddsSynchFolderConfiguration(String remotePath, GcubeVRE theVRE, String filter, String catalogName) { + public WsThreddsSynchFolderConfiguration(String remotePath, GcubeScope theVRE, String filter, String catalogName) { super(); this.remotePath = remotePath; - this.theSelectedVRE = theVRE; + this.selectedScope = theVRE; this.filter = filter; this.catalogName = catalogName; } @@ -77,24 +76,45 @@ public class WsThreddsSynchFolderConfiguration implements Serializable{ this.remotePath = remotePath; } - /** - * Gets the the VRE. - * - * @return the the VRE - */ - public GcubeVRE getTheVRE() { - return theSelectedVRE; - } /** - * Sets the the VRE. - * - * @param theVRE the new the VRE + * @return the selectedScope */ - public void setTheVRE(GcubeVRE theVRE) { - this.theSelectedVRE = theVRE; + public GcubeScope getSelectedScope() { + + return selectedScope; } + + /** + * @return the status + */ + public Status getStatus() { + + return status; + } + + + + /** + * @param selectedScope the selectedScope to set + */ + public void setSelectedScope(GcubeScope selectedScope) { + + this.selectedScope = selectedScope; + } + + + + /** + * @param status the status to set + */ + public void setStatus(Status status) { + + this.status = status; + } + + /** * Gets the filter. * @@ -130,22 +150,29 @@ public class WsThreddsSynchFolderConfiguration implements Serializable{ public void setCatalogName(String catalogName) { this.catalogName = catalogName; } - + + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { + StringBuilder builder = new StringBuilder(); - builder.append("WsThreddsSynchFolderDescriptor [remotePath="); + builder.append("WsThreddsSynchFolderConfiguration [remotePath="); builder.append(remotePath); - builder.append(", theSelectedVRE="); - builder.append(theSelectedVRE); + builder.append(", selectedScope="); + builder.append(selectedScope); builder.append(", filter="); builder.append(filter); builder.append(", catalogName="); builder.append(catalogName); + builder.append(", status="); + builder.append(status); builder.append("]"); return builder.toString(); } + + + } diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderDescriptor.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderDescriptor.java index 156f1b6..906401a 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderDescriptor.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/WsThreddsSynchFolderDescriptor.java @@ -16,11 +16,11 @@ import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor; public class WsThreddsSynchFolderDescriptor implements Serializable { /** - * + * */ private static final long serialVersionUID = -5395986188613871699L; - private GcubeVRE selectedVRE; + private GcubeScope selectedScope; private ThSyncFolderDescriptor serverFolderDescriptor; @@ -33,28 +33,32 @@ public class WsThreddsSynchFolderDescriptor implements Serializable { // TODO Auto-generated constructor stub } + /** * Instantiates a new ws thredds synch folder descriptor. * - * @param selectedVRE the selected VRE - * @param serverFolderDescriptor the server folder descriptor + * @param selectedScope the selected scope + * @param serverFolderDescriptor the server folder descriptor * @param syncStatus the sync status */ - public WsThreddsSynchFolderDescriptor(GcubeVRE selectedVRE, ThSyncFolderDescriptor serverFolderDescriptor, + public WsThreddsSynchFolderDescriptor(GcubeScope selectedScope, ThSyncFolderDescriptor serverFolderDescriptor, Sync_Status syncStatus) { super(); - this.selectedVRE = selectedVRE; + this.selectedScope = selectedScope; this.serverFolderDescriptor = serverFolderDescriptor; this.syncStatus = syncStatus; } + + /** - * Gets the selected VRE. + * Gets the selected scope. * - * @return the selected VRE + * @return the selectedScope */ - public GcubeVRE getSelectedVRE() { - return selectedVRE; + public GcubeScope getSelectedScope() { + + return selectedScope; } /** @@ -76,14 +80,14 @@ public class WsThreddsSynchFolderDescriptor implements Serializable { return syncStatus; } + /** - * Sets the selected VRE. + * Sets the selected scope. * - * @param selectedVRE - * the new selected VRE + * @param selectedVRE the new selected scope */ - public void setSelectedVRE(GcubeVRE selectedVRE) { - this.selectedVRE = selectedVRE; + public void setSelectedScope(GcubeScope selectedVRE) { + this.selectedScope = selectedVRE; } /** @@ -105,11 +109,14 @@ public class WsThreddsSynchFolderDescriptor implements Serializable { this.serverFolderDescriptor = serverFolderDescriptor; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("WsThreddsSynchFolderDescriptor [selectedVRE="); - builder.append(selectedVRE); + builder.append(selectedScope); builder.append(", serverFolderDescriptor="); builder.append(serverFolderDescriptor); builder.append(", syncStatus="); @@ -117,6 +124,6 @@ public class WsThreddsSynchFolderDescriptor implements Serializable { builder.append("]"); return builder.toString(); } - + }