ref 13226:StorageHub - Update workspace-sharing-widget to SH
https://support.d4science.org/issues/13226 Added notifications in case of share and unshare git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@178697 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f47d1fa9f5
commit
fa3a42ff6b
|
@ -36,6 +36,8 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL.USER_TYPE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL.USER_TYPE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE;
|
||||||
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -281,6 +283,26 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<InfoContactModel> searchUsersFromKeyword(PortalContextInfo info, String keyword)
|
||||||
|
throws Exception {
|
||||||
|
try {
|
||||||
|
logger.debug("Search Keyword: " + keyword);
|
||||||
|
List<InfoContactModel> listInfoContactModel = new ArrayList<>();
|
||||||
|
UserManager userManager = new LiferayUserManager();
|
||||||
|
List<GCubeUser> users = userManager.searchUsersByGroup(keyword, info.getCurrGroupId());
|
||||||
|
for (GCubeUser user : users) {
|
||||||
|
InfoContactModel icm = new InfoContactModel(String.valueOf(user.getUserId()), user.getUsername(),
|
||||||
|
user.getFullname(), false);
|
||||||
|
listInfoContactModel.add(icm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return listInfoContactModel;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error searching user by kewords: " + e.getLocalizedMessage(), e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the gxt info contacts from portal logins.
|
* Builds the gxt info contacts from portal logins.
|
||||||
*
|
*
|
||||||
|
@ -381,25 +403,29 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
logger.info("Workspace item is a SharedFolder...");
|
logger.info("Workspace item is a SharedFolder...");
|
||||||
SharedFolder shared = (SharedFolder) item;
|
SharedFolder shared = (SharedFolder) item;
|
||||||
String name = shared.isVreFolder() ? shared.getDisplayName() : item.getName();
|
String name = shared.isVreFolder() ? shared.getDisplayName() : item.getName();
|
||||||
fileModel = new FolderModel(item.getId(), name, item.getDescription(),parent, true, true, shared.isVreFolder());
|
fileModel = new FolderModel(item.getId(), name, item.getDescription(), parent, true, true,
|
||||||
|
shared.isVreFolder());
|
||||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||||
fileModel.setDescription(item.getDescription());
|
fileModel.setDescription(item.getDescription());
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof FolderItem) {
|
if (item instanceof FolderItem) {
|
||||||
logger.info("Workspace item is a Folder...");
|
logger.info("Workspace item is a Folder...");
|
||||||
fileModel = new FolderModel(item.getId(), item.getName(), item.getDescription(),parent, true, false, false);
|
fileModel = new FolderModel(item.getId(), item.getName(), item.getDescription(), parent, true,
|
||||||
|
false, false);
|
||||||
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||||
fileModel.setDescription(item.getDescription());
|
fileModel.setDescription(item.getDescription());
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof AbstractFileItem) {
|
if (item instanceof AbstractFileItem) {
|
||||||
logger.info("Workspace item is a AbstractFileItem...");
|
logger.info("Workspace item is a AbstractFileItem...");
|
||||||
fileModel = new FileModel(item.getId(), item.getName(), item.getDescription(), parent, false, false);
|
fileModel = new FileModel(item.getId(), item.getName(), item.getDescription(), parent, false,
|
||||||
|
false);
|
||||||
AbstractFileItem abstractFileItem = (AbstractFileItem) item;
|
AbstractFileItem abstractFileItem = (AbstractFileItem) item;
|
||||||
fileModel = setFolderItemType(fileModel, abstractFileItem);
|
fileModel = setFolderItemType(fileModel, abstractFileItem);
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof GCubeItem) {
|
if (item instanceof GCubeItem) {
|
||||||
logger.info("Workspace item is a GCubeItem...");
|
logger.info("Workspace item is a GCubeItem...");
|
||||||
fileModel = new FileModel(item.getId(), item.getName(), item.getDescription(),parent, false, false);
|
fileModel = new FileModel(item.getId(), item.getName(), item.getDescription(), parent,
|
||||||
|
false, false);
|
||||||
fileModel.setFolderItemType(GXTFolderItemTypeEnum.GCUBE_ITEM);
|
fileModel.setFolderItemType(GXTFolderItemTypeEnum.GCUBE_ITEM);
|
||||||
} else {
|
} else {
|
||||||
logger.error("gxt conversion return null for item " + item.getName());
|
logger.error("gxt conversion return null for item " + item.getName());
|
||||||
|
|
|
@ -111,19 +111,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
}
|
}
|
||||||
// READING USERS FROM VRE
|
|
||||||
/*
|
|
||||||
* UserManager userManag = new LiferayUserManager(); GroupManager gm
|
|
||||||
* = new LiferayGroupManager(); String aslSessionGN =
|
|
||||||
* aslSession.getGroupName();
|
|
||||||
* logger.info("aslSession.getGroupName(): "+ aslSessionGN); String
|
|
||||||
* groupId = gm.getGroupId(aslSessionGN);
|
|
||||||
* logger.info("groupId from GroupManager: "+ groupId);
|
|
||||||
* logger.info("Liferay User Manager getting list users by group: "
|
|
||||||
* +groupId); List<InfoContactModel> listContactsModel =
|
|
||||||
* builder.buildGXTListContactsModelFromUserModel(userManag.
|
|
||||||
* listUsersByGroup(groupId));
|
|
||||||
*/
|
|
||||||
|
|
||||||
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
||||||
|
|
||||||
|
@ -463,6 +451,8 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
Set<String> logins = new HashSet<>(listLogin);
|
Set<String> logins = new HashSet<>(listLogin);
|
||||||
folderContainer.share(logins, getAccessType(acl));
|
folderContainer.share(logins, getAccessType(acl));
|
||||||
created = true;
|
created = true;
|
||||||
|
NotificationsProducer np = getNotificationProducer(this.getThreadLocalRequest());
|
||||||
|
np.notifyFolderSharing(listContacts, folderItem);
|
||||||
} else {
|
} else {
|
||||||
logger.debug("The folder is already shared");
|
logger.debug("The folder is already shared");
|
||||||
throw new Exception("The folder selected is already shared!");
|
throw new Exception("The folder selected is already shared!");
|
||||||
|
@ -472,6 +462,9 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
Set<String> logins = new HashSet<>(listLogin);
|
Set<String> logins = new HashSet<>(listLogin);
|
||||||
folderContainer.share(logins, getAccessType(acl));
|
folderContainer.share(logins, getAccessType(acl));
|
||||||
created = true;
|
created = true;
|
||||||
|
NotificationsProducer np = getNotificationProducer(this.getThreadLocalRequest());
|
||||||
|
np.notifyFolderSharing(listContacts, folderItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("Invalid folder retrieved: [id=" + itemId + "]");
|
logger.error("Invalid folder retrieved: [id=" + itemId + "]");
|
||||||
|
@ -483,27 +476,6 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* if (created) { NotificationsProducer np =
|
|
||||||
* getNotificationProducer(this.getThreadLocalRequest()); if
|
|
||||||
* (!sourceFolderIsShared) {// if source folder is not already //
|
|
||||||
* shared
|
|
||||||
*
|
|
||||||
* // TODO ADD NOTIFICATION // np.notifyFolderSharing(listContacts,
|
|
||||||
* sharedFolder);
|
|
||||||
*
|
|
||||||
* } else {
|
|
||||||
*
|
|
||||||
* //System.out.println("SHARED CONTACS: ");
|
|
||||||
* //printContacts(listSharedContact);
|
|
||||||
* //System.out.println("NEW CONTACS: ");
|
|
||||||
* //printContacts(listContacts);
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* // TODO ADD NOTIFICATION //
|
|
||||||
* np.notifyAddedUsersToSharing(listSharedContact, // listContacts,
|
|
||||||
* sharedFolder); } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
return created;
|
return created;
|
||||||
|
|
||||||
|
@ -891,7 +863,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.error("Invalid folder requested: [id=" + itemId + "]");
|
logger.error("Invalid folder requested: [id=" + itemId + "]");
|
||||||
throw new Exception("Invalid folder requested: [id=" + itemId + "]");
|
throw new Exception("Invalid folder requested: [id=" + itemId + "]");
|
||||||
}
|
}
|
||||||
boolean shared = false;
|
boolean unshared = false;
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
OpenResolver openResolver = shc.open(itemId);
|
OpenResolver openResolver = shc.open(itemId);
|
||||||
FolderContainer folderContainer = openResolver.asFolder();
|
FolderContainer folderContainer = openResolver.asFolder();
|
||||||
|
@ -903,7 +875,15 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("Folder type: SharedFolder");
|
logger.debug("Folder type: SharedFolder");
|
||||||
SharedFolder sharedFolder = (SharedFolder) folderItem;
|
SharedFolder sharedFolder = (SharedFolder) folderItem;
|
||||||
folderContainer.unshare(sharedFolder.getUsers().getMap().keySet());
|
folderContainer.unshare(sharedFolder.getUsers().getMap().keySet());
|
||||||
shared = true;
|
unshared = true;
|
||||||
|
ArrayList<InfoContactModel> listContacts=new ArrayList<>();
|
||||||
|
for(String key:sharedFolder.getUsers().getMap().keySet()){
|
||||||
|
InfoContactModel contact=new InfoContactModel(key,key, key, false);
|
||||||
|
listContacts.add(contact);
|
||||||
|
}
|
||||||
|
NotificationsProducer np = getNotificationProducer(this.getThreadLocalRequest());
|
||||||
|
np.notifyFolderUnSharing(listContacts, folderItem);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String msg = "The folder requested is not a root shared folder."
|
String msg = "The folder requested is not a root shared folder."
|
||||||
+ "To unshare this folder you have to unshare the root shared folder!";
|
+ "To unshare this folder you have to unshare the root shared folder!";
|
||||||
|
@ -921,7 +901,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new Exception("Invalid folder retrieved: [id=" + itemId + "]");
|
throw new Exception("Invalid folder retrieved: [id=" + itemId + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
return shared;
|
return unshared;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error in unSharedFolderByFolderSharedId(): " + e.getLocalizedMessage(), e);
|
logger.error("Error in unSharedFolderByFolderSharedId(): " + e.getLocalizedMessage(), e);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
import org.gcube.applicationsupportlayer.social.shared.SocialFileItem;
|
import org.gcube.applicationsupportlayer.social.shared.SocialFileItem;
|
||||||
import org.gcube.applicationsupportlayer.social.shared.SocialSharedFolder;
|
import org.gcube.applicationsupportlayer.social.shared.SocialSharedFolder;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.gcube.common.storagehub.model.items.SharedFolder;
|
import org.gcube.common.storagehub.model.items.SharedFolder;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.DiffereceBeetweenInfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.DiffereceBeetweenInfoContactModel;
|
||||||
|
@ -64,10 +65,10 @@ public class NotificationsProducer {
|
||||||
*
|
*
|
||||||
* @param listContacts
|
* @param listContacts
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyFolderSharing(final List<InfoContactModel> listContacts, final SharedFolder sharedFolder) {
|
public void notifyFolderSharing(final List<InfoContactModel> listContacts, final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,15 +82,15 @@ public class NotificationsProducer {
|
||||||
// CURRENT USER
|
// CURRENT USER
|
||||||
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
||||||
|
|
||||||
logger.trace("Sending notification new share folder " + sharedFolder.getName()
|
logger.trace("Sending notification new share folder " + folderItem.getName()
|
||||||
+ " for user " + infoContactModel.getLogin());
|
+ " for user " + infoContactModel.getLogin());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
System.out.println("Sending notification new share folder " + sharedFolder.getName()
|
System.out.println("Sending notification new share folder " + folderItem.getName()
|
||||||
+ " for user " + infoContactModel.getLogin());
|
+ " for user " + infoContactModel.getLogin());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(),
|
||||||
socialSharedFolder);
|
socialSharedFolder);
|
||||||
|
@ -184,11 +185,11 @@ public class NotificationsProducer {
|
||||||
* the previous name
|
* the previous name
|
||||||
* @param item
|
* @param item
|
||||||
* the item
|
* the item
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyItemRenamed(final List<InfoContactModel> listSharedContact, final String previousName,
|
public void notifyItemRenamed(final List<InfoContactModel> listSharedContact, final String previousName,
|
||||||
final Item item, final SharedFolder sharedFolder) {
|
final Item item, final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -213,8 +214,8 @@ public class NotificationsProducer {
|
||||||
// previousName, item, sharedFolder);
|
// previousName, item, sharedFolder);
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, sharedFolder);
|
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(),
|
||||||
previousName, socialFileItem, socialSharedFolder);
|
previousName, socialFileItem, socialSharedFolder);
|
||||||
|
@ -241,11 +242,11 @@ public class NotificationsProducer {
|
||||||
* - list of contacts already shared
|
* - list of contacts already shared
|
||||||
* @param listSharingContact
|
* @param listSharingContact
|
||||||
* - list of "new" contacts witch share
|
* - list of "new" contacts witch share
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* - the shared folder
|
* - the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyAddedUsersToSharing(final List<InfoContactModel> listSharedContact,
|
public void notifyAddedUsersToSharing(final List<InfoContactModel> listSharedContact,
|
||||||
final List<InfoContactModel> listSharingContact, final SharedFolder sharedFolder) {
|
final List<InfoContactModel> listSharingContact, final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -284,7 +285,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + contact.getLogin() + ", added user "
|
logger.trace("Sending notification to user " + contact.getLogin() + ", added user "
|
||||||
+ infoContactModel.getLogin() + " to share folder "
|
+ infoContactModel.getLogin() + " to share folder "
|
||||||
+ sharedFolder.getName());
|
+ folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification
|
// System.out.println("Sending notification
|
||||||
|
@ -294,7 +295,7 @@ public class NotificationsProducer {
|
||||||
// "+contact.getLogin());
|
// "+contact.getLogin());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(),
|
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(),
|
||||||
socialSharedFolder, infoContactModel.getLogin());
|
socialSharedFolder, infoContactModel.getLogin());
|
||||||
|
@ -310,7 +311,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
List<InfoContactModel> listCts = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> listCts = new ArrayList<InfoContactModel>();
|
||||||
listCts.add(infoContactModel);
|
listCts.add(infoContactModel);
|
||||||
notifyFolderSharing(listCts, sharedFolder); // NOTIFIER
|
notifyFolderSharing(listCts, folderItem); // NOTIFIER
|
||||||
// NEW
|
// NEW
|
||||||
// USER
|
// USER
|
||||||
// OF
|
// OF
|
||||||
|
@ -335,7 +336,7 @@ public class NotificationsProducer {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + contact.getLogin() + ", added "
|
logger.trace("Sending notification to user " + contact.getLogin() + ", added "
|
||||||
+ listLogins.size() + " users to share folder " + sharedFolder.getName());
|
+ listLogins.size() + " users to share folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification
|
// System.out.println("Sending notification
|
||||||
|
@ -345,7 +346,7 @@ public class NotificationsProducer {
|
||||||
// "+contact.getLogin());
|
// "+contact.getLogin());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(),
|
boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(),
|
||||||
socialSharedFolder, listLogins);
|
socialSharedFolder, listLogins);
|
||||||
|
@ -359,7 +360,7 @@ public class NotificationsProducer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyFolderSharing(listExclusiveContacts, sharedFolder); // NOTIFIER
|
notifyFolderSharing(listExclusiveContacts, folderItem); // NOTIFIER
|
||||||
// NEW
|
// NEW
|
||||||
// USER
|
// USER
|
||||||
// OF
|
// OF
|
||||||
|
@ -384,10 +385,10 @@ public class NotificationsProducer {
|
||||||
*
|
*
|
||||||
* @param listContacts
|
* @param listContacts
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param unSharedFolder
|
* @param folderItem
|
||||||
* the un shared folder
|
* the un shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final SharedFolder unSharedFolder) {
|
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -404,7 +405,7 @@ public class NotificationsProducer {
|
||||||
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + infoContactModel.getLogin()
|
logger.trace("Sending notification to user " + infoContactModel.getLogin()
|
||||||
+ " un shared folder " + unSharedFolder.getName());
|
+ " un shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification to user
|
// System.out.println("Sending notification to user
|
||||||
|
@ -412,7 +413,7 @@ public class NotificationsProducer {
|
||||||
// "+unSharedFolder.getName());
|
// "+unSharedFolder.getName());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(unSharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(),
|
||||||
socialSharedFolder);
|
socialSharedFolder);
|
||||||
|
@ -440,11 +441,11 @@ public class NotificationsProducer {
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param item
|
* @param item
|
||||||
* the workspace item
|
* the workspace item
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyAddedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
public void notifyAddedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
||||||
final SharedFolder sharedFolder) {
|
final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -464,19 +465,19 @@ public class NotificationsProducer {
|
||||||
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + infoContactModel.getLogin() + " added item "
|
logger.trace("Sending notification to user " + infoContactModel.getLogin() + " added item "
|
||||||
+ item.getName() + " in shared folder " + sharedFolder.getName());
|
+ item.getName() + " in shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
System.out.println("Sending notification to user " + infoContactModel.getLogin()
|
System.out.println("Sending notification to user " + infoContactModel.getLogin()
|
||||||
+ " added item " + item.getName() + " in shared folder " + sharedFolder.getName());
|
+ " added item " + item.getName() + " in shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Send notify folder un share
|
// System.out.println("Send notify folder un share
|
||||||
// user "+infoContactModel.getLogin());
|
// user "+infoContactModel.getLogin());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, sharedFolder);
|
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(),
|
||||||
socialFileItem, socialSharedFolder);
|
socialFileItem, socialSharedFolder);
|
||||||
|
@ -511,11 +512,11 @@ public class NotificationsProducer {
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param item
|
* @param item
|
||||||
* the workspace item
|
* the workspace item
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyUpdatedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
public void notifyUpdatedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
||||||
final SharedFolder sharedFolder) {
|
final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -537,7 +538,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
logger.trace(
|
logger.trace(
|
||||||
"Sending notification to user " + infoContactModel.getLogin() + " updated item "
|
"Sending notification to user " + infoContactModel.getLogin() + " updated item "
|
||||||
+ item.getName() + " in shared folder " + sharedFolder.getName());
|
+ item.getName() + " in shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification to user
|
// System.out.println("Sending notification to user
|
||||||
|
@ -550,8 +551,8 @@ public class NotificationsProducer {
|
||||||
// user "+infoContactModel.getLogin());
|
// user "+infoContactModel.getLogin());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, sharedFolder);
|
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(),
|
||||||
socialFileItem, socialSharedFolder);
|
socialFileItem, socialSharedFolder);
|
||||||
|
@ -586,11 +587,11 @@ public class NotificationsProducer {
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param item
|
* @param item
|
||||||
* the workspace item
|
* the workspace item
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final Item item,
|
||||||
final SharedFolder sharedFolder) {
|
final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -601,7 +602,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NotificationsUtil notificationsUtil=new NotificationsUtil();
|
NotificationsUtil notificationsUtil=new NotificationsUtil();
|
||||||
if (notificationsUtil.checkIsRootFolderShared(item.getId(), sharedFolder.getId())) {
|
if (notificationsUtil.checkIsRootFolderShared(item.getId(), folderItem.getId())) {
|
||||||
logger.trace("Notification isn't sent because the event is on root shared folder");
|
logger.trace("Notification isn't sent because the event is on root shared folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -624,7 +625,7 @@ public class NotificationsProducer {
|
||||||
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + infoContactModel.getLogin() + " moved item "
|
logger.trace("Sending notification to user " + infoContactModel.getLogin() + " moved item "
|
||||||
+ item.getName() + " in shared folder " + sharedFolder.getName());
|
+ item.getName() + " in shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification to user
|
// System.out.println("Sending notification to user
|
||||||
|
@ -633,8 +634,8 @@ public class NotificationsProducer {
|
||||||
// "+sharedFolder.getName());
|
// "+sharedFolder.getName());
|
||||||
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
SocialItemFactory socialItemFactor = new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder = socialItemFactor
|
SocialSharedFolder socialSharedFolder = socialItemFactor
|
||||||
.createSocialSharedFolder(sharedFolder);
|
.createSocialSharedFolder(folderItem);
|
||||||
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, sharedFolder);
|
SocialFileItem socialFileItem = socialItemFactor.createSocialFileItem(item, folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(),
|
boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(),
|
||||||
socialFileItem, socialSharedFolder);
|
socialFileItem, socialSharedFolder);
|
||||||
|
@ -671,11 +672,11 @@ public class NotificationsProducer {
|
||||||
* the list contacts
|
* the list contacts
|
||||||
* @param itemName
|
* @param itemName
|
||||||
* the item name
|
* the item name
|
||||||
* @param sharedFolder
|
* @param folderItem
|
||||||
* the shared folder
|
* the shared folder
|
||||||
*/
|
*/
|
||||||
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName,
|
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName,
|
||||||
final SharedFolder sharedFolder) {
|
final FolderItem folderItem) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -689,7 +690,7 @@ public class NotificationsProducer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sharedFolder == null) {
|
if (folderItem == null) {
|
||||||
logger.trace("Notification isn't sent - sharedFolder is null");
|
logger.trace("Notification isn't sent - sharedFolder is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +707,7 @@ public class NotificationsProducer {
|
||||||
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
if (infoContactModel.getLogin().compareTo(userId) != 0) {
|
||||||
|
|
||||||
logger.trace("Sending notification to user " + infoContactModel.getLogin()
|
logger.trace("Sending notification to user " + infoContactModel.getLogin()
|
||||||
+ " removed item " + itemName + " in shared folder " + sharedFolder.getName());
|
+ " removed item " + itemName + " in shared folder " + folderItem.getName());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.println("Sending notification to user
|
// System.out.println("Sending notification to user
|
||||||
|
@ -714,7 +715,7 @@ public class NotificationsProducer {
|
||||||
// "+itemName+" in shared folder
|
// "+itemName+" in shared folder
|
||||||
// "+sharedFolder.getName());
|
// "+sharedFolder.getName());
|
||||||
SocialItemFactory socialItemFactor=new SocialItemFactory();
|
SocialItemFactory socialItemFactor=new SocialItemFactory();
|
||||||
SocialSharedFolder socialSharedFolder=socialItemFactor.createSocialSharedFolder(sharedFolder);
|
SocialSharedFolder socialSharedFolder=socialItemFactor.createSocialSharedFolder(folderItem);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), itemName,
|
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), itemName,
|
||||||
socialSharedFolder);
|
socialSharedFolder);
|
||||||
|
|
Loading…
Reference in New Issue