changed all notifications. New parameter is instance of WorkspaceSharedFolder

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@95679 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-05-14 13:47:17 +00:00
parent 104b922711
commit 2378dc73b2
3 changed files with 46 additions and 28 deletions

View File

@ -686,9 +686,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
NotificationsProducer np = getNotificationProducer();
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceFolder) destinationSharedFolder);
workspaceLogger.trace("The notifies sent correctly");
if(destinationSharedFolder instanceof WorkspaceSharedFolder){
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
workspaceLogger.trace("The notifies sent correctly");
}
else
workspaceLogger.warn("Notifies added item: "+sourceItem+ "to share doesn't sent because "+destinationSharedFolder+" is not istance of WorkspaceSharedFolder");
// np.notifyAddedItemToSharing(listContacts, (WorkspaceFolder) folderDestinationItem);
}
}
@ -740,10 +743,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
NotificationsProducer np = getNotificationProducer();
np.notifyMovedItemToSharing(listContacts, sourceItem, (WorkspaceFolder) sourceSharedFolder);
workspaceLogger.trace("The notifies was sent correctly");
if(sourceSharedFolder instanceof WorkspaceSharedFolder){
np.notifyMovedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) sourceSharedFolder);
workspaceLogger.trace("The notifies was sent correctly");
}else
workspaceLogger.warn("Notifies moved item: "+sourceItem+ "from share doesn't sent because "+sourceSharedFolder+" is not istance of WorkspaceSharedFolder");
}
}else
@ -852,8 +856,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
if(NotificationsUtil.isASharedFolder(wsItem)){
notification.notifyFolderRenamed(listSharedContact, wsItem, previousName, newName, wsItem.getIdSharedFolder());
}else{
WorkspaceFolder sharedFolder = (WorkspaceFolder) workspace.getItem(wsItem.getIdSharedFolder());
notification.notifyItemRenamed(listSharedContact, previousName, wsItem, sharedFolder);
//TWO CASES: EITHER ROOT FOLDER AS WorkspaceSharedFolder OR DOESN'T.
WorkspaceItem sharedFolder = workspace.getItem(wsItem.getIdSharedFolder());
if(sharedFolder instanceof WorkspaceSharedFolder)
notification.notifyItemRenamed(listSharedContact, previousName, wsItem, (WorkspaceSharedFolder) sharedFolder);
else
workspaceLogger.trace("Notifies for rename item itemId: "+itemId+" doesn't sent because: "+sharedFolder+" is not an instance of WorkspaceSharedFolder");
// notification.notifyItemRenamed(listSharedContact, previousName, wsItem, sharedFolder);
}
}catch (Exception e) {
workspaceLogger.error("An error occurred in checkNotify ", e);

View File

@ -64,7 +64,7 @@ public class NotificationsProducer {
* @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
@ -164,7 +164,7 @@ 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
@ -300,7 +300,7 @@ 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() {
@ -320,8 +320,7 @@ public class NotificationsProducer {
//DEBUG
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder);
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
if(!notify)
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
@ -346,7 +345,7 @@ 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
@ -401,7 +400,7 @@ 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
@ -459,7 +458,7 @@ 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() {
@ -529,7 +528,7 @@ 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() {

View File

@ -64,14 +64,18 @@ public class NotificationsUtil {
NotificationsProducer np = new NotificationsProducer(WsUtil.getAslSession(httpSession));
//SWITCH BEETWEEN ADDED OR UPDATED
if(!isOverwrite)
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceFolder) destinationSharedFolder);
else
np.notifyUpdatedItemToSharing(listContacts, sourceItem, (WorkspaceFolder) destinationSharedFolder);
if(destinationSharedFolder instanceof WorkspaceSharedFolder){
//SWITCH BEETWEEN ADDED OR UPDATED
if(!isOverwrite)
np.notifyAddedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
else
np.notifyUpdatedItemToSharing(listContacts, sourceItem, (WorkspaceSharedFolder) destinationSharedFolder);
logger.trace("The notifies was sent correctly");
logger.trace("The notifies was sent correctly");
}else
logger.trace("The notifies doesn't sent because "+destinationSharedFolder+ " is not instance of WorkspaceSharedFolder");
// np.notifyAddedItemToSharing(listContacts, (WorkspaceFolder) folderDestinationItem);
}
}
@ -187,8 +191,13 @@ public class NotificationsUtil {
//Notify Removed Item To Sharing?
if(!isRootFolderShared){
np.notifyRemovedItemToSharing(listContacts, oldItemName, (WorkspaceFolder) sourceSharedFolder);
logger.trace("The notifies was sent correctly");
if(sourceSharedFolder instanceof WorkspaceSharedFolder){
np.notifyRemovedItemToSharing(listContacts, oldItemName, (WorkspaceSharedFolder) sourceSharedFolder);
logger.trace("The notifies was sent correctly");
}
else
logger.trace("The notifies doesn't sent because "+sourceSharedFolder+ " is not instance of WorkspaceSharedFolder");
}else{
//Case removed shared folder
np.notifySharedFolderDeleted(listContacts, oldItemName);