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);
}
});
}
}
});

View File

@ -149,6 +149,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
else if (model.get(OPERATION).equals(
GxtAccountingEntryType.UNSHARE))
return Resources.getIconUnShareFolder().createImage();
else if (model.get(OPERATION).equals(
GxtAccountingEntryType.RESTORE))
return Resources.getIconUndo().createImage();
}
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.layout.FitLayout;
/**
*
* The Class WindowAccountingInfo.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
* Nov 10, 2015
*/
public class WindowAccountingInfo extends Window {
private List<GxtAccountingField> accountingsFields;
private AccoutingInfoContainer accountingsContainers;
/**
* Instantiates a new window accounting info.
*/
public WindowAccountingInfo() {
initAccounting();
// addResizeListner();
}
/**
* Instantiates a new window accounting info.
*
* @param fileModel the file model
* @param title the title
*/
public WindowAccountingInfo(FileModel fileModel, String title) {
initAccounting();
setIcon(fileModel.getAbstractPrototypeIcon());
setHeading(title);
// addResizeListner();
}
/**
* Adds the resize listner.
*/
public void addResizeListner(){
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) {
updateInfoContainer(accountingsFields);
}
/**
* Inits the accounting.
*/
private void initAccounting() {
setModal(true);
setLayout(new FitLayout());
@ -68,6 +86,11 @@ public class WindowAccountingInfo extends Window {
add(accountingsContainers);
}
/**
* Sets the window title.
*
* @param title the new window title
*/
public void setWindowTitle(String 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) {
this.accountingsContainers.resetStore();
@ -82,24 +110,25 @@ public class WindowAccountingInfo extends Window {
this.accountingsContainers.updateListAccounting(accountingsFields);
}
/**
* Gets the accountings fields.
*
* @return the accountings fields
*/
public List<GxtAccountingField> getAccountingsFields() {
return accountingsFields;
}
/**
* Mask accounting info.
*
* @param bool the bool
*/
public void maskAccountingInfo(boolean bool){
// if(accountingsContainers!=null){
//
// if(bool)
// accountingsContainers.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
// else
// accountingsContainers.unmask();
// }
if(bool)
this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
else
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.AccountingEntryRemoval;
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.AccountingEntryUnshare;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUpdate;
@ -1749,13 +1750,8 @@ public class GWTWorkspaceBuilder {
af.setOperation(GxtAccountingEntryType.REMOVE);
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
String msg = "";
if(rem.getItemName()==null || rem.getItemName().isEmpty())
msg = GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
else
msg = rem.getItemName() + " "+GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
String msg = (rem.getItemName()==null || rem.getItemName().isEmpty())?"":rem.getItemName()+" ";
msg+= GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
af.setDescription(msg);
}
break;
@ -1765,15 +1761,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){
af.setOperation(GxtAccountingEntryType.RENAME);
AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry;
String msg = "";
if(ren.getOldItemName()==null || ren.getOldItemName().isEmpty())
msg = GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName();
else
msg = ren.getOldItemName() +" "+GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName();
String msg = (ren.getOldItemName()==null || ren.getOldItemName().isEmpty())?"":ren.getOldItemName()+" ";
msg+= GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
af.setDescription(msg);
}
break;
@ -1783,15 +1773,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ADD)){
af.setOperation(GxtAccountingEntryType.ADD);
AccountingEntryAdd acc = (AccountingEntryAdd) accountingEntry;
String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
else
msg = acc.getItemName() + " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
String msg = (acc.getItemName()==null || acc.getItemName().isEmpty())?"":acc.getItemName()+" ";
msg+=GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
af.setDescription(msg);
}
break;
@ -1801,15 +1785,9 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UPDATE)){
af.setOperation(GxtAccountingEntryType.UPDATE);
AccountingEntryUpdate acc = (AccountingEntryUpdate) accountingEntry;
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();
AccountingEntryUpdate upd = (AccountingEntryUpdate) accountingEntry;
String msg = (upd.getItemName()==null || upd.getItemName().isEmpty())?"":upd.getItemName()+" ";
msg+=GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
af.setDescription(msg);
}
break;
@ -1828,10 +1806,8 @@ public class GWTWorkspaceBuilder {
else
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());
}
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)){
af.setOperation(GxtAccountingEntryType.UNSHARE);
AccountingEntryUnshare acc = (AccountingEntryUnshare) accountingEntry;
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();
AccountingEntryUnshare uns = (AccountingEntryUnshare) accountingEntry;
String msg = (uns.getItemName()==null || uns.getItemName().isEmpty())?"":uns.getItemName()+" ";
msg+=GxtAccountingEntryType.UNSHARE.getName()+" by "+user.getName();
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);
}

View File

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