task sharing.. updated
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@69134 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0e8598dc12
commit
6b81912a63
|
@ -79,6 +79,7 @@ import org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface;
|
|||
import org.gcube.portlets.user.workspace.client.interfaces.TreeAppControllerInterface;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.MessageModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||
|
@ -99,6 +100,7 @@ import org.gcube.portlets.user.workspace.client.view.windows.DialogWebDavUrl;
|
|||
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxConfirm;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxInfo;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.WindowImagePreview;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.WindowOpenUrl;
|
||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||
|
@ -208,75 +210,97 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onCreateSharedFolder(CreateSharedFolderEvent createSharedFolderEvent) {
|
||||
|
||||
|
||||
final FileModel sourceFileModel = createSharedFolderEvent.getFileSourceModel();
|
||||
System.out.println("##########sourceFileModel id "+sourceFileModel.getIdentifier());
|
||||
|
||||
final FileModel parentFileModel= createSharedFolderEvent.getParentFileModel();
|
||||
final boolean isNewFolder = createSharedFolderEvent.isNewFolder();
|
||||
DialogShareFolder dialogSharedFolder = null;
|
||||
String parentDirectoryName = null;
|
||||
|
||||
FolderModel parent = null;
|
||||
|
||||
if(sourceFileModel.isDirectory()){
|
||||
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(sourceFileModel.getIdentifier(), true);
|
||||
parentDirectoryName = sourceFileModel.getName();
|
||||
parent = (FolderModel) sourceFileModel;
|
||||
}
|
||||
else{
|
||||
parentDirectoryName = parentFileModel.getName();
|
||||
parent = (FolderModel) parentFileModel;
|
||||
}
|
||||
|
||||
if(isNewFolder)
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName,eventBus);
|
||||
else
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, (FolderModel) sourceFileModel, eventBus);
|
||||
|
||||
|
||||
final DialogShareFolder finalDialog = dialogSharedFolder;
|
||||
final FolderModel parentModel = parent;
|
||||
|
||||
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(BaseEvent be) {
|
||||
|
||||
if(finalDialog.isValidForm(true)){
|
||||
|
||||
FolderModel folderModel = null;
|
||||
|
||||
if(isNewFolder){
|
||||
folderModel = new FolderModel("tempId", finalDialog.getName(), parentModel, true, false); //create new shared folder
|
||||
}
|
||||
else{
|
||||
folderModel = finalDialog.getFolder(); //add user for share
|
||||
}
|
||||
|
||||
System.out.println("##########sourceFileModel id "+folderModel.getIdentifier());
|
||||
|
||||
rpcWorkspaceService.shareFolder(folderModel, finalDialog.getSharedListUsers(), isNewFolder, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR+" creating shared folder. "+ caught.getMessage(), null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if(result)
|
||||
eventBus.fireEvent(new RefreshFolderEvent(parentFileModel));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
//IF ITEM IS SHAREABLE
|
||||
if(sourceFileModel.isShareable()){
|
||||
|
||||
System.out.println("create shared folderEvent - sourceFileModel id "+sourceFileModel.getIdentifier());
|
||||
|
||||
final FileModel parentFileModel= createSharedFolderEvent.getParentFileModel();
|
||||
final boolean isNewFolder = createSharedFolderEvent.isNewFolder();
|
||||
DialogShareFolder dialogSharedFolder = null;
|
||||
String parentDirectoryName = null;
|
||||
FileModel parent = null;
|
||||
|
||||
if(parentFileModel==null){ //PARENT IS ROOT
|
||||
parent = explorerPanel.getAsycTreePanel().getRootItem();
|
||||
sourceFileModel.setParentFileModel(parent);
|
||||
}
|
||||
|
||||
if(sourceFileModel.isDirectory()){
|
||||
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(sourceFileModel.getIdentifier(), true);
|
||||
parentDirectoryName = sourceFileModel.getName();
|
||||
parent = sourceFileModel;
|
||||
}
|
||||
else{
|
||||
parentDirectoryName = parentFileModel.getName();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(isNewFolder)
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName,eventBus);
|
||||
else
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, sourceFileModel, eventBus);
|
||||
|
||||
|
||||
final DialogShareFolder finalDialog = dialogSharedFolder;
|
||||
final FileModel parentModel = parent;
|
||||
|
||||
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(BaseEvent be) {
|
||||
|
||||
if(finalDialog.isValidForm(true)){
|
||||
|
||||
FileModel fileModel = null;
|
||||
|
||||
if(isNewFolder){
|
||||
//create a lowest object to send to server
|
||||
fileModel = new FileModel("tempId", finalDialog.getName(), parentModel, true, false); //create new shared folder
|
||||
}
|
||||
else{
|
||||
fileModel = finalDialog.getParentFolder(); //add user for share
|
||||
|
||||
//create a lowest object to send to server
|
||||
fileModel = new FileModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), fileModel.isDirectory(), fileModel.isShared());
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
System.out.println("FileModel id "+fileModel.getIdentifier() + " name: "+fileModel.getName() + " parent " + fileModel.getParentFileModel());
|
||||
for(InfoContactModel contact:finalDialog.getSharedListUsers() ){
|
||||
System.out.println("Share with Contact "+contact) ;
|
||||
|
||||
}
|
||||
|
||||
rpcWorkspaceService.shareFolder(fileModel, finalDialog.getSharedListUsers(), isNewFolder, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR+" creating shared folder. "+ caught.getMessage(), null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if(result)
|
||||
eventBus.fireEvent(new RefreshFolderEvent(parentFileModel));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else{//ITEM IS NOT SHARABLE
|
||||
new MessageBoxInfo("Info", "The selected item is not shareable because an ancestor item is already shared");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ public class ConstantsExplorer {
|
|||
public static final String FOLDERLOADED = "loaded";
|
||||
public static final String MARKASREAD = "MARKASREAD";
|
||||
public static final String ISROOT = "ISROOT";
|
||||
public static final String ISSHAREABLE = "ISSHAREABLE";
|
||||
|
||||
|
||||
//GRID COLUMNS constants
|
||||
|
@ -194,6 +195,7 @@ public class ConstantsExplorer {
|
|||
public static final String ATTACHS = "Attachs";
|
||||
public static final Object NONE = "None";
|
||||
public static final String ABSTRACTICON = "Abstract Icon";
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -28,12 +28,21 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
protected FileModel(){
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param identifier
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param isDirectory
|
||||
* @param isShared
|
||||
*/
|
||||
public FileModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared) {
|
||||
setIdentifier(identifier);
|
||||
setName(name);
|
||||
setParentFileModel(parent);
|
||||
setIsDirectory(isDirectory);
|
||||
setShared(isShared);
|
||||
initDefaultProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,8 +55,34 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
setIdentifier(identifier);
|
||||
setName(name);
|
||||
setIsDirectory(isDirectory);
|
||||
initDefaultProperties();
|
||||
}
|
||||
|
||||
private void initDefaultProperties(){
|
||||
setMarkAsRead(false);
|
||||
setShortcutCategory("");
|
||||
setShareable(false);
|
||||
}
|
||||
|
||||
public void setShareable(boolean bool) {
|
||||
set(ConstantsExplorer.ISSHAREABLE,bool);
|
||||
|
||||
}
|
||||
|
||||
public boolean isShareable() {
|
||||
return (Boolean) get(ConstantsExplorer.ISSHAREABLE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param identifier
|
||||
* @param name
|
||||
* @param type
|
||||
* @param folderItemTypeEnum
|
||||
* @param isDirectory
|
||||
* @param isShared
|
||||
*/
|
||||
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
|
||||
setIdentifier(identifier);
|
||||
setName(name);
|
||||
|
@ -55,6 +90,7 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
setFolderItemType(folderItemTypeEnum);
|
||||
setIsDirectory(isDirectory);
|
||||
setShared(isShared);
|
||||
initDefaultProperties();
|
||||
}
|
||||
|
||||
public void setParentFileModel(FileModel parent) {
|
||||
|
@ -86,10 +122,14 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
//SHARED FOLDER
|
||||
else if(this.isShared()){
|
||||
|
||||
absImgPr = Resources.getIconSharedFolder();
|
||||
|
||||
//SIMPLE FOLDER
|
||||
}else{
|
||||
if(this.isShareable()) //IS ROOT SHARED FOLDER
|
||||
absImgPr = Resources.getIconSharedFolder();
|
||||
else
|
||||
absImgPr = Resources.getIconFolder(); //IS A DESCENDANT
|
||||
|
||||
|
||||
}
|
||||
else{//SIMPLE FOLDER
|
||||
absImgPr = Resources.getIconFolder();
|
||||
}
|
||||
|
||||
|
@ -228,9 +268,6 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
return (GXTFolderItemTypeEnum) get(ConstantsExplorer.FOLDERITEMTYPE);
|
||||
}
|
||||
|
||||
public String getGXTFolderItemTypeToString(){
|
||||
return get(ConstantsExplorer.FOLDERITEMTYPE).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -243,6 +280,8 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
builder.append(getListUserSharing());
|
||||
builder.append(", isShared()=");
|
||||
builder.append(isShared());
|
||||
builder.append(", isRoot()=");
|
||||
builder.append(isRoot());
|
||||
builder.append(", getIcon()=");
|
||||
builder.append(getIcon());
|
||||
builder.append(", getAbstractPrototypeIcon()=");
|
||||
|
@ -263,10 +302,10 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
builder.append(getType());
|
||||
builder.append(", getGXTFolderItemType()=");
|
||||
builder.append(getGXTFolderItemType());
|
||||
builder.append(", getGXTFolderItemTypeToString()=");
|
||||
builder.append(getGXTFolderItemTypeToString());
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@ public class FolderModel extends FileModel {
|
|||
builder.append(getType());
|
||||
builder.append(", getGXTFolderItemType()=");
|
||||
builder.append(getGXTFolderItemType());
|
||||
builder.append(", getGXTFolderItemTypeToString()=");
|
||||
builder.append(getGXTFolderItemTypeToString());
|
||||
builder.append(", getProperties()=");
|
||||
builder.append(getProperties());
|
||||
builder.append(", getPropertyNames()=");
|
||||
|
|
|
@ -103,8 +103,8 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
|
||||
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception;
|
||||
|
||||
boolean shareFolder(FolderModel folder, List<InfoContactModel> listContacts, boolean isNewFolder)
|
||||
throws Exception;
|
||||
boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts,
|
||||
boolean isNewFolder) throws Exception;
|
||||
|
||||
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public interface GWTWorkspaceServiceAsync {
|
|||
void getTimeSeriesById(String identifier,
|
||||
AsyncCallback<GWTWorkspaceItem> callback);
|
||||
|
||||
void shareFolder(FolderModel folder, List<InfoContactModel> listContacts,
|
||||
void shareFolder(FileModel folder, List<InfoContactModel> listContacts,
|
||||
boolean isNewFolder, AsyncCallback<Boolean> callback);
|
||||
|
||||
void getListUserSharedByFolderSharedId(String itemId,
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.workspace.client.view.sharing;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiDragContact;
|
||||
|
@ -37,7 +37,7 @@ public class DialogShareFolder extends Dialog {
|
|||
private int heightTextArea = 100;
|
||||
private TextField<String> txtName;
|
||||
private TextArea textAreaDescription = new TextArea();
|
||||
private FolderModel folder = null;
|
||||
private FileModel parentFolder = null;
|
||||
private UserStore userStore = new UserStore();
|
||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||
|
@ -47,9 +47,9 @@ public class DialogShareFolder extends Dialog {
|
|||
* @param folder
|
||||
* @param type
|
||||
*/
|
||||
public DialogShareFolder(String folderParentName, FolderModel folder, HandlerManager eventBus) {
|
||||
public DialogShareFolder(String folderParentName, FileModel folder, HandlerManager eventBus) {
|
||||
initLayout(folderParentName);
|
||||
this.folder = folder;
|
||||
this.parentFolder = folder;
|
||||
this.setIcon(Resources.getIconShareFolder());
|
||||
|
||||
setWidth(widthDialog);
|
||||
|
@ -119,8 +119,8 @@ public class DialogShareFolder extends Dialog {
|
|||
this.show();
|
||||
}
|
||||
|
||||
public FolderModel getFolder() {
|
||||
return folder;
|
||||
public FileModel getParentFolder() {
|
||||
return parentFolder;
|
||||
}
|
||||
|
||||
public void initLayout(String folderParentName){
|
||||
|
|
|
@ -148,12 +148,16 @@ public class AsyncTreePanel extends LayoutContainer {
|
|||
if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD)
|
||||
return Resources.getIconLoading2();
|
||||
|
||||
//SHARE
|
||||
if(model.isShared())
|
||||
return Resources.getIconSharedFolder();
|
||||
|
||||
//SHARE ICON
|
||||
if(model.isShared()){
|
||||
if(model.isShareable())
|
||||
return Resources.getIconSharedFolder();
|
||||
else
|
||||
return null; //Set default folder icon
|
||||
}
|
||||
|
||||
// return Resources.getIconFolder();
|
||||
return null;
|
||||
return null; //Set default folder icon
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -542,7 +546,7 @@ public class AsyncTreePanel extends LayoutContainer {
|
|||
|
||||
String folderItemType;
|
||||
if(fileModel.getGXTFolderItemType()!=null)
|
||||
folderItemType = fileModel.getGXTFolderItemTypeToString();
|
||||
folderItemType = fileModel.getGXTFolderItemType().toString();
|
||||
else
|
||||
folderItemType = null;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.extjs.gxt.ui.client.widget.menu.Menu;
|
|||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
|
||||
public class ContextMenuTree {
|
||||
|
||||
|
@ -198,7 +199,7 @@ public class ContextMenuTree {
|
|||
final FileModel sourceFileModel = listSelectedItems.get(0);
|
||||
|
||||
if (sourceFileModel != null) {
|
||||
eventBus.fireEvent( new CreateSharedFolderEvent(sourceFileModel, sourceFileModel.getParentFileModel(), true));
|
||||
eventBus.fireEvent(new CreateSharedFolderEvent(sourceFileModel, sourceFileModel.getParentFileModel(), true));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -297,6 +298,7 @@ public class ContextMenuTree {
|
|||
public void componentSelected(MenuEvent ce) {
|
||||
// List<FileModel> selected = treePanel.getSelectionModel().getSelectedItems();
|
||||
for (FileModel target : listSelectedItems) {
|
||||
|
||||
if(target.getIdentifier()!=null){
|
||||
eventBus.fireEvent(new CreateSharedFolderEvent(target, target.getParentFileModel(),false));
|
||||
}
|
||||
|
|
|
@ -954,6 +954,7 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, false);
|
||||
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||
fileModel.setShareable(true);
|
||||
break;
|
||||
|
||||
case FOLDER_ITEM:
|
||||
|
@ -967,6 +968,7 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, true);
|
||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||
fileModel.setShareable(true);
|
||||
|
||||
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
||||
// fileModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
||||
|
@ -979,8 +981,10 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
}
|
||||
|
||||
if(parentFolderModel.isShared())
|
||||
if(parentFolderModel.isShared()){
|
||||
fileModel.setShared(true);
|
||||
fileModel.setShareable(false);
|
||||
}
|
||||
|
||||
// fileModel.setOwner(new InfoContactModel(item.getOwner().getId(), item.getOwner().getPortalLogin(), "name"));
|
||||
//// fileModel.setShared(item.isShared());
|
||||
|
@ -1013,6 +1017,7 @@ public class GWTWorkspaceBuilder {
|
|||
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationDate()), parentFileModel, -1, true, false);
|
||||
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||
fileGridModel.setShareable(true);
|
||||
break;
|
||||
|
||||
case FOLDER_ITEM:
|
||||
|
@ -1027,7 +1032,7 @@ public class GWTWorkspaceBuilder {
|
|||
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationDate()), parentFileModel, -1, true, false);
|
||||
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||
|
||||
fileGridModel.setShareable(true);
|
||||
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
||||
// fileGridModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
||||
|
||||
|
@ -1084,6 +1089,7 @@ public class GWTWorkspaceBuilder {
|
|||
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, -1, true, false);
|
||||
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||
fileGridModel.setShareable(true);
|
||||
break;
|
||||
|
||||
case FOLDER_ITEM:
|
||||
|
@ -1098,6 +1104,7 @@ public class GWTWorkspaceBuilder {
|
|||
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, -1, true, true);
|
||||
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||
fileGridModel.setShareable(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1106,8 +1113,10 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
}
|
||||
|
||||
if(parentFileModel.isShared())
|
||||
if(parentFileModel.isShared()){
|
||||
fileGridModel.setShared(true);
|
||||
fileGridModel.setShareable(false);
|
||||
}
|
||||
|
||||
// fileGridModel.setOwner(new InfoContactModel(item.getOwner().getId(), item.getOwner().getPortalLogin(), "name"));
|
||||
//// fileGridModel.setShared(item.isShared());
|
||||
|
|
|
@ -1277,42 +1277,50 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shareFolder(FolderModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception {
|
||||
public boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
System.out.println("quiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
workspaceLogger.trace("shareFolder "+ folder.getIdentifier()
|
||||
+ " name: "+ folder.getName()
|
||||
+ " parent name: " + folder.getParentFileModel().getName()
|
||||
+ " listContacts size: " + listContacts.size());
|
||||
|
||||
// workspaceLogger.trace("shareFolder "+ folder.getIdentifier()
|
||||
// + " name: "+ folder.getName()
|
||||
// + " parent name: " + folder.getParentFileModel().getName()
|
||||
// + " listContacts size: " + listContacts.size());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("shareFolder "+ folder.getIdentifier() + " name: "+ folder.getName() + " parent name: " + folder.getParentFileModel().getName() + " listContacts size: " + listContacts.size());
|
||||
for (InfoContactModel infoContactModel : listContacts) {
|
||||
System.out.println("share with "+ infoContactModel.getLogin());
|
||||
}
|
||||
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
|
||||
List<String> listLogin = builder.getListLoginByInfoContactModel(listContacts);
|
||||
// //DEBUG
|
||||
// System.out.println("shareFolder "+ folder.getIdentifier()
|
||||
// + " name: "+ folder.getName()
|
||||
// + " parent name: " + folder.getParentFileModel().getName()
|
||||
// + " listContacts size: " + listContacts.size());
|
||||
//
|
||||
// for (InfoContactModel infoContactModel : listContacts) {
|
||||
// System.out.println("share with "+ infoContactModel.getLogin());
|
||||
// }
|
||||
|
||||
// GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
//
|
||||
// List<String> listLogin = builder.getListLoginByInfoContactModel(listContacts);
|
||||
//
|
||||
WorkspaceSharedFolder sharedFolder = null;
|
||||
|
||||
// if(listLogin.size()>0)
|
||||
|
||||
//
|
||||
// if(listLogin.size()>0){
|
||||
//
|
||||
// if(!isNewFolder)
|
||||
//TODO: sharedFolder = workspace.shareFolder(listLogin, folder.getIdentifier());
|
||||
// sharedFolder = workspace.shareFolder(listLogin, folder.getIdentifier());
|
||||
// else
|
||||
// sharedFolder = workspace.createSharedFolder(folder.getName(), "description", listLogin, folder.getParentFileModel().getIdentifier());
|
||||
|
||||
// boolean created = sharedFolder==null?false:true;
|
||||
// }
|
||||
|
||||
boolean created = sharedFolder==null?false:true;
|
||||
//
|
||||
// return created;
|
||||
return true;
|
||||
return created;
|
||||
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in shareFolder ", e);
|
||||
e.printStackTrace();
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Util {
|
|||
// public static final String TEST_SCOPE = "/gcube/devsec";
|
||||
// public static final String TEST_USER = "pasquale.pagano";
|
||||
|
||||
public static final String TEST_SCOPE = "/gcube/devsec";
|
||||
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
||||
// public static final String TEST_USER = "federico.defaveri";
|
||||
// public static final String TEST_USER = "massimiliano.assante";
|
||||
public static final String TEST_USER = "francesco.mangiacrapa";
|
||||
|
|
Loading…
Reference in New Issue