migrating to shub
This commit is contained in:
parent
dc656a78e2
commit
7280ed8138
|
@ -3,10 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialColumn;
|
|
||||||
import gwt.material.design.client.ui.MaterialLink;
|
|
||||||
import gwt.material.design.client.ui.MaterialRow;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.event.OrderDataByEvent;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.event.OrderDataByEvent;
|
||||||
|
@ -17,6 +13,10 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.ui.PopupPanel;
|
import com.google.gwt.user.client.ui.PopupPanel;
|
||||||
|
|
||||||
|
import gwt.material.design.client.ui.MaterialColumn;
|
||||||
|
import gwt.material.design.client.ui.MaterialLink;
|
||||||
|
import gwt.material.design.client.ui.MaterialRow;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -81,13 +81,13 @@ public class Util {
|
||||||
if (item.isSharedFolder()) return WorkspaceExplorerResources.INSTANCE.shared_folder();
|
if (item.isSharedFolder()) return WorkspaceExplorerResources.INSTANCE.shared_folder();
|
||||||
else return WorkspaceExplorerResources.INSTANCE.folder();
|
else return WorkspaceExplorerResources.INSTANCE.folder();
|
||||||
}
|
}
|
||||||
case EXTERNAL_IMAGE: return WorkspaceLightTreeResources.INSTANCE.external_image();
|
// case EXTERNAL_IMAGE: return WorkspaceLightTreeResources.INSTANCE.external_image();
|
||||||
case EXTERNAL_FILE: return WorkspaceLightTreeResources.INSTANCE.external_file();
|
// case EXTERNAL_FILE: return WorkspaceLightTreeResources.INSTANCE.external_file();
|
||||||
case EXTERNAL_PDF_FILE: return WorkspaceLightTreeResources.INSTANCE.external_pdf();
|
// case EXTERNAL_PDF_FILE: return WorkspaceLightTreeResources.INSTANCE.external_pdf();
|
||||||
case EXTERNAL_URL: return WorkspaceLightTreeResources.INSTANCE.external_url();
|
// case EXTERNAL_URL: return WorkspaceLightTreeResources.INSTANCE.external_url();
|
||||||
case REPORT_TEMPLATE: return WorkspaceLightTreeResources.INSTANCE.report_template();
|
// case REPORT_TEMPLATE: return WorkspaceLightTreeResources.INSTANCE.report_template();
|
||||||
case REPORT: return WorkspaceLightTreeResources.INSTANCE.report();
|
// case REPORT: return WorkspaceLightTreeResources.INSTANCE.report();
|
||||||
case QUERY: return WorkspaceLightTreeResources.INSTANCE.query();
|
// case QUERY: return WorkspaceLightTreeResources.INSTANCE.query();
|
||||||
case DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.document();
|
case DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.document();
|
||||||
case METADATA: return WorkspaceLightTreeResources.INSTANCE.metadata();
|
case METADATA: return WorkspaceLightTreeResources.INSTANCE.metadata();
|
||||||
case PDF_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.pdf_document();
|
case PDF_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.pdf_document();
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
|
|
||||||
import gwt.material.design.client.constants.IconPosition;
|
|
||||||
import gwt.material.design.client.constants.IconType;
|
|
||||||
import gwt.material.design.client.ui.MaterialLink;
|
|
||||||
import gwt.material.design.client.ui.MaterialNavBar;
|
|
||||||
import gwt.material.design.client.ui.MaterialNavSection;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -28,6 +22,12 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import gwt.material.design.client.constants.IconPosition;
|
||||||
|
import gwt.material.design.client.constants.IconType;
|
||||||
|
import gwt.material.design.client.ui.MaterialLink;
|
||||||
|
import gwt.material.design.client.ui.MaterialNavBar;
|
||||||
|
import gwt.material.design.client.ui.MaterialNavSection;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialFooter;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
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.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import gwt.material.design.client.ui.MaterialFooter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialToast;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -42,6 +40,8 @@ import com.google.gwt.user.client.ui.DockPanel;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
|
||||||
|
import gwt.material.design.client.ui.MaterialToast;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WorkspaceResourcesExplorerPanel.
|
* The Class WorkspaceResourcesExplorerPanel.
|
||||||
|
|
|
@ -3,13 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
||||||
|
|
||||||
import gwt.material.design.client.base.MaterialImageCell;
|
|
||||||
import gwt.material.design.client.constants.IconPosition;
|
|
||||||
import gwt.material.design.client.constants.IconType;
|
|
||||||
import gwt.material.design.client.constants.ImageType;
|
|
||||||
import gwt.material.design.client.ui.MaterialIcon;
|
|
||||||
import gwt.material.design.client.ui.MaterialImage;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -48,6 +41,13 @@ import com.google.gwt.user.cellview.client.TextColumn;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
|
||||||
|
import gwt.material.design.client.base.MaterialImageCell;
|
||||||
|
import gwt.material.design.client.constants.IconPosition;
|
||||||
|
import gwt.material.design.client.constants.IconType;
|
||||||
|
import gwt.material.design.client.constants.ImageType;
|
||||||
|
import gwt.material.design.client.ui.MaterialIcon;
|
||||||
|
import gwt.material.design.client.ui.MaterialImage;
|
||||||
/**
|
/**
|
||||||
* The Class PackagesTable.
|
* The Class PackagesTable.
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialIcon;
|
|
||||||
|
|
||||||
import com.google.gwt.cell.client.AbstractCell;
|
import com.google.gwt.cell.client.AbstractCell;
|
||||||
import com.google.gwt.cell.client.ValueUpdater;
|
import com.google.gwt.cell.client.ValueUpdater;
|
||||||
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.dom.client.NativeEvent;
|
import com.google.gwt.dom.client.NativeEvent;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
|
||||||
|
import gwt.material.design.client.ui.MaterialIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Mar 8, 2016
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Mar 8, 2016
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialLink;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
|
||||||
|
@ -19,6 +17,8 @@ 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.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import gwt.material.design.client.ui.MaterialLink;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,156 +4,79 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemCategory;
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.WorkspaceNavigatorServiceException;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface WorkspaceExplorerAppService.
|
* The Interface WorkspaceExplorerAppService.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 3, 2017
|
||||||
* Jul 3, 2017
|
|
||||||
*/
|
*/
|
||||||
@RemoteServiceRelativePath("WorkspaceExplorerAppService")
|
@RemoteServiceRelativePath("WorkspaceExplorerAppService")
|
||||||
public interface WorkspaceExplorerAppService extends RemoteService {
|
public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the breadcrumbs by item identifier.
|
|
||||||
*
|
|
||||||
* @param itemIdentifier the item identifier
|
|
||||||
* @param includeItemAsParent the include item as parent
|
|
||||||
* @return the breadcrumbs by item identifier
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier,
|
|
||||||
boolean includeItemAsParent) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check name.
|
|
||||||
*
|
|
||||||
* @param name the name
|
|
||||||
* @return true, if successful
|
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
|
||||||
*/
|
|
||||||
boolean checkName(String name) throws WorkspaceNavigatorServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the folder.
|
* Gets the folder.
|
||||||
*
|
*
|
||||||
* @param folder the folder
|
* @param folder the folder @param showableTypes the showable types @param
|
||||||
* @param showableTypes the showable types
|
* purgeEmpyFolders the purge empy folders @param filterCriteria
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
* the filter criteria @return the folder @throws
|
||||||
* @param filterCriteria the filter criteria
|
* WorkspaceNavigatorServiceException the workspace navigator
|
||||||
* @return the folder
|
* service exception @throws
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
|
||||||
* @throws
|
|
||||||
*/
|
*/
|
||||||
Item getFolder(
|
Item getFolder(Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
||||||
Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
throws WorkspaceNavigatorServiceException;
|
||||||
FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the root.
|
* Gets the root.
|
||||||
*
|
*
|
||||||
* @param showableTypes the showable types
|
* @param showableTypes the showable types
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
* @param filterCriteria the filter criteria
|
* @param filterCriteria the filter criteria
|
||||||
* @return the root
|
* @return the root
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
* @throws WorkspaceNavigatorServiceException the workspace navigator service
|
||||||
|
* exception
|
||||||
*/
|
*/
|
||||||
Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
||||||
FilterCriteria filterCriteria)
|
|
||||||
throws WorkspaceNavigatorServiceException;
|
throws WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my special folder.
|
* Gets the my special folder.
|
||||||
*
|
*
|
||||||
* @param showableTypes the showable types
|
* @param showableTypes the showable types
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
* @param filterCriteria the filter criteria
|
* @param filterCriteria the filter criteria
|
||||||
* @return the my special folder
|
* @return the my special folder
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
* @throws WorkspaceNavigatorServiceException the workspace navigator service
|
||||||
|
* exception
|
||||||
*/
|
*/
|
||||||
Item getMySpecialFolder(List<ItemType> showableTypes,
|
Item getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
||||||
boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
|
||||||
throws WorkspaceNavigatorServiceException;
|
throws WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the item by category.
|
|
||||||
*
|
|
||||||
* @param category the category
|
|
||||||
* @return the item by category
|
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
|
||||||
*/
|
|
||||||
Item getItemByCategory(ItemCategory category)throws WorkspaceNavigatorServiceException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the size by item id.
|
|
||||||
*
|
|
||||||
* @param itemId the item id
|
|
||||||
* @return the size by item id
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
Long getSizeByItemId(String itemId) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the mime type.
|
|
||||||
*
|
|
||||||
* @param itemId the item id
|
|
||||||
* @return the mime type
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
String getMimeType(String itemId) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the user acl for folder id.
|
|
||||||
*
|
|
||||||
* @param folderId the folder id
|
|
||||||
* @return the user acl for folder id
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
String getUserACLForFolderId(String folderId) throws Exception;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the readable size by item id.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @return the readable size by item id
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
String getReadableSizeByItemId(String id) throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the breadcrumbs by item identifier to parent limit.
|
* Gets the breadcrumbs by item identifier to parent limit.
|
||||||
*
|
*
|
||||||
* @param itemIdentifier the item identifier
|
* @param itemIdentifier the item identifier
|
||||||
* @param parentLimit the parent limit
|
* @param parentLimit the parent limit
|
||||||
* @param includeItemAsParent the include item as parent
|
* @param includeItemAsParent the include item as parent
|
||||||
* @return the breadcrumbs by item identifier to parent limit
|
* @return the breadcrumbs by item identifier to parent limit
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
List<Item> getBreadcrumbsByItemIdentifierToParentLimit(
|
List<Item> getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit,
|
||||||
String itemIdentifier, String parentLimit,
|
|
||||||
boolean includeItemAsParent) throws Exception;
|
boolean includeItemAsParent) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the folder.
|
* Gets the breadcrumbs by item identifier.
|
||||||
*
|
*
|
||||||
* @param nameFolder the name folder
|
* @param itemIdentifier the item identifier
|
||||||
* @param description the description
|
* @param includeItemAsParent the include item as parent
|
||||||
* @param parentId the parent id
|
* @return the breadcrumbs by item identifier
|
||||||
* @return the item
|
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
Item createFolder(
|
List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception;
|
||||||
String nameFolder, String description, String parentId)
|
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the public link for item id.
|
* Gets the public link for item id.
|
||||||
|
@ -162,8 +85,7 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
* @return the public link for item id
|
* @return the public link for item id
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
String getPublicLinkForItemId(String itemId)
|
String getPublicLinkForItemId(String itemId) throws Exception;
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the folder id from encrypted.
|
* Gets the folder id from encrypted.
|
||||||
|
@ -172,6 +94,77 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
* @return the folder id from encrypted
|
* @return the folder id from encrypted
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
String getFolderIdFromEncrypted(String encryptedFolderId)
|
String getFolderIdFromEncrypted(String encryptedFolderId) throws Exception;
|
||||||
throws Exception;
|
//
|
||||||
|
// /**
|
||||||
|
// * Check name.
|
||||||
|
// *
|
||||||
|
// * @param name the name
|
||||||
|
// * @return true, if successful
|
||||||
|
// * @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||||
|
// */
|
||||||
|
// boolean checkName(String name) throws WorkspaceNavigatorServiceException;
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the item by category.
|
||||||
|
// *
|
||||||
|
// * @param category the category
|
||||||
|
// * @return the item by category
|
||||||
|
// * @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||||
|
// */
|
||||||
|
// Item getItemByCategory(ItemCategory category)throws WorkspaceNavigatorServiceException;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the size by item id.
|
||||||
|
// *
|
||||||
|
// * @param itemId the item id
|
||||||
|
// * @return the size by item id
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// Long getSizeByItemId(String itemId) throws Exception;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the mime type.
|
||||||
|
// *
|
||||||
|
// * @param itemId the item id
|
||||||
|
// * @return the mime type
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// String getMimeType(String itemId) throws Exception;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the user acl for folder id.
|
||||||
|
// *
|
||||||
|
// * @param folderId the folder id
|
||||||
|
// * @return the user acl for folder id
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// String getUserACLForFolderId(String folderId) throws Exception;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the readable size by item id.
|
||||||
|
// *
|
||||||
|
// * @param id the id
|
||||||
|
// * @return the readable size by item id
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// String getReadableSizeByItemId(String id) throws Exception;
|
||||||
|
//
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Creates the folder.
|
||||||
|
// *
|
||||||
|
// * @param nameFolder the name folder
|
||||||
|
// * @param description the description
|
||||||
|
// * @param parentId the parent id
|
||||||
|
// * @return the item
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// Item createFolder(
|
||||||
|
// String nameFolder, String description, String parentId)
|
||||||
|
// throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,162 +7,21 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemCategory;
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface WorkspaceExplorerAppServiceAsync.
|
* The Interface WorkspaceExplorerAppServiceAsync.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 3, 2017
|
||||||
* Jul 3, 2017
|
|
||||||
*/
|
*/
|
||||||
public interface WorkspaceExplorerAppServiceAsync {
|
public interface WorkspaceExplorerAppServiceAsync {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the root.
|
|
||||||
*
|
|
||||||
* @param showableTypes the showable types
|
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
|
||||||
* @param filterCriteria the filter criteria
|
|
||||||
* @param callback the callback
|
|
||||||
* @return the root
|
|
||||||
*/
|
|
||||||
public void getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
|
||||||
FilterCriteria filterCriteria, AsyncCallback<Item> callback);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check name.
|
|
||||||
*
|
|
||||||
* @param name the name
|
|
||||||
* @param callback the callback
|
|
||||||
*/
|
|
||||||
public void checkName(String name, AsyncCallback<Boolean> callback);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the folder.
|
|
||||||
*
|
|
||||||
* @param folder the folder
|
|
||||||
* @param showableTypes the showable types
|
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
|
||||||
* @param filterCriteria the filter criteria
|
|
||||||
* @param callback the callback
|
|
||||||
* @return the folder
|
|
||||||
*/
|
|
||||||
public void getFolder(Item folder, List<ItemType> showableTypes,
|
|
||||||
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
|
|
||||||
AsyncCallback<Item> callback);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the breadcrumbs by item identifier.
|
|
||||||
*
|
|
||||||
* @param itemIdentifier the item identifier
|
|
||||||
* @param includeItemAsParent the include item as parent
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the breadcrumbs by item identifier
|
|
||||||
*/
|
|
||||||
public void getBreadcrumbsByItemIdentifier(String itemIdentifier,
|
|
||||||
boolean includeItemAsParent, AsyncCallback<List<Item>> asyncCallback);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the my special folder.
|
|
||||||
*
|
|
||||||
* @param showableTypes the showable types
|
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
|
||||||
* @param filterCriteria the filter criteria
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the my special folder
|
|
||||||
*/
|
|
||||||
public void getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria, AsyncCallback<Item> asyncCallback);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the item by category.
|
|
||||||
*
|
|
||||||
* @param category the category
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the item by category
|
|
||||||
*/
|
|
||||||
public void getItemByCategory(ItemCategory category, AsyncCallback<Item> asyncCallback);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the size by item id.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the size by item id
|
|
||||||
*/
|
|
||||||
public void getSizeByItemId(String id, AsyncCallback<Long> asyncCallback);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the readable size by item id.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the readable size by item id
|
|
||||||
*/
|
|
||||||
public void getReadableSizeByItemId(String id, AsyncCallback<String> asyncCallback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the mime type.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the mime type
|
|
||||||
*/
|
|
||||||
public void getMimeType(String id, AsyncCallback<String> asyncCallback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the user acl for folder id.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param asyncCallback the async callback
|
|
||||||
* @return the user acl for folder id
|
|
||||||
*/
|
|
||||||
public void getUserACLForFolderId(String id,
|
|
||||||
AsyncCallback<String> asyncCallback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the breadcrumbs by item identifier to parent limit.
|
|
||||||
*
|
|
||||||
* @param itemIdentifier the item identifier
|
|
||||||
* @param parentLimit the parent limit
|
|
||||||
* @param includeItemAsParent the include item as parent
|
|
||||||
* @param callback the callback
|
|
||||||
* @return the breadcrumbs by item identifier to parent limit
|
|
||||||
*/
|
|
||||||
void getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier,
|
|
||||||
String parentLimit, boolean includeItemAsParent,
|
|
||||||
AsyncCallback<List<Item>> callback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the folder.
|
|
||||||
*
|
|
||||||
* @param nameFolder the name folder
|
|
||||||
* @param description the description
|
|
||||||
* @param parentId the parent id
|
|
||||||
* @param callback the callback
|
|
||||||
*/
|
|
||||||
void createFolder(
|
|
||||||
String nameFolder, String description, String parentId,
|
|
||||||
AsyncCallback<Item> callback);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the public link for item id.
|
* Gets the public link for item id.
|
||||||
*
|
*
|
||||||
* @param itemId the item id
|
* @param itemId the item id
|
||||||
* @param callback the callback
|
* @param callback the callback
|
||||||
* @return the public link for item id
|
* @return the public link for item id
|
||||||
*/
|
*/
|
||||||
|
@ -172,10 +31,140 @@ public interface WorkspaceExplorerAppServiceAsync {
|
||||||
* Gets the folder id from encrypted.
|
* Gets the folder id from encrypted.
|
||||||
*
|
*
|
||||||
* @param encodedFolderID the encoded folder id
|
* @param encodedFolderID the encoded folder id
|
||||||
* @param callback the callback
|
* @param callback the callback
|
||||||
* @return the folder id from encrypted
|
* @return the folder id from encrypted
|
||||||
*/
|
*/
|
||||||
void getFolderIdFromEncrypted(
|
void getFolderIdFromEncrypted(String encodedFolderID, AsyncCallback<String> callback);
|
||||||
String encodedFolderID, AsyncCallback<String> callback);
|
|
||||||
|
/**
|
||||||
|
* Gets the root.
|
||||||
|
*
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @param callback the callback
|
||||||
|
* @return the root
|
||||||
|
*/
|
||||||
|
public void getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria,
|
||||||
|
AsyncCallback<Item> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the folder.
|
||||||
|
*
|
||||||
|
* @param folder the folder
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @param callback the callback
|
||||||
|
* @return the folder
|
||||||
|
*/
|
||||||
|
public void getFolder(Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||||
|
FilterCriteria filterCriteria, AsyncCallback<Item> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the breadcrumbs by item identifier.
|
||||||
|
*
|
||||||
|
* @param itemIdentifier the item identifier
|
||||||
|
* @param includeItemAsParent the include item as parent
|
||||||
|
* @param asyncCallback the async callback
|
||||||
|
* @return the breadcrumbs by item identifier
|
||||||
|
*/
|
||||||
|
public void getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent,
|
||||||
|
AsyncCallback<List<Item>> asyncCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the my special folder.
|
||||||
|
*
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @param asyncCallback the async callback
|
||||||
|
* @return the my special folder
|
||||||
|
*/
|
||||||
|
public void getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||||
|
FilterCriteria filterCriteria, AsyncCallback<Item> asyncCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the breadcrumbs by item identifier to parent limit.
|
||||||
|
*
|
||||||
|
* @param itemIdentifier the item identifier
|
||||||
|
* @param parentLimit the parent limit
|
||||||
|
* @param includeItemAsParent the include item as parent
|
||||||
|
* @param callback the callback
|
||||||
|
* @return the breadcrumbs by item identifier to parent limit
|
||||||
|
*/
|
||||||
|
void getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit,
|
||||||
|
boolean includeItemAsParent, AsyncCallback<List<Item>> callback);
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Check name.
|
||||||
|
// *
|
||||||
|
// * @param name the name
|
||||||
|
// * @param callback the callback
|
||||||
|
// */
|
||||||
|
// public void checkName(String name, AsyncCallback<Boolean> callback);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the item by category.
|
||||||
|
// *
|
||||||
|
// * @param category the category
|
||||||
|
// * @param asyncCallback the async callback
|
||||||
|
// * @return the item by category
|
||||||
|
// */
|
||||||
|
// public void getItemByCategory(ItemCategory category, AsyncCallback<Item> asyncCallback);
|
||||||
|
//
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Gets the size by item id.
|
||||||
|
// *
|
||||||
|
// * @param id the id
|
||||||
|
// * @param asyncCallback the async callback
|
||||||
|
// * @return the size by item id
|
||||||
|
// */
|
||||||
|
// public void getSizeByItemId(String id, AsyncCallback<Long> asyncCallback);
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Gets the readable size by item id.
|
||||||
|
// *
|
||||||
|
// * @param id the id
|
||||||
|
// * @param asyncCallback the async callback
|
||||||
|
// * @return the readable size by item id
|
||||||
|
// */
|
||||||
|
// public void getReadableSizeByItemId(String id, AsyncCallback<String> asyncCallback);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the mime type.
|
||||||
|
// *
|
||||||
|
// * @param id the id
|
||||||
|
// * @param asyncCallback the async callback
|
||||||
|
// * @return the mime type
|
||||||
|
// */
|
||||||
|
// public void getMimeType(String id, AsyncCallback<String> asyncCallback);
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Gets the user acl for folder id.
|
||||||
|
// *
|
||||||
|
// * @param id the id
|
||||||
|
// * @param asyncCallback the async callback
|
||||||
|
// * @return the user acl for folder id
|
||||||
|
// */
|
||||||
|
// public void getUserACLForFolderId(String id,
|
||||||
|
// AsyncCallback<String> asyncCallback);
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Creates the folder.
|
||||||
|
// *
|
||||||
|
// * @param nameFolder the name folder
|
||||||
|
// * @param description the description
|
||||||
|
// * @param parentId the parent id
|
||||||
|
// * @param callback the callback
|
||||||
|
// */
|
||||||
|
// void createFolder(String nameFolder, String description, String parentId, AsyncCallback<Item> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,24 +21,21 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.Query;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.Report;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.Report;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ReportTemplate;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ReportTemplate;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ts.TimeSeries;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ts.TimeSeries;
|
||||||
import org.gcube.common.homelibrary.util.Extensions;
|
import org.gcube.common.homelibrary.util.Extensions;
|
||||||
import org.gcube.common.homelibrary.util.MimeTypeUtil;
|
import org.gcube.common.homelibrary.util.MimeTypeUtil;
|
||||||
import org.gcube.common.homelibrary.util.zip.ZipUtil;
|
import org.gcube.common.homelibrary.util.zip.ZipUtil;
|
||||||
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||||
|
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.ItemNotFoundException;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
||||||
|
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.WsUtil;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.HandlerResultMessage;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.HandlerResultMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.server;
|
package org.gcube.portlets.user.workspaceexplorerapp.server;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.common.encryption.StringEncrypter;
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService;
|
||||||
|
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.ItemBuilder;
|
||||||
|
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.WorkspaceInstance;
|
||||||
|
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.WsUtil;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemCategory;
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.WorkspaceNavigatorServiceException;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.WorkspaceNavigatorServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -37,6 +41,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implements WorkspaceExplorerAppService {
|
public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implements WorkspaceExplorerAppService {
|
||||||
|
|
||||||
|
public static final String THE_WORKSPACE_SHUB_INSTANCIED = "THE_WORKSPACE_SHUB_INSTANCIED";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +49,25 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
public static final String UTF_8 = "UTF-8";
|
public static final String UTF_8 = "UTF-8";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the workspace.
|
||||||
|
*
|
||||||
|
* @return the workspace
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private Workspace getWorkspace() throws Exception {
|
||||||
|
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
|
Workspace workspace = (Workspace) httpSession.getAttribute(THE_WORKSPACE_SHUB_INSTANCIED);
|
||||||
|
|
||||||
|
if(workspace==null) {
|
||||||
|
WorkspaceInstance workspaceInstance = new WorkspaceInstance(httpSession);
|
||||||
|
workspace = workspaceInstance.get();
|
||||||
|
httpSession.setAttribute(THE_WORKSPACE_SHUB_INSTANCIED, workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return workspace;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +77,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = getWorkspace();
|
||||||
logger.trace("Start getRoot...");
|
logger.trace("Start getRoot...");
|
||||||
|
|
||||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder root = workspace.getRoot();
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder root = workspace.getRoot();
|
||||||
|
@ -62,7 +86,11 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
logger.trace("start time - " + startTime);
|
logger.trace("start time - " + startTime);
|
||||||
|
|
||||||
Item rootItem = ItemBuilder.getItem(null, root, root.getPath(), showableTypes, filterCriteria, true);
|
|
||||||
|
Item rootItem = ItemBuilder.getItem(null, root, root.getPath(), showableTypes, filterCriteria);
|
||||||
|
//adding the children
|
||||||
|
List<? extends WorkspaceItem> children = workspace.getChildren(root.getId());
|
||||||
|
rootItem = ItemBuilder.addChildren(rootItem, "", children, showableTypes, filterCriteria);
|
||||||
rootItem.setName(WorkspaceExplorerAppConstants.HOME_LABEL);
|
rootItem.setName(WorkspaceExplorerAppConstants.HOME_LABEL);
|
||||||
rootItem.setIsRoot(true);
|
rootItem.setIsRoot(true);
|
||||||
|
|
||||||
|
@ -100,19 +128,20 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
* @param purgeEmpyFolders the purge empy folders
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
* @param filterCriteria the filter criteria
|
* @param filterCriteria the filter criteria
|
||||||
* @return the folder
|
* @return the folder
|
||||||
* @throws Exception the exception
|
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Item getFolder(Item item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
public Item getFolder(Item item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||||
logger.trace("getFolder item: "+item+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
logger.trace("getFolder item: "+item+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||||
|
|
||||||
WorkspaceItem workspaceItem = null;
|
WorkspaceItem workspaceItem = null;
|
||||||
|
Workspace workspace = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(item==null || item.getId()==null)
|
if(item==null || item.getId()==null)
|
||||||
throw new Exception("Item id is null");
|
throw new Exception("Item id is null");
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
workspace = getWorkspace();
|
||||||
workspaceItem = workspace.getItem(item.getId());
|
workspaceItem = workspace.getItem(item.getId());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -131,8 +160,10 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
logger.trace("start time - " + startTime);
|
logger.trace("start time - " + startTime);
|
||||||
|
|
||||||
String path = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
String path = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
||||||
|
Item itemFolder = ItemBuilder.getItem(null, folder, path, showableTypes, filterCriteria);
|
||||||
Item itemFolder = ItemBuilder.getItem(null, folder, path, showableTypes, filterCriteria, true);
|
//adding the children
|
||||||
|
List<? extends WorkspaceItem> children = workspace.getChildren(itemFolder.getId());
|
||||||
|
itemFolder = ItemBuilder.addChildren(itemFolder, path, children, showableTypes, filterCriteria);
|
||||||
// _log.trace("Only showable types:");
|
// _log.trace("Only showable types:");
|
||||||
|
|
||||||
if (purgeEmpyFolders) {
|
if (purgeEmpyFolders) {
|
||||||
|
@ -160,21 +191,21 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the item by category.
|
// * Gets the item by category.
|
||||||
*
|
// *
|
||||||
* @param category the category
|
// * @param category the category
|
||||||
* @return the item by category
|
// * @return the item by category
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
// * @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||||
*/
|
// */
|
||||||
/* (non-Javadoc)
|
// /* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getItemByCategory(org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory)
|
// * @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getItemByCategory(org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory)
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public Item getItemByCategory(ItemCategory category) throws WorkspaceNavigatorServiceException{
|
// public Item getItemByCategory(ItemCategory category) throws WorkspaceNavigatorServiceException{
|
||||||
logger.trace("GetItemByCategory category: "+category);
|
// logger.trace("GetItemByCategory category: "+category);
|
||||||
throw new WorkspaceNavigatorServiceException("The method getItemByCategory is not implemented");
|
// throw new WorkspaceNavigatorServiceException("The method getItemByCategory is not implemented");
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -185,12 +216,16 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem folder = workspace.getMySpecialFolders();
|
WorkspaceItem folder = workspace.getMySpecialFolders();
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
logger.trace("start time - " + startTime);
|
logger.trace("start time - " + startTime);
|
||||||
Item itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria, true);
|
Item itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria);
|
||||||
|
//adding the children
|
||||||
|
List<? extends WorkspaceItem> children = workspace.getChildren(itemFolder.getId());
|
||||||
|
itemFolder = ItemBuilder.addChildren(itemFolder, "", children, showableTypes, filterCriteria);
|
||||||
|
|
||||||
//OVERRIDING VRE FOLDERS NAME - SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
//OVERRIDING VRE FOLDERS NAME - SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||||
itemFolder.setName(WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL);
|
itemFolder.setName(WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL);
|
||||||
itemFolder.setSpecialFolder(true);
|
itemFolder.setSpecialFolder(true);
|
||||||
|
@ -213,21 +248,21 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* {@inheritDoc}
|
// * {@inheritDoc}
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public boolean checkName(String name) throws WorkspaceNavigatorServiceException {
|
// public boolean checkName(String name) throws WorkspaceNavigatorServiceException {
|
||||||
logger.trace("checkName name: "+name);
|
// logger.trace("checkName name: "+name);
|
||||||
throw new WorkspaceNavigatorServiceException("The method checkName is not implemented");
|
// throw new WorkspaceNavigatorServiceException("The method checkName is not implemented");
|
||||||
// try {
|
//// try {
|
||||||
// Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
//// Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
// return workspace.isValidName(name);
|
//// return workspace.isValidName(name);
|
||||||
// } catch (Exception e) {
|
//// } catch (Exception e) {
|
||||||
// logger.error("Error during folder retrieving", e);
|
//// logger.error("Error during folder retrieving", e);
|
||||||
// throw new WorkspaceNavigatorServiceException(e.getMessage());
|
//// throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
// }
|
//// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*protected void printName(String indentation, Item item)
|
/*protected void printName(String indentation, Item item)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +285,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
logger.trace("ListParents By Item Identifier "+ itemIdentifier);
|
logger.trace("ListParents By Item Identifier "+ itemIdentifier);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
|
WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
|
||||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||||
List<? extends WorkspaceItem> parents = workspace.getParentsById(itemIdentifier);
|
List<? extends WorkspaceItem> parents = workspace.getParentsById(itemIdentifier);
|
||||||
|
@ -368,7 +403,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
logger.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit);
|
logger.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
|
WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
|
||||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||||
List<? extends WorkspaceItem> parents = null;
|
List<? extends WorkspaceItem> parents = null;
|
||||||
|
@ -477,103 +512,103 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the size by item id.
|
// * Gets the size by item id.
|
||||||
*
|
// *
|
||||||
* @param itemId the item id
|
// * @param itemId the item id
|
||||||
* @return the size by item id
|
// * @return the size by item id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
/* (non-Javadoc)
|
// /* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#loadSizeByItemId(java.lang.String)
|
// * @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#loadSizeByItemId(java.lang.String)
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public Long getSizeByItemId(String itemId) throws Exception {
|
// public Long getSizeByItemId(String itemId) throws Exception {
|
||||||
|
//
|
||||||
|
// logger.info("get Size By ItemId "+ itemId);
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// Workspace workspace = getWorkspace();
|
||||||
|
// WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
// Long size = new Long(-1);
|
||||||
|
//
|
||||||
|
// if(wsItem instanceof FileItem){ //ITEM
|
||||||
|
// FileItem fileItem = (FileItem) wsItem;
|
||||||
|
// size = new Long(fileItem.getSize());
|
||||||
|
// } else if (wsItem instanceof WorkspaceFolder ){ //FOLDER
|
||||||
|
// WorkspaceFolder theFolder = (WorkspaceFolder) wsItem;
|
||||||
|
// //size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
||||||
|
// } else if (wsItem instanceof WorkspaceSharedFolder){ //SHARED FOLDER
|
||||||
|
// WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) wsItem;
|
||||||
|
// //size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
||||||
|
// }
|
||||||
|
// logger.info("returning size: " +size);
|
||||||
|
// return size;
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error("get Size By ItemId ", e);
|
||||||
|
// throw new Exception(e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
logger.info("get Size By ItemId "+ itemId);
|
// /**
|
||||||
try {
|
// * Gets the mime type.
|
||||||
|
// *
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
// * @param itemId the item id
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
// * @return the mime type
|
||||||
Long size = new Long(-1);
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
if(wsItem instanceof FileItem){ //ITEM
|
// /* (non-Javadoc)
|
||||||
FileItem fileItem = (FileItem) wsItem;
|
// * @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getMimeType(java.lang.String)
|
||||||
size = new Long(fileItem.getSize());
|
// */
|
||||||
} else if (wsItem instanceof WorkspaceFolder ){ //FOLDER
|
// @Override
|
||||||
WorkspaceFolder theFolder = (WorkspaceFolder) wsItem;
|
// public String getMimeType(String itemId) throws Exception {
|
||||||
//size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
//
|
||||||
} else if (wsItem instanceof WorkspaceSharedFolder){ //SHARED FOLDER
|
// logger.info("get MimeType By ItemId "+ itemId);
|
||||||
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) wsItem;
|
// try {
|
||||||
//size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
//
|
||||||
}
|
// Workspace workspace = getWorkspace();
|
||||||
logger.info("returning size: " +size);
|
// WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
return size;
|
//
|
||||||
|
// if(wsItem instanceof FileItem) {
|
||||||
} catch (Exception e) {
|
// FileItem fileItem = (FileItem) wsItem;
|
||||||
logger.error("get Size By ItemId ", e);
|
// return fileItem.getMimeType();
|
||||||
throw new Exception(e.getMessage());
|
// }else
|
||||||
}
|
// return null;
|
||||||
}
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
/**
|
// logger.error("get MimeType By ItemId ", e);
|
||||||
* Gets the mime type.
|
// throw new Exception(e.getMessage());
|
||||||
*
|
// }
|
||||||
* @param itemId the item id
|
// }
|
||||||
* @return the mime type
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getMimeType(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getMimeType(String itemId) throws Exception {
|
|
||||||
|
|
||||||
logger.info("get MimeType By ItemId "+ itemId);
|
|
||||||
try {
|
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
|
||||||
|
|
||||||
if(wsItem instanceof FileItem) {
|
|
||||||
FileItem fileItem = (FileItem) wsItem;
|
|
||||||
return fileItem.getMimeType();
|
|
||||||
}else
|
|
||||||
return null;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("get MimeType By ItemId ", e);
|
|
||||||
throw new Exception(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the user acl for folder id.
|
// * Gets the user acl for folder id.
|
||||||
*
|
// *
|
||||||
* @param folderId the folder id
|
// * @param folderId the folder id
|
||||||
* @return the user acl for folder id
|
// * @return the user acl for folder id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public String getUserACLForFolderId(String folderId) throws Exception{
|
// public String getUserACLForFolderId(String folderId) throws Exception{
|
||||||
try {
|
// try {
|
||||||
logger.info("Get user ACL to FOLDER id: "+folderId);
|
// logger.info("Get user ACL to FOLDER id: "+folderId);
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
// Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
// WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||||
|
//
|
||||||
if(!isASharedFolder(wsItem, false)) {
|
// if(!isASharedFolder(wsItem, false)) {
|
||||||
return "OWNER";
|
// return "OWNER";
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
return wsItem.getACLUser().toString();
|
// return wsItem.getACLUser().toString();
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
logger.error("Error in server get UserACLForFolderId", e);
|
// logger.error("Error in server get UserACLForFolderId", e);
|
||||||
String error = "An error occurred when getting ACL rules for selected folder. "+e.getMessage();
|
// String error = "An error occurred when getting ACL rules for selected folder. "+e.getMessage();
|
||||||
throw new Exception(error);
|
// throw new Exception(error);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -601,92 +636,93 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the readable size by item id.
|
// * Gets the readable size by item id.
|
||||||
*
|
// *
|
||||||
* @param itemId the item id
|
// * @param itemId the item id
|
||||||
* @return the readable size by item id
|
// * @return the readable size by item id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
/* (non-Javadoc)
|
// /* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getFormattedSizeByItemId(java.lang.String, org.gcube.portlets.widgets.wsexplorer.shared.SizeFormatter)
|
// * @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getFormattedSizeByItemId(java.lang.String, org.gcube.portlets.widgets.wsexplorer.shared.SizeFormatter)
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public String getReadableSizeByItemId(String itemId) throws Exception {
|
// public String getReadableSizeByItemId(String itemId) throws Exception {
|
||||||
|
//
|
||||||
|
// try{
|
||||||
|
// logger.info("getFormattedSize ByItemId "+ itemId);
|
||||||
|
// long size = getSizeByItemId(itemId);
|
||||||
|
// return StringUtil.readableFileSize(size);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error("getFormattedSize By ItemId ", e);
|
||||||
|
// throw new Exception(e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
try{
|
// /**
|
||||||
logger.info("getFormattedSize ByItemId "+ itemId);
|
// * Creates the folder.
|
||||||
long size = getSizeByItemId(itemId);
|
// *
|
||||||
return StringUtil.readableFileSize(size);
|
// * @param nameFolder the name folder
|
||||||
} catch (Exception e) {
|
// * @param description the description
|
||||||
logger.error("getFormattedSize By ItemId ", e);
|
// * @param parentId the parent id
|
||||||
throw new Exception(e.getMessage());
|
// * @return the item
|
||||||
}
|
// * @throws Exception the exception
|
||||||
}
|
// */
|
||||||
|
// /* (non-Javadoc)
|
||||||
/**
|
// * @see org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService#createFolder(java.lang.String, java.lang.String, java.lang.String)
|
||||||
* Creates the folder.
|
// */
|
||||||
*
|
// @Override
|
||||||
* @param nameFolder the name folder
|
// public Item createFolder(String nameFolder, String description, String parentId) throws Exception {
|
||||||
* @param description the description
|
//
|
||||||
* @param parentId the parent id
|
// logger.debug("creating folder: "+nameFolder +", parent id: "+parentId);
|
||||||
* @return the item
|
// throw new WorkspaceNavigatorServiceException("The method 'createFolder' is not implemented");
|
||||||
* @throws Exception the exception
|
//
|
||||||
*/
|
// /*try {
|
||||||
/* (non-Javadoc)
|
//
|
||||||
* @see org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService#createFolder(java.lang.String, java.lang.String, java.lang.String)
|
// if(parentId==null || parentId.isEmpty())
|
||||||
*/
|
// throw new Exception("Parent id is null or empty");
|
||||||
@Override
|
//
|
||||||
public Item createFolder(String nameFolder, String description, String parentId) throws Exception {
|
// if(nameFolder == null)
|
||||||
|
// nameFolder = "Empty Folder";
|
||||||
logger.debug("creating folder: "+nameFolder +", parent id: "+parentId);
|
//
|
||||||
|
// Workspace workspace = getWorkspace();
|
||||||
try {
|
// WorkspaceFolder wsFolder = workspace.createFolder(nameFolder, description, parentId);
|
||||||
|
// List<ItemType> allTypes = Arrays.asList(ItemType.values());
|
||||||
if(parentId==null || parentId.isEmpty())
|
//
|
||||||
throw new Exception("Parent id is null or empty");
|
// Item parent = null;
|
||||||
|
// try{
|
||||||
if(nameFolder == null)
|
// String parentPath = wsFolder.getParent()!=null?wsFolder.getParent().getPath():"";
|
||||||
nameFolder = "Empty Folder";
|
// parent = ItemBuilder.getItem(null, wsFolder.getParent(), parentPath, allTypes, null, false);
|
||||||
|
// }catch(Exception e){
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
// logger.error("Get parent thown an exception, is it the root id? "+parentId);
|
||||||
WorkspaceFolder wsFolder = workspace.createFolder(nameFolder, description, parentId);
|
// }
|
||||||
List<ItemType> allTypes = Arrays.asList(ItemType.values());
|
//
|
||||||
|
// //TODO PATCH TO AVOID PROBLEM ON GETPATH. FOR EXAMPLE WHEN PARENT IS ROOT
|
||||||
Item parent = null;
|
// String itemPath = null;
|
||||||
try{
|
// try{
|
||||||
String parentPath = wsFolder.getParent()!=null?wsFolder.getParent().getPath():"";
|
// itemPath = wsFolder.getPath();
|
||||||
parent = ItemBuilder.getItem(null, wsFolder.getParent(), parentPath, allTypes, null, false);
|
// }catch(Exception e){
|
||||||
}catch(Exception e){
|
// logger.error("Get path thown an exception, for id: "+wsFolder.getId());
|
||||||
logger.error("Get parent thown an exception, is it the root id? "+parentId);
|
// itemPath= wsFolder.isFolder()?workspace.getRoot().getPath()+"/"+wsFolder.getName():workspace.getRoot().getPath();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//TODO PATCH TO AVOID PROBLEM ON GETPATH. FOR EXAMPLE WHEN PARENT IS ROOT
|
// return ItemBuilder.getItem(parent, wsFolder, itemPath, allTypes, null, false);
|
||||||
String itemPath = null;
|
//
|
||||||
try{
|
// } catch(InsufficientPrivilegesException e){
|
||||||
itemPath = wsFolder.getPath();
|
// String error = "Insufficient Privileges to create the folder";
|
||||||
}catch(Exception e){
|
// logger.error(error, e);
|
||||||
logger.error("Get path thown an exception, for id: "+wsFolder.getId());
|
// throw new Exception(error);
|
||||||
itemPath= wsFolder.isFolder()?workspace.getRoot().getPath()+"/"+wsFolder.getName():workspace.getRoot().getPath();
|
// } catch (ItemAlreadyExistException e) {
|
||||||
}
|
// String error = "An error occurred on creating folder, " +e.getMessage();
|
||||||
|
// logger.error(error, e);
|
||||||
return ItemBuilder.getItem(parent, wsFolder, itemPath, allTypes, null, false);
|
// throw new Exception(error);
|
||||||
|
// } catch (Exception e) {
|
||||||
} catch(InsufficientPrivilegesException e){
|
// String error = "An error occurred on the sever during creating folder. Try again";
|
||||||
String error = "Insufficient Privileges to create the folder";
|
// logger.error(error, e);
|
||||||
logger.error(error, e);
|
// throw new Exception(error);
|
||||||
throw new Exception(error);
|
// }*/
|
||||||
} catch (ItemAlreadyExistException e) {
|
//
|
||||||
String error = "An error occurred on creating folder, " +e.getMessage();
|
// }
|
||||||
logger.error(error, e);
|
|
||||||
throw new Exception(error);
|
|
||||||
} catch (Exception e) {
|
|
||||||
String error = "An error occurred on the sever during creating folder. Try again";
|
|
||||||
logger.error(error, e);
|
|
||||||
throw new Exception(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -703,31 +739,30 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
try{
|
try{
|
||||||
|
|
||||||
if(itemId==null)
|
if(itemId==null)
|
||||||
throw new Exception("Sorry, The Public Link for empty item is unavailable (itemId is null)");
|
throw new Exception("Sorry, the itemId is null. The public link for empty item is unavailable");
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
|
||||||
if(wsItem==null)
|
if(wsItem==null)
|
||||||
throw new Exception("Sorry, The Public Link for empty item is unavailable");
|
throw new Exception("Sorry, the workspace item is null. The public link for empty item is unavailable");
|
||||||
|
|
||||||
if(wsItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
if(wsItem instanceof FileItem){
|
||||||
|
|
||||||
FolderItem folderItem = (FolderItem) wsItem;
|
URL theURL = workspace.getPublicLinkForFile(wsItem.getId());
|
||||||
String uriRequest = folderItem.getPublicLink(false);
|
|
||||||
|
|
||||||
if(uriRequest==null || uriRequest.isEmpty())
|
if(theURL==null)
|
||||||
throw new Exception("Sorry, public link on "+folderItem.getName() +" is not available");
|
throw new Exception("Sorry, the public link for "+wsItem.getName() +" is not available");
|
||||||
|
|
||||||
return uriRequest;
|
return theURL.toString();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
logger.warn("ItemId: "+ itemId +" is not available, sent exception Public Link unavailable");
|
logger.warn("ItemId: "+ itemId +" is not available, sent exception Public Link unavailable");
|
||||||
throw new Exception("Sorry, The Public Link for selected item is unavailable");
|
throw new Exception("Sorry, the Public Link for selected item is unavailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("Error getPublicLinkForItemId for item: "+itemId, e);
|
logger.error("Error on getting public link for item: "+itemId, e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.server;
|
package org.gcube.portlets.user.workspaceexplorerapp.server.workspace;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -12,8 +12,8 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.Util;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.Util;
|
||||||
|
@ -84,7 +84,7 @@ public class ItemBuilder {
|
||||||
* @return the item
|
* @return the item
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public static Item getItem(Item parent, WorkspaceItem workspaceItem, String workspaceItemPath, List<ItemType> showableTypes, FilterCriteria filterCriteria, boolean loadChildren) throws Exception
|
public static Item getItem(Item parent, WorkspaceItem workspaceItem, String workspaceItemPath, List<ItemType> showableTypes, FilterCriteria filterCriteria) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -129,22 +129,22 @@ public class ItemBuilder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loadChildren){
|
// if(loadChildren){
|
||||||
//TODO A PATCH TO AVOID A SLOW GETPATH
|
// //TODO A PATCH TO AVOID A SLOW GETPATH
|
||||||
// workspaceItemPath = workspaceItem.getPath();
|
// // workspaceItemPath = workspaceItem.getPath();
|
||||||
for (WorkspaceItem child: workspaceItem.getChildren()){
|
// for (WorkspaceItem child: workspaceItem.getChildren()){
|
||||||
String itemPath = workspaceItemPath;
|
// String itemPath = workspaceItemPath;
|
||||||
if(child.isFolder())
|
// if(child.isFolder())
|
||||||
itemPath+="/"+child.getName();
|
// itemPath+="/"+child.getName();
|
||||||
|
//
|
||||||
// _log.trace("\nConverting child item: "+child.getName());
|
// // _log.trace("\nConverting child item: "+child.getName());
|
||||||
Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false);
|
// Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false);
|
||||||
// _log.trace("Item: "+child.getName() +" converted!!!");
|
// // _log.trace("Item: "+child.getName() +" converted!!!");
|
||||||
if (itemChild!=null){
|
// if (itemChild!=null){
|
||||||
item.addChild(itemChild);
|
// item.addChild(itemChild);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -154,6 +154,42 @@ public class ItemBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the children.
|
||||||
|
*
|
||||||
|
* @param item the item
|
||||||
|
* @param itemPathBuilt the item path built
|
||||||
|
* @param children the children
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @return the item with the children added
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public static Item addChildren(Item item, String itemPathBuilt, List<? extends WorkspaceItem> children, List<ItemType> showableTypes, FilterCriteria filterCriteria) throws Exception {
|
||||||
|
|
||||||
|
if(item==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if(children==null)
|
||||||
|
return item;
|
||||||
|
|
||||||
|
for (WorkspaceItem child: children){
|
||||||
|
String itemPath = itemPathBuilt;
|
||||||
|
if(child.isFolder()) {
|
||||||
|
itemPath+="/"+child.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria);
|
||||||
|
// _log.trace("Item: "+child.getName() +" converted!!!");
|
||||||
|
if (itemChild!=null){
|
||||||
|
item.addChild(itemChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To date.
|
* To date.
|
||||||
*
|
*
|
||||||
|
@ -375,7 +411,7 @@ public class ItemBuilder {
|
||||||
//name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
|
//name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
|
||||||
name = shared.isVreFolder()?shared.getName():wsFolder.getName(); //not implemented by SHUB
|
name = shared.isVreFolder()?shared.getName():wsFolder.getName(); //not implemented by SHUB
|
||||||
|
|
||||||
}else if(isSpecialFolder(wsFolder)){
|
}else {if(isSpecialFolder(wsFolder)){
|
||||||
//MANAGEMENT SPECIAL FOLDER
|
//MANAGEMENT SPECIAL FOLDER
|
||||||
name = WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL;
|
name = WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL;
|
||||||
isSpecialFolder = true;
|
isSpecialFolder = true;
|
||||||
|
@ -399,10 +435,10 @@ public class ItemBuilder {
|
||||||
* @param wsFolder the ws folder
|
* @param wsFolder the ws folder
|
||||||
* @return true, if is special folder
|
* @return true, if is special folder
|
||||||
*/
|
*/
|
||||||
public static boolean isSpecialFolder(WorkspaceFolder wsFolder){
|
public static boolean isSpecialFolder(WorkspaceFolder wsFolder, boolean parentIsRoot){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return wsFolder.getName().compareTo(WorkspaceExplorerAppConstants.SPECIAL_FOLDERS_NAME)==0 && wsFolder.getParentId()!=null && wsFolder.getParent().isRoot();
|
return wsFolder.getName().compareTo(WorkspaceExplorerAppConstants.SPECIAL_FOLDERS_NAME)==0 && wsFolder.getParentId()!=null && parentIsRoot;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.warn("isSpecialFolder exception, returning false");
|
_log.warn("isSpecialFolder exception, returning false");
|
||||||
return false;
|
return false;
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.server;
|
package org.gcube.portlets.user.workspaceexplorerapp.server.workspace;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@ -9,11 +9,12 @@ import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
|
||||||
/**
|
/**
|
||||||
* The Class WsUtil.
|
* The Class WsUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Sep 13, 2016
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
|
* Apr 9, 2020
|
||||||
*/
|
*/
|
||||||
public class WsUtil {
|
public class WsUtil {
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ public class WsUtil {
|
||||||
* @return the storage hub wrapper
|
* @return the storage hub wrapper
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static StorageHubWrapper getStorageHubWrapper(HttpSession httpSession) throws Exception {
|
private static StorageHubWrapper getStorageHubWrapper(HttpSession httpSession) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String scope = getScope(httpSession);
|
String scope = getScope(httpSession);
|
||||||
|
@ -52,7 +53,7 @@ public class WsUtil {
|
||||||
* @return the workpace
|
* @return the workpace
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static org.gcube.common.storagehubwrapper.server.tohl.Workspace getWorkspace(HttpSession httpSession) throws Exception {
|
protected static org.gcube.common.storagehubwrapper.server.tohl.Workspace getWorkspace(HttpSession httpSession) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StorageHubWrapper wrapper = getStorageHubWrapper(httpSession);
|
StorageHubWrapper wrapper = getStorageHubWrapper(httpSession);
|
Loading…
Reference in New Issue