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 FileModel fileModel;
|
||||||
|
|
||||||
|
private boolean readGroupsFromHL;
|
||||||
|
|
||||||
|
private boolean readGroupsFromPortal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param file - a fake file to display the field name ("filename") into dialog
|
* @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) {
|
public WorkspaceSmartSharingController(FileModel file, List<CredentialModel> listAlreadySharedContact) {
|
||||||
this.listAlreadySharedContact = listAlreadySharedContact;
|
this.listAlreadySharedContact = listAlreadySharedContact;
|
||||||
|
@ -47,6 +53,24 @@ public class WorkspaceSmartSharingController {
|
||||||
addListenersSharingDialog();
|
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
|
* Example of listeners
|
||||||
|
@ -101,4 +125,12 @@ public class WorkspaceSmartSharingController {
|
||||||
return smartShare;
|
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")
|
@RemoteServiceRelativePath("workspacesharing")
|
||||||
public interface WorkspaceSharingService extends RemoteService {
|
public interface WorkspaceSharingService extends RemoteService {
|
||||||
|
|
||||||
/**
|
List<InfoContactModel> getAllContacts(boolean readGroupsFromHL,
|
||||||
* @return
|
boolean readGroupsFromPortal) throws Exception;
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
List<InfoContactModel> getAllContacts() throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param folderSharedId
|
* @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,
|
void getListUserSharedByFolderSharedId(String folderSharedId,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
public interface ContactFetcher {
|
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 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);
|
public void getOwner(String sharedFolderId, AsyncCallback<InfoContactModel> callback);
|
||||||
|
@ -18,7 +18,7 @@ public interface ContactFetcher {
|
||||||
* @param listAlreadySharedContact
|
* @param listAlreadySharedContact
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
void getInfoContactModelsFromCredential(
|
public void getInfoContactModelsFromCredential(
|
||||||
List<CredentialModel> listAlreadySharedContact,
|
List<CredentialModel> listAlreadySharedContact,
|
||||||
AsyncCallback<List<InfoContactModel>> callback);
|
AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
|
|
|
@ -47,17 +47,34 @@ public class DialogShareWItem extends Dialog {
|
||||||
private TextArea textAreaDescription = new TextArea();
|
private TextArea textAreaDescription = new TextArea();
|
||||||
private FileModel fileToShare = null;
|
private FileModel fileToShare = null;
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel = null;
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
private TextField<String> txtOwner;
|
private TextField<String> txtOwner;
|
||||||
private PanelTogglePermission permission;
|
private PanelTogglePermission permission;
|
||||||
private HorizontalPanel hpPermission = null;
|
private HorizontalPanel hpPermission = null;
|
||||||
private boolean showError = false;
|
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
|
||||||
public DialogShareWItem() {
|
* @param readGroupsFromPortal
|
||||||
|
*/
|
||||||
|
public DialogShareWItem(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||||
|
this.readGroupsFromHL = readGroupsFromHL;
|
||||||
|
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||||
|
suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal);
|
||||||
initLayout();
|
initLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,32 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
private TextField<String> txtName;
|
private TextField<String> txtName;
|
||||||
private FileModel fileToShare = null;
|
private FileModel fileToShare = null;
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel = null;
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
|
private boolean readGroupsFromHL;
|
||||||
|
private boolean readGroupsFromPortal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* By DEFAULT DOESN'T READ GROUPS FROM SERVER
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public SmartShare() {
|
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();
|
initLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +180,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
add(txtName);
|
add(txtName);
|
||||||
// add(txtOwner);
|
// add(txtOwner);
|
||||||
add(lc);
|
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>() {
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
|
|
@ -25,25 +25,16 @@ public class UserStore implements ContactFetcher{
|
||||||
public UserStore() {
|
public UserStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList){
|
|
||||||
|
|
||||||
if(reloadList || listAllContact==null)
|
|
||||||
loadAllUsersFromServer(callback);
|
|
||||||
else
|
|
||||||
callback.onSuccess(listAllContact);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
||||||
loadSharedUserBySharedFolderId(sharedFolderId, 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>();
|
listAllContact = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContacts(readGroupsFromHL, readGroupsFromPortal, new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
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 SuggestBox box;
|
||||||
private ContactFetcher userFetch;
|
private ContactFetcher userFetch;
|
||||||
private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
|
private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
|
||||||
|
private boolean readGroupsFromHL;
|
||||||
|
private boolean readGroupsFromPortal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param userFetch the ContactFetcher
|
* @param userFetch the ContactFetcher
|
||||||
*/
|
*/
|
||||||
public MultiValuePanel(ContactFetcher userFetch) {
|
public MultiValuePanel(ContactFetcher userFetch, boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||||
this.userFetch = userFetch;
|
this.userFetch = userFetch;
|
||||||
|
this.readGroupsFromHL = readGroupsFromHL;
|
||||||
|
this.readGroupsFromPortal = readGroupsFromPortal;
|
||||||
initWidget(panel);
|
initWidget(panel);
|
||||||
panel.setWidth("100%");
|
panel.setWidth("100%");
|
||||||
listBullet.setStyleName("multivalue-panel-suggest");
|
listBullet.setStyleName("multivalue-panel-suggest");
|
||||||
|
@ -169,7 +173,7 @@ public class MultiValuePanel extends Composite {
|
||||||
*/
|
*/
|
||||||
private MultiWordSuggestOracle getSuggestions() {
|
private MultiWordSuggestOracle getSuggestions() {
|
||||||
|
|
||||||
userFetch.getListContact(contacts, false);
|
userFetch.getListContact(contacts, false,readGroupsFromHL,readGroupsFromPortal);
|
||||||
|
|
||||||
return oracle;
|
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.ExternalPDFFile;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.Document;
|
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.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.server.util.UserUtil;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
|
@ -37,7 +38,8 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class GWTWorkspaceSharingBuilder {
|
public class GWTWorkspaceSharingBuilder {
|
||||||
|
|
||||||
protected Logger logger = LoggerFactory.getLogger(GWTWorkspaceSharingBuilder.class);
|
protected Logger logger = LoggerFactory
|
||||||
|
.getLogger(GWTWorkspaceSharingBuilder.class);
|
||||||
|
|
||||||
private InfoContactModel userLogged;
|
private InfoContactModel userLogged;
|
||||||
|
|
||||||
|
@ -53,47 +55,41 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
if (hashTestUser == null) {
|
if (hashTestUser == null) {
|
||||||
hashTestUser = new HashMap<String, InfoContactModel>();
|
hashTestUser = new HashMap<String, InfoContactModel>();
|
||||||
|
|
||||||
hashTestUser.put("federico.defaveri",
|
hashTestUser.put("federico.defaveri", new InfoContactModel(
|
||||||
new InfoContactModel(
|
|
||||||
"federico.defaveri", "federico.defaveri",
|
"federico.defaveri", "federico.defaveri",
|
||||||
"Federico de Faveri", false));
|
"Federico de Faveri", false));
|
||||||
|
|
||||||
hashTestUser.put("antonio.gioia",
|
hashTestUser.put("antonio.gioia", new InfoContactModel(
|
||||||
new InfoContactModel(
|
|
||||||
"antonio.gioia", "antonio.gioia", "Antonio Gioia", false));
|
"antonio.gioia", "antonio.gioia", "Antonio Gioia", false));
|
||||||
|
|
||||||
hashTestUser.put("fabio.sinibaldi",
|
hashTestUser.put("fabio.sinibaldi", new InfoContactModel(
|
||||||
new InfoContactModel(
|
"fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",
|
||||||
"fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",false));
|
false));
|
||||||
|
|
||||||
hashTestUser.put("pasquale.pagano",
|
hashTestUser.put("pasquale.pagano", new InfoContactModel(
|
||||||
new InfoContactModel(
|
"pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",
|
||||||
"pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",false));
|
false));
|
||||||
|
|
||||||
hashTestUser.put("francesco.mangiacrapa",
|
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel(
|
||||||
new InfoContactModel(
|
|
||||||
"francesco.mangiacrapa", "francesco.mangiacrapa",
|
"francesco.mangiacrapa", "francesco.mangiacrapa",
|
||||||
"Francesco Mangiacrapa",false));
|
"Francesco Mangiacrapa", false));
|
||||||
|
|
||||||
hashTestUser.put("massimiliano.assante",
|
hashTestUser.put("massimiliano.assante", new InfoContactModel(
|
||||||
new InfoContactModel(
|
|
||||||
"massimiliano.assante", "massimiliano.assante",
|
"massimiliano.assante", "massimiliano.assante",
|
||||||
"Massimiliano Assante",false));
|
"Massimiliano Assante", false));
|
||||||
|
|
||||||
hashTestUser.put("leonardo.candela",
|
hashTestUser.put("leonardo.candela", new InfoContactModel(
|
||||||
new InfoContactModel(
|
"leonardo.candela", "leonardo.candela", "Leonardo Candela",
|
||||||
"leonardo.candela", "leonardo.candela",
|
false));
|
||||||
"Leonardo Candela",false));
|
|
||||||
|
|
||||||
hashTestUser.put("valentina.marioli",
|
hashTestUser.put("valentina.marioli", new InfoContactModel(
|
||||||
new InfoContactModel(
|
|
||||||
"valentina.marioli", "valentina.marioli",
|
"valentina.marioli", "valentina.marioli",
|
||||||
"Valentina Marioli",false));
|
"Valentina Marioli", false));
|
||||||
|
|
||||||
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
||||||
// new InfoContactModel(
|
// new InfoContactModel(
|
||||||
// WsUtil.TEST_USER, WsUtil.TEST_USER,
|
// WsUtil.TEST_USER, WsUtil.TEST_USER,
|
||||||
// WsUtil.TEST_USER_FULL_NAME));
|
// WsUtil.TEST_USER_FULL_NAME));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,33 +105,81 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param listUsers
|
* @param list
|
||||||
* @return
|
* @return
|
||||||
* @throws InternalErrorException
|
* @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>();
|
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
if (listUsers == null)
|
if (listUsers == null)
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
|
|
||||||
logger.info("List<UserModel> size returned from Portal VO is: "
|
logger.trace("List<UserModel> size returned from Portal VO is: "
|
||||||
+ listUsers.size());
|
+ listUsers.size());
|
||||||
|
|
||||||
logger.info("Building list contact model list user model");
|
logger.trace("Building list contact model list user model");
|
||||||
for (UserModel userModel : listUsers) {
|
for (UserModel userModel : listUsers) {
|
||||||
String fullName = userModel.getFullname();
|
String fullName = userModel.getFullname();
|
||||||
|
|
||||||
//TODO ISGROUP?
|
|
||||||
if (fullName != null && !fullName.isEmpty())
|
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
|
else
|
||||||
logger.info("buildGXTListContactsModel doesn't return user: "
|
logger.trace("buildGXTListContactsModel is not returning user: "
|
||||||
+ userModel.getScreenName()
|
+ userModel.getScreenName()
|
||||||
+ "because name is null or empty");
|
+ "because name is null or empty");
|
||||||
}
|
}
|
||||||
logger.info("List contact model completed, return "
|
logger.trace("List contact model completed, return "
|
||||||
+ listContactsModel.size() + " contacts");
|
+ listContactsModel.size() + " contacts");
|
||||||
|
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
|
@ -146,7 +190,8 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
* @param listPortalLogin
|
* @param listPortalLogin
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<InfoContactModel> buildGxtInfoContactsFromPortalLogins(List<String> listPortalLogin) {
|
public List<InfoContactModel> buildGxtInfoContactsFromPortalLogins(
|
||||||
|
List<String> listPortalLogin) {
|
||||||
|
|
||||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||||
for (String portalLogin : listPortalLogin)
|
for (String portalLogin : listPortalLogin)
|
||||||
|
@ -168,8 +213,9 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
portalLogin = "";
|
portalLogin = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO ISGROUP
|
// TODO ISGROUP
|
||||||
return new InfoContactModel(portalLogin, portalLogin,UserUtil.getUserFullName(portalLogin), false);
|
return new InfoContactModel(portalLogin, portalLogin,
|
||||||
|
UserUtil.getUserFullName(portalLogin), false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,9 +245,10 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
public InfoContactModel buildGXTInfoContactModel(User user)
|
public InfoContactModel buildGXTInfoContactModel(User user)
|
||||||
throws InternalErrorException {
|
throws InternalErrorException {
|
||||||
|
|
||||||
//TODO ISGROUP
|
// TODO ISGROUP
|
||||||
if (user != null)
|
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();
|
return new InfoContactModel();
|
||||||
}
|
}
|
||||||
|
@ -250,26 +297,30 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
return acls;
|
return acls;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FileModel buildGXTFileModelItem(WorkspaceItem item, FileModel parentFolderModel) throws Exception {
|
protected FileModel buildGXTFileModelItem(WorkspaceItem item,
|
||||||
|
FileModel parentFolderModel) throws Exception {
|
||||||
FileModel fileModel = null;
|
FileModel fileModel = null;
|
||||||
|
|
||||||
FileModel parent = parentFolderModel != null ? (FileModel) parentFolderModel: null;
|
FileModel parent = parentFolderModel != null ? (FileModel) parentFolderModel
|
||||||
|
: null;
|
||||||
|
|
||||||
logger.info("Workspace item converting...");
|
logger.info("Workspace item converting...");
|
||||||
|
|
||||||
try{
|
try {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
|
|
||||||
case FOLDER:
|
case FOLDER:
|
||||||
logger.info("Workspace item is 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.setType(GXTFolderItemTypeEnum.FOLDER.toString());
|
||||||
fileModel.setDescription(item.getDescription());
|
fileModel.setDescription(item.getDescription());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FOLDER_ITEM:
|
case FOLDER_ITEM:
|
||||||
logger.info("Workspace item is 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;
|
FolderItem folderItem = (FolderItem) item;
|
||||||
fileModel = setFolderItemType(fileModel, folderItem);
|
fileModel = setFolderItemType(fileModel, folderItem);
|
||||||
break;
|
break;
|
||||||
|
@ -277,20 +328,24 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
case SHARED_FOLDER:
|
case SHARED_FOLDER:
|
||||||
logger.info("Workspace item is shared item...");
|
logger.info("Workspace item is shared item...");
|
||||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
|
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
|
||||||
String name = shared.isVreFolder() ? shared.getDisplayName() : item.getName();
|
String name = shared.isVreFolder() ? shared.getDisplayName()
|
||||||
fileModel = new FolderModel(item.getId(), name, parent, true, true, shared.isVreFolder());
|
: item.getName();
|
||||||
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
|
fileModel = new FolderModel(item.getId(), name, parent, true,
|
||||||
|
true, shared.isVreFolder());
|
||||||
|
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER
|
||||||
|
.toString());
|
||||||
fileModel.setDescription(item.getDescription());
|
fileModel.setDescription(item.getDescription());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.error("gxt conversion return null for item "+ item.getName());
|
logger.error("gxt conversion return null for item "
|
||||||
|
+ item.getName());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("gxt conversion error: ",e);
|
logger.error("gxt conversion error: ", e);
|
||||||
throw new Exception("Error on conversion: ",e);
|
throw new Exception("Error on conversion: ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileModel;
|
return fileModel;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
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.HomeNotFoundException;
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
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.ItemAlreadyExistException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
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.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.ConstantsSharing;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
|
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
|
||||||
|
@ -73,7 +75,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InfoContactModel> getAllContacts() throws Exception {
|
public List<InfoContactModel> getAllContacts(boolean readGroupsFromHL, boolean readGroupsFromPortal) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); //THIS FORCE THE SESSION CREATION
|
WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); //THIS FORCE THE SESSION CREATION
|
||||||
|
@ -105,8 +107,28 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
UserManager userManag = new LiferayUserManager();
|
UserManager userManag = new LiferayUserManager();
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
String groupId = gm.getRootVO().getGroupId();
|
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) {
|
} catch (Exception e) {
|
||||||
logger.error("Error in server get all contacts ", e);
|
logger.error("Error in server get all contacts ", e);
|
||||||
|
|
Loading…
Reference in New Issue