git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@69632 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5d6f91bbec
commit
0f1b52824c
|
@ -263,6 +263,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
//create a lowest object to send to server
|
//create a lowest object to send to server
|
||||||
fileModel = new FileModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), fileModel.isDirectory(), fileModel.isShared());
|
fileModel = new FileModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), fileModel.isDirectory(), fileModel.isShared());
|
||||||
|
fileModel.setDescription(finalDialog.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class ConstantsExplorer {
|
||||||
public static final String MARKASREAD = "MARKASREAD";
|
public static final String MARKASREAD = "MARKASREAD";
|
||||||
public static final String ISROOT = "ISROOT";
|
public static final String ISROOT = "ISROOT";
|
||||||
public static final String ISSHAREABLE = "ISSHAREABLE";
|
public static final String ISSHAREABLE = "ISSHAREABLE";
|
||||||
|
public static final String DIRECTORYDESCRIPTION = "DIRECTORYDESCRIPTION";
|
||||||
|
|
||||||
|
|
||||||
//GRID COLUMNS constants
|
//GRID COLUMNS constants
|
||||||
|
|
|
@ -26,12 +26,12 @@ public class FileDetailsModel extends FileGridModel {
|
||||||
// this.setLastModified(lastModified);
|
// this.setLastModified(lastModified);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public FileDetailsModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, String description, Date lastModified, String owner, boolean isShared) {
|
public FileDetailsModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, String description, Date lastModified, InfoContactModel owner, boolean isShared) {
|
||||||
super(identifier,name,path,creationDate,parent,size,isDirectory, isShared);
|
super(identifier,name,path,creationDate,parent,size,isDirectory, isShared);
|
||||||
|
|
||||||
setLastModified(lastModified);
|
setLastModified(lastModified);
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
setDescription(owner);
|
setOwner(owner);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +39,6 @@ public class FileDetailsModel extends FileGridModel {
|
||||||
set(ConstantsExplorer.LASTMODIFIED, lastModified);
|
set(ConstantsExplorer.LASTMODIFIED, lastModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDescription(String description){
|
|
||||||
set(ConstantsExplorer.DESCRIPTION, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Date getLastModified() {
|
private Date getLastModified() {
|
||||||
return (Date) get(ConstantsExplorer.LASTMODIFIED);
|
return (Date) get(ConstantsExplorer.LASTMODIFIED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,14 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description){
|
||||||
|
set(ConstantsExplorer.DIRECTORYDESCRIPTION, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription(){
|
||||||
|
return get(ConstantsExplorer.DIRECTORYDESCRIPTION);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShareable() {
|
public boolean isShareable() {
|
||||||
return (Boolean) get(ConstantsExplorer.ISSHAREABLE);
|
return (Boolean) get(ConstantsExplorer.ISSHAREABLE);
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,8 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public String getURLFromApplicationProfile(String oid) throws Exception;
|
public String getURLFromApplicationProfile(String oid) throws Exception;
|
||||||
|
|
||||||
|
public InfoContactModel getOwnerByItemId(String itemId) throws Exception;
|
||||||
|
|
||||||
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
||||||
|
|
||||||
// public List<GWTUser> getUsers() throws Exception;
|
// public List<GWTUser> getUsers() throws Exception;
|
||||||
|
|
|
@ -119,6 +119,9 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
|
|
||||||
void getURLFromApplicationProfile(String oid, AsyncCallback<String> callback);
|
void getURLFromApplicationProfile(String oid, AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
void getOwnerByItemId(String itemId,
|
||||||
|
AsyncCallback<InfoContactModel> callback);
|
||||||
|
|
||||||
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
||||||
|
|
||||||
// void getChildrenListsByParentsIdentifier(String itemIdentifier,AsyncCallback<ArrayList<List<FileModel>>> callback);
|
// void getChildrenListsByParentsIdentifier(String itemIdentifier,AsyncCallback<ArrayList<List<FileModel>>> callback);
|
||||||
|
|
|
@ -11,5 +11,6 @@ public interface ContactFetcher {
|
||||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList);
|
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList);
|
||||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser);
|
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser);
|
||||||
|
public void getOwner(String sharedFolderId, AsyncCallback<InfoContactModel> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.sharing;
|
package org.gcube.portlets.user.workspace.client.view.sharing;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
|
@ -41,6 +42,37 @@ public class DialogShareFolder extends Dialog {
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
|
private TextField<String> txtOwner;
|
||||||
|
|
||||||
|
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare Login
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o) {
|
||||||
|
|
||||||
|
if(o==null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
InfoContactModel contact = (InfoContactModel) o;
|
||||||
|
|
||||||
|
for (int i = 0; i < listAlreadyShared.size(); i++){
|
||||||
|
if (contact.getLogin().compareTo(listAlreadyShared.get(i).getLogin())==0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to modify a shared folder or share an existing folder
|
* Use to modify a shared folder or share an existing folder
|
||||||
|
@ -64,9 +96,18 @@ public class DialogShareFolder extends Dialog {
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
|
|
||||||
|
txtOwner = new TextField<String>();
|
||||||
|
txtOwner.setAllowBlank(true);
|
||||||
|
txtOwner.setValue("");
|
||||||
|
txtOwner.setReadOnly(true);
|
||||||
|
txtOwner.setAutoValidate(false);
|
||||||
|
txtOwner.setFieldLabel("Owner");
|
||||||
|
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
|
textAreaDescription.setValue(folder.getDescription());
|
||||||
|
textAreaDescription.setReadOnly(true);
|
||||||
|
|
||||||
final LayoutContainer lc = new LayoutContainer();
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
|
@ -89,6 +130,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
|
|
||||||
lc.mask();
|
lc.mask();
|
||||||
|
@ -98,6 +140,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : result) {
|
for (InfoContactModel infoContactModel : result) {
|
||||||
|
listAlreadyShared.add(infoContactModel);
|
||||||
suggestPanel.addRecipient(infoContactModel.getLogin(),false);
|
suggestPanel.addRecipient(infoContactModel.getLogin(),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +154,24 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(InfoContactModel result) {
|
||||||
|
txtOwner.setValue(result.getLogin());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setFocusWidget(suggestPanel.getBox());
|
setFocusWidget(suggestPanel.getBox());
|
||||||
add(txtName);
|
add(txtName);
|
||||||
|
add(txtOwner);
|
||||||
add(lc);
|
add(lc);
|
||||||
addListners();
|
addListners();
|
||||||
|
|
||||||
|
@ -224,7 +283,14 @@ public class DialogShareFolder extends Dialog {
|
||||||
final MultiDragContact multiDrag = new MultiDragContact();
|
final MultiDragContact multiDrag = new MultiDragContact();
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
multiDrag.addSourceContacts(exclusiveContacts);
|
||||||
multiDrag.addTargetContacts(suggestPanel.getSelectedUser());
|
|
||||||
|
|
||||||
|
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
||||||
|
if(!listAlreadyShared.contains(infoContactModel))
|
||||||
|
multiDrag.addTargetContact(infoContactModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// multiDrag.addTargetContacts(suggestPanel.getSelectedUser());
|
||||||
multiDrag.show();
|
multiDrag.show();
|
||||||
|
|
||||||
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
@ -232,7 +298,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
suggestPanel.resetItemSelected();
|
initSuggestContacts();
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
||||||
suggestPanel.addRecipient(infoContactModel.getLogin(),true);
|
suggestPanel.addRecipient(infoContactModel.getLogin(),true);
|
||||||
|
@ -245,6 +311,17 @@ public class DialogShareFolder extends Dialog {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initSuggestContacts(){
|
||||||
|
|
||||||
|
suggestPanel.resetItemSelected();
|
||||||
|
|
||||||
|
for (InfoContactModel contact : listAlreadyShared) {
|
||||||
|
suggestPanel.addRecipient(contact.getLogin(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return txtName.getValue();
|
return txtName.getValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,23 @@ public class UserStore implements ContactFetcher{
|
||||||
|
|
||||||
return listExclusiveContact;
|
return listExclusiveContact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getOwner(final String sharedFolderId,final AsyncCallback<InfoContactModel> callback) {
|
||||||
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(sharedFolderId, new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("an error occured in get Owner by Id "+sharedFolderId + " "+caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(InfoContactModel result) {
|
||||||
|
callback.onSuccess(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -155,6 +155,11 @@ public class MultiDragContact extends Dialog {
|
||||||
storeTarget.add(listContact);
|
storeTarget.add(listContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addTargetContact(InfoContactModel contact){
|
||||||
|
if(contact!=null)
|
||||||
|
storeTarget.add(contact);
|
||||||
|
}
|
||||||
|
|
||||||
public List<InfoContactModel> getTargetListContact(){
|
public List<InfoContactModel> getTargetListContact(){
|
||||||
return storeTarget.getModels();
|
return storeTarget.getModels();
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,14 +220,16 @@ public class MultiValuePanel extends Composite {
|
||||||
listBullet.add(item);
|
listBullet.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* insert the attachment item view in the flow panel
|
*
|
||||||
* @param fullName
|
* @param contact
|
||||||
* @param displayRemoveItem
|
* @param displayRemoveItem
|
||||||
*/
|
*/
|
||||||
public void addRecipient(String fullName, boolean displayRemoveItem) {
|
public void addRecipient(String fullName, boolean displayRemoveItem) {
|
||||||
|
|
||||||
if (fullName != null) {
|
if (fullName != null) {
|
||||||
|
|
||||||
TextBox itemBox = new TextBox();
|
TextBox itemBox = new TextBox();
|
||||||
itemBox.setText(fullName);
|
itemBox.setText(fullName);
|
||||||
itemBox.setValue(fullName);
|
itemBox.setValue(fullName);
|
||||||
|
|
|
@ -860,6 +860,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, false);
|
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, false);
|
||||||
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||||
fileModel.setShareable(true);
|
fileModel.setShareable(true);
|
||||||
|
fileModel.setDescription(item.getDescription());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FOLDER_ITEM:
|
case FOLDER_ITEM:
|
||||||
|
@ -875,6 +876,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, true);
|
fileModel = new FolderModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, true, true);
|
||||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||||
fileModel.setShareable(true);
|
fileModel.setShareable(true);
|
||||||
|
fileModel.setDescription(item.getDescription());
|
||||||
|
|
||||||
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
||||||
// fileModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
// fileModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
||||||
|
@ -939,6 +941,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||||
fileGridModel.setShareable(true);
|
fileGridModel.setShareable(true);
|
||||||
|
// fileGridModel.setDescription(item.getDescription()); // GET DESCRIPTION IN SEARCH //TODO
|
||||||
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
|
||||||
// fileGridModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
// fileGridModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
|
||||||
|
|
||||||
|
@ -996,6 +999,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||||
fileGridModel.setShareable(true);
|
fileGridModel.setShareable(true);
|
||||||
|
fileGridModel.setDescription(item.getDescription());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FOLDER_ITEM:
|
case FOLDER_ITEM:
|
||||||
|
@ -1011,6 +1015,7 @@ public class GWTWorkspaceBuilder {
|
||||||
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||||
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
|
||||||
fileGridModel.setShareable(true);
|
fileGridModel.setShareable(true);
|
||||||
|
fileGridModel.setDescription(item.getDescription());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1252,7 +1257,8 @@ public class GWTWorkspaceBuilder {
|
||||||
item.isDirectory(),
|
item.isDirectory(),
|
||||||
wsItem.getDescription(),
|
wsItem.getDescription(),
|
||||||
toDate(wsItem.getLastModificationTime()),
|
toDate(wsItem.getLastModificationTime()),
|
||||||
""+wsItem.getOwner(),wsItem.isShared());
|
buildGXTInfoContactModel(wsItem.getOwner()),
|
||||||
|
wsItem.isShared());
|
||||||
|
|
||||||
return fileDetailsModel;
|
return fileDetailsModel;
|
||||||
}
|
}
|
||||||
|
@ -1365,28 +1371,6 @@ public class GWTWorkspaceBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public SmartFolderModel buildGXTSmartFolderModel(WorkspaceFolder wsFolder, String query) throws InternalErrorException {
|
|
||||||
//
|
|
||||||
// SmartFolderModel smartFolderModel = new SmartFolderModel(
|
|
||||||
// wsFolder.getId(),
|
|
||||||
// wsFolder.getName(),
|
|
||||||
// query);
|
|
||||||
//
|
|
||||||
// logger.trace("in return SmartFolder: " + smartFolderModel.getIdentifier() + " " + smartFolderModel.getName() + " " + smartFolderModel.getQuery());
|
|
||||||
// return smartFolderModel;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public List<SmartFolderModel> buildGXTListSmartFolderModel(List<WorkspaceFolder> listWorkspaceFolder) throws InternalErrorException {
|
|
||||||
//
|
|
||||||
// List<SmartFolderModel> listSmartFolder = new ArrayList<SmartFolderModel>();
|
|
||||||
//
|
|
||||||
// for(WorkspaceFolder workspaceFolder : listWorkspaceFolder)
|
|
||||||
// listSmartFolder.add(buildGXTSmartFolderModel(workspaceFolder, ""));
|
|
||||||
//
|
|
||||||
// return listSmartFolder;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public List<SmartFolderModel> buildGXTListSmartFolderModel(List<WorkspaceSmartFolder> listWorkspaceSmartFolder) throws InternalErrorException {
|
public List<SmartFolderModel> buildGXTListSmartFolderModel(List<WorkspaceSmartFolder> listWorkspaceSmartFolder) throws InternalErrorException {
|
||||||
List<SmartFolderModel> listSmartFolder = new ArrayList<SmartFolderModel>();
|
List<SmartFolderModel> listSmartFolder = new ArrayList<SmartFolderModel>();
|
||||||
|
|
||||||
|
@ -1500,9 +1484,18 @@ public class GWTWorkspaceBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private InfoContactModel buildGXTInfoContactModel(User user) throws InternalErrorException{
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @return InfoContactModel
|
||||||
|
* @throws InternalErrorException
|
||||||
|
*/
|
||||||
|
public InfoContactModel buildGXTInfoContactModel(User user) throws InternalErrorException{
|
||||||
|
|
||||||
return new InfoContactModel(user.getId(), user.getPortalLogin(), "name");
|
if(user!=null)
|
||||||
|
return new InfoContactModel(user.getId(), user.getPortalLogin(), "name");
|
||||||
|
|
||||||
|
return new InfoContactModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -849,7 +849,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
listContactsModel.add(new InfoContactModel("Fabio.Test", "Fabio.Test", "Fabio Sinibaldi"));
|
listContactsModel.add(new InfoContactModel("Fabio.Test", "Fabio.Test", "Fabio Sinibaldi"));
|
||||||
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER));
|
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER));
|
||||||
listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
||||||
listContactsModel.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1360,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
if(!isNewFolder)
|
if(!isNewFolder)
|
||||||
sharedFolder = workspace.shareFolder(listLogin, folder.getIdentifier());
|
sharedFolder = workspace.shareFolder(listLogin, folder.getIdentifier());
|
||||||
else
|
else
|
||||||
sharedFolder = workspace.createSharedFolder(folder.getName(), "description", listLogin, folder.getParentFileModel().getIdentifier());
|
sharedFolder = workspace.createSharedFolder(folder.getName(), folder.getDescription(), listLogin, folder.getParentFileModel().getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean created = sharedFolder==null?false:true;
|
boolean created = sharedFolder==null?false:true;
|
||||||
|
@ -1524,4 +1523,24 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
return listParents;
|
return listParents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InfoContactModel getOwnerByItemId(String itemId) throws Exception {
|
||||||
|
|
||||||
|
workspaceLogger.trace("get Owner By ItemId "+ itemId);
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
|
||||||
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
|
|
||||||
|
return builder.buildGXTInfoContactModel(wsItem.getOwner());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
workspaceLogger.error("Error in getOwnerByItemId ", e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,13 +66,20 @@ public class NotificationsProducer {
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
// if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
|
||||||
|
|
||||||
gcubeLogger.trace("Send notify folder sharing for user "+infoContactModel.getId());
|
gcubeLogger.trace("Send notify folder sharing for user "+infoContactModel.getId());
|
||||||
|
|
||||||
|
|
||||||
|
//DEBUG
|
||||||
|
System.out.println("Send notify folder sharing for user "+infoContactModel.getId());
|
||||||
|
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getId(), sharedFolder);
|
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getId(), sharedFolder);
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
||||||
}
|
// }
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -104,16 +111,18 @@ public class NotificationsProducer {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getId().compareTo(userId)!=0){
|
// if(infoContactModel.getId().compareTo(userId)!=0){ //TODO remove this comment
|
||||||
|
|
||||||
gcubeLogger.trace("Send notify folder un share user "+infoContactModel.getId());
|
gcubeLogger.trace("Send notify folder un share user "+infoContactModel.getId());
|
||||||
// System.out.println("Send notify folder un share user "+infoContactModel.getId());
|
|
||||||
|
//DEBUG
|
||||||
|
System.out.println("Send notify folder un share user "+infoContactModel.getId());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getId(), sharedFolder, userId);
|
boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getId(), sharedFolder, userId);
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
gcubeLogger.error("An error occured when notify user: "+infoContactModel.getId());
|
||||||
}
|
// }
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
gcubeLogger.error("An error occured in notifyFolderSharing ", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue