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();
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
workspaceLogger.trace("unSharedFolderByFolderSharedId "+ folderSharedId);
|
workspaceLogger.trace("unSharedFolderByFolderSharedId "+ folderSharedId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = getWorkspace();
|
Workspace workspace = getWorkspace();
|
||||||
|
@ -2162,39 +2163,35 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
||||||
|
|
||||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
|
||||||
|
|
||||||
// WorkspaceFolder unSharedFolder = wsFolder.unShare();
|
|
||||||
// unShared = unSharedFolder==null?false:true;
|
|
||||||
|
|
||||||
//TEMPORARY SOLUTION
|
List<InfoContactModel> contacts = getListUserSharedByFolderSharedId(folderSharedId);
|
||||||
|
|
||||||
|
String sharedFolderName = wsFolder.getName();
|
||||||
|
|
||||||
|
//RETURN A NEW FOLDER
|
||||||
wsFolder.unShare();
|
wsFolder.unShare();
|
||||||
|
workspaceLogger.trace("no error incoming on unsharing");
|
||||||
unShared = true;
|
unShared = true;
|
||||||
// System.out.println("unShared is "+unShared);
|
// if(newFolder!=null)
|
||||||
|
// unShared = true;
|
||||||
|
|
||||||
workspaceLogger.trace("unShared is "+ unShared);
|
NotificationsProducer np = getNotificationProducer();
|
||||||
|
List<InfoContactModel> purgeMyContact = new ArrayList<InfoContactModel>(contacts.size()-1);
|
||||||
|
String myLogin = getMyLogin();
|
||||||
/* INTERNAL POLICY, UN SHARE NOT SHOULD PRODUCE NOTIFICATIONS
|
workspaceLogger.trace("Preparing list of contacts to send un share notification");
|
||||||
if(unShared){
|
for (InfoContactModel infoContactModel : contacts) {
|
||||||
NotificationsProducer np = getNotificationProducer();
|
if(infoContactModel.getLogin().compareToIgnoreCase(getMyLogin())==0)
|
||||||
|
workspaceLogger.trace("skipping my login "+myLogin);
|
||||||
List<InfoContactModel> contacts = getListUserSharedByFolderSharedId(folderSharedId);
|
else
|
||||||
|
purgeMyContact.add(infoContactModel);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
workspaceLogger.trace("UNSHARE WITH: ");
|
||||||
|
printContacts(purgeMyContact);
|
||||||
|
|
||||||
*/
|
np.notifyFolderUnSharing(purgeMyContact, folderSharedId, sharedFolderName);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
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) {
|
} catch (InternalErrorException e) {
|
||||||
workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e);
|
workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e);
|
||||||
|
|
|
@ -299,7 +299,7 @@ public class NotificationsProducer {
|
||||||
* @param listContacts
|
* @param listContacts
|
||||||
* @param unSharedFolder
|
* @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() {
|
new Thread() {
|
||||||
|
@ -315,12 +315,13 @@ public class NotificationsProducer {
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
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
|
//DEBUG
|
||||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
// 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)
|
if(!notify)
|
||||||
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,6 @@ public class UriResolverReaderRR {
|
||||||
|
|
||||||
public static String getPublicLinkForFolderItemId(String itemId){
|
public static String getPublicLinkForFolderItemId(String itemId){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
ScopeProvider.instance.set(DEFAULT_SCOPE);
|
ScopeProvider.instance.set(DEFAULT_SCOPE);
|
||||||
|
|
Loading…
Reference in New Issue