history of share, unshare is completed

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81006 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-02 16:16:37 +00:00
parent d464d73eed
commit d1f0dc7dbb
3 changed files with 53 additions and 11 deletions

View File

@ -93,6 +93,8 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.liferay.portal.model.Contact;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
@ -1894,17 +1896,30 @@ public class GWTWorkspaceBuilder {
af.setOperation(GxtAccountingEntryType.SHARE);
AccountingEntryShare acc = (AccountingEntryShare) accountingEntry;
List<String> listContacts = new ArrayList<String>();
if(acc.getMembers()!=null && acc.getMembers().size()>0){
listContacts = acc.getMembers();
}
String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder";
// msg = GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
else
msg = acc.getItemName() +" "+GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder "+acc.getItemName();
// msg = acc.getItemName() +" "+GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
if(listContacts.size()>0){
msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(acc.getMembers());
}
af.setDescription(msg);
// af.setDescription(GxtAccountingEntryType.UPDATE.getName()+ " "+acc.getItemName() +" by "+user.getName());
// af.setDescription(acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName());
}
break;
@ -1924,14 +1939,11 @@ public class GWTWorkspaceBuilder {
af.setDescription(msg);
// af.setDescription(GxtAccountingEntryType.UPDATE.getName()+ " "+acc.getItemName() +" by "+user.getName());
// af.setDescription(acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName());
}
break;
}
listAccFields.add(af);
}

View File

@ -66,4 +66,34 @@ public class UserUtil {
return listUsers;
}
public static String separateUsersNamesToComma(List<InfoContactModel> listContacts){
String users = "";
for (int i = 0; i < listContacts.size()-1; i++) {
users+= listContacts.get(i).getName() + ", ";
}
if(listContacts.size()>1)
users += listContacts.get(listContacts.size()-1).getName();
return users;
}
public static String separateFullNameToCommaForPortalLogin(List<String> listLogin){
String users = "";
for (int i = 0; i < listLogin.size()-1; i++) {
users+= getUserFullName(listLogin.get(i)) + ", ";
}
if(listLogin.size()>1)
users += getUserFullName(listLogin.get(listLogin.size()-1));
return users;
}
}

View File

@ -71,8 +71,8 @@ public class WsUtil {
if (user == null) {
user=TEST_USER;
// user = "francesco.mangiacrapa";
// user=TEST_USER;
user = "francesco.mangiacrapa";
defaultLogger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
defaultLogger.warn("session id: "+sessionID);