diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/SimpleMultiDragWorkspaceContact.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/SimpleMultiDragWorkspaceContact.java index 49c08d0..e6511c9 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/SimpleMultiDragWorkspaceContact.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/SimpleMultiDragWorkspaceContact.java @@ -180,7 +180,7 @@ public class SimpleMultiDragWorkspaceContact { * Load all contacts */ private void loadAllContacts(boolean readGroupsFromHL, boolean readGroupsFromPortal) { - userStore.getListContact(addSourceContacts, false, readGroupsFromHL, readGroupsFromPortal); + userStore.getListContact(addSourceContacts, false); } private AsyncCallback> addSourceContacts = new AsyncCallback>() { diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingService.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingService.java index a4150e1..a6977bc 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingService.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingService.java @@ -6,6 +6,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess; import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel; +import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup; import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL; @@ -61,4 +62,8 @@ public interface WorkspaceSharingService extends RemoteService { boolean addAdministratorsByFolderId(String itemId, List listContactLogins) throws Exception; + List getVREList() throws Exception; + + List getUsersByKeyword(String keyword) throws Exception; + } diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingServiceAsync.java index a47186a..3b0e341 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingServiceAsync.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/rpc/WorkspaceSharingServiceAsync.java @@ -6,6 +6,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess; import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel; +import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup; import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL; @@ -61,4 +62,8 @@ public interface WorkspaceSharingServiceAsync { void addAdministratorsByFolderId(String itemId, List listContactLogins, AsyncCallback callback); + void getVREList(AsyncCallback> callback); + + void getUsersByKeyword(String keyword, AsyncCallback> callback); + } diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/ContactFetcher.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/ContactFetcher.java index 6160ce4..4be0c69 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/ContactFetcher.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/ContactFetcher.java @@ -9,7 +9,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback; public interface ContactFetcher { - public void getListContact(AsyncCallback> callback, boolean reloadList, boolean readGroupsFromHL, boolean readGroupsFromPortal); + public void getListContact(AsyncCallback> callback, boolean reloadList); public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback> callback); public List getExclusiveContactsFromAllContact(List listSharedUser); public void getOwner(String sharedFolderId, AsyncCallback callback); diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/DialogShareWItem.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/DialogShareWItem.java index 4b13133..65781d1 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/DialogShareWItem.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/DialogShareWItem.java @@ -5,6 +5,7 @@ import java.util.List; import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing; import org.gcube.portlets.widgets.workspacesharingwidget.client.WorkspaceSharingController; +import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.PanelTogglePermission; import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact; import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiDragContact; import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiValuePanel; @@ -65,7 +66,7 @@ public class DialogShareWItem extends Dialog { public DialogShareWItem(boolean readGroupsFromHL, boolean readGroupsFromPortal) { this.readGroupsFromHL = readGroupsFromHL; this.readGroupsFromPortal = readGroupsFromPortal; - suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal); + suggestPanel = new MultiValuePanel(userStore); initLayout(); } @@ -162,7 +163,7 @@ public class DialogShareWItem extends Dialog { @Override public void onSuccess(List result) { - permission = new PanelTogglePermission(result, defaultACL); + permission = new PanelTogglePermission(result); hpPermission.add(permission); hpPermission.layout(); layout(); diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/PanelTogglePermission.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/PanelTogglePermission.java deleted file mode 100644 index b779b7a..0000000 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/PanelTogglePermission.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing; - -import java.util.List; - -import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.GetPermissionIconByACL; -import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE; -import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL; -import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL.USER_TYPE; - -import com.extjs.gxt.ui.client.Style.ButtonScale; -import com.extjs.gxt.ui.client.Style.IconAlign; -import com.extjs.gxt.ui.client.Style.VerticalAlignment; -import com.extjs.gxt.ui.client.event.ButtonEvent; -import com.extjs.gxt.ui.client.event.SelectionListener; -import com.extjs.gxt.ui.client.widget.HorizontalPanel; -import com.extjs.gxt.ui.client.widget.LayoutContainer; -import com.extjs.gxt.ui.client.widget.button.ToggleButton; -import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig; -import com.google.gwt.core.shared.GWT; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class PanelTogglePermission extends LayoutContainer { - - protected static final String WORKSPACEACLGROUP = "WORKSPACEACLGROUPSHARING"; - private HorizontalPanel hp = new HorizontalPanel(); - private WorkspaceACL selectedAcl = null; - private ACL_TYPE defaultACLType; - - public PanelTogglePermission(List acls, ACL_TYPE defaultACL) { - this.defaultACLType = defaultACL; - -// setStyleAttribute("margin-top", "10px"); - setStyleAttribute("margin-bottom", "15px"); - setSize(350, 40); - - hp.mask("Loading ACLs"); - hp.setVerticalAlign(VerticalAlignment.MIDDLE); - hp.setStyleAttribute("padding-left", "35px"); - - for (WorkspaceACL acl : acls) { - if(acl.getUserType().equals(USER_TYPE.OTHER)){ - ToggleButton toggle = createToggle(acl); - toggle.setToggleGroup(WORKSPACEACLGROUP); - toggle.setStyleAttribute("margin-right", "10px"); -// buttonGroup.add(toggle); -// listToogle.add(toggle); -// add(toggle); - hp.add(toggle); - } - } - - hp.unmask(); - add(hp); - layout(); - } - - private ToggleButton createToggle(final WorkspaceACL acl) { - - final ToggleButton bToggle = new ToggleButton(acl.getLabel()); - bToggle.setScale(ButtonScale.MEDIUM); - bToggle.setId(acl.getId()); - bToggle.setAllowDepress(false); - - if(defaultACLType!=null){ - GWT.log("comparing.. "+defaultACLType + " and "+acl.getAclType()); - GWT.log(defaultACLType.equals(acl.getAclType())+""); -// defaultACLType.equals(acl.getAclType()); - bToggle.toggle(defaultACLType.equals(acl.getAclType())); - }else{ - bToggle.toggle(acl.getDefaultValue()); - } - - if(acl.getDefaultValue()) - selectedAcl = acl; - - bToggle.setIconAlign(IconAlign.TOP); - bToggle.addSelectionListener(new SelectionListener() { - - @Override - public void componentSelected(ButtonEvent ce) { - if(bToggle.isPressed()){ - selectedAcl = acl; - } - - } - }); - bToggle.setToolTip(new ToolTipConfig(acl.getDescription())); - AbstractImagePrototype img = GetPermissionIconByACL.getImage(acl); - - if(img!=null) - bToggle.setIcon(img); - -// setIcon(bToggle, acl.getId()); - return bToggle; - - } - -// private void setIcon(ToggleButton bToggle, String id){ -// -// if(id.compareTo("ADMINISTRATOR")==0){ -// -// }else if(id.compareTo("READ_ONLY")==0){ -// bToggle.setIcon(Resources.getIconReadOnly()); -// }else if(id.compareTo("WRITE_OWNER")==0){ -// bToggle.setIcon(Resources.getIconWriteOwn()); -// }else if(id.compareTo("WRITE_ALL")==0){ -// bToggle.setIcon(Resources.getIconWriteAll()); -// } -// -// } - - public WorkspaceACL getSelectedACL() { - GWT.log("Selected ACL is: "+selectedAcl); - return selectedAcl; - } - - - /* - public List getCheckedGroupList() { - - List listDS = new ArrayList(); - - List values = new ArrayList(); - - if (radioGroup.getValue()!=null){ - Radio radio = radioGroup.getValue(); - values.add((Radio) radio); - } - else { - List> listChecks = radioGroup.getAll(); - for (Field field : listChecks) { - values.add((Radio) field); - } - } - - for (Radio radio : values) { - if (radio.isEnabled()){ - WorkspaceACL acl = (WorkspaceACL) radio.getData(WORKSPACEACL); - listDS.add(acl); - } - } - - if (listDS.size() == 0) - return null; - - return listDS; - } - */ -} diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/SmartShare.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/SmartShare.java index c934ad7..cc4dfb1 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/SmartShare.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/SmartShare.java @@ -66,7 +66,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{ public SmartShare(boolean readGroupsFromHL, boolean readGroupsFromPortal) { this.readGroupsFromHL = readGroupsFromHL; this.readGroupsFromPortal = readGroupsFromPortal; - suggestPanel = new MultiValuePanel(userStore, readGroupsFromHL, readGroupsFromPortal); + suggestPanel = new MultiValuePanel(userStore); initLayout(); } diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/UserStore.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/UserStore.java index 27ad977..3c32775 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/UserStore.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/UserStore.java @@ -30,7 +30,7 @@ public class UserStore implements ContactFetcher{ loadSharedUserBySharedFolderId(sharedFolderId, callback); } - private void loadAllUsersFromServer(final AsyncCallback> callback, boolean readGroupsFromHL, boolean readGroupsFromPortal){ + private void loadAllUsersFromServer(final AsyncCallback> callback){ listAllContact = new ArrayList(); @@ -126,10 +126,10 @@ public class UserStore implements ContactFetcher{ * @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> callback,boolean reloadList, boolean readGroupsFromHL, boolean readGroupsFromPortal) { + public void getListContact(AsyncCallback> callback,boolean reloadList) { if(reloadList || listAllContact==null) - loadAllUsersFromServer(callback,readGroupsFromHL,readGroupsFromPortal); + loadAllUsersFromServer(callback); else callback.onSuccess(listAllContact); diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/multisuggest/MultiValuePanel.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/multisuggest/MultiValuePanel.java index c28b582..9795988 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/multisuggest/MultiValuePanel.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/client/view/sharing/multisuggest/MultiValuePanel.java @@ -41,9 +41,7 @@ public class MultiValuePanel extends Composite { private SuggestBox box; private ContactFetcher userFetch; private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); //ORACLE OF FULL NAMES - private boolean readGroupsFromHL; - private boolean readGroupsFromPortal; - + /** * Instantiates a new multi value panel. * @@ -51,10 +49,8 @@ public class MultiValuePanel extends Composite { * @param readGroupsFromHL the read groups from hl * @param readGroupsFromPortal the read groups from portal */ - public MultiValuePanel(ContactFetcher userFetch, boolean readGroupsFromHL, boolean readGroupsFromPortal) { + public MultiValuePanel(ContactFetcher userFetch) { this.userFetch = userFetch; - this.readGroupsFromHL = readGroupsFromHL; - this.readGroupsFromPortal = readGroupsFromPortal; initWidget(panel); panel.setWidth("100%"); listBullet.setStyleName("multivalue-panel-suggest"); @@ -128,7 +124,7 @@ public class MultiValuePanel extends Composite { * @param list the list */ private void chosenContactItem(final TextBox itemBox, final BulletList list) { - if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) { + if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) { final ListItem displayItem = new ListItem(); displayItem.setStyleName("multivalue-panel-token-ws"); Paragraph p = new Paragraph(itemBox.getValue()); @@ -193,7 +189,7 @@ public class MultiValuePanel extends Composite { * @return names of possible contacts */ private MultiWordSuggestOracle getSuggestions() { - userFetch.getListContact(contacts, false,readGroupsFromHL,readGroupsFromPortal); + userFetch.getListContact(contacts, false); return oracle; } diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/GWTWorkspaceSharingBuilder.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/GWTWorkspaceSharingBuilder.java index 9fcc541..28792b1 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/GWTWorkspaceSharingBuilder.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/GWTWorkspaceSharingBuilder.java @@ -30,13 +30,16 @@ import org.gcube.portlets.widgets.workspacesharingwidget.server.util.WsUtil; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE; import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.FolderModel; +import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup; import org.gcube.portlets.widgets.workspacesharingwidget.shared.GXTFolderItemTypeEnum; import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL.USER_TYPE; import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO; import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE; +import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.UserManager; +import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; import org.gcube.vomanagement.usermanagement.model.GCubeGroup; import org.gcube.vomanagement.usermanagement.model.GCubeUser; @@ -255,9 +258,9 @@ public class GWTWorkspaceSharingBuilder { * Error */ public List buildGXTListContactsModelFromUserModel(PortalContextInfo info) throws Exception { - - List listUsers = new LiferayUserManager().listUsersByGroup(info.getCurrGroupId()); - + + List listUsers = new LiferayUserManager().listUsersByGroup(info.getCurrGroupId()); + if (listUsers == null) { logger.error("No users found in: " + info.getCurrentScope()); throw new Exception("An error occurred on recovering users from Portal, try again later"); @@ -283,9 +286,40 @@ public class GWTWorkspaceSharingBuilder { return listContactsModel; } - public List searchUsersFromKeyword(PortalContextInfo info, String keyword) throws Exception { + public ArrayList getVREList(PortalContextInfo info) throws Exception { + try { - logger.debug("Search Keyword: " + keyword); + logger.info("Current context is " + info.getCurrGroupId()); + ArrayList contexts = new ArrayList<>(); + + GroupManager gm = new LiferayGroupManager(); + GCubeGroup currentGroup = gm.getGroup(info.getCurrGroupId()); + + // is root + List children = currentGroup.getChildren(); + for (GCubeGroup gCubeGroup : children) { + + // get the vo children + List childrenVO = gCubeGroup.getChildren(); + for (GCubeGroup voChildren : childrenVO) { + GGroup gGroup = new GGroup(voChildren.getGroupId(), voChildren.getParentGroupId(), + voChildren.getGroupName(), voChildren.getDescription()); + contexts.add(gGroup); + } + } + + return contexts; + + } catch (Exception e) { + logger.error("Error retrieving the list of VRE!", e); + throw new Exception("Error retrieving the list of VRE!", e); + } + + } + + public List searchUsersByKeyword(PortalContextInfo info, String keyword) throws Exception { + try { + logger.debug("Search use keyword: " + keyword); List listInfoContactModel = new ArrayList<>(); UserManager userManager = new LiferayUserManager(); List users = userManager.searchUsersByGroup(keyword, info.getCurrGroupId()); @@ -294,10 +328,9 @@ public class GWTWorkspaceSharingBuilder { user.getFullname(), false); listInfoContactModel.add(icm); } - return listInfoContactModel; } catch (Exception e) { - logger.error("Error searching user by kewords: " + e.getLocalizedMessage(), e); + logger.error("Error retrieving the users by keyword: "+e.getLocalizedMessage(), e); throw e; } } diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java index 7cddf06..925e2f4 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java @@ -45,6 +45,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess; import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel; +import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup; import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL; import org.gcube.portlets.widgets.workspacesharingwidget.shared.SessionExpiredException; @@ -169,10 +170,50 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements } catch (Exception e) { logger.error("Error in getAllContacts(): " + e.getLocalizedMessage(), e); - throw new Exception("Error retrieving all contacts: " + e.getLocalizedMessage(), e); + throw new Exception("Error retrieving the contacts!", e); } } + @Override + public List getUsersByKeyword(String keyword) throws Exception { + + try { + logger.info("Call getUsersByKeyword(): keyword="+keyword); + + PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest()); + + GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder(); + + List listContactsModel = builder.searchUsersByKeyword(info, keyword); + + logger.debug("Get Users by keyword returning a list having size: " + listContactsModel.size()); + return listContactsModel; + + } catch (Exception e) { + logger.error("Error in getUsersByKeyword(): " + e.getLocalizedMessage(), e); + throw new Exception("Error retrieving list of contacts!", e); + } + } + + @Override + public List getVREList() throws Exception { + try { + PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest()); + + GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder(); + + List listContactsModel = builder.getVREList(info); + + return listContactsModel; + } catch (Exception e) { + logger.error("Error in getVREList(): " + e.getLocalizedMessage(), e); + throw new Exception("Error retrieving VRE List!", e); + } + } + + + + /* * (non-Javadoc) * diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/GGroup.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/GGroup.java new file mode 100644 index 0000000..071387e --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/GGroup.java @@ -0,0 +1,64 @@ +package org.gcube.portlets.widgets.workspacesharingwidget.shared; + +import java.io.Serializable; + +public class GGroup implements Serializable { + + private static final long serialVersionUID = 1L; + + private long groupId; + private long parentGroupId; + private String groupName; + private String description; + + public GGroup() { + super(); + } + + public GGroup(long groupId, long parentGroupId, String groupName, String description) { + super(); + this.groupId = groupId; + this.parentGroupId = parentGroupId; + this.groupName = groupName; + this.description = description; + } + + public long getGroupId() { + return groupId; + } + + public void setGroupId(long groupId) { + this.groupId = groupId; + } + + public long getParentGroupId() { + return parentGroupId; + } + + public void setParentGroupId(long parentGroupId) { + this.parentGroupId = parentGroupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "GGroup [groupId=" + groupId + ", parentGroupId=" + parentGroupId + ", groupName=" + groupName + + ", description=" + description + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/ListContact.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/ListContact.java new file mode 100644 index 0000000..74c3b16 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/shared/ListContact.java @@ -0,0 +1,43 @@ +/** + * + */ +package org.gcube.portlets.widgets.workspacesharingwidget.shared; + +import java.io.Serializable; +import java.util.ArrayList; + +import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it + * Nov 4, 2015 + */ +public class ListContact extends ArrayList implements Serializable{ + + + private static final long serialVersionUID = 544202687567940083L; + + public ListContact() { + } + + public boolean contains(InfoContactModel infoContactModel) { + + if(infoContactModel==null) + return false; + + + if(infoContactModel.getLogin()==null) + return false; + + + for (int i = 0; i < this.size(); i++){ + + InfoContactModel log = get(i); + if (log.getLogin()!=null && log.getLogin().compareTo(infoContactModel.getLogin())==0) + return true; + } + + return false; + } +}