1259: Enhancement to workspace item history

Task-Url: https://support.d4science.org/issues/1259

Updated history according to ticket

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@120258 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-11-10 14:48:36 +00:00
parent ccaaa5c9f0
commit 57028d0e00
5 changed files with 112 additions and 72 deletions

View File

@ -978,10 +978,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
winInfo.maskAccountingInfo(false); winInfo.maskAccountingInfo(false);
} }
}); });
} }
} }
}); });

View File

@ -149,6 +149,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
else if (model.get(OPERATION).equals( else if (model.get(OPERATION).equals(
GxtAccountingEntryType.UNSHARE)) GxtAccountingEntryType.UNSHARE))
return Resources.getIconUnShareFolder().createImage(); return Resources.getIconUnShareFolder().createImage();
else if (model.get(OPERATION).equals(
GxtAccountingEntryType.RESTORE))
return Resources.getIconUndo().createImage();
} }
return null; return null;
} }

View File

@ -12,30 +12,40 @@ import com.extjs.gxt.ui.client.event.WindowEvent;
import com.extjs.gxt.ui.client.widget.Window; import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.FitLayout;
/** /**
* * The Class WindowAccountingInfo.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013 * Nov 10, 2015
*
*/ */
public class WindowAccountingInfo extends Window { public class WindowAccountingInfo extends Window {
private List<GxtAccountingField> accountingsFields; private List<GxtAccountingField> accountingsFields;
private AccoutingInfoContainer accountingsContainers; private AccoutingInfoContainer accountingsContainers;
/**
* Instantiates a new window accounting info.
*/
public WindowAccountingInfo() { public WindowAccountingInfo() {
initAccounting(); initAccounting();
// addResizeListner();
} }
/**
* Instantiates a new window accounting info.
*
* @param fileModel the file model
* @param title the title
*/
public WindowAccountingInfo(FileModel fileModel, String title) { public WindowAccountingInfo(FileModel fileModel, String title) {
initAccounting(); initAccounting();
setIcon(fileModel.getAbstractPrototypeIcon()); setIcon(fileModel.getAbstractPrototypeIcon());
setHeading(title); setHeading(title);
// addResizeListner();
} }
/**
* Adds the resize listner.
*/
public void addResizeListner(){ public void addResizeListner(){
this.addListener(Events.Resize, new Listener<WindowEvent>() { this.addListener(Events.Resize, new Listener<WindowEvent>() {
@ -53,10 +63,18 @@ public class WindowAccountingInfo extends Window {
}); });
} }
/**
* Instantiates a new window accounting info.
*
* @param accountingsFields the accountings fields
*/
public WindowAccountingInfo(List<GxtAccountingField> accountingsFields) { public WindowAccountingInfo(List<GxtAccountingField> accountingsFields) {
updateInfoContainer(accountingsFields); updateInfoContainer(accountingsFields);
} }
/**
* Inits the accounting.
*/
private void initAccounting() { private void initAccounting() {
setModal(true); setModal(true);
setLayout(new FitLayout()); setLayout(new FitLayout());
@ -68,6 +86,11 @@ public class WindowAccountingInfo extends Window {
add(accountingsContainers); add(accountingsContainers);
} }
/**
* Sets the window title.
*
* @param title the new window title
*/
public void setWindowTitle(String title) { public void setWindowTitle(String title) {
this.setHeading(title); this.setHeading(title);
@ -75,6 +98,11 @@ public class WindowAccountingInfo extends Window {
/**
* Update info container.
*
* @param accountingsFields the accountings fields
*/
public void updateInfoContainer(List<GxtAccountingField> accountingsFields) { public void updateInfoContainer(List<GxtAccountingField> accountingsFields) {
this.accountingsContainers.resetStore(); this.accountingsContainers.resetStore();
@ -82,24 +110,25 @@ public class WindowAccountingInfo extends Window {
this.accountingsContainers.updateListAccounting(accountingsFields); this.accountingsContainers.updateListAccounting(accountingsFields);
} }
/**
* Gets the accountings fields.
*
* @return the accountings fields
*/
public List<GxtAccountingField> getAccountingsFields() { public List<GxtAccountingField> getAccountingsFields() {
return accountingsFields; return accountingsFields;
} }
/**
* Mask accounting info.
*
* @param bool the bool
*/
public void maskAccountingInfo(boolean bool){ public void maskAccountingInfo(boolean bool){
// if(accountingsContainers!=null){
//
// if(bool)
// accountingsContainers.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
// else
// accountingsContainers.unmask();
// }
if(bool) if(bool)
this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE); this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
else else
this.unmask(); this.unmask();
} }
} }

View File

@ -36,6 +36,7 @@ import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryPas
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRead; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRead;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRemoval; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRemoval;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRenaming; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRenaming;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRestore;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryShare; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryShare;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUnshare; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUnshare;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUpdate; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUpdate;
@ -1749,13 +1750,8 @@ public class GWTWorkspaceBuilder {
af.setOperation(GxtAccountingEntryType.REMOVE); af.setOperation(GxtAccountingEntryType.REMOVE);
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry; AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
String msg = (rem.getItemName()==null || rem.getItemName().isEmpty())?"":rem.getItemName()+" ";
String msg = ""; msg+= GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
if(rem.getItemName()==null || rem.getItemName().isEmpty())
msg = GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
else
msg = rem.getItemName() + " "+GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
@ -1765,15 +1761,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){
af.setOperation(GxtAccountingEntryType.RENAME); af.setOperation(GxtAccountingEntryType.RENAME);
AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry; AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry;
String msg = (ren.getOldItemName()==null || ren.getOldItemName().isEmpty())?"":ren.getOldItemName()+" ";
String msg = ""; msg+= GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
if(ren.getOldItemName()==null || ren.getOldItemName().isEmpty())
msg = GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName();
else
msg = ren.getOldItemName() +" "+GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
@ -1783,15 +1773,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ADD)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ADD)){
af.setOperation(GxtAccountingEntryType.ADD); af.setOperation(GxtAccountingEntryType.ADD);
AccountingEntryAdd acc = (AccountingEntryAdd) accountingEntry; AccountingEntryAdd acc = (AccountingEntryAdd) accountingEntry;
String msg = (acc.getItemName()==null || acc.getItemName().isEmpty())?"":acc.getItemName()+" ";
String msg = ""; msg+=GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
else
msg = acc.getItemName() + " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
@ -1801,15 +1785,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UPDATE)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UPDATE)){
af.setOperation(GxtAccountingEntryType.UPDATE); af.setOperation(GxtAccountingEntryType.UPDATE);
AccountingEntryUpdate upd = (AccountingEntryUpdate) accountingEntry;
AccountingEntryUpdate acc = (AccountingEntryUpdate) accountingEntry; String msg = (upd.getItemName()==null || upd.getItemName().isEmpty())?"":upd.getItemName()+" ";
msg+=GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
else
msg = acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
@ -1828,10 +1806,8 @@ public class GWTWorkspaceBuilder {
else else
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder "+acc.getItemName(); msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder "+acc.getItemName();
if(acc.getMembers()!=null && acc.getMembers().size()>0){ if(acc.getMembers()!=null && acc.getMembers().size()>0)
msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(acc.getMembers()); msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(acc.getMembers());
}
af.setDescription(msg); af.setDescription(msg);
} }
@ -1842,19 +1818,24 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)){
af.setOperation(GxtAccountingEntryType.UNSHARE); af.setOperation(GxtAccountingEntryType.UNSHARE);
AccountingEntryUnshare uns = (AccountingEntryUnshare) accountingEntry;
AccountingEntryUnshare acc = (AccountingEntryUnshare) accountingEntry; String msg = (uns.getItemName()==null || uns.getItemName().isEmpty())?"":uns.getItemName()+" ";
msg+=GxtAccountingEntryType.UNSHARE.getName()+" by "+user.getName();
String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = GxtAccountingEntryType.UNSHARE.getName()+" by "+user.getName();
else
msg = acc.getItemName() +" "+GxtAccountingEntryType.UNSHARE.getName()+" by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
case RESTORE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RESTORE)){
af.setOperation(GxtAccountingEntryType.RESTORE);
AccountingEntryRestore acc = (AccountingEntryRestore) accountingEntry;
String msg = (acc.getItemName()==null || acc.getItemName().isEmpty())?"":acc.getItemName()+" ";
msg+=GxtAccountingEntryType.RESTORE.getName()+" by "+user.getName();
af.setDescription(msg);
}
break;
} }
listAccFields.add(af); listAccFields.add(af);
} }

View File

@ -3,10 +3,12 @@
*/ */
package org.gcube.portlets.user.workspace.shared.accounting; package org.gcube.portlets.user.workspace.shared.accounting;
/** /**
* The Enum GxtAccountingEntryType.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013 * Nov 10, 2015
*
*/ */
public enum GxtAccountingEntryType { public enum GxtAccountingEntryType {
@ -21,40 +23,68 @@ public enum GxtAccountingEntryType {
CUT("Cut", "cut"), CUT("Cut", "cut"),
READ("Read", "read"), READ("Read", "read"),
ADD("Added", "added"), ADD("Added", "added"),
UPDATE("Updated", "updated"), UPDATE("Updated", "updated"),
SHARE("Shared", "shared"), SHARE("Shared", "shared"),
UNSHARE("Unshared", "unshared"), UNSHARE("Unshared", "unshared"),
ALL("all", "all"), ALL("all", "all"),
RESTORE("Restored", "restored"),
ALLWITHOUTREAD("allwithoutread", "allwithoutread"); ALLWITHOUTREAD("allwithoutread", "allwithoutread");
private String id; private String id;
private String name; private String name;
/**
* Instantiates a new gxt accounting entry type.
*
* @param id the id
* @param name the name
*/
GxtAccountingEntryType(String id, String name) { GxtAccountingEntryType(String id, String name) {
this.id = id; this.id = id;
this.name = name; this.name = name;
} }
/**
* Gets the id.
*
* @return the id
*/
public String getId() { public String getId() {
return id; return id;
} }
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/**
* Gets the name.
*
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }