ref 17169: Selection of users in the Sharing panel
https://support.d4science.org/issues/17169 Updated support to VREs discovery git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@181382 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
234bb80439
commit
bb814fc3ea
|
@ -59,13 +59,12 @@ import com.google.gwt.user.client.ui.FlexTable;
|
||||||
*/
|
*/
|
||||||
public class PanelMultiDragContactAdmin extends ContentPanel {
|
public class PanelMultiDragContactAdmin extends ContentPanel {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
private String workspaceItemId;
|
private String workspaceItemId;
|
||||||
|
|
||||||
private String myLogin;
|
private String myLogin;
|
||||||
private InfoContactModel myContact;
|
private InfoContactModel myContact;
|
||||||
|
private InfoContactModel owner;
|
||||||
private List<InfoContactModel> targetContact;
|
private List<InfoContactModel> targetContact;
|
||||||
private List<UserVRE> vresList;
|
private List<UserVRE> vresList;
|
||||||
private HashMap<UserVRE, List<InfoContactModel>> contactsMap;
|
private HashMap<UserVRE, List<InfoContactModel>> contactsMap;
|
||||||
|
@ -136,16 +135,38 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
GWT.log("Error retrieving my login");
|
GWT.log("Error retrieving my login");
|
||||||
myLogin = null;
|
myLogin = null;
|
||||||
retrieveListOfAdmin();
|
retrieveOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
GWT.log("My login is: " + result);
|
GWT.log("My login is: " + result);
|
||||||
myLogin = result;
|
myLogin = result;
|
||||||
|
retrieveOwner();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveOwner() {
|
||||||
|
WorkspaceSharingServiceAsync.INSTANCE.getOwnerByItemId(workspaceItemId, new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving owner");
|
||||||
|
owner = null;
|
||||||
retrieveListOfAdmin();
|
retrieveListOfAdmin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(InfoContactModel result) {
|
||||||
|
GWT.log("Owner is: " + result);
|
||||||
|
owner = result;
|
||||||
|
retrieveListOfAdmin();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,14 +190,32 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myContact != null) {
|
if (myContact != null) {
|
||||||
|
if (owner != null) {
|
||||||
|
if (InfoContactModel.COMPARATORLOGINS.compare(myContact, owner) == 0) {
|
||||||
result.remove(myContact);
|
result.remove(myContact);
|
||||||
targetContact = result;
|
targetContact = result;
|
||||||
|
} else {
|
||||||
|
result.remove(myContact);
|
||||||
|
result.remove(owner);
|
||||||
|
targetContact = result;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result.remove(myContact);
|
||||||
|
targetContact = result;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (owner != null) {
|
||||||
|
result.remove(owner);
|
||||||
|
targetContact = result;
|
||||||
} else {
|
} else {
|
||||||
targetContact = result;
|
targetContact = result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
storeTarget.removeAll();
|
storeTarget.removeAll();
|
||||||
storeTarget.add(targetContact);
|
storeTarget.add(targetContact);
|
||||||
storeTarget.commitChanges();
|
storeTarget.commitChanges();
|
||||||
|
@ -417,7 +456,6 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
|
||||||
GWT.log("PanelMultiDragContactAdmin view Created");
|
GWT.log("PanelMultiDragContactAdmin view Created");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void retrieveContactList(final UserVRE userVRE) {
|
private void retrieveContactList(final UserVRE userVRE) {
|
||||||
|
|
||||||
if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) {
|
if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) {
|
||||||
|
@ -638,7 +676,22 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
|
||||||
public List<InfoContactModel> getTargetListContactWithMyLogin() {
|
public List<InfoContactModel> getTargetListContactWithMyLogin() {
|
||||||
List<InfoContactModel> target = new ArrayList<>();
|
List<InfoContactModel> target = new ArrayList<>();
|
||||||
target.addAll(storeTarget.getModels());
|
target.addAll(storeTarget.getModels());
|
||||||
|
if (myContact != null) {
|
||||||
|
if (owner != null) {
|
||||||
|
if (InfoContactModel.COMPARATORLOGINS.compare(myContact, owner) == 0) {
|
||||||
|
target.add(owner);
|
||||||
|
} else {
|
||||||
|
target.add(owner);
|
||||||
target.add(myContact);
|
target.add(myContact);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
target.add(myContact);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (owner != null) {
|
||||||
|
target.add(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue