Implemented enhancement #23225
This commit is contained in:
parent
b3e50eb26b
commit
bea9e9e566
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -3,24 +3,31 @@
|
||||||
All notable changes to this project will be documented in this file.
|
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).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v2.1.0-SNAPSHOT] - 2022-05-02
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#23225] Updated the method to read the members of VREs
|
||||||
|
|
||||||
|
|
||||||
## [v2.0.6] - 2020-07-15
|
## [v2.0.6] - 2020-07-15
|
||||||
|
|
||||||
[#19317] Just to include the storagehub-client-wrapper at 1.0.0 version
|
- [#19317] Just to include the storagehub-client-wrapper at 1.0.0 version
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
|
|
||||||
[#19243] upload archive facility does not work properly with Windows OS
|
- [#19243] upload archive facility does not work properly with Windows OS
|
||||||
|
|
||||||
[#19232] manage file names that use special characters
|
- [#19232] manage file names that use special characters
|
||||||
|
|
||||||
|
|
||||||
## [v2.0.5] - 2020-05-14
|
## [v2.0.5] - 2020-05-14
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
|
|
||||||
[#19243] upload archive facility does not work properly with Windows OS
|
- [#19243] upload archive facility does not work properly with Windows OS
|
||||||
|
|
||||||
[#19232] manage file names that use special characters
|
- [#19232] manage file names that use special characters
|
||||||
|
|
||||||
|
|
||||||
## [v2.0.4] - 2019-12-19
|
## [v2.0.4] - 2019-12-19
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>workspace-uploader</artifactId>
|
<artifactId>workspace-uploader</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.0.6</version>
|
<version>2.1.0-SNAPSHOT</version>
|
||||||
<name>Workspace Uploader Widget</name>
|
<name>Workspace Uploader Widget</name>
|
||||||
<description>Workspace Uploader Widget allows your application to upload file/s in the gCube Workspace</description>
|
<description>Workspace Uploader Widget allows your application to upload file/s in the gCube Workspace</description>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.6.3</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.gcube.common.storagehub.model.service.Version;
|
||||||
import org.gcube.common.storagehub.model.types.WorkspaceItemType;
|
import org.gcube.common.storagehub.model.types.WorkspaceItemType;
|
||||||
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
||||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.Member;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.server.util.UserUtil;
|
import org.gcube.portlets.widgets.workspaceuploader.server.util.UserUtil;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.shared.ContactModel;
|
import org.gcube.portlets.widgets.workspaceuploader.shared.ContactModel;
|
||||||
|
@ -25,8 +26,6 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class NotificationsWorkspaceUploader.
|
* The Class NotificationsWorkspaceUploader.
|
||||||
*
|
*
|
||||||
|
@ -35,10 +34,8 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class NotificationsWorkspaceUploader {
|
public class NotificationsWorkspaceUploader {
|
||||||
|
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(NotificationsWorkspaceUploader.class);
|
protected static Logger logger = LoggerFactory.getLogger(NotificationsWorkspaceUploader.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check send notify changed item to share.
|
* Check send notify changed item to share.
|
||||||
*
|
*
|
||||||
|
@ -53,7 +50,9 @@ public class NotificationsWorkspaceUploader {
|
||||||
* @param folderDestinationItem the folder destination item
|
* @param folderDestinationItem the folder destination item
|
||||||
* @param isOverwrite the is overwrite
|
* @param isOverwrite the is overwrite
|
||||||
*/
|
*/
|
||||||
public static void checkSendNotifyChangedItemToShare(StorageHubWrapper storageWrapper, HttpServletRequest request, GCubeUser currUser, String scopeGroupId, NotificationsWorkspaceUploaderProducer np, HttpSession httpSession, final Item sourceItem, final String sourceSharedId, final FolderItem folderDestinationItem) {
|
public static void checkSendNotifyChangedItemToShare(StorageHubWrapper storageWrapper, HttpServletRequest request,
|
||||||
|
GCubeUser currUser, String scopeGroupId, NotificationsWorkspaceUploaderProducer np, HttpSession httpSession,
|
||||||
|
final Item sourceItem, final String sourceSharedId, final FolderItem folderDestinationItem) {
|
||||||
|
|
||||||
logger.debug("checkSendNotifyChangedItemToShare called");
|
logger.debug("checkSendNotifyChangedItemToShare called");
|
||||||
|
|
||||||
|
@ -61,7 +60,9 @@ public class NotificationsWorkspaceUploader {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (folderDestinationItem.isShared()) { // Notify Added Item To Sharing?
|
if (folderDestinationItem.isShared()) { // Notify Added Item To Sharing?
|
||||||
logger.trace("checkNotifyAddItemToShare source item: "+sourceItem.getName()+" sourceSharedId: "+sourceSharedId + " folder destination name: "+folderDestinationItem.getName() + " folder destination id: "+folderDestinationItem.getId());
|
logger.trace("checkNotifyAddItemToShare source item: " + sourceItem.getName() + " sourceSharedId: "
|
||||||
|
+ sourceSharedId + " folder destination name: " + folderDestinationItem.getName()
|
||||||
|
+ " folder destination id: " + folderDestinationItem.getId());
|
||||||
// share condition is true if source shared folder is not null
|
// share condition is true if source shared folder is not null
|
||||||
|
|
||||||
boolean shareChangeCondition = sourceSharedId == null ? false : true;
|
boolean shareChangeCondition = sourceSharedId == null ? false : true;
|
||||||
|
@ -73,18 +74,18 @@ public class NotificationsWorkspaceUploader {
|
||||||
FolderItem folderDest = (FolderItem) folderDestinationItem;
|
FolderItem folderDest = (FolderItem) folderDestinationItem;
|
||||||
SharedFolder rootSharedFolder = null;
|
SharedFolder rootSharedFolder = null;
|
||||||
try {
|
try {
|
||||||
FolderItem sharedFolder = storageWrapper.getStorageHubClientService().getRootSharedFolder(folderDest.getId());
|
FolderItem sharedFolder = storageWrapper.getStorageHubClientService()
|
||||||
|
.getRootSharedFolder(folderDest.getId());
|
||||||
rootSharedFolder = (SharedFolder) sharedFolder;
|
rootSharedFolder = (SharedFolder) sharedFolder;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// silent
|
// silent
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reading memmbers from rootSharedFolder
|
// Reading members from rootSharedFolder
|
||||||
List<String> listLogins = storageWrapper.getWorkspace().getSharedFolderMembers(rootSharedFolder.getId());
|
List<Member> listMemebers = storageWrapper.getWorkspace()
|
||||||
List<ContactModel> listContacts = new ArrayList<ContactModel>(listLogins.size());
|
.getSharedFolderMembers(rootSharedFolder.getId());
|
||||||
for (String login : listLogins) {
|
|
||||||
listContacts.add(new ContactModel(login, login, false, UserUtil.getUserFullName(login)));
|
List<ContactModel> listContacts = UserUtil.listMembersToListContact(listMemebers);
|
||||||
}
|
|
||||||
|
|
||||||
SocialFileItem socialItem = NotificationMapper.toSocialItem(storageWrapper, sourceItem);
|
SocialFileItem socialItem = NotificationMapper.toSocialItem(storageWrapper, sourceItem);
|
||||||
|
|
||||||
|
@ -93,7 +94,8 @@ public class NotificationsWorkspaceUploader {
|
||||||
|
|
||||||
boolean isUpdate = false;
|
boolean isUpdate = false;
|
||||||
try {
|
try {
|
||||||
List<Version> versions = storageWrapper.getStorageHubClientService().getListVersions(sourceItem.getId());
|
List<Version> versions = storageWrapper.getStorageHubClientService()
|
||||||
|
.getListVersions(sourceItem.getId());
|
||||||
isUpdate = versions.size() > 1 ? true : false;
|
isUpdate = versions.size() > 1 ? true : false;
|
||||||
logger.debug("Is file updating? " + shareChangeCondition);
|
logger.debug("Is file updating? " + shareChangeCondition);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -106,15 +108,15 @@ public class NotificationsWorkspaceUploader {
|
||||||
else
|
else
|
||||||
np.notifyUpdatedItemToSharing(listContacts, socialItem, socialFolder);
|
np.notifyUpdatedItemToSharing(listContacts, socialItem, socialFolder);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
logger.trace("folder destination is not shared");
|
logger.trace("folder destination is not shared");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("An error occurred in checkSendNotifyAddItemToShare ", e);
|
logger.error("An error occurred in checkSendNotifyAddItemToShare ", e);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
logger.warn("The notifies is failure in checkSendNotifyAddItemToShare because folder destination item is null");
|
logger.warn(
|
||||||
|
"The notifies is failure in checkSendNotifyAddItemToShare because folder destination item is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +131,6 @@ public class NotificationsWorkspaceUploader {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is a shared folder for id.
|
* Checks if is a shared folder for id.
|
||||||
*
|
*
|
||||||
|
@ -156,7 +157,6 @@ public class NotificationsWorkspaceUploader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check is root folder shared.
|
* Check is root folder shared.
|
||||||
*
|
*
|
||||||
|
@ -166,7 +166,8 @@ public class NotificationsWorkspaceUploader {
|
||||||
*/
|
*/
|
||||||
public static boolean checkIsRootFolderShared(String itemId, String rootFolderSharedId) {
|
public static boolean checkIsRootFolderShared(String itemId, String rootFolderSharedId) {
|
||||||
|
|
||||||
logger.trace("checkIsRootFolderShared between [itemid: "+itemId +", rootFolderSharedId: "+rootFolderSharedId+"]");
|
logger.trace("checkIsRootFolderShared between [itemid: " + itemId + ", rootFolderSharedId: "
|
||||||
|
+ rootFolderSharedId + "]");
|
||||||
if (itemId == null)
|
if (itemId == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,10 @@ package org.gcube.portlets.widgets.workspaceuploader.server.util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.Member;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.shared.ContactModel;
|
import org.gcube.portlets.widgets.workspaceuploader.shared.ContactModel;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
|
@ -12,20 +14,16 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class UserUtil.
|
* The Class UserUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Aug 3, 2015
|
||||||
* Aug 3, 2015
|
|
||||||
*/
|
*/
|
||||||
public class UserUtil {
|
public class UserUtil {
|
||||||
|
|
||||||
static UserManager um = new LiferayUserManager();
|
static UserManager um = new LiferayUserManager();
|
||||||
protected static Logger logger = LoggerFactory.getLogger(UserUtil.class);
|
protected static Logger logger = LoggerFactory.getLogger(UserUtil.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user full name.
|
* Gets the user full name.
|
||||||
*
|
*
|
||||||
|
@ -71,6 +69,48 @@ public class UserUtil {
|
||||||
return portalLogin;
|
return portalLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<ContactModel> listMembersToListContact(List<Member> members) {
|
||||||
|
logger.info("listMembersToListContact called for " + members.size() + " member/s");
|
||||||
|
|
||||||
|
List<ContactModel> listContacts = new ArrayList<ContactModel>();
|
||||||
|
UserManager userManager = new LiferayUserManager();
|
||||||
|
|
||||||
|
for (Member member : members) {
|
||||||
|
logger.debug("Resolving member: " + member);
|
||||||
|
boolean isGroup = member.getMemberType().equals(Member.TYPE.GROUP) ? true : false;
|
||||||
|
|
||||||
|
if (!isGroup) {
|
||||||
|
// HE/SHE IS A USER
|
||||||
|
listContacts.add(new ContactModel(member.getIdentity(), member.getIdentity(), false,
|
||||||
|
UserUtil.getUserFullName(member.getIdentity())));
|
||||||
|
} else {
|
||||||
|
// HE/SHE IS A GROUP
|
||||||
|
logger.debug("The member: " + member
|
||||||
|
+ " is a group, resolving list of Users from "+LiferayUserManager.class.getSimpleName()+" for the group name: "
|
||||||
|
+ member.getName());
|
||||||
|
try {
|
||||||
|
List<GCubeUser> listUsers = userManager.listUsersByGroupName(member.getName());
|
||||||
|
|
||||||
|
if (listUsers != null) {
|
||||||
|
logger.debug("List of user for groupName are: " + listUsers.size());
|
||||||
|
for (GCubeUser user : listUsers) {
|
||||||
|
listContacts.add(new ContactModel(user.getUsername(), user.getUsername(), false,
|
||||||
|
user.getFullname()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn("List of user for groupName: " + member.getName() + " is null");
|
||||||
|
}
|
||||||
|
} catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault e) {
|
||||||
|
logger.warn("Error occurrend on resolving the member: " + member.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Returning " + listContacts.size() + " from members");
|
||||||
|
return listContacts;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list login by info contact model.
|
* Gets the list login by info contact model.
|
||||||
*
|
*
|
||||||
|
@ -108,7 +148,6 @@ public class UserUtil {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Separate full name to comma for portal login.
|
* Separate full name to comma for portal login.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue