in progess on #21388

This commit is contained in:
Francesco Mangiacrapa 2021-05-14 17:18:16 +02:00
parent cc17be1761
commit 996c982b39
11 changed files with 643 additions and 687 deletions

View File

@ -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:
if (this.getSynchedWithWsThredds() != null) {
if(this.getSynchedWithWsThredds()) {
absImgPr = Resources.getIconSyncTo();
break;
case OUTDATED_WS:
absImgPr = Resources.getIconSyncFrom();
break;
case UP_TO_DATE:
absImgPr = Resources.getIconSynched();
break;
}
} 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();
}
}

View File

@ -412,11 +412,11 @@ 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/sync-icon-from.png")
// ImageResource syncIconFrom();
//
// @Source("icons/sync-icon-synched.png")
// ImageResource syncIconSynched();
@Source("icons/no-preview-available.png")
ImageResource previewNotAvailable();

View File

@ -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.
*
@ -1268,25 +1247,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.syncIconTo());
}
/**
* Gets the icon sync from.
*
* @return the icon sync from
*/
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());
}
/**
* Gets the image delete.
*
@ -1296,7 +1256,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.move24());
}
// ImageResources
/**
* Gets the image path separator.
@ -1352,7 +1311,6 @@ public class Resources {
return ICONS.cancel();
}
/**
* Gets the image delete.
*
@ -1371,7 +1329,6 @@ public class Resources {
return ICONS.attach();
}
/**
* Gets the preview not available.
*
@ -1390,7 +1347,6 @@ public class Resources {
return ICONS.previewNotAvailableNoBorder();
}
/**
* Gets the icon by media type name.
*
@ -1400,7 +1356,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 +1467,6 @@ public class Resources {
return Resources.getIconTxt();
}
/**
* Gets the icon by type.
*
@ -1526,8 +1482,6 @@ public class Resources {
return Resources.getIconByMediaTypeName(name, mediaTypeName);
}
/**
* Gets the icon by folder enum.
*

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 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:
if (model.getSynchedWithWsThredds() != null) {
if (model.getSynchedWithWsThredds()) {
return Resources.getIconSyncTo();
case OUTDATED_WS:
return Resources.getIconSyncFrom();
case UP_TO_DATE:
return Resources.getIconSynched();
}
}
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();
}
@ -855,7 +846,7 @@ public class AsyncTreePanel extends LayoutContainer {
addChildrenToFolder(folder, result);
GWT.log("End RPC - getFolderChildren");
AppControllerExplorer.getEventBus().fireEvent(new CheckItemLockedBySyncEvent(folder));
//AppControllerExplorer.getEventBus().fireEvent(new CheckItemLockedBySyncEvent(folder));
}
});
@ -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.
*

View File

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

View File

@ -295,10 +295,12 @@ public class DialogGetInfoBootstrap extends Composite {
cgTxtIsPublic.setVisible(true);
htmlSetValue(txtIsPublic, fileModel.isPublic() + "");
if (fileModel.getSynchedThreddsStatus() != null) {
if (fileModel.getSynchedWithWsThredds() != null) {
if (fileModel.getSynchedWithWsThredds()) {
txtThreddsSynched.setVisible(true);
htmlSetValue(txtThreddsSynched, fileModel.getSynchedThreddsStatus() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedThreddsStatus() + "");
htmlSetValue(txtThreddsSynched, fileModel.getSynchedWithWsThredds() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedWithWsThredds() + "");
}
}
}

View File

@ -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>Synched with Thredds</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtThreddsSynched">
</g:HTML>

View File

@ -32,7 +32,6 @@ import org.gcube.common.storagehubwrapper.shared.tohl.items.URLFileItem;
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLItem;
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
import org.gcube.portlets.user.urlshortener.UrlShortener;

View File

@ -29,27 +29,34 @@ import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
import org.gcube.common.storagehubwrapper.shared.tohl.impl.URLFile;
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
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.shared.thredds.ThSyncFolderDescriptor;
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
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;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FileVersionModel;
import org.gcube.portlets.user.workspace.client.model.FolderGridModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
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.faults.WorkspaceNotSynchedException;
import org.gcube.usecases.ws.thredds.model.ContainerType;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.allen_sauer.gwt.log.client.Log;
/**
* The Class StorageHubToWorkpaceConverter.
*
@ -136,9 +143,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
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);
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
return setSynchedWithWsThredds(fileModel, wrappedItem);
}
/**
@ -152,35 +158,64 @@ public class StorageHubToWorkpaceConverter implements Serializable {
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);
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
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) {
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
Sync_Status status = null;
boolean isItemSynched = false;
try {
status = WorkspaceThreddsSynchronize.getInstance().getInfo(wrappedItem.getId());
logger.debug("item id: " + wrappedItem.getId() + " has ws-thredds sync status: " + status);
} catch (WorkspaceNotSynchedException e) {
logger.debug("WorkspaceNotSynchedException catched, the item with id: " + wrappedItem.getId()
+ " is not synched");
} catch (Exception e) {
logger.info(
"Error on getting configuration for the item id: " + wrappedItem.getId() + ", (means not synched)");
Map<String, Object> mapProperties = wrappedItem.getPropertyMap().getValues();
ContainerType containerItemType = null;
// is it a directory?
if (fileModel.isDirectory()) {
containerItemType = ContainerType.FOLDER;
}
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;
}