enhancements on groups integration
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@97622 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6c0c417e7f
commit
e37736b893
|
@ -32,11 +32,17 @@ public class WorkspaceSmartSharingController {
|
|||
|
||||
private FileModel fileModel;
|
||||
|
||||
private boolean readGroupsFromHL;
|
||||
|
||||
private boolean readGroupsFromPortal;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param file - a fake file to display the field name ("filename") into dialog
|
||||
* @param listAlreadySharedContact
|
||||
* @param listAlreadySharedContact - list of already shared contacts to show into dialog
|
||||
*
|
||||
*
|
||||
*/
|
||||
public WorkspaceSmartSharingController(FileModel file, List<CredentialModel> listAlreadySharedContact) {
|
||||
this.listAlreadySharedContact = listAlreadySharedContact;
|
||||
|
@ -47,6 +53,24 @@ public class WorkspaceSmartSharingController {
|
|||
addListenersSharingDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param file - a fake file to display the field name ("filename") into dialog
|
||||
* @param listAlreadySharedContact - list of already shared contacts to show into dialog
|
||||
* @param readGroupsFromHL - if true read group names from HL
|
||||
* @param readGroupsFromPortal - if true read group names from Portal (as VRE)
|
||||
*/
|
||||
public WorkspaceSmartSharingController(FileModel file, List<CredentialModel> listAlreadySharedContact, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||
this.listAlreadySharedContact = listAlreadySharedContact;
|
||||
this.fileModel = file;
|
||||
this.smartShare = new SmartShare();
|
||||
this.smartShare.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG-170);
|
||||
this.readGroupsFromHL = readGroupsFromHL;
|
||||
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||
updateSharingDialog();
|
||||
addListenersSharingDialog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Example of listeners
|
||||
|
@ -101,4 +125,12 @@ public class WorkspaceSmartSharingController {
|
|||
return smartShare;
|
||||
}
|
||||
|
||||
public boolean isReadGroupsFromHL() {
|
||||
return readGroupsFromHL;
|
||||
}
|
||||
|
||||
public boolean isReadGroupsFromPortal() {
|
||||
return readGroupsFromPortal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,8 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
@RemoteServiceRelativePath("workspacesharing")
|
||||
public interface WorkspaceSharingService extends RemoteService {
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<InfoContactModel> getAllContacts() throws Exception;
|
||||
List<InfoContactModel> getAllContacts(boolean readGroupsFromHL,
|
||||
boolean readGroupsFromPortal) throws Exception;
|
||||
|
||||
/**
|
||||
* @param folderSharedId
|
||||
|
|
|
@ -36,7 +36,7 @@ public interface WorkspaceSharingServiceAsync
|
|||
}
|
||||
|
||||
|
||||
void getAllContacts(AsyncCallback<List<InfoContactModel>> callback);
|
||||
void getAllContacts(boolean readGroupsFromHL, boolean readGroupsFromPortal, AsyncCallback<List<InfoContactModel>> callback);
|
||||
|
||||
|
||||
void getListUserSharedByFolderSharedId(String folderSharedId,
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
|
||||
public interface ContactFetcher {
|
||||
|
||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList);
|
||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList, boolean readGroupsFromHL, boolean readGroupsFromPortal);
|
||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser);
|
||||
public void getOwner(String sharedFolderId, AsyncCallback<InfoContactModel> callback);
|
||||
|
@ -18,7 +18,7 @@ public interface ContactFetcher {
|
|||
* @param listAlreadySharedContact
|
||||
* @param callback
|
||||
*/
|
||||
void getInfoContactModelsFromCredential(
|
||||
public void getInfoContactModelsFromCredential(
|
||||
List<CredentialModel> listAlreadySharedContact,
|
||||
AsyncCallback<List<InfoContactModel>> callback);
|
||||
|
||||
|
|
|
@ -47,17 +47,34 @@ public class DialogShareWItem extends Dialog {
|
|||
private TextArea textAreaDescription = new TextArea();
|
||||
private FileModel fileToShare = null;
|
||||
private UserStore userStore = new UserStore();
|
||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||
private MultiValuePanel suggestPanel = null;
|
||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||
private TextField<String> txtOwner;
|
||||
private PanelTogglePermission permission;
|
||||
private HorizontalPanel hpPermission = null;
|
||||
private boolean showError = false;
|
||||
private boolean readGroupsFromHL;
|
||||
private boolean readGroupsFromPortal;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* By DEFAULT DOESN'T READ GROUPS FROM SERVER
|
||||
*/
|
||||
public DialogShareWItem() {
|
||||
this.readGroupsFromHL = false;
|
||||
this.readGroupsFromPortal = false;
|
||||
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
|
||||
initLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param readGroupsFromHL
|
||||
* @param readGroupsFromPortal
|
||||
*/
|
||||
public DialogShareWItem(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||
this.readGroupsFromHL = readGroupsFromHL;
|
||||
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
|
||||
initLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,13 +41,32 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
|||
private TextField<String> txtName;
|
||||
private FileModel fileToShare = null;
|
||||
private UserStore userStore = new UserStore();
|
||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||
private MultiValuePanel suggestPanel = null;
|
||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||
private boolean readGroupsFromHL;
|
||||
private boolean readGroupsFromPortal;
|
||||
|
||||
/**
|
||||
* By DEFAULT DOESN'T READ GROUPS FROM SERVER
|
||||
*
|
||||
*/
|
||||
public SmartShare() {
|
||||
this.readGroupsFromHL = false;
|
||||
this.readGroupsFromPortal = false;
|
||||
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
|
||||
initLayout();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param readGroupsFromHL
|
||||
* @param readGroupsFromPortal
|
||||
*/
|
||||
public SmartShare(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||
this.readGroupsFromHL = readGroupsFromHL;
|
||||
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
|
||||
initLayout();
|
||||
}
|
||||
|
||||
|
@ -161,7 +180,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
|||
add(txtName);
|
||||
// add(txtOwner);
|
||||
add(lc);
|
||||
addListners();
|
||||
addListeners();
|
||||
|
||||
}
|
||||
|
||||
|
@ -243,7 +262,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
|||
}
|
||||
|
||||
|
||||
public void addListners(){
|
||||
public void addListeners(){
|
||||
|
||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
|
|
|
@ -25,25 +25,16 @@ public class UserStore implements ContactFetcher{
|
|||
public UserStore() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList){
|
||||
|
||||
if(reloadList || listAllContact==null)
|
||||
loadAllUsersFromServer(callback);
|
||||
else
|
||||
callback.onSuccess(listAllContact);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
||||
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
||||
}
|
||||
|
||||
private void loadAllUsersFromServer(final AsyncCallback<List<InfoContactModel>> callback){
|
||||
private void loadAllUsersFromServer(final AsyncCallback<List<InfoContactModel>> callback, boolean readGroupsFromHL, boolean readGroupsFromPortal){
|
||||
|
||||
listAllContact = new ArrayList<InfoContactModel>();
|
||||
|
||||
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
||||
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContacts(readGroupsFromHL, readGroupsFromPortal, new AsyncCallback<List<InfoContactModel>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<InfoContactModel> result) {
|
||||
|
@ -130,4 +121,17 @@ public class UserStore implements ContactFetcher{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher#getListContact(com.google.gwt.user.client.rpc.AsyncCallback, boolean, boolean, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback,boolean reloadList, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||
|
||||
if(reloadList || listAllContact==null)
|
||||
loadAllUsersFromServer(callback,readGroupsFromHL,readGroupsFromPortal);
|
||||
else
|
||||
callback.onSuccess(listAllContact);
|
||||
|
||||
}
|
||||
}
|
|
@ -41,13 +41,17 @@ public class MultiValuePanel extends Composite {
|
|||
private SuggestBox box;
|
||||
private ContactFetcher userFetch;
|
||||
private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
|
||||
private boolean readGroupsFromHL;
|
||||
private boolean readGroupsFromPortal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userFetch the ContactFetcher
|
||||
*/
|
||||
public MultiValuePanel(ContactFetcher userFetch) {
|
||||
public MultiValuePanel(ContactFetcher userFetch, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||
this.userFetch = userFetch;
|
||||
this.readGroupsFromHL = readGroupsFromHL;
|
||||
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||
initWidget(panel);
|
||||
panel.setWidth("100%");
|
||||
listBullet.setStyleName("multivalue-panel-suggest");
|
||||
|
@ -169,7 +173,7 @@ public class MultiValuePanel extends Composite {
|
|||
*/
|
||||
private MultiWordSuggestOracle getSuggestions() {
|
||||
|
||||
userFetch.getListContact(contacts, false);
|
||||
userFetch.getListContact(contacts, false,readGroupsFromHL,readGroupsFromPortal);
|
||||
|
||||
return oracle;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage;
|
|||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalPDFFile;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.Document;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.ImageDocument;
|
||||
import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.UserUtil;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||
|
@ -37,7 +38,8 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
public class GWTWorkspaceSharingBuilder {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(GWTWorkspaceSharingBuilder.class);
|
||||
protected Logger logger = LoggerFactory
|
||||
.getLogger(GWTWorkspaceSharingBuilder.class);
|
||||
|
||||
private InfoContactModel userLogged;
|
||||
|
||||
|
@ -52,48 +54,42 @@ public class GWTWorkspaceSharingBuilder {
|
|||
|
||||
if (hashTestUser == null) {
|
||||
hashTestUser = new HashMap<String, InfoContactModel>();
|
||||
|
||||
hashTestUser.put("federico.defaveri",
|
||||
new InfoContactModel(
|
||||
|
||||
hashTestUser.put("federico.defaveri", new InfoContactModel(
|
||||
"federico.defaveri", "federico.defaveri",
|
||||
"Federico de Faveri", false));
|
||||
|
||||
hashTestUser.put("antonio.gioia",
|
||||
new InfoContactModel(
|
||||
|
||||
hashTestUser.put("antonio.gioia", new InfoContactModel(
|
||||
"antonio.gioia", "antonio.gioia", "Antonio Gioia", false));
|
||||
|
||||
hashTestUser.put("fabio.sinibaldi",
|
||||
new InfoContactModel(
|
||||
"fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",false));
|
||||
|
||||
hashTestUser.put("pasquale.pagano",
|
||||
new InfoContactModel(
|
||||
"pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",false));
|
||||
|
||||
hashTestUser.put("francesco.mangiacrapa",
|
||||
new InfoContactModel(
|
||||
|
||||
hashTestUser.put("fabio.sinibaldi", new InfoContactModel(
|
||||
"fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",
|
||||
false));
|
||||
|
||||
hashTestUser.put("pasquale.pagano", new InfoContactModel(
|
||||
"pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",
|
||||
false));
|
||||
|
||||
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel(
|
||||
"francesco.mangiacrapa", "francesco.mangiacrapa",
|
||||
"Francesco Mangiacrapa",false));
|
||||
|
||||
hashTestUser.put("massimiliano.assante",
|
||||
new InfoContactModel(
|
||||
"Francesco Mangiacrapa", false));
|
||||
|
||||
hashTestUser.put("massimiliano.assante", new InfoContactModel(
|
||||
"massimiliano.assante", "massimiliano.assante",
|
||||
"Massimiliano Assante",false));
|
||||
|
||||
hashTestUser.put("leonardo.candela",
|
||||
new InfoContactModel(
|
||||
"leonardo.candela", "leonardo.candela",
|
||||
"Leonardo Candela",false));
|
||||
|
||||
hashTestUser.put("valentina.marioli",
|
||||
new InfoContactModel(
|
||||
"Massimiliano Assante", false));
|
||||
|
||||
hashTestUser.put("leonardo.candela", new InfoContactModel(
|
||||
"leonardo.candela", "leonardo.candela", "Leonardo Candela",
|
||||
false));
|
||||
|
||||
hashTestUser.put("valentina.marioli", new InfoContactModel(
|
||||
"valentina.marioli", "valentina.marioli",
|
||||
"Valentina Marioli",false));
|
||||
|
||||
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
||||
// new InfoContactModel(
|
||||
// WsUtil.TEST_USER, WsUtil.TEST_USER,
|
||||
// WsUtil.TEST_USER_FULL_NAME));
|
||||
"Valentina Marioli", false));
|
||||
|
||||
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
||||
// new InfoContactModel(
|
||||
// WsUtil.TEST_USER, WsUtil.TEST_USER,
|
||||
// WsUtil.TEST_USER_FULL_NAME));
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,33 +105,81 @@ public class GWTWorkspaceSharingBuilder {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param listUsers
|
||||
* @param list
|
||||
* @return
|
||||
* @throws InternalErrorException
|
||||
*/
|
||||
public List<InfoContactModel> buildGXTListContactsModel(List<UserModel> listUsers) throws InternalErrorException {
|
||||
public List<InfoContactModel> buildGXTListContactsModelFromGcubeGroup(
|
||||
List<GCubeGroup> list) throws InternalErrorException {
|
||||
|
||||
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||
|
||||
if (list == null)
|
||||
return listContactsModel;
|
||||
|
||||
logger.trace("List<GCubeGroup> size returned from GcubeGroup is: "+ list.size());
|
||||
|
||||
logger.trace("Building list contact model...");
|
||||
|
||||
for (GCubeGroup group : list) {
|
||||
try {
|
||||
String groupDN = group.getDisplayName();
|
||||
|
||||
if (groupDN == null || groupDN.isEmpty())
|
||||
groupDN = group.getName();
|
||||
|
||||
if (group.getName() == null || group.getName().isEmpty())
|
||||
logger.warn("Skipping group with null or empty name "+ group);
|
||||
else {
|
||||
InfoContactModel contact = new InfoContactModel(
|
||||
group.getName(), group.getName(), groupDN, true);
|
||||
logger.trace("Adding group " + contact);
|
||||
listContactsModel.add(contact);
|
||||
}
|
||||
} catch (InternalErrorException e) {
|
||||
logger.warn("Dispaly name is not available to group " + group);
|
||||
logger.warn("Adding get name property " + group.getName());
|
||||
|
||||
if (group.getName() == null || group.getName().isEmpty())
|
||||
logger.warn("Skipping group with null or empty name "
|
||||
+ group);
|
||||
else
|
||||
listContactsModel.add(new InfoContactModel(group.getName(),
|
||||
group.getName(), group.getName(), true));
|
||||
}
|
||||
}
|
||||
|
||||
logger.trace("List GCubeGroup contact model completed, return "
|
||||
+ listContactsModel.size() + " contacts");
|
||||
|
||||
return listContactsModel;
|
||||
}
|
||||
|
||||
public List<InfoContactModel> buildGXTListContactsModelFromUserModel(
|
||||
List<UserModel> listUsers) throws InternalErrorException {
|
||||
|
||||
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||
|
||||
if (listUsers == null)
|
||||
return listContactsModel;
|
||||
|
||||
logger.info("List<UserModel> size returned from Portal VO is: "
|
||||
logger.trace("List<UserModel> size returned from Portal VO is: "
|
||||
+ listUsers.size());
|
||||
|
||||
logger.info("Building list contact model list user model");
|
||||
logger.trace("Building list contact model list user model");
|
||||
for (UserModel userModel : listUsers) {
|
||||
String fullName = userModel.getFullname();
|
||||
|
||||
//TODO ISGROUP?
|
||||
if (fullName != null && !fullName.isEmpty())
|
||||
listContactsModel.add(new InfoContactModel(userModel.getUserId() + "",userModel.getScreenName(), fullName,false));
|
||||
listContactsModel.add(new InfoContactModel(userModel
|
||||
.getUserId() + "", userModel.getScreenName(), fullName,
|
||||
false));
|
||||
else
|
||||
logger.info("buildGXTListContactsModel doesn't return user: "
|
||||
logger.trace("buildGXTListContactsModel is not returning user: "
|
||||
+ userModel.getScreenName()
|
||||
+ "because name is null or empty");
|
||||
}
|
||||
logger.info("List contact model completed, return "
|
||||
logger.trace("List contact model completed, return "
|
||||
+ listContactsModel.size() + " contacts");
|
||||
|
||||
return listContactsModel;
|
||||
|
@ -146,7 +190,8 @@ public class GWTWorkspaceSharingBuilder {
|
|||
* @param listPortalLogin
|
||||
* @return
|
||||
*/
|
||||
public List<InfoContactModel> buildGxtInfoContactsFromPortalLogins(List<String> listPortalLogin) {
|
||||
public List<InfoContactModel> buildGxtInfoContactsFromPortalLogins(
|
||||
List<String> listPortalLogin) {
|
||||
|
||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||
for (String portalLogin : listPortalLogin)
|
||||
|
@ -168,8 +213,9 @@ public class GWTWorkspaceSharingBuilder {
|
|||
portalLogin = "";
|
||||
}
|
||||
|
||||
//TODO ISGROUP
|
||||
return new InfoContactModel(portalLogin, portalLogin,UserUtil.getUserFullName(portalLogin), false);
|
||||
// TODO ISGROUP
|
||||
return new InfoContactModel(portalLogin, portalLogin,
|
||||
UserUtil.getUserFullName(portalLogin), false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -199,9 +245,10 @@ public class GWTWorkspaceSharingBuilder {
|
|||
public InfoContactModel buildGXTInfoContactModel(User user)
|
||||
throws InternalErrorException {
|
||||
|
||||
//TODO ISGROUP
|
||||
// TODO ISGROUP
|
||||
if (user != null)
|
||||
return new InfoContactModel(user.getId(), user.getPortalLogin(), UserUtil.getUserFullName(user.getPortalLogin()),false);
|
||||
return new InfoContactModel(user.getId(), user.getPortalLogin(),
|
||||
UserUtil.getUserFullName(user.getPortalLogin()), false);
|
||||
|
||||
return new InfoContactModel();
|
||||
}
|
||||
|
@ -250,47 +297,55 @@ public class GWTWorkspaceSharingBuilder {
|
|||
return acls;
|
||||
}
|
||||
|
||||
protected FileModel buildGXTFileModelItem(WorkspaceItem item, FileModel parentFolderModel) throws Exception {
|
||||
protected FileModel buildGXTFileModelItem(WorkspaceItem item,
|
||||
FileModel parentFolderModel) throws Exception {
|
||||
FileModel fileModel = null;
|
||||
|
||||
FileModel parent = parentFolderModel != null ? (FileModel) parentFolderModel: null;
|
||||
FileModel parent = parentFolderModel != null ? (FileModel) parentFolderModel
|
||||
: null;
|
||||
|
||||
logger.info("Workspace item converting...");
|
||||
|
||||
try{
|
||||
|
||||
try {
|
||||
switch (item.getType()) {
|
||||
|
||||
|
||||
case FOLDER:
|
||||
logger.info("Workspace item is folder...");
|
||||
fileModel = new FolderModel(item.getId(), item.getName(), parent, true, false, false);
|
||||
fileModel = new FolderModel(item.getId(), item.getName(),
|
||||
parent, true, false, false);
|
||||
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||
fileModel.setDescription(item.getDescription());
|
||||
break;
|
||||
|
||||
|
||||
case FOLDER_ITEM:
|
||||
logger.info("Workspace item is folder item...");
|
||||
fileModel = new FileModel(item.getId(), item.getName(), parent, false, false);
|
||||
fileModel = new FileModel(item.getId(), item.getName(), parent,
|
||||
false, false);
|
||||
FolderItem folderItem = (FolderItem) item;
|
||||
fileModel = setFolderItemType(fileModel, folderItem);
|
||||
break;
|
||||
|
||||
|
||||
case SHARED_FOLDER:
|
||||
logger.info("Workspace item is shared item...");
|
||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
|
||||
String name = shared.isVreFolder() ? shared.getDisplayName() : item.getName();
|
||||
fileModel = new FolderModel(item.getId(), name, parent, true, true, shared.isVreFolder());
|
||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
||||
String name = shared.isVreFolder() ? shared.getDisplayName()
|
||||
: item.getName();
|
||||
fileModel = new FolderModel(item.getId(), name, parent, true,
|
||||
true, shared.isVreFolder());
|
||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER
|
||||
.toString());
|
||||
fileModel.setDescription(item.getDescription());
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
logger.error("gxt conversion return null for item "+ item.getName());
|
||||
logger.error("gxt conversion return null for item "
|
||||
+ item.getName());
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.error("gxt conversion error: ",e);
|
||||
throw new Exception("Error on conversion: ",e);
|
||||
} catch (Exception e) {
|
||||
logger.error("gxt conversion error: ", e);
|
||||
throw new Exception("Error on conversion: ", e);
|
||||
}
|
||||
|
||||
return fileModel;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
|
@ -17,6 +18,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivil
|
|||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||
import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
|
||||
|
@ -73,7 +75,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InfoContactModel> getAllContacts() throws Exception {
|
||||
public List<InfoContactModel> getAllContacts(boolean readGroupsFromHL, boolean readGroupsFromPortal) throws Exception {
|
||||
|
||||
try {
|
||||
WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); //THIS FORCE THE SESSION CREATION
|
||||
|
@ -105,8 +107,28 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
|||
UserManager userManag = new LiferayUserManager();
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
String groupId = gm.getRootVO().getGroupId();
|
||||
logger.info("user manager getting list users by group: "+groupId);
|
||||
return builder.buildGXTListContactsModel(userManag.listUsersByGroup(groupId));
|
||||
|
||||
logger.trace("Liferay User Manager getting list users by group: "+groupId);
|
||||
List<InfoContactModel> listContactsModel = builder.buildGXTListContactsModelFromUserModel(userManag.listUsersByGroup(groupId));
|
||||
|
||||
if(readGroupsFromHL){
|
||||
logger.info("Reading group names from HL..");
|
||||
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager hlUserManager = HomeLibrary.getHomeManagerFactory().getUserManager();
|
||||
logger.trace("Home Library User Manager getting list Gcube Group");
|
||||
List<GCubeGroup> groups = hlUserManager.getGroups();
|
||||
if(groups!=null){
|
||||
logger.info("Read group names from HL, return "+groups.size()+" groups, noewconverting");
|
||||
listContactsModel.addAll(builder.buildGXTListContactsModelFromGcubeGroup(groups));
|
||||
}else
|
||||
logger.warn("Read group names from HL, return list null, skipping");
|
||||
}
|
||||
|
||||
if(readGroupsFromPortal){
|
||||
|
||||
}
|
||||
|
||||
|
||||
return listContactsModel;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in server get all contacts ", e);
|
||||
|
|
Loading…
Reference in New Issue