updated to realize
https://issue.imarine.research-infrastructures.eu/ticket/3072 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@101453 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2bb5be9ffc
commit
371c909341
|
@ -274,4 +274,11 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
*/
|
*/
|
||||||
WorkspaceUserQuote getUserWorkspaceQuote() throws Exception;
|
WorkspaceUserQuote getUserWorkspaceQuote() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param identifier
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
String getItemDescriptionById(String identifier) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,4 +223,7 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
|
|
||||||
void getUserWorkspaceQuote(AsyncCallback<WorkspaceUserQuote> callback);
|
void getUserWorkspaceQuote(AsyncCallback<WorkspaceUserQuote> callback);
|
||||||
|
|
||||||
|
void getItemDescriptionById(String identifier,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,13 +87,18 @@ public class DialogGetInfo extends Dialog {
|
||||||
|
|
||||||
add(txtLocation);
|
add(txtLocation);
|
||||||
|
|
||||||
|
|
||||||
|
txtAreaDescription.setFieldLabel("Description");
|
||||||
|
txtAreaDescription.setHeight(30);
|
||||||
|
txtAreaDescription.setReadOnly(true);
|
||||||
|
add(txtAreaDescription);
|
||||||
|
|
||||||
|
|
||||||
if(fileModel.isDirectory()){
|
if(fileModel.isDirectory()){
|
||||||
txtAreaDescription.setFieldLabel("Description");
|
|
||||||
txtAreaDescription.setHeight(30);
|
|
||||||
txtAreaDescription.setReadOnly(true);
|
|
||||||
txtAreaDescription.setValue(fileModel.getDescription());
|
txtAreaDescription.setValue(fileModel.getDescription());
|
||||||
add(txtAreaDescription);
|
// add(txtAreaDescription);
|
||||||
}
|
}else
|
||||||
|
loadDescription(fileModel.getIdentifier());
|
||||||
|
|
||||||
txtType = new TextField<String>();
|
txtType = new TextField<String>();
|
||||||
txtType.setFieldLabel("Type");
|
txtType.setFieldLabel("Type");
|
||||||
|
@ -193,6 +198,34 @@ public class DialogGetInfo extends Dialog {
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param identifier
|
||||||
|
*/
|
||||||
|
private void loadDescription(String identifier) {
|
||||||
|
txtAreaDescription.mask();
|
||||||
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.getItemDescriptionById(identifier, new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable arg0) {
|
||||||
|
txtAreaDescription.unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
if(result!=null)
|
||||||
|
txtAreaDescription.setValue(result);
|
||||||
|
else
|
||||||
|
txtAreaDescription.setValue("");
|
||||||
|
|
||||||
|
txtAreaDescription.unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void loadLastModificationDate(final String itemId) {
|
private void loadLastModificationDate(final String itemId) {
|
||||||
|
|
||||||
txtLastMofication.mask();
|
txtLastMofication.mask();
|
||||||
|
|
|
@ -42,6 +42,7 @@ 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.ExternalPDFFile;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalPDFFile;
|
||||||
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.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;
|
||||||
|
@ -2357,4 +2358,55 @@ public class GWTWorkspaceBuilder {
|
||||||
|
|
||||||
return formattedSize;
|
return formattedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getItemDescriptionForTypeById(WorkspaceItem item) throws Exception {
|
||||||
|
|
||||||
|
if(item==null)
|
||||||
|
throw new Exception("The item is null");
|
||||||
|
|
||||||
|
logger.info("Getting ItemDescriptionById: "+item.getId());
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
switch (item.getType()) {
|
||||||
|
|
||||||
|
case FOLDER:{
|
||||||
|
WorkspaceFolder theFolder = (WorkspaceFolder) item;
|
||||||
|
return theFolder.getDescription();
|
||||||
|
}
|
||||||
|
case SHARED_FOLDER:{
|
||||||
|
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) item;
|
||||||
|
return theFolder.getDescription();
|
||||||
|
}
|
||||||
|
case GCUBE_ITEM:{
|
||||||
|
|
||||||
|
GCubeItem theGcubeItem = (GCubeItem) item;
|
||||||
|
return theGcubeItem.getDescription();
|
||||||
|
}
|
||||||
|
case SMART_FOLDER:{
|
||||||
|
WorkspaceSmartFolder theFolder = (WorkspaceSmartFolder) item;
|
||||||
|
return theFolder.getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
case TRASH_FOLDER:{
|
||||||
|
WorkspaceTrashFolder theFolder = (WorkspaceTrashFolder) item;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
case TRASH_ITEM:{
|
||||||
|
WorkspaceTrashItem tItem = (WorkspaceTrashItem) item;
|
||||||
|
return tItem.getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
default:{ //IS AN ITEM
|
||||||
|
return item.getDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error in server ItemDescriptionForTypeById: ", e);
|
||||||
|
String error = ConstantsExplorer.SERVER_ERROR +" getting description for item id: "+item.getId();
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3176,6 +3176,30 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
throw new Exception(error);
|
throw new Exception(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemDescriptionById(String identifier) throws Exception {
|
||||||
|
|
||||||
|
workspaceLogger.info("Getting ItemDescriptionById: "+identifier);
|
||||||
|
if(identifier==null || identifier.isEmpty()){
|
||||||
|
workspaceLogger.warn("Getting ItemDescriptionById identifier is null or empty, returning null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
WorkspaceItem item = workspace.getItem(identifier);
|
||||||
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
|
return builder.getItemDescriptionForTypeById(item);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
workspaceLogger.error("Error in server ItemDescriptionById: ", e);
|
||||||
|
String error = ConstantsExplorer.SERVER_ERROR +" getting description for item id: "+identifier;
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getACLBySharedFolderId(java.lang.String)
|
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getACLBySharedFolderId(java.lang.String)
|
||||||
|
@ -3272,5 +3296,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
throw new Exception(error);
|
throw new Exception(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue