Starting #11127
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@164633 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bc1e67e430
commit
6d14ec7745
|
@ -3,6 +3,7 @@ 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;
|
||||||
|
@ -35,7 +36,6 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
protected boolean isSpecialFolder = false;
|
protected boolean isSpecialFolder = false;
|
||||||
protected boolean isPublic = false; // IS IT A PUBLIC FOLDER?
|
protected boolean isPublic = false; // IS IT A PUBLIC FOLDER?
|
||||||
|
|
||||||
|
|
||||||
public static final String NAME = "Name";
|
public static final String NAME = "Name";
|
||||||
public static final String TYPE = "Type";
|
public static final String TYPE = "Type";
|
||||||
public static final String ICON = "Icon";
|
public static final String ICON = "Icon";
|
||||||
|
@ -52,6 +52,9 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
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
|
||||||
|
private Sync_Status synchedThreddsStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new file model.
|
* Instantiates a new file model.
|
||||||
*/
|
*/
|
||||||
|
@ -328,10 +331,24 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
else{ //SIMPLE FOLDER
|
else{ //SIMPLE FOLDER
|
||||||
if(this.isPublic()) //IS PLUBIC
|
if(this.isPublic()) //IS PLUBIC
|
||||||
absImgPr = Resources.getIconFolderPublic();
|
absImgPr = Resources.getIconFolderPublic();
|
||||||
else
|
else {
|
||||||
|
if(this.getSynchedThreddsStatus()!=null) {
|
||||||
|
switch(this.getSynchedThreddsStatus()) {
|
||||||
|
case OUTDATED_REMOTE:
|
||||||
|
absImgPr = Resources.getIconSyncTo();
|
||||||
|
break;
|
||||||
|
case OUTDATED_WS:
|
||||||
|
absImgPr = Resources.getIconSyncFrom();
|
||||||
|
break;
|
||||||
|
case UP_TO_DATE:
|
||||||
|
absImgPr = Resources.getIconSynched();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
absImgPr = Resources.getIconFolder();
|
absImgPr = Resources.getIconFolder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return absImgPr;
|
return absImgPr;
|
||||||
}
|
}
|
||||||
|
@ -553,6 +570,15 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
return isPublic;
|
return isPublic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSyncThreddsStatus(Sync_Status status) {
|
||||||
|
this.synchedThreddsStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Sync_Status getSynchedThreddsStatus() {
|
||||||
|
return synchedThreddsStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
|
@ -587,4 +613,5 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,5 +457,21 @@ public interface Icons extends ClientBundle {
|
||||||
*/
|
*/
|
||||||
@Source("icons/thredds.gif")
|
@Source("icons/thredds.gif")
|
||||||
ImageResource thredds();
|
ImageResource thredds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sync icon to.
|
||||||
|
*
|
||||||
|
* @return the image resource
|
||||||
|
*/
|
||||||
|
@Source("icons/sync-icon-to.png")
|
||||||
|
ImageResource syncIconTo();
|
||||||
|
|
||||||
|
@Source("icons/sync-icon-from.png")
|
||||||
|
ImageResource syncIconFrom();
|
||||||
|
|
||||||
|
@Source("icons/sync-icon-synched.png")
|
||||||
|
ImageResource syncIconSynched();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle.Source;
|
||||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1374,6 +1375,19 @@ public class Resources {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconSyncTo() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.syncIconTo());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconSyncFrom() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.syncIconFrom());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconSynched() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.syncIconSynched());
|
||||||
|
}
|
||||||
|
|
||||||
//ImageResources
|
//ImageResources
|
||||||
/**
|
/**
|
||||||
* Gets the image path separator.
|
* Gets the image path separator.
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 639 B |
Binary file not shown.
After Width: | Height: | Size: 769 B |
Binary file not shown.
After Width: | Height: | Size: 890 B |
|
@ -55,6 +55,10 @@ import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage;
|
||||||
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashFolder;
|
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashFolder;
|
||||||
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashItem;
|
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashItem;
|
||||||
import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
|
import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||||
|
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.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;
|
||||||
|
@ -89,6 +93,7 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class GWTWorkspaceBuilder.
|
* The Class GWTWorkspaceBuilder.
|
||||||
*
|
*
|
||||||
|
@ -100,6 +105,7 @@ public class GWTWorkspaceBuilder {
|
||||||
protected static final String IMAGE_SERVICE_URL = "ImageService";
|
protected static final String IMAGE_SERVICE_URL = "ImageService";
|
||||||
protected static Logger logger = Logger.getLogger(GWTWorkspaceBuilder.class);
|
protected static Logger logger = Logger.getLogger(GWTWorkspaceBuilder.class);
|
||||||
private InfoContactModel userLogged;
|
private InfoContactModel userLogged;
|
||||||
|
private String scope;
|
||||||
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -741,6 +747,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileModel.setShareable(false);
|
fileModel.setShareable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSynchedThreddsStateFor(fileModel, scope, userLogged.getLogin());
|
||||||
return fileModel;
|
return fileModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,6 +827,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileGridModel.setOwnerFullName(userLogged.getName());
|
fileGridModel.setOwnerFullName(userLogged.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSynchedThreddsStateFor(fileGridModel, scope, userLogged.getLogin());
|
||||||
return fileGridModel;
|
return fileGridModel;
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -937,6 +945,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileGridModel.setOwnerFullName(userLogged.getName());
|
fileGridModel.setOwnerFullName(userLogged.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSynchedThreddsStateFor(fileGridModel, scope, userLogged.getLogin());
|
||||||
return fileGridModel;
|
return fileGridModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1952,12 +1961,14 @@ public class GWTWorkspaceBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user logged.
|
* Sets the contex info.
|
||||||
*
|
*
|
||||||
* @param infoContactModel the new user logged
|
* @param infoContactModel the info contact model
|
||||||
|
* @param scope the scope
|
||||||
*/
|
*/
|
||||||
public void setUserLogged(InfoContactModel infoContactModel) {
|
public void setContexInfo(InfoContactModel infoContactModel, String scope) {
|
||||||
this.userLogged = infoContactModel;
|
this.userLogged = infoContactModel;
|
||||||
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2300,4 +2311,33 @@ public class GWTWorkspaceBuilder {
|
||||||
return listVersions;
|
return listVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the synched thredds state for.
|
||||||
|
*
|
||||||
|
* @param fileModel the file model
|
||||||
|
* @param scope the scope
|
||||||
|
* @param username the username
|
||||||
|
* @return the file model
|
||||||
|
*/
|
||||||
|
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, String scope, String username) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(fileModel.isDirectory()) {
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
Sync_Status status = WorkspaceThreddsSynchronize.getInstance().getSynchedStatusFromItemProperty(fileModel.getIdentifier(), username);
|
||||||
|
fileModel.setSyncThreddsStatus(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (ItemNotSynched e) {
|
||||||
|
//silent
|
||||||
|
logger.trace("Item: "+fileModel.getIdentifier() + " name: "+fileModel.getName() +" is not synched");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileModel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class WsUtil {
|
||||||
logger.info("Initializing the workspace area builder");
|
logger.info("Initializing the workspace area builder");
|
||||||
builder = new GWTWorkspaceBuilder();
|
builder = new GWTWorkspaceBuilder();
|
||||||
//ADDED 03/09/2013
|
//ADDED 03/09/2013
|
||||||
builder.setUserLogged(new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false));
|
builder.setContexInfo(new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false), info.getCurrentScope());
|
||||||
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue