Moved partially the method markFolderAsPublicForFolderItemId to SHUB

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181338 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-07-29 13:27:34 +00:00
parent 1493f96f76
commit 85d54e6051
4 changed files with 105 additions and 157 deletions

View File

@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.model.FileDetailsModel;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
@ -113,16 +112,6 @@ public interface GWTWorkspaceService extends RemoteService {
*/
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException;
/**
* Gets the details file.
*
* @param item
* the item
* @return the details file
* @throws Exception
* the exception
*/
public FileDetailsModel getDetailsFile(FileModel item) throws Exception;
/**
* Creates the folder.
@ -657,17 +646,6 @@ public interface GWTWorkspaceService extends RemoteService {
*/
void setGcubeItemProperties(String itemId, Map<String, String> properties) throws Exception;
/**
* Gets the item for file tree.
*
* @param itemId
* the item id
* @return the item for file tree
* @throws Exception
* the exception
*/
FileModel getItemForFileTree(String itemId) throws Exception;
/**
* Gets the my first name.
*
@ -765,4 +743,14 @@ public interface GWTWorkspaceService extends RemoteService {
*/
PublicLink getPublicLinkForFileItemIdToVersion(String itemId, String version, boolean shortenUrl) throws Exception;
/**
* Gets the item for file tree.
*
* @param itemId the item id
* @return the item for file tree
* @throws Exception the exception
*/
FileModel getItemForFileTree(String itemId) throws Exception;
}

View File

@ -9,7 +9,6 @@ import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.model.FileDetailsModel;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
@ -114,15 +113,6 @@ public interface GWTWorkspaceServiceAsync {
*/
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
/**
*
* @param item
* the item
* @param callback
* file details model
*/
void getDetailsFile(FileModel item, AsyncCallback<FileDetailsModel> callback);
/**
* Gets the children sub tree to root by identifier.
*

View File

@ -794,6 +794,7 @@ public class AsyncTreePanel extends LayoutContainer {
public void addItemIdAndExpandFolder(final FileModel parent, String itemId, boolean expandFolder){
treePanel.mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
AppControllerExplorer.rpcWorkspaceService.getItemForFileTree(itemId, new AsyncCallback<FileModel>(){
@Override

View File

@ -54,7 +54,6 @@ import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
import org.gcube.portlets.user.urlshortener.UrlShortener;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.model.FileDetailsModel;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
@ -72,7 +71,6 @@ import org.gcube.portlets.user.workspace.server.notifications.tostoragehub.Notif
import org.gcube.portlets.user.workspace.server.notifications.tostoragehub.NotificationsProducerToStorageHub;
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfile;
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex;
import org.gcube.portlets.user.workspace.server.tostoragehub.StorageHubToWorkpaceConverter;
import org.gcube.portlets.user.workspace.server.util.PortalContextInfo;
import org.gcube.portlets.user.workspace.server.util.StringUtil;
@ -182,15 +180,19 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
protected UrlShortener getUrlShortener() {
return WsUtil.getUrlShortener(this.getThreadLocalRequest());
}
//TODO CHECK METHODS BEFORE
/**
* Gets the uri resolver.
*
* @return the uri resolver
*/
protected UriResolverReaderParameterForResolverIndex getUriResolver() {
return WsUtil.getUriResolver(this.getThreadLocalRequest());
}
// /**
// * Gets the uri resolver.
// *
// * @return the uri resolver
// */
// protected UriResolverReaderParameterForResolverIndex getUriResolver() {
// return WsUtil.getUriResolver(this.getThreadLocalRequest());
// }
/**
* Gets the property special folder reader.
@ -214,6 +216,25 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
+ ConstantsExplorer.SPECIALFOLDERNAMEPROPERTIESFILE;
}
/**
* Gets the name for special folder.
*
* @return the name for special folder
*/
private String getNameForSpecialFolder() {
PropertySpecialFolderReader sfReader = getPropertySpecialFolderReader();
if (sfReader == null) {
workspaceLogger.warn("Reader is null, skypping set to special folder name");
return "";
}
workspaceLogger
.info("Read special folder name: '" + sfReader.getSpecialFolderName() + "', from property file..");
return sfReader.getSpecialFolderName();
}
/*
* (non-Javadoc)
*
@ -233,6 +254,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
*/
@Override
public List<FileGridModel> getItemsBySearchName(String text, String folderId) throws Exception {
//TODO MOVE TO SHUB
try {
Workspace workspace = getWorkspace();
@ -263,92 +286,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
}
/**
* Gets the name for special folder.
*
* @return the name for special folder
*/
private String getNameForSpecialFolder() {
PropertySpecialFolderReader sfReader = getPropertySpecialFolderReader();
if (sfReader == null) {
workspaceLogger.warn("Reader is null, skypping set to special folder name");
return "";
}
workspaceLogger
.info("Read special folder name: '" + sfReader.getSpecialFolderName() + "', from property file..");
return sfReader.getSpecialFolderName();
}
/*
* (non-Javadoc)
*
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#
* getItemForFileTree(java.lang.String)
*/
/**
* Gets the item for file tree.
*
* @param itemId
* the item id
* @return the item for file tree
* @throws Exception
* the exception
*/
@Override
public FileModel getItemForFileTree(String itemId) throws Exception {
try {
if (itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(itemId);
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
// BUILD PARENT
WorkspaceFolder folderParent = wsItem.getParent(); // get parent
FileModel wsFolderParent = builder.buildGXTFileModelItem(folderParent, null);
// BUILD ITEM
return builder.buildGXTFileModelItem(wsItem, wsFolderParent);
} catch (Exception e) {
workspaceLogger.error("Error in server during item retrieving, getItemForFileGrid", e);
String error = ConstantsExplorer.SERVER_ERROR + RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST;
throw new Exception(error);
}
}
// DEBUG
/**
* Prints the contacts.
*
* @param listContacts
* the list contacts
*/
private void printContacts(List<InfoContactModel> listContacts) {
workspaceLogger.trace("Contacts:");
for (InfoContactModel infoContactModel : listContacts) {
workspaceLogger.trace("User: " + infoContactModel);
}
}
// DEBUG
/**
* Prints the list.
*
* @param list
* the list
*/
private void printList(List<String> list) {
for (String string : list) {
workspaceLogger.trace(string);
}
}
/*
* (non-Javadoc)
@ -356,35 +293,36 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#
* getDetailsFile(org.gcube.portlets.user.workspace.client.model.FileModel)
*/
/**
* Gets the details file.
*
* @param folder
* the folder
* @return the details file
* @throws Exception
* the exception
*/
@Override
public FileDetailsModel getDetailsFile(FileModel folder) throws Exception {
try {
if (folder == null)
throw new Exception("Folder is null");
workspaceLogger.trace("load file details: " + folder.getName());
Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
return builder.buildGWTWorkspaceFileDetails(wsItem, folder);
} catch (Exception e) {
workspaceLogger.error("Error in load server file details", e);
throw new Exception(e.getMessage());
}
}
// /**
// * Gets the details file.
// *
// * @param folder
// * the folder
// * @return the details file
// * @throws Exception
// * the exception
// */
// @Override
// public FileDetailsModel getDetailsFile(FileModel folder) throws Exception {
//
// try {
//
// if (folder == null)
// throw new Exception("Folder is null");
//
// workspaceLogger.trace("load file details: " + folder.getName());
// Workspace workspace = getWorkspace();
// WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier());
// GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
//
// return builder.buildGWTWorkspaceFileDetails(wsItem, folder);
//
// } catch (Exception e) {
// workspaceLogger.error("Error in load server file details", e);
// throw new Exception(e.getMessage());
// }
// }
/*
* (non-Javadoc)
@ -3755,6 +3693,37 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getItemForFileTree(java.lang.String)
*/
@Override
public FileModel getItemForFileTree(String itemId) throws Exception {
try {
if (itemId == null)
throw new Exception(IDENTIFIER_IS_NULL);
org.gcube.common.storagehubwrapper.server.tohl.Workspace workspace = getWorkspaceFromStorageHub();
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsItem = workspace.getItem(itemId);
StorageHubToWorkpaceConverter converter = getStorageHubToWorkpaceConverter();
FileModel parentModel = null;
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent = null;
if(wsItem.getParentId()!=null) {
parent = workspace.getItem(wsItem.getParentId());
parentModel = converter.toTreeFileModel(parent, null, parent.isShared());
}
return converter.toTreeFileModel(wsItem, parentModel, parent!=null?parent.isShared():false);
} catch (Exception e) {
workspaceLogger.error("Error in server during item retrieving, getItemForFileGrid", e);
String error = ConstantsExplorer.SERVER_ERROR + RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST;
throw new Exception(error);
}
}
}