From c04ef57cfa55d5e771a2ea695652917256f59f25 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Wed, 24 Jul 2013 14:44:26 +0000 Subject: [PATCH] renamed history operations git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@79616 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/AppControllerExplorer.java | 27 ++++++++++++---- .../workspace/server/GWTWorkspaceBuilder.java | 31 ++++++++++++++----- .../server/GWTWorkspaceServiceImpl.java | 3 ++ .../accounting/GxtAccountingEntryType.java | 14 ++++----- 4 files changed, 54 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index fb37af4..86e733a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -835,11 +835,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt // - FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(fileDownloadEvent.getItemIdentifier()); + markItemInTreeAsRead(fileDownloadEvent.getItemIdentifier(), true); - if(file!=null){ //FILE CAN NOT LOADED IN TREE - file.setMarkAsRead(true); - } +// FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(fileDownloadEvent.getItemIdentifier()); +// +// if(file!=null){ //FILE CAN NOT LOADED IN TREE +// file.setMarkAsRead(true); +// } notifySubscriber(fileDownloadEvent); } @@ -1292,9 +1294,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt doClickPreview(imagePreviewEvent, 50, 50); -// if(imagePreviewEvent.getSourceFileModel()!=null){ //FILE CAN NOT LOADED IN TREE + //ADDED 24/07/2013 + if(imagePreviewEvent.getSourceFileModel()!=null){ //FILE CAN NOT LOADED IN TREE + + markItemInTreeAsRead(imagePreviewEvent.getSourceFileModel().getIdentifier(), true); // imagePreviewEvent.getSourceFileModel().setMarkAsRead(true); -// } + notifySubscriber(new FileDownloadEvent(imagePreviewEvent.getSourceFileModel().getIdentifier(), imagePreviewEvent.getSourceFileModel().getName(), FileDownloadEvent.DownloadType.SHOW)); + } } @@ -2008,6 +2014,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } } + private void markItemInTreeAsRead(String itemId, boolean bool){ + + FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(itemId); + + if(file!=null){ //FILE CAN NOT LOADED IN TREE + file.setMarkAsRead(bool); + } + } + public AsyncCallback downloadHandlerCallback = new AsyncCallback() { @Override diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java index 1382862..c5f99ed 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java @@ -22,6 +22,7 @@ import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSmartFolder; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntry; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryAdd; +import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryCreate; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryCut; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryPaste; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryRead; @@ -1728,9 +1729,12 @@ public class GWTWorkspaceBuilder { case CREATE: if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){ - + AccountingEntryCreate create = (AccountingEntryCreate) accountingEntry; af.setOperation(GxtAccountingEntryType.CREATE); - af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName()); + +// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName()); + + af.setDescription("itemName" + " " + GxtAccountingEntryType.CREATE.getName() + " by "+user.getName()); } break; @@ -1739,8 +1743,12 @@ public class GWTWorkspaceBuilder { if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.READ)){ + AccountingEntryRead read = (AccountingEntryRead) accountingEntry; + af.setOperation(GxtAccountingEntryType.READ); - af.setDescription(GxtAccountingEntryType.READ.getName() + " by "+user.getName()); + +// af.setDescription(GxtAccountingEntryType.READ.getName() + " by "+user.getName()); + af.setDescription("itemName" + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName()); } break; @@ -1753,7 +1761,9 @@ public class GWTWorkspaceBuilder { AccountingEntryCut cut = (AccountingEntryCut) accountingEntry; - af.setDescription(GxtAccountingEntryType.CUT.getName()+ " "+cut.getItemName()+" by "+user.getName()); +// af.setDescription(GxtAccountingEntryType.CUT.getName()+ " "+cut.getItemName()+" by "+user.getName()); + + af.setDescription(cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName()); } break; @@ -1779,7 +1789,8 @@ public class GWTWorkspaceBuilder { AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry; - af.setDescription(GxtAccountingEntryType.REMOVE.getName() + " "+rem.getItemName()+" by "+user.getName()); +// af.setDescription(GxtAccountingEntryType.REMOVE.getName() + " "+rem.getItemName()+" by "+user.getName()); + af.setDescription(rem.getItemName() + " "+GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName()); } break; @@ -1791,7 +1802,8 @@ public class GWTWorkspaceBuilder { AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry; - af.setDescription(GxtAccountingEntryType.RENAME.getName()+" from "+ren.getOldItemName() + " by "+user.getName()); +// af.setDescription(GxtAccountingEntryType.RENAME.getName()+" from "+ren.getOldItemName() + " by "+user.getName()); + af.setDescription(ren.getOldItemName() +" "+GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName()); } break; @@ -1815,7 +1827,8 @@ public class GWTWorkspaceBuilder { AccountingEntryUpdate acc = (AccountingEntryUpdate) accountingEntry; - af.setDescription(GxtAccountingEntryType.UPDATE.getName()+ " "+acc.getItemName() +" by "+user.getName()); +// af.setDescription(GxtAccountingEntryType.UPDATE.getName()+ " "+acc.getItemName() +" by "+user.getName()); + af.setDescription(acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName()); } break; } @@ -1854,7 +1867,9 @@ public class GWTWorkspaceBuilder { af.setDate(toDate(accReader.getDate())); af.setOperation(GxtAccountingEntryType.READ); - af.setDescription(GxtAccountingEntryType.READ.getName() +" by "+user.getName()); +// af.setDescription(GxtAccountingEntryType.READ.getName() +" by "+user.getName()); + + af.setDescription("itemName" + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName()); listAccFields.add(af); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java index fba2dab..0e68296 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java @@ -1001,6 +1001,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT WorkspaceItem item = workspace.getItem(identifier); //get item from workspace + //ACCOUNTING READ + item.markAsRead(true); + workspaceLogger.trace("item name " + item.getName()); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); diff --git a/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java b/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java index 50e52de..9886815 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java +++ b/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java @@ -10,21 +10,21 @@ package org.gcube.portlets.user.workspace.shared.accounting; */ public enum GxtAccountingEntryType { - REMOVE("removed", "Removed"), + REMOVE("removed", "removed"), - RENAME("renamed", "Renamed"), + RENAME("renamed", "renamed"), - CREATE("created", "Created"), + CREATE("created", "created"), PASTE("pasted", "Pasted"), - CUT("cut", "Cut"), + CUT("cut", "cut"), - READ("read", "Read"), + READ("read", "read"), - ADD("added", "Added"), + ADD("added", "added"), - UPDATE("updated", "Updated"), + UPDATE("updated", "updated"), ALLWITHOUTREAD("all", "all");