|
|
|
@ -1,21 +1,20 @@
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
package org.gcube.portlets.widgets.workspacesharingwidget.server.notifications;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.gcube.application.framework.core.session.ASLSession;
|
|
|
|
|
import org.gcube.application.framework.core.session.SessionManager;
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
|
|
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
|
|
|
|
import org.gcube.common.scope.impl.ScopeBean;
|
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.DiffereceBeetweenInfoContactModel;
|
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.UserUtil;
|
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.WsUtil;
|
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
@ -26,7 +25,7 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
protected ScopeBean scope;
|
|
|
|
|
|
|
|
|
|
protected static Logger logger = LoggerFactory.getLogger(NotificationsProducer.class);
|
|
|
|
|
protected static Logger logger = Logger.getLogger(NotificationsProducer.class);
|
|
|
|
|
|
|
|
|
|
protected NotificationsManager notificationsMng;
|
|
|
|
|
protected ASLSession aslSession;
|
|
|
|
@ -55,25 +54,26 @@ public class NotificationsProducer {
|
|
|
|
|
return aslSession;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs a new thread to notify the contacts passed in input
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param sharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyFolderSharing(final List<InfoContactModel> listContacts, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyFolderSharing(final List<InfoContactModel> listContacts, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
new Thread(){
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logger.info("Send notifies folder sharing is running...");
|
|
|
|
|
logger.trace("Send notifies folder sharing is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
|
|
|
|
logger.trace("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
|
|
|
@ -86,15 +86,15 @@ public class NotificationsProducer {
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyFolderSharing ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies share folder is completed");
|
|
|
|
|
logger.trace("notifies share folder is completed");
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -106,17 +106,17 @@ public class NotificationsProducer {
|
|
|
|
|
* @param sharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyFolderRenamed(final List<InfoContactModel> listSharedContact, final WorkspaceItem folderItem, final String itemOldName, final String itemNewName, final String idsharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
new Thread(){
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logger.info("Send notifies shared folder was renamed is running...");
|
|
|
|
|
logger.trace("Send notifies shared folder was renamed is running...");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if(NotificationsUtil.checkIsRootFolderShared(folderItem.getId(), idsharedFolder)){
|
|
|
|
|
logger.info("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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -130,7 +130,7 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
|
|
|
|
logger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
|
|
|
@ -143,14 +143,15 @@ public class NotificationsProducer {
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyFolderRenamed ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies share folder was renamed is completed");
|
|
|
|
|
logger.trace("notifies share folder was renamed is completed");
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -159,41 +160,41 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param sharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyItemRenamed(final List<InfoContactModel> listSharedContact, final String previousName, final WorkspaceItem item, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyItemRenamed(final List<InfoContactModel> listSharedContact, final String previousName, final WorkspaceItem item, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
new Thread(){
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logger.info("Send notifies shared item was updated is running...");
|
|
|
|
|
logger.trace("Send notifies shared item was updated is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
|
|
|
|
try{
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
|
|
|
|
|
|
|
|
|
// notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
|
|
|
|
|
|
|
|
|
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item);
|
|
|
|
|
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
|
|
|
|
|
|
|
|
|
if(!notify)
|
|
|
|
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyItemUpdated ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies shared item was updated is completed");
|
|
|
|
|
logger.trace("notifies shared item was updated is completed");
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -205,7 +206,7 @@ public class NotificationsProducer {
|
|
|
|
|
* @param sharedFolder - the shared folder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyAddedUsersToSharing(final List<InfoContactModel> listSharedContact, final List<InfoContactModel> listSharingContact, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -228,7 +229,7 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
|
|
|
@ -240,7 +241,7 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyFolderAddedUser ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -256,7 +257,7 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
|
|
|
@ -268,7 +269,7 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyFolderAddedUser ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -281,12 +282,12 @@ public class NotificationsProducer {
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyAddedUserToSharing ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -295,15 +296,15 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param unSharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final WorkspaceFolder unSharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final WorkspaceSharedFolder unSharedFolder) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
logger.info("Send notifies folder un share is running...");
|
|
|
|
|
logger.trace("Send notifies folder un share is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
@ -311,27 +312,26 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder);
|
|
|
|
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
|
|
|
|
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
|
|
|
|
|
|
|
|
|
|
if(!notify)
|
|
|
|
|
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyFolderUnSharing ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies of un share notifications is completed");
|
|
|
|
|
logger.trace("notifies of un share notifications is completed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -341,14 +341,14 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param workspaceItem
|
|
|
|
|
*/
|
|
|
|
|
public void notifyAddedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyAddedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
logger.info("Send notifies added item in sharedfolder is running...");
|
|
|
|
|
logger.trace("Send notifies added item in sharedfolder is running...");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Send notifies added item in sharedfolder is running...");
|
|
|
|
@ -359,7 +359,7 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
@ -372,24 +372,22 @@ public class NotificationsProducer {
|
|
|
|
|
if(!notify){
|
|
|
|
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifyAddedItemToSharing ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies of added item in shared folder is completed");
|
|
|
|
|
logger.trace("notifies of added item in shared folder is completed");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("notifies of added item in shared folder is completed");
|
|
|
|
|
// System.out.println("notifies of added item in shared folder is completed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -398,17 +396,17 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param workspaceItem
|
|
|
|
|
*/
|
|
|
|
|
public void notifyUpdatedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyUpdatedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
logger.info("Send notifies updated item in shared folder is running...");
|
|
|
|
|
logger.trace("Send notifies updated item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Send notifies updated item in shared folder is running...");
|
|
|
|
|
// System.out.println("Send notifies updated item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
@ -416,10 +414,10 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
|
|
|
@ -429,7 +427,7 @@ public class NotificationsProducer {
|
|
|
|
|
if(!notify){
|
|
|
|
|
logger.error("An error updated when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("An error updated when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
// System.out.println("An error updated when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
@ -438,15 +436,13 @@ public class NotificationsProducer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies of updated item in shared folder is completed");
|
|
|
|
|
logger.trace("notifies of updated item in shared folder is completed");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("notifies of updated item in shared folder is completed");
|
|
|
|
|
// System.out.println("notifies of updated item in shared folder is completed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -458,20 +454,20 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param sharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification remove item in shared folder is running...");
|
|
|
|
|
logger.trace("Sending notification remove item in shared folder is running...");
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if(NotificationsUtil.checkIsRootFolderShared(workspaceItem.getId(), sharedFolder.getId())){
|
|
|
|
|
logger.info("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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -480,9 +476,9 @@ public class NotificationsProducer {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification moved item in shared folder is running...");
|
|
|
|
|
logger.trace("Sending notification moved item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
System.out.println("Sending notification moved item in shared folder is running...");
|
|
|
|
|
// System.out.println("Sending notification moved item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
@ -490,10 +486,10 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
|
|
|
|
|
|
|
|
@ -501,7 +497,7 @@ public class NotificationsProducer {
|
|
|
|
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
@ -510,16 +506,16 @@ public class NotificationsProducer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies of moved item in shared folder is completed");
|
|
|
|
|
logger.trace("notifies of moved item in shared folder is completed");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("notifies of moved item in shared folder is completed");
|
|
|
|
|
// System.out.println("notifies of moved item in shared folder is completed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -528,28 +524,28 @@ public class NotificationsProducer {
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param sharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName, final WorkspaceFolder sharedFolder) {
|
|
|
|
|
/*
|
|
|
|
|
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName, final WorkspaceSharedFolder sharedFolder) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification remove item in shared folder is running...");
|
|
|
|
|
logger.trace("Sending notification remove item in shared folder is running...");
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
|
|
|
|
|
if(itemName==null || itemName.isEmpty()){
|
|
|
|
|
logger.info("Notification isn't sent - itemName is null or empty");
|
|
|
|
|
logger.trace("Notification isn't sent - itemName is null or empty");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sharedFolder==null){
|
|
|
|
|
logger.info("Notification isn't sent - sharedFolder is null");
|
|
|
|
|
logger.trace("Notification isn't sent - sharedFolder is null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification removed item in shared folder is running...");
|
|
|
|
|
logger.trace("Sending notification removed item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
System.out.println("Sending notification removed item in shared folder is running...");
|
|
|
|
|
// System.out.println("Sending notification removed item in shared folder is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
@ -557,42 +553,82 @@ public class NotificationsProducer {
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.info("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
|
|
|
|
|
|
|
|
|
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), itemName, sharedFolder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!notify){
|
|
|
|
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occurred in notifyRemovedItemToSharing ", e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("notifies of moved item in shared folder is completed");
|
|
|
|
|
logger.trace("notifies of moved item in shared folder is completed");
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("notifies of moved item in shared folder is completed");
|
|
|
|
|
// System.out.println("notifies of moved item in shared folder is completed");
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs a new thread to notify the contacts passed in input
|
|
|
|
|
* @param listContacts
|
|
|
|
|
* @param unSharedFolder
|
|
|
|
|
*/
|
|
|
|
|
public void notifySharedFolderDeleted(final List<InfoContactModel> listContacts, final String folderNameDeleted) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
// printContacts(listContacts);
|
|
|
|
|
logger.trace("Send notifies shared folder deleted is running...");
|
|
|
|
|
|
|
|
|
|
for (InfoContactModel infoContactModel : listContacts) {
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
|
|
|
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
|
|
|
|
|
|
|
|
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
// boolean notify = notificationsMng.
|
|
|
|
|
|
|
|
|
|
// if(!notify)
|
|
|
|
|
// logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occured in notifySharedFolderDeleted ", e);
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.trace("notifies of deleted shared foder is completed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}.start();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//DEBUG
|
|
|
|
|
private void printContacts(List<InfoContactModel> listContacts){
|
|
|
|
|
|
|
|
|
|