working on migration to SHUB
This commit is contained in:
parent
06b3a2a987
commit
dc656a78e2
|
@ -51,6 +51,7 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
* @param filterCriteria the filter criteria
|
* @param filterCriteria the filter criteria
|
||||||
* @return the folder
|
* @return the folder
|
||||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||||
|
* @throws
|
||||||
*/
|
*/
|
||||||
Item getFolder(
|
Item getFolder(
|
||||||
Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||||
|
|
|
@ -10,8 +10,12 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
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.items.FileItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
||||||
|
@ -21,6 +25,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class ItemBuilder.
|
* The Class ItemBuilder.
|
||||||
*
|
*
|
||||||
|
@ -79,62 +84,73 @@ 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 InternalErrorException
|
public static Item getItem(Item parent, WorkspaceItem workspaceItem, String workspaceItemPath, List<ItemType> showableTypes, FilterCriteria filterCriteria, boolean loadChildren) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemType type = getItemType(workspaceItem);
|
try {
|
||||||
|
|
||||||
if (!showableTypes.contains(type)) {
|
String itemName = workspaceItem.getName();
|
||||||
return null;
|
boolean isFolder = workspaceItem.isFolder();
|
||||||
}
|
ItemType type = getItemType(workspaceItem);
|
||||||
if (!filterItem(type, workspaceItem, filterCriteria)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// //TODO ADD CONTROL ON THE PATH WHEN WILL BE MORE FAST
|
if (!showableTypes.contains(type)) {
|
||||||
// if (itemName.equals(WorkspaceExplorerConstants.SPECIAL_FOLDERS_LABEL))
|
return null;
|
||||||
// itemName = WorkspaceExplorerConstants.VRE_FOLDERS_LABEL;
|
}
|
||||||
|
if (!filterItem(workspaceItem, filterCriteria)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isFolder = type.equals(ItemType.FOLDER)?true:false;
|
boolean isSharedFolder = false;
|
||||||
boolean isSharedFolder = workspaceItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)?true:false;
|
if(workspaceItem instanceof WorkspaceSharedFolder){
|
||||||
|
isSharedFolder = true;
|
||||||
|
_log.debug("Is shared folder");
|
||||||
|
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) workspaceItem;
|
||||||
|
//itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getName(); //NOT IMPLEMENTED BY SHUB
|
||||||
|
itemName = shared.isVreFolder()?shared.getName():workspaceItem.getName();
|
||||||
|
}
|
||||||
|
|
||||||
String itemName = workspaceItem.getName();
|
// _log.debug("Building Item for: "+itemName);
|
||||||
|
Item item = null;
|
||||||
|
try{
|
||||||
|
|
||||||
if(isSharedFolder){
|
item = new Item(parent,
|
||||||
_log.debug("Is shared folder");
|
workspaceItem.getId(),
|
||||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) workspaceItem;
|
itemName,
|
||||||
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getName();
|
type,
|
||||||
}
|
workspaceItemPath,
|
||||||
|
workspaceItem.getOwner(),
|
||||||
|
toDate(workspaceItem.getCreationTime()),
|
||||||
|
isFolder,
|
||||||
|
false);
|
||||||
|
|
||||||
// _log.debug("Building Item for: "+itemName);
|
item.setSharedFolder(isSharedFolder);
|
||||||
Item item = null;
|
}catch(Exception e){
|
||||||
try{
|
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
item = new Item(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, workspaceItem.getOwner().getPortalLogin(), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
if(loadChildren){
|
||||||
item.setSharedFolder(isSharedFolder);
|
//TODO A PATCH TO AVOID A SLOW GETPATH
|
||||||
}catch(Exception e){
|
// workspaceItemPath = workspaceItem.getPath();
|
||||||
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
for (WorkspaceItem child: workspaceItem.getChildren()){
|
||||||
return null;
|
String itemPath = workspaceItemPath;
|
||||||
}
|
if(child.isFolder())
|
||||||
|
itemPath+="/"+child.getName();
|
||||||
|
|
||||||
if(loadChildren){
|
// _log.trace("\nConverting child item: "+child.getName());
|
||||||
//TODO A PATCH TO AVOID A SLOW GETPATH
|
Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false);
|
||||||
// workspaceItemPath = workspaceItem.getPath();
|
// _log.trace("Item: "+child.getName() +" converted!!!");
|
||||||
for (WorkspaceItem child: workspaceItem.getChildren()){
|
if (itemChild!=null){
|
||||||
String itemPath = workspaceItemPath;
|
item.addChild(itemChild);
|
||||||
if(child.isFolder())
|
}
|
||||||
itemPath+="/"+child.getName();
|
|
||||||
|
|
||||||
// _log.trace("\nConverting child item: "+child.getName());
|
|
||||||
Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false);
|
|
||||||
// _log.trace("Item: "+child.getName() +" converted!!!");
|
|
||||||
if (itemChild!=null){
|
|
||||||
item.addChild(itemChild);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
}catch (Exception e) {
|
||||||
|
_log.error("Error on getting item: "+workspaceItem.getName()+" with id: "+workspaceItem.getId(), e);
|
||||||
|
throw new Exception("Error on retrieving the item: "+workspaceItem.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +172,6 @@ public class ItemBuilder {
|
||||||
*
|
*
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @return the item type
|
* @return the item type
|
||||||
* @throws InternalErrorException the internal error exception
|
|
||||||
*/
|
*/
|
||||||
protected static ItemType getItemType(WorkspaceItem item) {
|
protected static ItemType getItemType(WorkspaceItem item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
|
@ -198,49 +213,47 @@ public class ItemBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter item.
|
* Filter item using the input Filter Criteria
|
||||||
*
|
*
|
||||||
* @param type the type
|
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param filterCriteria the filter criteria
|
* @param filterCriteria the filter criteria
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
* @throws InternalErrorException the internal error exception
|
|
||||||
*/
|
*/
|
||||||
protected static boolean filterItem(ItemType type, WorkspaceItem item, FilterCriteria filterCriteria) throws InternalErrorException {
|
protected static boolean filterItem(WorkspaceItem item, FilterCriteria filterCriteria) {
|
||||||
if(filterCriteria==null) {
|
if(filterCriteria==null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean mimeTypeCheck = checkAllowedMimeTypes(type, item, filterCriteria.getAllowedMimeTypes());
|
boolean mimeTypeCheck = checkAllowedMimeTypes(item, filterCriteria.getAllowedMimeTypes());
|
||||||
if (!mimeTypeCheck) {
|
if (!mimeTypeCheck) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean fileExtensionCheck = checkAllowedFileExtension(type, item, filterCriteria.getAllowedFileExtensions());
|
boolean fileExtensionCheck = checkAllowedFileExtension(item, filterCriteria.getAllowedFileExtensions());
|
||||||
if(!fileExtensionCheck) {
|
if(!fileExtensionCheck) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean propertiesCheck = checkProperties(item, filterCriteria.getRequiredProperties());
|
boolean propertiesCheck = checkProperties(item, filterCriteria.getRequiredProperties());
|
||||||
|
|
||||||
return propertiesCheck;
|
return propertiesCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check allowed mime types.
|
* Check allowed mime types on file.
|
||||||
*
|
*
|
||||||
* @param type the type
|
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param allowedMimeTypes the allowed mime types
|
* @param allowedMimeTypes the allowed mime types
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
protected static boolean checkAllowedMimeTypes(ItemType type, WorkspaceItem item, List<String> allowedMimeTypes){
|
protected static boolean checkAllowedMimeTypes(WorkspaceItem item, List<String> allowedMimeTypes){
|
||||||
if (allowedMimeTypes==null || allowedMimeTypes.size()==0) {
|
if (allowedMimeTypes==null || allowedMimeTypes.size()==0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == ItemType.EXTERNAL_FILE || type == ItemType.EXTERNAL_IMAGE || type == ItemType.EXTERNAL_PDF_FILE) {
|
if (item instanceof FileItem) {
|
||||||
ExternalFile externalFile = (ExternalFile)item;
|
FileItem fileItem = (FileItem) item;
|
||||||
String mimeType = externalFile.getMimeType();
|
String mimeType = fileItem.getMimeType();
|
||||||
return allowedMimeTypes.contains(mimeType);
|
return allowedMimeTypes.contains(mimeType);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -250,25 +263,24 @@ public class ItemBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check allowed file extension.
|
* Check allowed file extension on file.
|
||||||
*
|
*
|
||||||
* @param type the type
|
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param allowedFileExtension the allowed mime types
|
* @param allowedFileExtension the allowed mime types
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
protected static boolean checkAllowedFileExtension(ItemType type, WorkspaceItem item, List<String> allowedFileExtension){
|
protected static boolean checkAllowedFileExtension(WorkspaceItem item, List<String> allowedFileExtension){
|
||||||
if (allowedFileExtension==null || allowedFileExtension.size()==0) {
|
if (allowedFileExtension==null || allowedFileExtension.size()==0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (type != ItemType.FOLDER) {
|
if (item instanceof FileItem) {
|
||||||
String name = item.getName();
|
String name = item.getName();
|
||||||
return checkFileExtension(name, allowedFileExtension);
|
return checkFileExtension(name, allowedFileExtension);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (InternalErrorException e) {
|
} catch (Exception e) {
|
||||||
_log.error("checkAllowedFileExtension, InternalErrorException: ",e);
|
_log.error("checkAllowedFileExtension, InternalErrorException: ",e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -312,22 +324,26 @@ public class ItemBuilder {
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param requestedProperties the requested properties
|
* @param requestedProperties the requested properties
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
* @throws InternalErrorException the internal error exception
|
|
||||||
*/
|
*/
|
||||||
protected static boolean checkProperties(WorkspaceItem item, Map<String, String> requestedProperties) throws InternalErrorException
|
protected static boolean checkProperties(WorkspaceItem item, Map<String, String> requestedProperties) {
|
||||||
{
|
|
||||||
if (requestedProperties==null || requestedProperties.size()==0 || item.getType()!=WorkspaceItemType.FOLDER_ITEM) {
|
if (requestedProperties == null || requestedProperties.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> itemProperties = item.getProperties().getProperties();
|
if (item.getPropertyMap() != null) {
|
||||||
for (Entry<String, String> requestProperty:requestedProperties.entrySet()) {
|
PropertyMap mapProp = item.getPropertyMap();
|
||||||
String propertyValue = itemProperties.get(requestProperty.getKey());
|
if (mapProp != null && mapProp.getValues() != null) {
|
||||||
if (propertyValue == null) {
|
Map<String, Object> itemProperties = mapProp.getValues();
|
||||||
return false;
|
for (Entry<String, String> requestProperty : requestedProperties.entrySet()) {
|
||||||
}
|
Object propertyValue = itemProperties.get(requestProperty.getKey());
|
||||||
if (!propertyValue.equals(requestProperty.getValue())) {
|
if (propertyValue == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (!propertyValue.equals(requestProperty.getValue())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +360,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 buildFolderForBreadcrumbs(WorkspaceFolder wsFolder, Item parent) throws InternalErrorException {
|
public static Item buildFolderForBreadcrumbs(WorkspaceFolder wsFolder, Item parent) throws Exception {
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
boolean isSpecialFolder = false;
|
boolean isSpecialFolder = false;
|
||||||
|
@ -353,11 +369,14 @@ public class ItemBuilder {
|
||||||
if(wsFolder.isRoot()){ //IS ROOT
|
if(wsFolder.isRoot()){ //IS ROOT
|
||||||
name = WorkspaceExplorerAppConstants.HOME_LABEL;
|
name = WorkspaceExplorerAppConstants.HOME_LABEL;
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
}else if(wsFolder.isShared() && wsFolder.getType().equals(WorkspaceItemType.SHARED_FOLDER)){ //MANAGEMENT SHARED FOLDER NAME
|
}else if(wsFolder.isShared() && wsFolder instanceof WorkspaceSharedFolder){
|
||||||
|
//MANAGEMENT SHARED FOLDER NAME
|
||||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) wsFolder;
|
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) wsFolder;
|
||||||
name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
|
//name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
|
||||||
//MANAGEMENT SPECIAL FOLDER
|
name = shared.isVreFolder()?shared.getName():wsFolder.getName(); //not implemented by SHUB
|
||||||
|
|
||||||
}else if(isSpecialFolder(wsFolder)){
|
}else if(isSpecialFolder(wsFolder)){
|
||||||
|
//MANAGEMENT SPECIAL FOLDER
|
||||||
name = WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL;
|
name = WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL;
|
||||||
isSpecialFolder = true;
|
isSpecialFolder = true;
|
||||||
}
|
}
|
||||||
|
@ -383,8 +402,8 @@ public class ItemBuilder {
|
||||||
public static boolean isSpecialFolder(WorkspaceFolder wsFolder){
|
public static boolean isSpecialFolder(WorkspaceFolder wsFolder){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return wsFolder.getName().compareTo(WorkspaceExplorerAppConstants.SPECIAL_FOLDERS_NAME)==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot();
|
return wsFolder.getName().compareTo(WorkspaceExplorerAppConstants.SPECIAL_FOLDERS_NAME)==0 && wsFolder.getParentId()!=null && wsFolder.getParent().isRoot();
|
||||||
} catch (InternalErrorException e) {
|
} catch (Exception e) {
|
||||||
_log.warn("isSpecialFolder exception, returning false");
|
_log.warn("isSpecialFolder exception, returning false");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ import java.util.concurrent.TimeUnit;
|
||||||
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.impl.WorkspaceFolder;
|
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.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.shared.FilterCriteria;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.FilterCriteria;
|
||||||
|
@ -23,6 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class WorkspaceExplorerAppServiceImpl.
|
* The Class WorkspaceExplorerAppServiceImpl.
|
||||||
*
|
*
|
||||||
|
@ -86,86 +91,89 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the folder.
|
||||||
|
*
|
||||||
|
* @param item the item
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @return the folder
|
||||||
|
* @throws Exception the 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;
|
||||||
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 workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
WorkspaceItem folder = workspace.getItem(item.getId());
|
workspaceItem = workspace.getItem(item.getId());
|
||||||
|
|
||||||
logger.trace("GetFolder - Replyiing folder");
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
logger.trace("start time - " + startTime);
|
|
||||||
|
|
||||||
String path = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
|
||||||
|
|
||||||
Item itemFolder = ItemBuilder.getItem(null, folder, path, showableTypes, filterCriteria, true);
|
|
||||||
// _log.trace("Only showable types:");
|
|
||||||
|
|
||||||
if (purgeEmpyFolders) {
|
|
||||||
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.trace("Returning:");
|
|
||||||
Long endTime = System.currentTimeMillis() - startTime;
|
|
||||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
|
||||||
logger.info("end time - " + time);
|
|
||||||
|
|
||||||
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
|
||||||
|
|
||||||
return itemFolder;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error during folder retrieving", e);
|
logger.error("Error during item retrieving", e);
|
||||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get folder");
|
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get folder. Does it still exist?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(workspaceItem != null && workspaceItem.isFolder()) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
WorkspaceItem folder = workspaceItem;
|
||||||
|
|
||||||
|
logger.trace("GetFolder - Replyiing folder");
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
logger.trace("start time - " + startTime);
|
||||||
|
|
||||||
|
String path = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
||||||
|
|
||||||
|
Item itemFolder = ItemBuilder.getItem(null, folder, path, showableTypes, filterCriteria, true);
|
||||||
|
// _log.trace("Only showable types:");
|
||||||
|
|
||||||
|
if (purgeEmpyFolders) {
|
||||||
|
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.trace("Returning:");
|
||||||
|
Long endTime = System.currentTimeMillis() - startTime;
|
||||||
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||||
|
logger.info("end time - " + time);
|
||||||
|
|
||||||
|
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
||||||
|
|
||||||
|
return itemFolder;
|
||||||
|
}catch (Exception e) {
|
||||||
|
throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
logger.error("The item requested is not a folder");
|
||||||
|
throw new WorkspaceNavigatorServiceException("Error, the item requested is not a folder");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the item by category.
|
||||||
|
*
|
||||||
|
* @param category the category
|
||||||
|
* @return the item by category
|
||||||
|
* @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);
|
||||||
return null; //TODO
|
throw new WorkspaceNavigatorServiceException("The method getItemByCategory is not implemented");
|
||||||
// try {
|
|
||||||
// Workspace workspace = WsUtil.getWorkspace();
|
|
||||||
// Item item = null;
|
|
||||||
//
|
|
||||||
// switch(category){
|
|
||||||
// case HOME:{
|
|
||||||
// WorkspaceItem root = workspace.getRoot();
|
|
||||||
//// String fullName = UserUtil.getUserFullName(session.getUsername());
|
|
||||||
// String fullName = session.getUsername();
|
|
||||||
// if(fullName.indexOf(" ")>0){
|
|
||||||
// fullName = fullName.substring(0, fullName.indexOf(" "));
|
|
||||||
// }else if(fullName.indexOf(".")>0){
|
|
||||||
// fullName = fullName.substring(0, fullName.indexOf("."));
|
|
||||||
// }
|
|
||||||
// item = new Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner().getPortalLogin(), null, true, true);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case VRE_FOLDER:{
|
|
||||||
// WorkspaceItem folder = workspace.getMySpecialFolders();
|
|
||||||
// item = new Item(null, folder.getId(), WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner().getPortalLogin(), null, true, false);
|
|
||||||
// //SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
|
||||||
// item.setSpecialFolder(true);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return item;
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// logger.error("Error during get item by category", e);
|
|
||||||
// throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get item by category");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,34 +187,24 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
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, true);
|
||||||
//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);
|
||||||
|
|
||||||
logger.trace("Builded MySpecialFolder: "+itemFolder);
|
logger.trace("Builded MySpecialFolder: "+itemFolder);
|
||||||
|
|
||||||
logger.trace("Only showable types:");
|
logger.trace("Only showable types:");
|
||||||
//printName("", folderItem);
|
|
||||||
|
|
||||||
if (purgeEmpyFolders) {
|
if (purgeEmpyFolders) {
|
||||||
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Returning:");
|
logger.trace("Returning:");
|
||||||
|
|
||||||
Long endTime = System.currentTimeMillis() - startTime;
|
Long endTime = System.currentTimeMillis() - startTime;
|
||||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||||
logger.trace("end time - " + time);
|
logger.trace("end time - " + time);
|
||||||
|
|
||||||
//printName("", folderItem);
|
|
||||||
|
|
||||||
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
||||||
|
|
||||||
return itemFolder;
|
return itemFolder;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -221,13 +219,14 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
@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);
|
||||||
try {
|
throw new WorkspaceNavigatorServiceException("The method checkName is not implemented");
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
// try {
|
||||||
return workspace.isValidName(name);
|
// Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
} catch (Exception e) {
|
// return workspace.isValidName(name);
|
||||||
logger.error("Error during folder retrieving", e);
|
// } catch (Exception e) {
|
||||||
throw new WorkspaceNavigatorServiceException(e.getMessage());
|
// logger.error("Error during folder retrieving", e);
|
||||||
}
|
// throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*protected void printName(String indentation, Item item)
|
/*protected void printName(String indentation, Item item)
|
||||||
|
@ -254,7 +253,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
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<WorkspaceItem> parents = workspace.getParentsById(itemIdentifier);
|
List<? extends WorkspaceItem> parents = workspace.getParentsById(itemIdentifier);
|
||||||
logger.trace("parents size: "+parents.size());
|
logger.trace("parents size: "+parents.size());
|
||||||
Item[] arrayParents;
|
Item[] arrayParents;
|
||||||
|
|
||||||
|
@ -262,12 +261,13 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
switch (parents.size()) {
|
switch (parents.size()) {
|
||||||
case 0: // itemIdentifier is ROOT
|
case 0: // itemIdentifier is ROOT
|
||||||
logger.trace("itemIdentifier isRoot...");
|
logger.trace("itemIdentifier isRoot...");
|
||||||
if (includeItemAsParent) { //ADDIND ROOT
|
if (includeItemAsParent) { //ADDING ROOT
|
||||||
WorkspaceFolder wsFolder =(WorkspaceFolder) workspace.getItem(itemIdentifier);
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder wsFolder =
|
||||||
|
(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsItem;
|
||||||
Item root = ItemBuilder.buildFolderForBreadcrumbs(wsFolder, null);
|
Item root = ItemBuilder.buildFolderForBreadcrumbs(wsFolder, null);
|
||||||
List<Item> listParents = new ArrayList<Item>(1);
|
List<Item> listParents = new ArrayList<Item>(1);
|
||||||
listParents.add(root);
|
listParents.add(root);
|
||||||
// workspaceLogger.trace("returning: "+listParents.toString());
|
//workspaceLogger.trace("returning: "+listParents.toString());
|
||||||
return listParents;
|
return listParents;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -278,11 +278,12 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
case 1: //itemIdentifier is first level from root
|
case 1: //itemIdentifier is first level from root
|
||||||
logger.trace("itemIdentifier is first level...");
|
logger.trace("itemIdentifier is first level...");
|
||||||
List<Item> listParents = new ArrayList<Item>();
|
List<Item> listParents = new ArrayList<Item>();
|
||||||
WorkspaceFolder wsRootFolder = (WorkspaceFolder) parents.get(0); //isRoot
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder wsRootFolder = (org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) parents.get(0); //isRoot
|
||||||
Item root = ItemBuilder.buildFolderForBreadcrumbs(wsRootFolder, null);
|
Item root = ItemBuilder.buildFolderForBreadcrumbs(wsRootFolder, null);
|
||||||
Item parent = null;
|
Item parent = null;
|
||||||
if(includeItemAsParent){
|
if(includeItemAsParent){
|
||||||
WorkspaceFolder wsFolder1 =(WorkspaceFolder) workspace.getItem(itemIdentifier); //root
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder wsFolder1 =
|
||||||
|
(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) workspace.getItem(itemIdentifier); //root
|
||||||
parent = ItemBuilder.buildFolderForBreadcrumbs(wsFolder1, null);
|
parent = ItemBuilder.buildFolderForBreadcrumbs(wsFolder1, null);
|
||||||
}
|
}
|
||||||
listParents.add(root);
|
listParents.add(root);
|
||||||
|
@ -370,7 +371,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
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<WorkspaceItem> parents = null;
|
List<? extends WorkspaceItem> parents = null;
|
||||||
try{
|
try{
|
||||||
parents = workspace.getParentsById(itemIdentifier);
|
parents = workspace.getParentsById(itemIdentifier);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
@ -405,7 +406,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
WorkspaceItem lastItem = parents.get(parents.size()-1);
|
WorkspaceItem lastItem = parents.get(parents.size()-1);
|
||||||
|
|
||||||
//CONVERTING LAST ELEMENT IF NECESSARY
|
//CONVERTING LAST ELEMENT IF NEEDED...
|
||||||
logger.debug("converting last element..");
|
logger.debug("converting last element..");
|
||||||
if(includeItemAsParent && lastItem.isFolder()){ //FIX BUG #298
|
if(includeItemAsParent && lastItem.isFolder()){ //FIX BUG #298
|
||||||
arrayParents = new Item[parents.size()];
|
arrayParents = new Item[parents.size()];
|
||||||
|
@ -476,6 +477,13 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size by item id.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @return the size by item id
|
||||||
|
* @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)
|
||||||
*/
|
*/
|
||||||
|
@ -489,15 +497,15 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
Long size = new Long(-1);
|
Long size = new Long(-1);
|
||||||
|
|
||||||
if(wsItem instanceof FolderItem){ //ITEM
|
if(wsItem instanceof FileItem){ //ITEM
|
||||||
FolderItem folderItem = (FolderItem) wsItem;
|
FileItem fileItem = (FileItem) wsItem;
|
||||||
size = new Long(folderItem.getLength());
|
size = new Long(fileItem.getSize());
|
||||||
} else if (wsItem instanceof WorkspaceFolder ){ //FOLDER
|
} else if (wsItem instanceof WorkspaceFolder ){ //FOLDER
|
||||||
WorkspaceFolder theFolder = (WorkspaceFolder) wsItem;
|
WorkspaceFolder theFolder = (WorkspaceFolder) wsItem;
|
||||||
size = theFolder.getSize();
|
//size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
||||||
} else if (wsItem instanceof WorkspaceSharedFolder){ //SHARED FOLDER
|
} else if (wsItem instanceof WorkspaceSharedFolder){ //SHARED FOLDER
|
||||||
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) wsItem;
|
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) wsItem;
|
||||||
size = theFolder.getSize();
|
//size = theFolder.getSize(); NOT SUPPORTED BY SHUB
|
||||||
}
|
}
|
||||||
logger.info("returning size: " +size);
|
logger.info("returning size: " +size);
|
||||||
return size;
|
return size;
|
||||||
|
@ -508,6 +516,13 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the mime type.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @return the mime type
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getMimeType(java.lang.String)
|
* @see org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService#getMimeType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -520,13 +535,11 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
Workspace workspace = WsUtil.getWorkspace(this.getThreadLocalRequest().getSession());
|
||||||
WorkspaceItem wsItem = workspace.getItem(itemId);
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
|
||||||
if(!wsItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)) {
|
if(wsItem instanceof FileItem) {
|
||||||
|
FileItem fileItem = (FileItem) wsItem;
|
||||||
|
return fileItem.getMimeType();
|
||||||
|
}else
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
FolderItem folderItem = (FolderItem) wsItem;
|
|
||||||
|
|
||||||
return folderItem.getMimeType();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("get MimeType By ItemId ", e);
|
logger.error("get MimeType By ItemId ", e);
|
||||||
|
@ -570,25 +583,31 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
* @param asRoot the as root
|
* @param asRoot the as root
|
||||||
* @return true, if is a shared folder
|
* @return true, if is a shared folder
|
||||||
*/
|
*/
|
||||||
private boolean isASharedFolder(WorkspaceItem item, boolean asRoot){
|
private boolean isASharedFolder(WorkspaceItem item, boolean asRoot) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(item!=null && item.isFolder() && item.isShared()){ //IS A SHARED SUB-FOLDER
|
if (item != null && item.isFolder() && item.isShared()) { // IS A SHARED SUB-FOLDER
|
||||||
if(asRoot)
|
if (asRoot) {
|
||||||
{
|
return item.getType().equals(WorkspaceItemType.SHARED_FOLDER); // IS ROOT?
|
||||||
return item.getType().equals(WorkspaceItemType.SHARED_FOLDER); //IS ROOT?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
logger.error("Error in server isASharedFolder", e);
|
logger.error("Error in server isASharedFolder", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the readable size by item id.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @return the readable size by item id
|
||||||
|
* @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)
|
||||||
*/
|
*/
|
||||||
|
@ -605,6 +624,15 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the folder.
|
||||||
|
*
|
||||||
|
* @param nameFolder the name folder
|
||||||
|
* @param description the description
|
||||||
|
* @param parentId the parent id
|
||||||
|
* @return the item
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService#createFolder(java.lang.String, java.lang.String, java.lang.String)
|
* @see org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService#createFolder(java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,12 +40,11 @@ public class WsUtil {
|
||||||
|
|
||||||
return new StorageHubWrapper(scope, token, false, false, true);
|
return new StorageHubWrapper(scope, token, false, false, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error during getting storageHub wrapper", e);
|
logger.error("Error when instancing the storageHub wrapper", e);
|
||||||
throw new Exception("Error on inizializing the StorageHub");
|
throw new Exception("Error on inizializing the StorageHub wrapper");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workpace.
|
* Gets the workpace.
|
||||||
*
|
*
|
||||||
|
@ -64,28 +63,6 @@ public class WsUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Gets the workspace.
|
|
||||||
// *
|
|
||||||
// * @param httpSession the http session
|
|
||||||
// * @return the workspace
|
|
||||||
// * @throws InternalErrorException the internal error exception
|
|
||||||
// * @throws HomeNotFoundException the home not found exception
|
|
||||||
// * @throws WorkspaceFolderNotFoundException the workspace folder not found
|
|
||||||
// * exception
|
|
||||||
// * @throws UserNotFoundException the user not found exception
|
|
||||||
// */
|
|
||||||
// public static Workspace getWorkspace(HttpSession httpSession) throws InternalErrorException, HomeNotFoundException,
|
|
||||||
// WorkspaceFolderNotFoundException, UserNotFoundException {
|
|
||||||
//// ASLSession session = getASLSession(httpSession);
|
|
||||||
//
|
|
||||||
// String scope = getScope(httpSession);
|
|
||||||
// // GET CONTEXT
|
|
||||||
// logger.info("Setting scope: " + scope);
|
|
||||||
// ScopeProvider.instance.set(scope);
|
|
||||||
// return HomeLibrary.getHomeManagerFactory().getHomeManager().getGuestLogin().getWorkspace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the scope.
|
* Gets the scope.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.shared;
|
package org.gcube.portlets.user.workspaceexplorerapp.shared;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum ItemType.
|
* The Enum ItemType.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 18, 2015
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
|
* Apr 9, 2020
|
||||||
*/
|
*/
|
||||||
public enum ItemType {
|
public enum ItemType {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue