Merge pull request 'task_21388' (#2) from task_21388 into master

Reviewed-on: #2
feature_23026
Francesco Mangiacrapa 3 years ago
commit b5effefc64

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.33.0-SNAPSHOT] - 2021-05-11
#### Enhancements
[#21388] Integrated with new workflow to interact with ws-thredds 1.x
[#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT
## [v6.32.0] - 2021-04-12
#### Enhancements

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.32.0</version>
<version>6.33.0-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
@ -46,7 +46,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.1</version>
<version>3.6.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -65,7 +65,6 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>storagehub-icons-library</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>

@ -3,7 +3,6 @@ package org.gcube.portlets.user.workspace.client.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
@ -16,8 +15,7 @@ import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image;
// TODO: Auto-generated Javadoc
/**
* The Class FileModel.
*
@ -55,8 +53,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
public static final String OWNERFULLNAME = "Owner Name";
public static final String HUMAN_REDABLE_CATEGORY = "HR Category";
//Thredds Synch status
private Sync_Status synchedThreddsStatus;
// Synched with thredds
private Boolean synchedWithWsThredds = null;
/**
* Instantiates a new file model.
@ -154,7 +152,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
* @param isDirectory the is directory
* @param isShared the is shared
*/
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum,
boolean isDirectory, boolean isShared) {
setIdentifier(identifier);
setName(name);
setType(type);
@ -173,10 +172,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
set(PARENT, parent);
}
/**
* Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded";
*
* @param status the new status
@ -279,7 +276,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
this.isRoot = isRoot;
}
/**
* Gets the icon.
*
@ -308,7 +304,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
} else if (this.isShared()) { // IS A SHARED FOLDER?
//GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable());
// GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ",
// this.isVreFolder() "+this.isVreFolder() +", this.isShareable()
// "+this.isShareable());
if (this.isVreFolder())
absImgPr = Resources.getIconVREFolder();
@ -322,7 +320,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
if (this.isPublic()) // IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
else
absImgPr = Resources.getIconSharedFolder(); //IS A SHARED FOLDER DESCENDANT OF ROOT SHARED FOLDER
absImgPr = Resources.getIconSharedFolder(); // IS A SHARED FOLDER DESCENDANT OF ROOT SHARED
// FOLDER
}
}
@ -337,17 +336,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
if (this.isPublic()) // IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
else {
if(this.getSynchedThreddsStatus()!=null) {
switch(this.getSynchedThreddsStatus()) {
case OUTDATED_REMOTE:
absImgPr = Resources.getIconSyncTo();
break;
case OUTDATED_WS:
absImgPr = Resources.getIconSyncFrom();
break;
case UP_TO_DATE:
absImgPr = Resources.getIconSynched();
break;
if (this.getSynchedWithWsThredds() != null) {
if(this.getSynchedWithWsThredds()) {
absImgPr = Resources.getIconSynchedFolder();
}
} else
absImgPr = Resources.getIconFolder();
@ -358,7 +349,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return absImgPr;
}
/**
* Gets the status.
*
@ -368,7 +358,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return get("status");
}
/**
* Sets the checks if is directory.
*
@ -407,7 +396,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
set(HUMAN_REDABLE_CATEGORY, smfDocuments.getValue());
}
/**
* Gets the shortcut category.
*
@ -417,7 +405,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return (GXTCategorySmartFolder) get(SHORTCUTCATEGORY);
}
/**
* Sets the name.
*
@ -457,7 +444,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return false;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
/**
@ -575,17 +564,27 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return isPublic;
}
public void setSyncThreddsStatus(Sync_Status status) {
this.synchedThreddsStatus = status;
/**
* Sets the synched with ws thredds.
*
* @param bool the new synched with ws thredds
*/
public void setSynchedWithWsThredds(Boolean bool) {
this.synchedWithWsThredds = bool;
}
public Sync_Status getSynchedThreddsStatus() {
return synchedThreddsStatus;
/**
* Gets the synched with ws thredds.
*
* @return the synched with ws thredds
*/
public Boolean getSynchedWithWsThredds() {
return synchedWithWsThredds;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
/**
@ -620,5 +619,4 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return builder.toString();
}
}

@ -412,11 +412,14 @@ public interface Icons extends ClientBundle {
@Source("icons/sync-icon-to.png")
ImageResource syncIconTo();
@Source("icons/sync-icon-from.png")
ImageResource syncIconFrom();
@Source("icons/sync-icon-synched.png")
ImageResource syncIconSynched();
@Source("icons/folder_sync.png")
ImageResource synchedFolder();
// @Source("icons/sync-icon-from.png")
// ImageResource syncIconFrom();
//
// @Source("icons/sync-icon-synched.png")
// ImageResource syncIconSynched();
@Source("icons/no-preview-available.png")
ImageResource previewNotAvailable();

@ -80,8 +80,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.TXT());
}
/**
* Gets the data catalogue publish.
*
@ -102,7 +100,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.switchboard());
}
/**
* Gets the icon postscript.
*
@ -123,8 +120,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.dvi());
}
/**
* Gets the icon folder shared public.
*
@ -135,7 +130,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK());
}
/**
* Gets the icon information.
*
@ -154,8 +148,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.SCRIPT());
}
/**
* Gets the icon information.
*
@ -174,7 +166,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.ARCHIVE());
}
/**
* Gets the icon odp.
*
@ -193,7 +184,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC());
}
/**
* Gets the icon odp.
*
@ -203,7 +193,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC());
}
/**
* Gets the icon folder link.
*
@ -213,7 +202,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK());
}
/**
* Gets the icon odp.
*
@ -263,7 +251,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.undo());
}
/**
* Gets the icon archive.
*
@ -477,7 +464,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.spinner());
}
/**
* Gets the close icon.
*
@ -557,6 +543,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.XML());
}
/**
* Gets the icon permissions.
*
@ -565,6 +552,7 @@ public class Resources {
public static AbstractImagePrototype getIconCalendar() {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.CALENDAR());
}
/**
* Gets the icon html.
*
@ -806,7 +794,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.search());
}
/**
* Gets the icon search ws.
*
@ -817,7 +804,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.search2());
}
/**
* Gets the icon links.
*
@ -971,6 +957,7 @@ public class Resources {
public static AbstractImagePrototype getIconCheckUser() {
return AbstractImagePrototype.create(ICONS.checkUser());
}
/**
* Gets the icon hand.
*
@ -988,6 +975,7 @@ public class Resources {
public static AbstractImagePrototype getIconSaveAttachments() {
return AbstractImagePrototype.create(ICONS.saveAttachs());
}
/**
* Gets the icon copy.
*
@ -1078,7 +1066,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.removeFilter());
}
/**
* Gets the icon public link.
*
@ -1088,7 +1075,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.PUBLIC_LINK());
}
/**
* Gets the icon versioning.
*
@ -1098,9 +1084,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.VERSIONS());
}
/**
* Gets the icon web dav.
*
@ -1227,7 +1210,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.folderPublicRemove());
}
/**
* Gets the icon add administrator.
*
@ -1246,8 +1228,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.manageAdmin());
}
/**
* Gets the icon thredds publish.
*
@ -1258,7 +1238,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.thredds());
}
/**
* Gets the icon sync to.
*
@ -1269,22 +1248,12 @@ public class Resources {
}
/**
* Gets the icon sync from.
* Gets the icon synched folder.
*
* @return the icon sync from
* @return the icon synched folder
*/
public static AbstractImagePrototype getIconSyncFrom() {
return AbstractImagePrototype.create(ICONS.syncIconFrom());
}
/**
* Gets the icon synched.
*
* @return the icon synched
*/
public static AbstractImagePrototype getIconSynched() {
return AbstractImagePrototype.create(ICONS.syncIconSynched());
public static AbstractImagePrototype getIconSynchedFolder() {
return AbstractImagePrototype.create(ICONS.synchedFolder());
}
/**
@ -1296,7 +1265,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.move24());
}
// ImageResources
/**
* Gets the image path separator.
@ -1352,7 +1320,6 @@ public class Resources {
return ICONS.cancel();
}
/**
* Gets the image delete.
*
@ -1371,7 +1338,6 @@ public class Resources {
return ICONS.attach();
}
/**
* Gets the preview not available.
*
@ -1390,7 +1356,6 @@ public class Resources {
return ICONS.previewNotAvailableNoBorder();
}
/**
* Gets the icon by media type name.
*
@ -1400,7 +1365,8 @@ public class Resources {
*/
public static AbstractImagePrototype getIconByMediaTypeName(String name, String mediaTypeName) {
if (MPEG.equals(mediaTypeName) || SWF.equals(mediaTypeName) || FLV.equals(mediaTypeName) || AVI.equals(mediaTypeName)) {
if (MPEG.equals(mediaTypeName) || SWF.equals(mediaTypeName) || FLV.equals(mediaTypeName)
|| AVI.equals(mediaTypeName)) {
return Resources.getIconMovie();
} else if (JPEG.equals(mediaTypeName) || JPG.equals(mediaTypeName)) {
return Resources.getIconJpeg();
@ -1510,7 +1476,6 @@ public class Resources {
return Resources.getIconTxt();
}
/**
* Gets the icon by type.
*
@ -1526,8 +1491,6 @@ public class Resources {
return Resources.getIconByMediaTypeName(name, mediaTypeName);
}
/**
* Gets the icon by folder enum.
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -65,7 +65,6 @@ public class AsyncTreePanel extends LayoutContainer {
private static final String ROOT_SUFFIX = "'s workspace";
private String myRootDisplayName = null;
// private TreeLoader<FileModel> loader;
private TreePanel<FileModel> treePanel;
private TreeStore<FileModel> store;
private ContextMenuTree contextMenuTree;
@ -73,7 +72,6 @@ public class AsyncTreePanel extends LayoutContainer {
private ContentPanel cp = new ContentPanel();
private boolean isSubTreeLoaded = false;
private boolean isSearch = false;
//private String scopeId = null;
/**
* The Enum DragType.
@ -81,7 +79,10 @@ public class AsyncTreePanel extends LayoutContainer {
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Aug 29, 2016
*/
private enum DragType {INSERT, APPEND};
private enum DragType {
INSERT, APPEND
};
private boolean rightClick = false;
/**
@ -140,7 +141,6 @@ public class AsyncTreePanel extends LayoutContainer {
}
};
treePanel.setStateful(false);
treePanel.setDisplayProperty(FileModel.NAME);
@ -163,8 +163,10 @@ public class AsyncTreePanel extends LayoutContainer {
if (model.isRoot()) { // IS ROOT?
// ConstantsExplorer.log("getIcon isRoot Model is: "+model);
if(AppControllerExplorer.myLoginFirstName==null || AppControllerExplorer.myLoginFirstName.isEmpty()){
ConstantsExplorer.log("Getting My First Name from server, into myLoginFirstName call is null yet");
if (AppControllerExplorer.myLoginFirstName == null
|| AppControllerExplorer.myLoginFirstName.isEmpty()) {
ConstantsExplorer
.log("Getting My First Name from server, into myLoginFirstName call is null yet");
AppControllerExplorer.rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() {
@Override
@ -179,7 +181,8 @@ public class AsyncTreePanel extends LayoutContainer {
if (firstName == null || firstName.isEmpty())
model.setName("My Workspace");
else
setRootDisplayName(model, AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX, true);
setRootDisplayName(model, AppControllerExplorer.myLoginFirstName + ROOT_SUFFIX,
true);
}
});
} else {
@ -218,14 +221,9 @@ public class AsyncTreePanel extends LayoutContainer {
if (model.isPublic()) // IS PLUBIC
return Resources.getIconFolderPublic();
else {
if(model.getSynchedThreddsStatus()!=null) {
switch(model.getSynchedThreddsStatus()) {
case OUTDATED_REMOTE:
return Resources.getIconSyncTo();
case OUTDATED_WS:
return Resources.getIconSyncFrom();
case UP_TO_DATE:
return Resources.getIconSynched();
if (model.getSynchedWithWsThredds() != null) {
if (model.getSynchedWithWsThredds()) {
return Resources.getIconSynchedFolder();
}
}
return Resources.getIconFolder();
@ -272,7 +270,8 @@ public class AsyncTreePanel extends LayoutContainer {
System.out.println("\n\nStore by root");
for (FileModel item : listFileModel) {
System.out.println(item.getName() + " ID " + item.getIdentifier() + " isDirectory " + item.isDirectory());
System.out.println(
item.getName() + " ID " + item.getIdentifier() + " isDirectory " + item.isDirectory());
// eventBus.fireEvent(new SelectedItemEvent(treePanel.getStore().getRootItems().get(0)));
printingTreeLevel(item);
@ -280,18 +279,12 @@ public class AsyncTreePanel extends LayoutContainer {
}
});
// cp.add(butt);
// ***End Debug the store
cp.add(treePanel);
add(cp);
}
/**
* Sets the root display name.
*
@ -307,8 +300,7 @@ public class AsyncTreePanel extends LayoutContainer {
}
/**
* Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded";
*
* @param itemIdentifier the item identifier
@ -321,24 +313,19 @@ public class AsyncTreePanel extends LayoutContainer {
fileModel.setStatus(status);
}
/**
* Load root item.
*
* @param selectRoot the select root
*/
public void loadRootItem(final boolean selectRoot) {
//this.scopeId = scopeId;
System.out.println("***Start Root load");
// Load Root without filtering on scope id
AppControllerExplorer.rpcWorkspaceService.getRootForTree(new AsyncCallback<FolderModel>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. " +ConstantsExplorer.TRY_AGAIN, null);
new MessageBoxAlert("Error",
ConstantsExplorer.SERVER_ERROR + " getting root item. " + ConstantsExplorer.TRY_AGAIN, null);
}
@ -349,7 +336,6 @@ public class AsyncTreePanel extends LayoutContainer {
});
}
/**
* Load root in store.
*
@ -367,9 +353,9 @@ public class AsyncTreePanel extends LayoutContainer {
selectRootItem(); // select root item
System.out.println("***End Root load ");
}
else
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. Root item is null " +ConstantsExplorer.TRY_AGAIN, null);
} else
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. Root item is null "
+ ConstantsExplorer.TRY_AGAIN, null);
}
@ -406,7 +392,6 @@ public class AsyncTreePanel extends LayoutContainer {
}
});
TreePanelDropTarget targetTreePanel = new TreePanelDropTarget(treePanel) {
// @Override
// protected void onDragDrop(DNDEvent event) {
@ -449,7 +434,8 @@ public class AsyncTreePanel extends LayoutContainer {
for (FileModel model : selection) {
// check the "model" against "zone" and return false
// if "zone" is not a valid drop target for "model", otherwise check the next "model"
// if "zone" is not a valid drop target for "model", otherwise check the next
// "model"
// example:
if (source.getStore().getParent(model) == zone.getModel())
return false;
@ -494,7 +480,8 @@ public class AsyncTreePanel extends LayoutContainer {
FileModel destination = getDragDestination(item, DragType.APPEND);
if (destination != null) {
// REMOVE THIS COMMENT TODO
eventBus.fireEvent(new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
eventBus.fireEvent(
new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
GWT.log("Destination: " + destination.getName() + " id " + destination.getIdentifier());
}
} else {
@ -522,7 +509,8 @@ public class AsyncTreePanel extends LayoutContainer {
if (destination != null) {
GWT.log("Destination: " + destination.getName() + " id " + destination.getIdentifier());
// REMOVE THIS COMMENT TODO
eventBus.fireEvent(new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
eventBus.fireEvent(
new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
}
} else {
// multi drag
@ -559,9 +547,13 @@ public class AsyncTreePanel extends LayoutContainer {
listDraggedFile.add((FileModel) itemSource.getModel());
sourceFileModel = (FileModel) itemSource.getModel();
if (sourceFileModel.getParentFileModel() != null)
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
GWT.log("Source Name " + sourceFileModel.getName() + " id "
+ sourceFileModel.getIdentifier() + " end drag " + " Parent Name: "
+ sourceFileModel.getParentFileModel().getName() + "id "
+ sourceFileModel.getParentFileModel().getIdentifier());
else
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
GWT.log("Source Name " + sourceFileModel.getName() + " id "
+ sourceFileModel.getIdentifier() + " end drag ");
GWT.log("Child count: " + itemSource.getChildCount());
}
@ -582,7 +574,6 @@ public class AsyncTreePanel extends LayoutContainer {
// targetTreePanel.setAllowDropOnLeaf(true);
}
/**
* Adds the listners.
*/
@ -630,7 +621,6 @@ public class AsyncTreePanel extends LayoutContainer {
}
System.out.println("***End Event selection change");
}
@ -670,7 +660,6 @@ public class AsyncTreePanel extends LayoutContainer {
}
});
treePanel.addListener(Events.BeforeExpand, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(final TreePanelEvent<ModelData> be) {
@ -718,24 +707,22 @@ public class AsyncTreePanel extends LayoutContainer {
//
}
});
}
/**
* Manage context menu.
*/
private void manageContextMenu() {
contextMenuTree.setListSelectedItems(treePanel.getSelectionModel().getSelectedItems()); //Set items list selected in context menu tree
contextMenuTree.setListSelectedItems(treePanel.getSelectionModel().getSelectedItems()); // Set items list
// selected in context
// menu tree
List<FileModel> selectedItems = treePanel.getSelectionModel().getSelectedItems();
contextMenuTree.viewContextMenu(selectedItems, -1, -1);
}
/**
* Reload tree level and expand folder.
*
@ -770,7 +757,9 @@ public class AsyncTreePanel extends LayoutContainer {
return;
}
treePanel.unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting item from workspace." +ConstantsExplorer.TRY_AGAIN, null);
new MessageBoxAlert("Error",
ConstantsExplorer.SERVER_ERROR + " getting item from workspace." + ConstantsExplorer.TRY_AGAIN,
null);
removeAllAndRecoveryRoot();
}
@ -803,7 +792,8 @@ public class AsyncTreePanel extends LayoutContainer {
return;
}
treePanel.unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items." +ConstantsExplorer.TRY_AGAIN, null);
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items."
+ ConstantsExplorer.TRY_AGAIN, null);
removeAllAndRecoveryRoot();
}
@ -842,7 +832,8 @@ public class AsyncTreePanel extends LayoutContainer {
return;
}
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. " +ConstantsExplorer.TRY_AGAIN, null);
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. "
+ ConstantsExplorer.TRY_AGAIN, null);
removeAllAndRecoveryRoot();
}
@ -902,15 +893,6 @@ public class AsyncTreePanel extends LayoutContainer {
}
// /**
// * Sets the visibile get web dav url.
// *
// * @param bool the new visibile get web dav url
// */
// private void setVisibileGetWebDavUrl(boolean bool){
// treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(bool);
// }
/**
* Sets the alphanumeric store sorter.
*/
@ -940,25 +922,20 @@ public class AsyncTreePanel extends LayoutContainer {
});
}
//TODO for debug
// for debugging
/**
* Printing tree level.
*
* @param item the item
*/
private void printingTreeLevel(FileModel item) {
List<FileModel> children = treePanel.getStore().getChildren(item);
if (children != null) {
for (FileModel item2 : children) {
System.out.println(" " + item2.getName() + " ID " + item2.getIdentifier() + " isDirectory " + item.isDirectory());
System.out.println(" " + item2.getName() + " ID " + item2.getIdentifier() + " isDirectory "
+ item.isDirectory());
printingTreeLevel(item2);
}
System.out.println(" ");
}
}
@ -997,7 +974,6 @@ public class AsyncTreePanel extends LayoutContainer {
return store.getChildCount(folder);
}
/**
* Delete item.
*
@ -1010,14 +986,12 @@ public class AsyncTreePanel extends LayoutContainer {
if (fileTarget != null) {
return deleteItem(fileTarget);
}
else
} else
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store");
return false;
}
/**
* Rename item.
*
@ -1037,17 +1011,15 @@ public class AsyncTreePanel extends LayoutContainer {
record.set(FileModel.NAME, newName);
return true;
}
else
System.out.println("Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store" );
}
else
} else
System.out.println("Record Error: file target with " + fileTarget.getIdentifier()
+ " identifier not exist in store");
} else
System.out.println("Rename Error: file target not exist in store");
return false;
}
/**
* Rename item.
*
@ -1083,9 +1055,8 @@ public class AsyncTreePanel extends LayoutContainer {
return true;
} else
System.out.println("Record Error: file target with "
+ fileTarget.getIdentifier()
+ " identifier not exist in store");
System.out.println(
"Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store");
return false;
@ -1104,7 +1075,6 @@ public class AsyncTreePanel extends LayoutContainer {
addItem(parent, child, addChildren);
}
/**
* Adds the item.
*
@ -1137,7 +1107,6 @@ public class AsyncTreePanel extends LayoutContainer {
if (identifier == null)
return false;
FileModel fileTarget = getFileModelByIdentifier(identifier);
if (fileTarget == null)
@ -1317,7 +1286,6 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.setSize(width, height);
}
/**
* Gets the context menu tree.
*

@ -114,11 +114,11 @@ public class DialogGetInfo extends Dialog {
txtIsPublic.setValue(fileModel.isPublic() + "");
add(txtIsPublic);
if (fileModel.getSynchedThreddsStatus() != null) {
if (fileModel.getSynchedWithWsThredds() != null) {
txtThreddsSynched = new TextField<String>();
txtThreddsSynched.setFieldLabel("Thredds Sync");
txtThreddsSynched.setFieldLabel("Synched with Thredds");
txtThreddsSynched.setReadOnly(true);
txtThreddsSynched.setValue(fileModel.getSynchedThreddsStatus() + "");
txtThreddsSynched.setValue(fileModel.getSynchedWithWsThredds() + "");
add(txtThreddsSynched);
}

@ -295,10 +295,15 @@ public class DialogGetInfoBootstrap extends Composite {
cgTxtIsPublic.setVisible(true);
htmlSetValue(txtIsPublic, fileModel.isPublic() + "");
if (fileModel.getSynchedThreddsStatus() != null) {
txtThreddsSynched.setVisible(true);
htmlSetValue(txtThreddsSynched, fileModel.getSynchedThreddsStatus() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedThreddsStatus() + "");
GWT.log("Is synched? "+fileModel.getSynchedWithWsThredds());
if (fileModel.getSynchedWithWsThredds() != null) {
if (fileModel.getSynchedWithWsThredds()) {
cgThreddsSynched.setVisible(true);
//txtThreddsSynched.setVisible(true);
htmlSetValue(txtThreddsSynched, fileModel.getSynchedWithWsThredds() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedWithWsThredds() + "");
}
}
}

@ -73,7 +73,7 @@
<b:ControlGroup
addStyleNames="my-control-group-get-info"
ui:field="cgThreddsSynched" visible="false">
<b:ControlLabel>Thredds Sync</b:ControlLabel>
<b:ControlLabel title="Synched with THREDDS">Synched</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtThreddsSynched">
</g:HTML>

@ -63,9 +63,6 @@ public class ObjectStorageHubToWorkpaceMapper {
isVreFolder = sharedFolder.isVreFolder();
}
// FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false, workspaceRoot.isPublic());
// root.setIsRoot(true);
FolderModel theFolder = new FolderModel(folder.getId(), folder.getName(), null, folder.isFolder(), folder.isShared(), isVreFolder, isPublicFolder);
theFolder.setIsRoot(folder.isRoot());
return theFolder;

@ -3,7 +3,6 @@
*/
package org.gcube.portlets.user.workspace.server.tostoragehub;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@ -33,7 +32,6 @@ import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorEx
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
@ -45,13 +43,11 @@ import org.gcube.portlets.user.workspace.server.util.UserUtil;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import org.gcube.usecases.ws.thredds.model.ContainerType;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class StorageHubToWorkpaceConverter.
*
@ -60,7 +56,6 @@ import org.slf4j.LoggerFactory;
*/
public class StorageHubToWorkpaceConverter implements Serializable {
/**
*
*/
@ -71,8 +66,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
private GCubeUser loggedUser;
private String workspaceRootId;
/**
* Instantiates a new storage hub to workpace converter.
*/
@ -80,68 +73,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
/**********************************************************************************************************************************************
*
*
*
*
* TESTING MODE METHODS
*
*
*
*
***********************************************************************************************************************************************/
protected static HashMap<String, InfoContactModel> hashTestUser = null;
/**
* Used in test mode.
*
* @return the hash test users
*/
public static HashMap<String, InfoContactModel> getHashTestUsers(){
if(hashTestUser==null){
hashTestUser = new HashMap<String, InfoContactModel>();
//USERS
hashTestUser.put("federico.defaveri", new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri",null, false));
hashTestUser.put("antonio.gioia", new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",null, false));
hashTestUser.put("fabio.sinibaldi", new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",null, false));
hashTestUser.put("pasquale.pagano", new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",null, false));
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli",null, false));
hashTestUser.put("roberto.cirillo", new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo",null, false));
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",null, false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",null, false));
}
return hashTestUser;
}
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin){
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
for (String portalLogin : listPortalLogin)
listContact.add(getHashTestUsers().get(portalLogin));
return listContact;
}
/**********************************************************************************************************************************************
*
*
*
*
* END TESTING MODE
*
*
*
*
***********************************************************************************************************************************************/
/**
* To version history.
*
@ -158,14 +89,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
for (WorkspaceFileVersion wsVersion : versions) {
String user = UserUtil.getUserFullName(wsVersion.getOwner());
FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(), wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()), wsVersion.isCurrentVersion());
FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(),
wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()),
wsVersion.isCurrentVersion());
listVersions.add(file);
}
return listVersions;
}
/**
* Instantiates a new storage hub to workpace converter.
*
@ -177,7 +108,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
this.loggedUser = loggedUser;
}
/**
* To root folder.
*
@ -185,7 +115,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the folder model
* @throws InternalErrorException the internal error exception
*/
public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder) throws InternalErrorException{
public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder)
throws InternalErrorException {
return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder);
@ -200,14 +131,13 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the file model
* @throws InternalErrorException the internal error exception
*/
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException{
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
return setSynchedThreddsStateFor(fileModel, wrappedItem);
return setSynchedWithWsThredds(fileModel, wrappedItem);
}
/**
* To grid file model.
*
@ -216,48 +146,70 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the file grid model
* @throws InternalErrorException the internal error exception
*/
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel) throws InternalErrorException{
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
FileModel parentFolderModel) throws InternalErrorException {
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem);
return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
}
/**
* Sets the synched thredds state for.
*
* @param fileModel the file model
* @param wrappedItem item
* @return the file model
*/
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
Sync_Status status = null;
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
try {
if(wrappedItem.getPropertyMap()!=null) {
String wsSyncStatus = null;
boolean isItemSynched = false;
try {
PropertyMap map = wrappedItem.getPropertyMap();
logger.debug("Property Map for folder: "+fileModel.getName()+" has value: "+map.getValues());
wsSyncStatus = (String) map.getValues().get(WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS);
logger.debug("Item id: "+wrappedItem.getId()+" read from Shub has current: "+WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS +" value at: "+wsSyncStatus);
if(wsSyncStatus!=null)
status = Sync_Status.valueOf(wsSyncStatus);
}catch (Exception e) {
logger.warn(wsSyncStatus + " is not value of "+Sync_Status.values()+", returning null");
Map<String, Object> mapProperties = wrappedItem.getPropertyMap().getValues();
ContainerType containerItemType = null;
// is it a directory?
if (fileModel.isDirectory()) {
containerItemType = ContainerType.FOLDER;
}
// checking other cases
if (containerItemType == null) {
switch (wrappedItem.getType()) {
case FOLDER:
case VRE_FOLDER:
case SHARED_FOLDER:
case SMART_FOLDER:
containerItemType = ContainerType.FOLDER;
break;
case FILE_ITEM:
containerItemType = ContainerType.FILE;
break;
case URL_ITEM:
containerItemType = ContainerType.URL;
break;
default:
containerItemType = ContainerType.GENERIC_ITEM;
break;
}
}
logger.debug(
"calling isItemSynched for id: " + wrappedItem.getId() + ", with name: " + wrappedItem.getName()
+ ", with map: " + mapProperties + ", containerItemType: " + containerItemType);
isItemSynched = WorkspaceThreddsSynchronize.getInstance().isItemSynched(wrappedItem.getId(), mapProperties,
containerItemType);
} catch (Exception e) {
logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
logger.info("Error on calling isItemSynched for the item id: " + wrappedItem.getId()
+ ", (means not synched)");
}
fileModel.setSyncThreddsStatus(status);
logger.debug("the item id: " + wrappedItem.getId() + " with name: " + wrappedItem.getName() + " is synched: "
+ isItemSynched);
fileModel.setSynchedWithWsThredds(isItemSynched);
return fileModel;
}
/**
* To file trashed model.
*
@ -301,13 +253,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
fileTrashModel.setShared(trashItem.isShared());
logger.debug("Converting return trash item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
logger.debug("Converting return trash item: " + fileTrashModel.getName() + " id: "
+ fileTrashModel.getIdentifier());
logger.trace("Returning trash item: " + fileTrashModel);
} catch (Exception e) {
logger.debug("Error into toFileTrashedModel for item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
logger.debug("Error into toFileTrashedModel for item: " + fileTrashModel.getName() + " id: "
+ fileTrashModel.getIdentifier());
return null;
}
@ -316,7 +270,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
/**
* Builds the gxt info contact from portal login.
*
@ -345,8 +298,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
/**
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS WORKSPACESPECIALFOLDER****
* REMOVE THIS METHOD AND ADDING INSTANCE OF AT buildGXTFolderModelItem.
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS
* WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT
* buildGXTFolderModelItem.
*
* @param wsFolder the ws folder
* @param parent the parent
@ -354,7 +308,10 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the folder model
* @throws InternalErrorException the internal error exception
*/
public FolderModel buildGXTFolderModelItemHandleSpecialFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder, org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName) throws InternalErrorException {
public FolderModel buildGXTFolderModelItemHandleSpecialFolder(
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder,
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName)
throws InternalErrorException {
String name = "";
@ -371,7 +328,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
name = shared.getName();
// MANAGEMENT SPECIAL FOLDER
}else if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && parent!=null && parent.isRoot()){
} else if (wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS) == 0 && parent != null
&& parent.isRoot()) {
// MANAGEMENT SPECIAL FOLDER
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: " + specialFolderName);
if (specialFolderName != null && !specialFolderName.isEmpty())
@ -384,12 +342,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
logger.debug("Name is: " + name);
boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder).isPublicFolder(); //TODO
boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder)
.isPublicFolder(); // TODO
FileModel parentModel = null;
if (parent != null)
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false, isPublicDir);
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
isPublicDir);
folder.setShareable(true);
folder.setIsRoot(wsFolder.isRoot());
folder.setDescription(wsFolder.getDescription());
@ -402,7 +362,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return folder;
}
/**
* Gets the workspace root id.
*
@ -413,7 +372,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return workspaceRootId;
}
/**
* Sets the workspace root id.
*
@ -424,8 +382,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
this.workspaceRootId = workspaceRootId;
}
/**
* To simple map.
*
@ -459,7 +415,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
}
/**
* Builds the GXT accounting item.
*
@ -467,7 +422,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @param gxtEntryType the gxt entry type
* @return the list
*/
public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings, GxtAccountingEntryType gxtEntryType) {
public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings,
GxtAccountingEntryType gxtEntryType) {
List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>();
@ -492,20 +448,25 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case CREATE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.CREATE)) {
AccountEntryCreate create = (AccountEntryCreate) shubAccEntry;
af.setOperation(GxtAccountingEntryType.CREATE);
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName());
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by
// "+user.getName());
String msg = "";
if (create.getItemName() == null || create.getItemName().isEmpty())
msg = GxtAccountingEntryType.CREATE.getId() + " by " + user.getName();
else {
if (create.getVersion() == null)
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "
+ user.getName();
else
msg = create.getItemName() + " v. "+create.getVersion()+" "+ GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
msg = create.getItemName() + " v. " + create.getVersion() + " "
+ GxtAccountingEntryType.CREATE.getName() + " by " + user.getName();
}
af.setDescription(msg);
@ -515,11 +476,13 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case READ:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.READ)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.READ)) {
AccountEntryRead read = (AccountEntryRead) shubAccEntry;
af.setOperation(GxtAccountingEntryType.READ);
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName());
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "
+ user.getName());
String msg = "";
if (read.getItemName() == null || read.getItemName().isEmpty())
@ -527,9 +490,11 @@ public class StorageHubToWorkpaceConverter implements Serializable{
else {
if (read.getVersion() == null)
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName();
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "
+ user.getName();
else
msg = read.getItemName() + " v."+read.getVersion() +" "+ GxtAccountingEntryType.READ.getName() + " by "+user.getName();
msg = read.getItemName() + " v." + read.getVersion() + " "
+ GxtAccountingEntryType.READ.getName() + " by " + user.getName();
}
af.setDescription(msg);
@ -539,7 +504,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case CUT:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CUT)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.CUT)) {
af.setOperation(GxtAccountingEntryType.CUT);
@ -552,14 +519,18 @@ public class StorageHubToWorkpaceConverter implements Serializable{
msg = GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
else {
if (cut.getVersion() == null)
msg = cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
msg = cut.getItemName() + " " + GxtAccountingEntryType.CUT.getName() + " by "
+ user.getName();
else
msg = cut.getItemName()+" v."+cut.getVersion()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
msg = cut.getItemName() + " v." + cut.getVersion() + " "
+ GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
}
af.setDescription(msg);
} else {
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryCut.class.getSimpleName());
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryCut.class.getSimpleName());
}
}
@ -567,91 +538,118 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case PASTE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.PASTE)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.PASTE)) {
af.setOperation(GxtAccountingEntryType.PASTE);
AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry;
if (paste.getVersion() == null)
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from "+paste.getFromPath()+" by "+user.getName());
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from " + paste.getFromPath()
+ " by " + user.getName());
else
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. "+paste.getVersion()+" from "+paste.getFromPath()+" by "+user.getName());
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. " + paste.getVersion()
+ " from " + paste.getFromPath() + " by " + user.getName());
}
break;
case REMOVAL:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVE)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.REMOVE)) {
if (shubAccEntry instanceof AccountFolderEntryRemoval) {
af.setOperation(GxtAccountingEntryType.REMOVE);
AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry;
String msg = rem.getItemName()==null || rem.getItemName().isEmpty()?"":rem.getItemName()+" ";
String msg = rem.getItemName() == null || rem.getItemName().isEmpty() ? ""
: rem.getItemName() + " ";
if (rem.getVersion() == null)
msg += GxtAccountingEntryType.REMOVE.getName() + " by " + user.getName();
else
msg+= GxtAccountingEntryType.REMOVE.getName() +" v."+rem.getVersion()+" by "+user.getName();
msg += GxtAccountingEntryType.REMOVE.getName() + " v." + rem.getVersion() + " by "
+ user.getName();
af.setDescription(msg);
} else {
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRemoval.class.getSimpleName());
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryRemoval.class.getSimpleName());
}
}
break;
case RENAMING:
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)) {
if (shubAccEntry instanceof AccountFolderEntryRenaming) {
af.setOperation(GxtAccountingEntryType.RENAME);
AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry;
String msg = ren.getOldItemName()==null || ren.getOldItemName().isEmpty()?"":ren.getOldItemName()+" ";
String msg = ren.getOldItemName() == null || ren.getOldItemName().isEmpty() ? ""
: ren.getOldItemName() + " ";
if (ren.getVersion() == null)
msg+= GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
msg += GxtAccountingEntryType.RENAME.getName() + " to " + ren.getNewItemName() + " by "
+ user.getName();
else
msg+= " v."+ren.getVersion() +" "+GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
msg += " v." + ren.getVersion() + " " + GxtAccountingEntryType.RENAME.getName() + " to "
+ ren.getNewItemName() + " by " + user.getName();
af.setDescription(msg);
} else {
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRenaming.class.getSimpleName());
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryRenaming.class.getSimpleName());
}
}
break;
case ADD:
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)) {
if (shubAccEntry instanceof AccountFolderEntryAdd) {
af.setOperation(GxtAccountingEntryType.ADD);
AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry;
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? ""
: acc.getItemName() + " ";
if (acc.getVersion() == null)
msg += GxtAccountingEntryType.ADD.getName() + " by " + user.getName();
else
msg+=" v."+acc.getVersion()+ " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.ADD.getName() + " by "
+ user.getName();
af.setDescription(msg);
} else {
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryAdd.class.getSimpleName());
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryAdd.class.getSimpleName());
}
}
break;
case UPDATE:
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);
AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry;
String msg = upd.getItemName()==null || upd.getItemName().isEmpty()?"":upd.getItemName()+" ";
String msg = upd.getItemName() == null || upd.getItemName().isEmpty() ? ""
: upd.getItemName() + " ";
if (upd.getVersion() == null)
msg += GxtAccountingEntryType.UPDATE.getName() + " by " + user.getName();
else
msg+=" v."+upd.getVersion()+" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
msg += " v." + upd.getVersion() + " " + GxtAccountingEntryType.UPDATE.getName() + " by "
+ user.getName();
af.setDescription(msg);
}
@ -659,7 +657,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case SHARE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.SHARE)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.SHARE)) {
af.setOperation(GxtAccountingEntryType.SHARE);
@ -669,10 +669,12 @@ public class StorageHubToWorkpaceConverter implements Serializable{
if (acc.getItemName() == null || acc.getItemName().isEmpty())
msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder";
else
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " folder "+acc.getItemName();
msg = user.getName() + " " + GxtAccountingEntryType.SHARE.getName() + " folder "
+ acc.getItemName();
if (acc.getMembers() != null && acc.getMembers().length > 0)
msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
msg += " with "
+ UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
af.setDescription(msg);
}
@ -680,12 +682,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case UNSHARE:
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);
AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry;
String msg = "Folder ";
msg+= uns.getItemName()==null || uns.getItemName().isEmpty()?"":"\""+uns.getItemName()+"\" ";
msg += uns.getItemName() == null || uns.getItemName().isEmpty() ? ""
: "\"" + uns.getItemName() + "\" ";
// see Task #19544
if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) {
// CASE ALL
@ -702,16 +707,20 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case RESTORE:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RESTORE)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.RESTORE)) {
af.setOperation(GxtAccountingEntryType.RESTORE);
AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry;
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? ""
: acc.getItemName() + " ";
if (acc.getVersion() == null)
msg += GxtAccountingEntryType.RESTORE.getName() + " by " + user.getName();
else
msg+=" v."+acc.getVersion()+" "+GxtAccountingEntryType.RESTORE.getName() +" by "+user.getName();
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.RESTORE.getName() + " by "
+ user.getName();
af.setDescription(msg);
}
@ -719,12 +728,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case DISABLED_PUBLIC_ACCESS:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)) {
af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry;
// TODO acc.getItemName() is missing in SHUB
//String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
// String msg = acc.getItemName()==null ||
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg = GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
af.setDescription(msg);
}
@ -733,12 +745,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case ENABLED_PUBLIC_ACCESS:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)){
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)) {
af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry;
// TODO acc.getItemName() is missing in SHUB
//String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
// String msg = acc.getItemName()==null ||
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg = GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
af.setDescription(msg);
}
@ -759,7 +774,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
/**
* Gets the gcube item properties for gcube item as HTML.
*
@ -768,7 +782,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
*/
public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) {
Map<String, String> properties = getGcubeItemProperties(wsItem);
if (properties != null) {
@ -798,7 +811,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
}
}
/**
* Gets the gcube item properties.
*
@ -822,4 +834,73 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return null;
}
/**********************************************************************************************************************************************
*
*
*
*
* TESTING MODE METHODS
*
*
*
*
***********************************************************************************************************************************************/
protected static HashMap<String, InfoContactModel> hashTestUser = null;
/**
* Used in test mode.
*
* @return the hash test users
*/
public static HashMap<String, InfoContactModel> getHashTestUsers() {
if (hashTestUser == null) {
hashTestUser = new HashMap<String, InfoContactModel>();
// USERS
hashTestUser.put("federico.defaveri",
new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri", null, false));
hashTestUser.put("antonio.gioia",
new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia", null, false));
hashTestUser.put("fabio.sinibaldi",
new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi", null, false));
hashTestUser.put("pasquale.pagano",
new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano", null, false));
hashTestUser.put("valentina.marioli",
new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli", null, false));
hashTestUser.put("roberto.cirillo",
new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo", null, false));
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa",
"francesco.mangiacrapa", "Francesco Mangiacrapa", null, false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante",
"massimiliano.assante", "Massimiliano Assante", null, false));
}
return hashTestUser;
}
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin) {
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
for (String portalLogin : listPortalLogin)
listContact.add(getHashTestUsers().get(portalLogin));
return listContact;
}
/**********************************************************************************************************************************************
*
*
*
*
* END TESTING MODE
*
*
*
*
***********************************************************************************************************************************************/
}

Loading…
Cancel
Save