Browse Source

Bug fixing #22578. Moved to v6.34.1-SNAPSHOT

feature_23026
Francesco Mangiacrapa 5 months ago
parent
commit
064009cea0
  1. 6
      CHANGELOG.md
  2. 2
      pom.xml
  3. 23
      src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/ObjectStorageHubToWorkpaceMapper.java
  4. 4
      src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java

6
CHANGELOG.md

@ -4,6 +4,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.34.1-SNAPSHOT] - 2021-12-20
#### Fixes
- [#22578] GetInfo facility invoked by Tree View does not display properly the Owner field
## [v6.34.0] - 2021-11-05
#### Enhancements

2
pom.xml

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.34.0</version>
<version>6.34.1-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace

23
src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/ObjectStorageHubToWorkpaceMapper.java

@ -79,7 +79,7 @@ public class ObjectStorageHubToWorkpaceMapper {
* @return the file model
* @throws InternalErrorException the internal error exception
*/
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared) throws InternalErrorException{
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared, GCubeUser loggedUser) throws InternalErrorException{
FileModel fileModel = null;
//boolean isPublic = false;
@ -144,6 +144,8 @@ public class ObjectStorageHubToWorkpaceMapper {
if(wrappedItem.getParentId()!=null && isParentShared)
fileModel.setShareable(false);
}
setFullNameOwner(wrappedItem, fileModel, loggedUser);
//setSynchedThreddsStateFor(fileModel);
fileModel.setIsRoot(wrappedItem.isRoot());
@ -247,27 +249,32 @@ public class ObjectStorageHubToWorkpaceMapper {
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
}
setFullNameOwner(wrappedItem, fileGridModel, loggedUser);
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}
private static void setFullNameOwner(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel fileModel, GCubeUser loggedUser) {
//OWNER
if(wrappedItem.isShared()){ //IT IS READ FROM SHUB ONLY IF THE ITEM IS SHARED
fileGridModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
fileModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
String ownerUsername = wrappedItem.getOwner();
if(ownerUsername!=null){
// System.out.println("++++reading owner");
//String portalLogin = owner.getPortalLogin();
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}
}
else{
String ownerUsername = wrappedItem.getOwner();
//Task #12911 I'm calling getUserFullName for any user other than logged user
if(ownerUsername!=null && ownerUsername.compareToIgnoreCase(loggedUser.getUsername())!=0){
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}else
fileGridModel.setOwnerFullName(loggedUser.getFullname());
fileModel.setOwnerFullName(loggedUser.getFullname());
}
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}

4
src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java

@ -134,7 +134,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared, loggedUser);
return setSynchedWithWsThredds(fileModel, wrappedItem);
}
@ -346,7 +346,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
.isPublicFolder(); // TODO
FileModel parentModel = null;
if (parent != null)
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared(), loggedUser);
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
isPublicDir);

Loading…
Cancel
Save