notifyFolderAddedUsers method added

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@71685 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-03-25 11:08:25 +00:00
parent 75618683c3
commit 2ff8f3ad0c
2 changed files with 46 additions and 2 deletions

View File

@ -157,6 +157,40 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
return saveNotification(not);
}
/**
* {@inheritDoc}
* @throws UserManagementPortalException
* @throws UserRetrievalFault
* @throws UserManagementSystemException
*/
@Override
public boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceFolder sharedFolder, List<String> newAddedUserIds) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException {
if (newAddedUserIds != null && newAddedUserIds.size() > 0) {
if (newAddedUserIds.size() == 1)
return notifyFolderAddedUser(userIdToNotify, sharedFolder, newAddedUserIds.get(0));
StringBuilder addedUsersFullNames = new StringBuilder();
UserManager um = new LiferayUserManager();
for (String userId : newAddedUserIds)
addedUsersFullNames.append(um.getUserByScreenName(userId).getFullname()).append(" ");
Notification not = new Notification(
UUID.randomUUID().toString(),
NotificationType.WP_FOLDER_ADDEDUSER,
userIdToNotify, //user no notify
sharedFolder.getId(), //the
new Date(),
"?oid="+sharedFolder.getId(),
"added "+ addedUsersFullNames +" to your workspace shared folder "+ sharedFolder.getName(),
false,
aslSession.getUsername(),
aslSession.getUserFullName(),
aslSession.getUserAvatarId());
return saveNotification(not);
}
return false;
}
/**
* {@inheritDoc}
*/
@ -453,5 +487,5 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
aslSession.getUserAvatarId());
return saveNotification(not);
}
}
}

View File

@ -1,5 +1,7 @@
package org.gcube.applicationsupportlayer.social;
import java.util.List;
import org.gcube.portal.databook.shared.ApplicationProfile;
import org.gcube.portal.databook.shared.RunningJob;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
@ -28,7 +30,6 @@ public interface NotificationsManager {
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyFolderRenaming(String userIdToNotify, String previousName, String newName, String renamedFolderId) throws Exception;
/**
/**
* use to notify a user that a new user was added in on of his workspace shared folder
*
@ -38,6 +39,15 @@ public interface NotificationsManager {
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceFolder sharedFolder, String newAddedUserId) throws Exception;
/**
* use to notify a user that a new user was added in on of his workspace shared folder
*
* @param userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link WorkspaceFolder}
* @param newAddedUserIds List of new users that were added
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceFolder sharedFolder, List<String> newAddedUserIds) throws Exception;
/**
* use to notify a user that an existing user was removed from one of his workspace shared folder
*