removed file items in the tree only folder are shown

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@169664 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-07-04 14:34:36 +00:00
parent b63f679d33
commit 1123a92dad
2 changed files with 691 additions and 689 deletions

View File

@ -366,7 +366,7 @@ public class Resources {
* @return the icon share user
*/
public static AbstractImagePrototype getIconShareUser(){
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.GROUP());
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.USER());
}
/**
@ -1113,7 +1113,7 @@ public class Resources {
* @return the icon un share folder
*/
public static AbstractImagePrototype getIconUnShareFolder() {
return AbstractImagePrototype.create(ICONS.unShareFolder());
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.UNSHARE());
}
/**
@ -1122,7 +1122,7 @@ public class Resources {
* @return the icon un share user
*/
public static AbstractImagePrototype getIconUnShareUser() {
return AbstractImagePrototype.create(ICONS.unShareUser());
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.UNSHARE());
}
/**

View File

@ -135,16 +135,16 @@ public class GWTWorkspaceBuilder {
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false));
// try{
// logger.info("Sleeping for testing...");
// Thread.sleep(30000);
// logger.info("Alive again");
// }catch(Exception e){
//
// }
// try{
// logger.info("Sleeping for testing...");
// Thread.sleep(30000);
// logger.info("Alive again");
// }catch(Exception e){
//
// }
//GROUPS
// hashTestUser.put("/gcube/devsec/devVRE", new InfoContactModel("/gcube/devsec/devVRE", "/gcube/devsec/devVRE", "",true));
// hashTestUser.put("/gcube/devsec/gcube-test-test", new InfoContactModel("/gcube/devsec/gcube-test-test", "/gcube/gcube-test-test", "",true));
// hashTestUser.put("/gcube/devsec/devVRE", new InfoContactModel("/gcube/devsec/devVRE", "/gcube/devsec/devVRE", "",true));
// hashTestUser.put("/gcube/devsec/gcube-test-test", new InfoContactModel("/gcube/devsec/gcube-test-test", "/gcube/gcube-test-test", "",true));
}
return hashTestUser;
@ -228,7 +228,7 @@ public class GWTWorkspaceBuilder {
protected GWTProperties buildGWTProperties(Properties metadata) throws InternalErrorException
{
//FIXME temp solution
// GWTProperties gwtProperties = new GWTProperties(metadata.getId(), metadata.getProperties());
// GWTProperties gwtProperties = new GWTProperties(metadata.getId(), metadata.getProperties());
return new GWTProperties();
}
@ -280,8 +280,8 @@ public class GWTWorkspaceBuilder {
sb.append(requestType.toString());
sb.append("&"+ConstantsExplorer.CURRENT_CONTEXT_ID+"=");
sb.append(currentGroupId);
// sb.append("&"+ConstantsExplorer.CURRENT_USER_ID+"=");
// sb.append(currUserId);
// sb.append("&"+ConstantsExplorer.CURRENT_USER_ID+"=");
// sb.append(currUserId);
sb.append("&random=");
sb.append(UUID.randomUUID().toString());
return sb.toString();
@ -305,7 +305,7 @@ public class GWTWorkspaceBuilder {
GWTWorkspaceItem gwtImage;
GWTProperties gwtProperties = buildGWTProperties(item.getProperties());
//
//
if(isInteralImage){
GCubeItem image = (GCubeItem) item; //Cast OLD Image Document
@ -431,7 +431,7 @@ public class GWTWorkspaceBuilder {
if(isInternalUrl){
GCubeItem document = (GCubeItem) item; //Cast OLD UrlDocument
// UrlDocument document = (UrlDocument) item; //Cast
// UrlDocument document = (UrlDocument) item; //Cast
List<DocumentAlternativeLink> links = (List<DocumentAlternativeLink>) new XStream().fromXML(document.getProperties().getPropertyValue(NodeProperty.ALTERNATIVES.toString()));
List<DocumentPartLink> parts = (List<DocumentPartLink>) new XStream().fromXML(document.getProperties().getPropertyValue(NodeProperty.PARTS.toString()));
Map<String, DocumentMetadata> metadatas = (Map<String, DocumentMetadata>) new XStream().fromXML(document.getProperties().getPropertyValue(NodeProperty.METADATA.toString()));
@ -541,36 +541,38 @@ public class GWTWorkspaceBuilder {
* @return the list
* @throws InternalErrorException the internal error exception
*/
protected List<FileModel> buildGXTListFileModelItem(WorkspaceItem workspaceFolder, FileModel parentFolderModel) throws InternalErrorException
{
protected List<FileModel> buildGXTListFileModelItem(WorkspaceItem workspaceFolder, FileModel parentFolderModel) throws InternalErrorException {
List<FileModel> listFileModel = new ArrayList<FileModel>();
@SuppressWarnings("unchecked")
List<WorkspaceItem> listItems = (List<WorkspaceItem>) workspaceFolder.getChildren();
if(listItems!=null)
logger.trace("HL return "+listItems.size()+ " items, converting...");
//TEST TIME
// Long startTime = System.currentTimeMillis();
// Long endTime = System.currentTimeMillis() - startTime;
// String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
// logger.trace("tree getChildren() returning "+listItems.size()+" elements in " + time);
// startTime = System.currentTimeMillis();
// Long startTime = System.currentTimeMillis();
// Long endTime = System.currentTimeMillis() - startTime;
// String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
// logger.trace("tree getChildren() returning "+listItems.size()+" elements in " + time);
// startTime = System.currentTimeMillis();
for (WorkspaceItem item : listItems){
if (item.isFolder()) {
logger.debug("item: "+item.getName()+ "is root? " +item.isRoot());
listFileModel.add(buildGXTFileModelItem(item,parentFolderModel));
}
}
//TEST TIME
// endTime = System.currentTimeMillis() - startTime;
// time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
// logger.trace("tree gxt objects getChildren() returning "+listItems.size()+" elements in " + time);
// endTime = System.currentTimeMillis() - startTime;
// time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
// logger.trace("tree gxt objects getChildren() returning "+listItems.size()+" elements in " + time);
return listFileModel;
// return buildGXTListFileModelItem((WorkspaceItem) workspaceFolder.getChildren(), parentFolderModel);
// return buildGXTListFileModelItem((WorkspaceItem) workspaceFolder.getChildren(), parentFolderModel);
}
@ -685,7 +687,7 @@ public class GWTWorkspaceBuilder {
*/
protected FileModel buildGXTFileModelItem(WorkspaceItem item, FileModel parentFolderModel) throws InternalErrorException
{
// logger.debug("buildGXTFileModelItem: "+item.getName());
// logger.debug("buildGXTFileModelItem: "+item.getName());
FileModel fileModel = null;
@ -893,12 +895,12 @@ public class GWTWorkspaceBuilder {
fileGridModel = (FileGridModel) setFolderItemType(fileGridModel, folderItem);
//ADDING VERSION NAME
// if (folderItem instanceof ExternalFile){
//
// ExternalFile extFile = (ExternalFile) folderItem;
// WorkspaceVersion version = extFile.getCurrentVersion();
// fileGridModel.setVersionName(version!=null?version.getName():null);
// }
// if (folderItem instanceof ExternalFile){
//
// ExternalFile extFile = (ExternalFile) folderItem;
// WorkspaceVersion version = extFile.getCurrentVersion();
// fileGridModel.setVersionName(version!=null?version.getName():null);
// }
break;
@ -934,14 +936,14 @@ public class GWTWorkspaceBuilder {
fileGridModel.setShared(true); //NOT REMOVE IT IS IMPORTAT SEE #1459
User owner = item.getOwner();
if(owner!=null){
// System.out.println("++++reading owner");
// System.out.println("++++reading owner");
String portalLogin = owner.getPortalLogin();
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(portalLogin));
}
}
else{
if(userLogged!=null)
// fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
// fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
fileGridModel.setOwnerFullName(userLogged.getName());
}
@ -961,7 +963,7 @@ public class GWTWorkspaceBuilder {
if(searchFolderItem.getFolderItemType()==null){
logger.trace("Search folder item type is null for "+searchFolderItem.getId() + " name: "+searchFolderItem.getName());
//FOR DEBUG
// System.out.println("Search folder item type is null for "+searchFolderItem.getId() + " name: "+searchFolderItem.getName());
// System.out.println("Search folder item type is null for "+searchFolderItem.getId() + " name: "+searchFolderItem.getName());
return fileModel;
}
@ -1094,7 +1096,7 @@ public class GWTWorkspaceBuilder {
case IMAGE_DOCUMENT:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.IMAGE_DOCUMENT);
fileModel.setShortcutCategory(GXTCategorySmartFolder.SMF_IMAGES);
// ImageDocument imgDoc = (ImageDocument) worspaceFolderItem;
// ImageDocument imgDoc = (ImageDocument) worspaceFolderItem;
GCubeItem imgDoc = (GCubeItem) worspaceFolderItem; //Cast GCubeItem
try {
fileModel.setType(imgDoc.getMimeType());
@ -1105,7 +1107,7 @@ public class GWTWorkspaceBuilder {
case DOCUMENT:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.DOCUMENT);
fileModel.setShortcutCategory(GXTCategorySmartFolder.SMF_DOCUMENTS);
// Document doc = (Document) worspaceFolderItem;
// Document doc = (Document) worspaceFolderItem;
GCubeItem doc = (GCubeItem) worspaceFolderItem; //Cast GCubeItem
try {
fileModel.setType(doc.getMimeType());
@ -1264,16 +1266,16 @@ public class GWTWorkspaceBuilder {
name = wsFolder.getName();
//MANAGEMENT SPECIAL FOLDER
// if(wsFolder.getName().compareTo("MySpecialFolders")==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot()){
// WorkspaceSharedFolder shared = (WorkspaceSharedFolder) wsFolder;
// name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
// }else
// name = wsFolder.getName();
// if(wsFolder.getName().compareTo("MySpecialFolders")==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot()){
// WorkspaceSharedFolder shared = (WorkspaceSharedFolder) wsFolder;
// name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
// }else
// name = wsFolder.getName();
FolderModel folder = new FolderModel(wsFolder.getId(), name, parent, true, wsFolder.isShared(), false, wsFolder.isPublic());
folder.setShareable(true);
folder.setDescription(wsFolder.getDescription());
// folder.setOwner(wsFolder.getOwner());
// folder.setOwner(wsFolder.getOwner());
if(parent != null && parent.isShared()){
folder.setShared(true);
@ -1328,7 +1330,7 @@ public class GWTWorkspaceBuilder {
folder.setShareable(true);
folder.setIsRoot(wsFolder.isRoot());
folder.setDescription(wsFolder.getDescription());
// folder.setOwner(wsFolder.getOwner());
// folder.setOwner(wsFolder.getOwner());
if(parent != null && parent.isShared()){
folder.setShared(true);
@ -1689,7 +1691,7 @@ public class GWTWorkspaceBuilder {
AccountingEntryCreate create = (AccountingEntryCreate) accountingEntry;
af.setOperation(GxtAccountingEntryType.CREATE);
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName());
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName());
String msg = "";
if(create.getItemName()==null || create.getItemName().isEmpty())
msg = GxtAccountingEntryType.CREATE.getId() + " by "+user.getName();
@ -2001,8 +2003,8 @@ public class GWTWorkspaceBuilder {
break;
default:
// acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.OTHER, ""));
// break;
// acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.OTHER, ""));
// break;
}
}