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