Added notification Folder Unshare
Added Session Checker git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@100262 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
44c32e14f4
commit
f0e6b002f8
|
@ -2151,6 +2151,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
throw new SessionExpiredException();
|
||||
|
||||
workspaceLogger.trace("unSharedFolderByFolderSharedId "+ folderSharedId);
|
||||
|
||||
try {
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
|
@ -2163,38 +2164,34 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
||||
|
||||
// WorkspaceFolder unSharedFolder = wsFolder.unShare();
|
||||
// unShared = unSharedFolder==null?false:true;
|
||||
List<InfoContactModel> contacts = getListUserSharedByFolderSharedId(folderSharedId);
|
||||
|
||||
//TEMPORARY SOLUTION
|
||||
String sharedFolderName = wsFolder.getName();
|
||||
|
||||
//RETURN A NEW FOLDER
|
||||
wsFolder.unShare();
|
||||
workspaceLogger.trace("no error incoming on unsharing");
|
||||
unShared = true;
|
||||
// System.out.println("unShared is "+unShared);
|
||||
// if(newFolder!=null)
|
||||
// unShared = true;
|
||||
|
||||
workspaceLogger.trace("unShared is "+ unShared);
|
||||
|
||||
|
||||
/* INTERNAL POLICY, UN SHARE NOT SHOULD PRODUCE NOTIFICATIONS
|
||||
if(unShared){
|
||||
NotificationsProducer np = getNotificationProducer();
|
||||
|
||||
List<InfoContactModel> contacts = getListUserSharedByFolderSharedId(folderSharedId);
|
||||
|
||||
// if(isTestMode()){
|
||||
// contacts = new ArrayList<InfoContactModel>();
|
||||
// contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||
// }
|
||||
workspaceLogger.trace("UNSHARE WITH: ");
|
||||
printContacts(contacts);
|
||||
|
||||
np.notifyFolderUnSharing(contacts, unSharedFolder);
|
||||
NotificationsProducer np = getNotificationProducer();
|
||||
List<InfoContactModel> purgeMyContact = new ArrayList<InfoContactModel>(contacts.size()-1);
|
||||
String myLogin = getMyLogin();
|
||||
workspaceLogger.trace("Preparing list of contacts to send un share notification");
|
||||
for (InfoContactModel infoContactModel : contacts) {
|
||||
if(infoContactModel.getLogin().compareToIgnoreCase(getMyLogin())==0)
|
||||
workspaceLogger.trace("skipping my login "+myLogin);
|
||||
else
|
||||
purgeMyContact.add(infoContactModel);
|
||||
}
|
||||
workspaceLogger.trace("UNSHARE WITH: ");
|
||||
printContacts(purgeMyContact);
|
||||
|
||||
*/
|
||||
|
||||
np.notifyFolderUnSharing(purgeMyContact, folderSharedId, sharedFolderName);
|
||||
}
|
||||
else
|
||||
workspaceLogger.trace("the item with id: "+folderSharedId+ "is not "+WorkspaceItemType.SHARED_FOLDER);
|
||||
workspaceLogger.info("the item with id: "+folderSharedId+ "is not "+WorkspaceItemType.SHARED_FOLDER);
|
||||
|
||||
} catch (InternalErrorException e) {
|
||||
workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e);
|
||||
|
|
|
@ -299,7 +299,7 @@ public class NotificationsProducer {
|
|||
* @param listContacts
|
||||
* @param unSharedFolder
|
||||
*/
|
||||
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final WorkspaceSharedFolder unSharedFolder) {
|
||||
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final String unShareFolderId, final String unSharedFolderName) {
|
||||
|
||||
|
||||
new Thread() {
|
||||
|
@ -315,12 +315,13 @@ public class NotificationsProducer {
|
|||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" unshare folder "+unSharedFolderName);
|
||||
|
||||
//DEBUG
|
||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
|
||||
// boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
|
||||
|
||||
boolean notify = notificationsMng.notifyFolderUnsharing(infoContactModel.getLogin(), unShareFolderId, unSharedFolderName);
|
||||
if(!notify)
|
||||
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||
}
|
||||
|
|
|
@ -163,8 +163,6 @@ public class UriResolverReaderRR {
|
|||
|
||||
public static String getPublicLinkForFolderItemId(String itemId){
|
||||
|
||||
|
||||
|
||||
try{
|
||||
|
||||
ScopeProvider.instance.set(DEFAULT_SCOPE);
|
||||
|
|
Loading…
Reference in New Issue