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

Reviewed-on: #2
This commit is contained in:
Francesco Mangiacrapa 2021-05-25 10:57:37 +02:00
commit b5effefc64
17 changed files with 1526 additions and 1537 deletions

View File

@ -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). 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 ## [v6.32.0] - 2021-04-12
#### Enhancements #### Enhancements

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

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

View File

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

View File

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

View File

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

View File

@ -63,9 +63,6 @@ public class ObjectStorageHubToWorkpaceMapper {
isVreFolder = sharedFolder.isVreFolder(); 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); FolderModel theFolder = new FolderModel(folder.getId(), folder.getName(), null, folder.isFolder(), folder.isShared(), isVreFolder, isPublicFolder);
theFolder.setIsRoot(folder.isRoot()); theFolder.setIsRoot(folder.isRoot());
return theFolder; return theFolder;

View File

@ -3,7 +3,6 @@
*/ */
package org.gcube.portlets.user.workspace.server.tostoragehub; package org.gcube.portlets.user.workspace.server.tostoragehub;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; 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.impl.WorkspaceFileVersion;
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem; import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap; 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.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileGridModel; 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.GxtAccountingEntryType;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField; import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; 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.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The Class StorageHubToWorkpaceConverter. * The Class StorageHubToWorkpaceConverter.
* *
@ -60,7 +56,6 @@ import org.slf4j.LoggerFactory;
*/ */
public class StorageHubToWorkpaceConverter implements Serializable { public class StorageHubToWorkpaceConverter implements Serializable {
/** /**
* *
*/ */
@ -71,8 +66,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
private GCubeUser loggedUser; private GCubeUser loggedUser;
private String workspaceRootId; private String workspaceRootId;
/** /**
* Instantiates a new storage hub to workpace converter. * 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. * To version history.
* *
@ -158,14 +89,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size()); List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
for (WorkspaceFileVersion wsVersion : versions) { for (WorkspaceFileVersion wsVersion : versions) {
String user = UserUtil.getUserFullName(wsVersion.getOwner()); 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); listVersions.add(file);
} }
return listVersions; return listVersions;
} }
/** /**
* Instantiates a new storage hub to workpace converter. * Instantiates a new storage hub to workpace converter.
* *
@ -177,7 +108,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
this.loggedUser = loggedUser; this.loggedUser = loggedUser;
} }
/** /**
* To root folder. * To root folder.
* *
@ -185,7 +115,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the folder model * @return the folder model
* @throws InternalErrorException the internal error exception * @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); return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder);
@ -200,14 +131,13 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the file model * @return the file model
* @throws InternalErrorException the internal error exception * @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); FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
return setSynchedThreddsStateFor(fileModel, wrappedItem); return setSynchedWithWsThredds(fileModel, wrappedItem);
} }
/** /**
* To grid file model. * To grid file model.
* *
@ -216,48 +146,70 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the file grid model * @return the file grid model
* @throws InternalErrorException the internal error exception * @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); FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem); return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
} }
/** protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
* Sets the synched thredds state for. logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
*
* @param fileModel the file model
* @param wrappedItem item
* @return the file model
*/
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
Sync_Status status = null; boolean isItemSynched = false;
try {
if(wrappedItem.getPropertyMap()!=null) {
String wsSyncStatus = null;
try { try {
PropertyMap map = wrappedItem.getPropertyMap(); Map<String, Object> mapProperties = wrappedItem.getPropertyMap().getValues();
logger.debug("Property Map for folder: "+fileModel.getName()+" has value: "+map.getValues()); ContainerType containerItemType = null;
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); // is it a directory?
if(wsSyncStatus!=null) if (fileModel.isDirectory()) {
status = Sync_Status.valueOf(wsSyncStatus); containerItemType = ContainerType.FOLDER;
}catch (Exception e) {
logger.warn(wsSyncStatus + " is not value of "+Sync_Status.values()+", returning null");
}
}
} catch (Exception e) {
logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
} }
fileModel.setSyncThreddsStatus(status); // 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.info("Error on calling isItemSynched for the item id: " + wrappedItem.getId()
+ ", (means not synched)");
}
logger.debug("the item id: " + wrappedItem.getId() + " with name: " + wrappedItem.getName() + " is synched: "
+ isItemSynched);
fileModel.setSynchedWithWsThredds(isItemSynched);
return fileModel; return fileModel;
} }
/** /**
* To file trashed model. * To file trashed model.
* *
@ -301,13 +253,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
fileTrashModel.setShared(trashItem.isShared()); 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); logger.trace("Returning trash item: " + fileTrashModel);
} catch (Exception e) { } 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; return null;
} }
@ -316,7 +270,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
} }
/** /**
* Builds the gxt info contact from portal login. * 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**** * TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS
* REMOVE THIS METHOD AND ADDING INSTANCE OF AT buildGXTFolderModelItem. * WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT
* buildGXTFolderModelItem.
* *
* @param wsFolder the ws folder * @param wsFolder the ws folder
* @param parent the parent * @param parent the parent
@ -354,7 +308,10 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @return the folder model * @return the folder model
* @throws InternalErrorException the internal error exception * @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 = ""; String name = "";
@ -371,7 +328,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
name = shared.getName(); name = shared.getName();
// MANAGEMENT SPECIAL FOLDER // 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 // MANAGEMENT SPECIAL FOLDER
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: " + specialFolderName); logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: " + specialFolderName);
if (specialFolderName != null && !specialFolderName.isEmpty()) if (specialFolderName != null && !specialFolderName.isEmpty())
@ -384,12 +342,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
} }
logger.debug("Name is: " + name); 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; FileModel parentModel = null;
if (parent != null) if (parent != null)
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared()); 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.setShareable(true);
folder.setIsRoot(wsFolder.isRoot()); folder.setIsRoot(wsFolder.isRoot());
folder.setDescription(wsFolder.getDescription()); folder.setDescription(wsFolder.getDescription());
@ -402,7 +362,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return folder; return folder;
} }
/** /**
* Gets the workspace root id. * Gets the workspace root id.
* *
@ -413,7 +372,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return workspaceRootId; return workspaceRootId;
} }
/** /**
* Sets the workspace root id. * Sets the workspace root id.
* *
@ -424,8 +382,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
this.workspaceRootId = workspaceRootId; this.workspaceRootId = workspaceRootId;
} }
/** /**
* To simple map. * To simple map.
* *
@ -459,7 +415,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
} }
} }
/** /**
* Builds the GXT accounting item. * Builds the GXT accounting item.
* *
@ -467,7 +422,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
* @param gxtEntryType the gxt entry type * @param gxtEntryType the gxt entry type
* @return the list * @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>(); List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>();
@ -492,20 +448,25 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case CREATE: 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; AccountEntryCreate create = (AccountEntryCreate) shubAccEntry;
af.setOperation(GxtAccountingEntryType.CREATE); af.setOperation(GxtAccountingEntryType.CREATE);
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName()); // af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by
// "+user.getName());
String msg = ""; String msg = "";
if (create.getItemName() == null || create.getItemName().isEmpty()) if (create.getItemName() == null || create.getItemName().isEmpty())
msg = GxtAccountingEntryType.CREATE.getId() + " by " + user.getName(); msg = GxtAccountingEntryType.CREATE.getId() + " by " + user.getName();
else { else {
if (create.getVersion() == null) if (create.getVersion() == null)
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "+user.getName(); msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "
+ user.getName();
else 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); af.setDescription(msg);
@ -515,11 +476,13 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case READ: 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; AccountEntryRead read = (AccountEntryRead) shubAccEntry;
af.setOperation(GxtAccountingEntryType.READ); 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 = ""; String msg = "";
if (read.getItemName() == null || read.getItemName().isEmpty()) if (read.getItemName() == null || read.getItemName().isEmpty())
@ -527,9 +490,11 @@ public class StorageHubToWorkpaceConverter implements Serializable{
else { else {
if (read.getVersion() == null) if (read.getVersion() == null)
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName(); msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "
+ user.getName();
else 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); af.setDescription(msg);
@ -539,7 +504,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case CUT: 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); af.setOperation(GxtAccountingEntryType.CUT);
@ -552,14 +519,18 @@ public class StorageHubToWorkpaceConverter implements Serializable{
msg = GxtAccountingEntryType.CUT.getName() + " by " + user.getName(); msg = GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
else { else {
if (cut.getVersion() == null) if (cut.getVersion() == null)
msg = cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName(); msg = cut.getItemName() + " " + GxtAccountingEntryType.CUT.getName() + " by "
+ user.getName();
else 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); af.setDescription(msg);
} else { } 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: 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); af.setOperation(GxtAccountingEntryType.PASTE);
AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry; AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry;
if (paste.getVersion() == null) 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 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; break;
case REMOVAL: 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) { if (shubAccEntry instanceof AccountFolderEntryRemoval) {
af.setOperation(GxtAccountingEntryType.REMOVE); af.setOperation(GxtAccountingEntryType.REMOVE);
AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry; 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) if (rem.getVersion() == null)
msg += GxtAccountingEntryType.REMOVE.getName() + " by " + user.getName(); msg += GxtAccountingEntryType.REMOVE.getName() + " by " + user.getName();
else else
msg+= GxtAccountingEntryType.REMOVE.getName() +" v."+rem.getVersion()+" by "+user.getName(); msg += GxtAccountingEntryType.REMOVE.getName() + " v." + rem.getVersion() + " by "
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} else { } 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; break;
case RENAMING: 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) { if (shubAccEntry instanceof AccountFolderEntryRenaming) {
af.setOperation(GxtAccountingEntryType.RENAME); af.setOperation(GxtAccountingEntryType.RENAME);
AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry; 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) 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 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); af.setDescription(msg);
} else { } 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; break;
case ADD: 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) { if (shubAccEntry instanceof AccountFolderEntryAdd) {
af.setOperation(GxtAccountingEntryType.ADD); af.setOperation(GxtAccountingEntryType.ADD);
AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry; 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) if (acc.getVersion() == null)
msg += GxtAccountingEntryType.ADD.getName() + " by " + user.getName(); msg += GxtAccountingEntryType.ADD.getName() + " by " + user.getName();
else else
msg+=" v."+acc.getVersion()+ " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName(); msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.ADD.getName() + " by "
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} else { } 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; break;
case UPDATE: 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); af.setOperation(GxtAccountingEntryType.UPDATE);
AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry; 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) if (upd.getVersion() == null)
msg += GxtAccountingEntryType.UPDATE.getName() + " by " + user.getName(); msg += GxtAccountingEntryType.UPDATE.getName() + " by " + user.getName();
else else
msg+=" v."+upd.getVersion()+" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName(); msg += " v." + upd.getVersion() + " " + GxtAccountingEntryType.UPDATE.getName() + " by "
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -659,7 +657,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case SHARE: 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); af.setOperation(GxtAccountingEntryType.SHARE);
@ -669,10 +669,12 @@ public class StorageHubToWorkpaceConverter implements Serializable{
if (acc.getItemName() == null || acc.getItemName().isEmpty()) if (acc.getItemName() == null || acc.getItemName().isEmpty())
msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder"; msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder";
else 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) 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); af.setDescription(msg);
} }
@ -680,12 +682,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case UNSHARE: 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); af.setOperation(GxtAccountingEntryType.UNSHARE);
AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry; AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry;
String msg = "Folder "; String msg = "Folder ";
msg+= uns.getItemName()==null || uns.getItemName().isEmpty()?"":"\""+uns.getItemName()+"\" "; msg += uns.getItemName() == null || uns.getItemName().isEmpty() ? ""
: "\"" + uns.getItemName() + "\" ";
// see Task #19544 // see Task #19544
if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) { if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) {
// CASE ALL // CASE ALL
@ -702,16 +707,20 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case RESTORE: 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); af.setOperation(GxtAccountingEntryType.RESTORE);
AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry; 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) if (acc.getVersion() == null)
msg += GxtAccountingEntryType.RESTORE.getName() + " by " + user.getName(); msg += GxtAccountingEntryType.RESTORE.getName() + " by " + user.getName();
else else
msg+=" v."+acc.getVersion()+" "+GxtAccountingEntryType.RESTORE.getName() +" by "+user.getName(); msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.RESTORE.getName() + " by "
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -719,12 +728,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case DISABLED_PUBLIC_ACCESS: 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); af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry; AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry;
// TODO acc.getItemName() is missing in SHUB // 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(); String msg = GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -733,12 +745,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
case ENABLED_PUBLIC_ACCESS: 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); af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry; AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry;
// TODO acc.getItemName() is missing in SHUB // 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(); String msg = GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -759,7 +774,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
} }
/** /**
* Gets the gcube item properties for gcube item as HTML. * Gets the gcube item properties for gcube item as HTML.
* *
@ -768,7 +782,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
*/ */
public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) { public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) {
Map<String, String> properties = getGcubeItemProperties(wsItem); Map<String, String> properties = getGcubeItemProperties(wsItem);
if (properties != null) { if (properties != null) {
@ -798,7 +811,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
} }
} }
/** /**
* Gets the gcube item properties. * Gets the gcube item properties.
* *
@ -822,4 +834,73 @@ public class StorageHubToWorkpaceConverter implements Serializable{
return null; 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
*
*
*
*
***********************************************************************************************************************************************/
} }