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
This commit is contained in:
Francesco Mangiacrapa 2013-07-24 14:44:26 +00:00
parent 309af54ca5
commit c04ef57cfa
4 changed files with 54 additions and 21 deletions

View File

@ -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 // FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(fileDownloadEvent.getItemIdentifier());
file.setMarkAsRead(true); //
} // if(file!=null){ //FILE CAN NOT LOADED IN TREE
// file.setMarkAsRead(true);
// }
notifySubscriber(fileDownloadEvent); notifySubscriber(fileDownloadEvent);
} }
@ -1292,9 +1294,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
doClickPreview(imagePreviewEvent, 50, 50); 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); // 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<WindowOpenParameter> downloadHandlerCallback = new AsyncCallback<WindowOpenParameter>() { public AsyncCallback<WindowOpenParameter> downloadHandlerCallback = new AsyncCallback<WindowOpenParameter>() {
@Override @Override

View File

@ -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.WorkspaceSmartFolder;
import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntry; 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.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.AccountingEntryCut;
import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryPaste; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryPaste;
import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryRead; import org.gcube.portlets.user.homelibrary.home.workspace.accounting.AccountingEntryRead;
@ -1728,9 +1729,12 @@ public class GWTWorkspaceBuilder {
case CREATE: case CREATE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){
AccountingEntryCreate create = (AccountingEntryCreate) accountingEntry;
af.setOperation(GxtAccountingEntryType.CREATE); 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; break;
@ -1739,8 +1743,12 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.READ)){ if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.READ)){
AccountingEntryRead read = (AccountingEntryRead) accountingEntry;
af.setOperation(GxtAccountingEntryType.READ); 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; break;
@ -1753,7 +1761,9 @@ public class GWTWorkspaceBuilder {
AccountingEntryCut cut = (AccountingEntryCut) accountingEntry; 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; break;
@ -1779,7 +1789,8 @@ public class GWTWorkspaceBuilder {
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry; 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; break;
@ -1791,7 +1802,8 @@ public class GWTWorkspaceBuilder {
AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry; 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; break;
@ -1815,7 +1827,8 @@ public class GWTWorkspaceBuilder {
AccountingEntryUpdate acc = (AccountingEntryUpdate) accountingEntry; 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; break;
} }
@ -1854,7 +1867,9 @@ public class GWTWorkspaceBuilder {
af.setDate(toDate(accReader.getDate())); af.setDate(toDate(accReader.getDate()));
af.setOperation(GxtAccountingEntryType.READ); 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); listAccFields.add(af);
} }

View File

@ -1001,6 +1001,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
WorkspaceItem item = workspace.getItem(identifier); //get item from workspace WorkspaceItem item = workspace.getItem(identifier); //get item from workspace
//ACCOUNTING READ
item.markAsRead(true);
workspaceLogger.trace("item name " + item.getName()); workspaceLogger.trace("item name " + item.getName());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder(); GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();

View File

@ -10,21 +10,21 @@ package org.gcube.portlets.user.workspace.shared.accounting;
*/ */
public enum GxtAccountingEntryType { public enum GxtAccountingEntryType {
REMOVE("removed", "Removed"), REMOVE("removed", "removed"),
RENAME("renamed", "Renamed"), RENAME("renamed", "renamed"),
CREATE("created", "Created"), CREATE("created", "created"),
PASTE("pasted", "Pasted"), 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"); ALLWITHOUTREAD("all", "all");