notification was updated

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@69644 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-02-26 10:37:55 +00:00
parent 0f1b52824c
commit c6cbf9ccaa
2 changed files with 103 additions and 10 deletions

View File

@ -1511,7 +1511,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
fileModel.setParentFileModel(parent);
}
workspaceLogger.trace("list parents return size: "+listParents.size());

View File

@ -63,10 +63,12 @@ public class NotificationsProducer {
@Override
public void run() {
gcubeLogger.trace("Send notify folder sharing is running...");
for (InfoContactModel infoContactModel : listContacts) {
try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
// if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
gcubeLogger.trace("Send notify folder sharing for user "+infoContactModel.getId());
@ -79,7 +81,7 @@ public class NotificationsProducer {
if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
// }
}
}catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
e.printStackTrace();
@ -105,38 +107,128 @@ public class NotificationsProducer {
@Override
public void run() {
printContacts(listContacts);
// printContacts(listContacts);
gcubeLogger.trace("Send notify folder un share is running...");
for (InfoContactModel infoContactModel : listContacts) {
try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
// if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
gcubeLogger.trace("Send notify folder un share user "+infoContactModel.getId());
//DEBUG
System.out.println("Send notify folder un share user "+infoContactModel.getId());
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getId(), sharedFolder, userId);
if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
// }
}
}catch (Exception e) {
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
e.printStackTrace();
}
}
gcubeLogger.trace("un share notifications is completed");
System.out.println("un share folder completed");
gcubeLogger.trace("notify of un share notifications is completed");
}
}.start();
}
/**
* Runs a new thread to notify the contacts passed in input
* @param listContacts
* @param sharedFolder
*/
public void notifyAddedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceFolder sharedFolder) {
new Thread() {
@Override
public void run() {
// printContacts(listContacts);
gcubeLogger.trace("Send notify added item in sharedfolder is running...");
for (InfoContactModel infoContactModel : listContacts) {
try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
gcubeLogger.trace("Send notify added item in sharedfolder + "+sharedFolder.getName()+" for user "+infoContactModel.getId());
//DEBUG
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getId(), sharedFolder);
if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
}
}catch (Exception e) {
gcubeLogger.error("An error occured in notifyAddedItemToSharing ", e);
e.printStackTrace();
}
}
gcubeLogger.trace("notigy of added item in shared folder is completed");
}
}.start();
}
/**
* Runs a new thread to notify the contacts passed in input
* @param listContacts
* @param sharedFolder
*/
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceFolder sharedFolder) {
new Thread() {
@Override
public void run() {
// printContacts(listContacts);
gcubeLogger.trace("Send notify remove item in sharedfolder is running...");
for (InfoContactModel infoContactModel : listContacts) {
try{
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
gcubeLogger.trace("Send notify remove item in sharedfolder + "+sharedFolder.getName()+" for user "+infoContactModel.getId());
//DEBUG
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getId(), sharedFolder);
if(!notify)
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
}
}catch (Exception e) {
gcubeLogger.error("An error occured in notifyRemovedItemToSharing ", e);
e.printStackTrace();
}
}
gcubeLogger.trace("notify of removed item in shared folder is completed");
}
}.start();
}
//DEBUG
private void printContacts(List<InfoContactModel> listContacts){
System.out.println("Print contacts");
@ -164,6 +256,8 @@ public class NotificationsProducer {
NotificationsProducer feeder = new NotificationsProducer(session);
}
}