[kune-commits] r1492 - in trunk: . src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/core/client/sitebar src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/manager src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/server/users src/main/java/cc/kune/core/shared/dto src/main/java/cc/kune/domain src/main/java/cc/kune/domain/finders src/main/java/cc/kune/domain/utils src/main/java/cc/kune/lists/client src/main/java/cc/kune/msgs/client src/test/java/cc/kune/core/server/integration/site src/test/java/cc/kune/core/server/integration/socialnet src/test/java/cc/kune/core/server/mapper
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Aug 12 20:33:43 CEST 2011
Author: vjrj_
Date: 2011-08-12 20:33:43 +0200 (Fri, 12 Aug 2011)
New Revision: 1492
Modified:
trunk/TODO
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java
trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
trunk/src/main/java/cc/kune/core/server/NotInObject.java
trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/cc/kune/core/server/users/UserInfo.java
trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java
trunk/src/main/java/cc/kune/core/shared/dto/UserInfoDTO.java
trunk/src/main/java/cc/kune/domain/GroupList.java
trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java
trunk/src/main/java/cc/kune/domain/utils/ParticipationData.java
trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java
trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java
trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
Log:
GroupList now use Set instead of List
Fix "Your groups" submenu.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/TODO 2011-08-12 18:33:43 UTC (rev 1492)
@@ -167,6 +167,15 @@
http://code.google.com/p/google-web-toolkit/wiki/WAR_Design_1_6
http://www.gwt-ext.com/forum/viewtopic.php?f=5&p=12038
** TODO <v> User preferences storing
+*** links:
+**** http://download.oracle.com/javase/1.4.2/docs/guide/lang/preferences.html (Preferences API)
+**** http://stackoverflow.com/questions/6050397/hibernate-mapping-optional-value
+**** http://stackoverflow.com/questions/3100881/user-preferences-file-vs-app-preferences-file
+**** http://stackoverflow.com/questions/1079711/best-approach-to-save-user-preferences
+**** http://stackoverflow.com/questions/3109550/user-preferences-in-jee-application
+**** http://stackoverflow.com/questions/598877/user-preferences-database-table-design
+
+*** old work
(See also variables in 'Styling braimstorming')
We need a way to store (in db) User preferences (like emite chat configurations) in a extensible way.
Something similar to java.util.prefs.Preferences or Mozilla about:config
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -197,6 +197,13 @@
setParent(parent, true);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * cc.kune.common.client.actions.ui.descrip.GuiActionDescrip#setParent(cc.
+ * kune.common.client.actions.ui.descrip.GuiActionDescrip, boolean)
+ */
@Override
public void setParent(final GuiActionDescrip parent, final boolean addToParent) {
if (parent != NO_PARENT && addToParent) {
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -16,6 +16,10 @@
childs.add(descriptors);
}
+ public void clear() {
+ childs.clear();
+ }
+
public GuiActionDescCollection getChilds() {
return childs;
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -98,7 +98,8 @@
* @param addToParent
* if yes, the action will be added directly to the parent, useful to
* attach menu items (or other child actions) directly to its parent
- * without any other check (for instance session status, etc)
+ * without any other check (for instance session status, etc).
+ * Default to yes
*/
void setParent(GuiActionDescrip parent, boolean addToParent);
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -73,10 +73,12 @@
this(new BaseAction(text, tooltip, icon));
}
+ @Override
public void clear() {
// Action detects changes in values, then we fire a change (whatever) to
// fire this method in the UI
putValue(MENU_CLEAR, !((Boolean) getValue(MENU_CLEAR)));
+ super.clear();
}
public ImageResource getRightIcon() {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -19,7 +19,7 @@
\*/
package cc.kune.core.client.sitebar;
-import java.util.List;
+import java.util.Set;
import cc.kune.common.client.actions.AbstractExtendedAction;
import cc.kune.common.client.actions.Action;
@@ -46,7 +46,9 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
+import com.google.inject.Singleton;
+ at Singleton
public class SiteUserOptionsPresenter implements SiteUserOptions {
public static final MenuDescriptor LOGGED_USER_MENU = new MenuDescriptor();
@@ -98,7 +100,7 @@
}
private void addActionImpl(final GuiActionDescrip descriptor) {
- descriptor.setParent(LOGGED_USER_MENU);
+ descriptor.setParent(LOGGED_USER_MENU, true);
}
private void addPartipation(final GroupDTO group) {
@@ -107,8 +109,8 @@
participant.setTarget(group);
participant.putValue(Action.NAME, group.getLongName());
participant.putValue(Action.SMALL_ICON, logoImageUrl);
- participant.setParent(partiMenu, false);
- siteOptions.getRightToolbar().add(participant);
+ participant.setParent(partiMenu, true);
+ // siteOptions.getRightToolbar().add(participant);
}
private void createActions() {
@@ -142,8 +144,8 @@
LOGGED_USER_MENU.setEnabled(true);
setLoggedUserName(userInfoDTO.getShortName());
partiMenu.clear();
- final List<GroupDTO> groupsIsAdmin = userInfoDTO.getGroupsIsAdmin();
- final List<GroupDTO> groupsIsCollab = userInfoDTO.getGroupsIsCollab();
+ final Set<GroupDTO> groupsIsAdmin = userInfoDTO.getGroupsIsAdmin();
+ final Set<GroupDTO> groupsIsCollab = userInfoDTO.getGroupsIsCollab();
for (final GroupDTO group : groupsIsAdmin) {
addPartipation(group);
}
@@ -151,6 +153,7 @@
addPartipation(group);
}
partiMenu.setEnabled((groupsIsAdmin.size() + groupsIsCollab.size()) > 0);
+ siteOptions.refreshActions();
}
private void setLoggedUserName(final String shortName) {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -27,4 +27,6 @@
ToolbarDescriptor getRightToolbar();
+ void refreshActions();
+
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -68,11 +68,9 @@
private static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
private static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor();
public static final String SITE_OPTIONS_MENU = "kune-sop-om";
-
private final I18nTranslationService i18n;
private final CoreResources icons;
private final Provider<SitebarNewGroupLink> newGroupLink;
-
private final CoreResources res;
private final Provider<SitebarSignInLink> signInLink;
private final Provider<SitebarSignOutLink> signOutLink;
@@ -181,6 +179,17 @@
MenuSeparatorDescriptor.build(OPTIONS_MENU);
MenuItemDescriptor.build(OPTIONS_MENU, wavePowered);
OPTIONS_MENU.setParent(RIGHT_TOOLBAR);
+ refreshActionsImpl();
+ }
+
+ @Override
+ public void refreshActions() {
+ refreshActionsImpl();
+ }
+
+ private void refreshActionsImpl() {
+ getView().getLeftBar().clear();
+ getView().getRightBar().clear();
getView().getLeftBar().add(LEFT_TOOLBAR);
getView().getRightBar().add(RIGHT_TOOLBAR);
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -19,7 +19,7 @@
*/
package cc.kune.core.client.sn;
-import java.util.List;
+import java.util.Set;
import cc.kune.common.client.actions.ui.IsActionExtensible;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
@@ -181,9 +181,9 @@
private void setGroupMembers(final SocialNetworkDTO socialNetwork, final AccessRights rights) {
final AccessListsDTO accessLists = socialNetwork.getAccessLists();
- final List<GroupDTO> adminsList = accessLists.getAdmins().getList();
- final List<GroupDTO> collabList = accessLists.getEditors().getList();
- final List<GroupDTO> pendingCollabsList = socialNetwork.getPendingCollaborators().getList();
+ final Set<GroupDTO> adminsList = accessLists.getAdmins().getList();
+ final Set<GroupDTO> collabList = accessLists.getEditors().getList();
+ final Set<GroupDTO> pendingCollabsList = socialNetwork.getPendingCollaborators().getList();
final int numAdmins = adminsList.size();
final int numCollabs = collabList.size();
Modified: trunk/src/main/java/cc/kune/core/server/NotInObject.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/NotInObject.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/server/NotInObject.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -27,21 +27,22 @@
public class NotInObject extends AbstractMatcher<Method> {
- private final List<String> excluded;
+ private final List<String> excluded;
- public NotInObject() {
- super();
- // FIXME exclude password
- excluded = Arrays.asList(new String[] { "finalize", "toString", "hashCode", "getClass", "wait", "equals" });
- }
+ public NotInObject() {
+ super();
+ // FIXME exclude password
+ excluded = Arrays.asList(new String[] { "finalize", "toString", "hashCode", "getClass", "wait",
+ "equals" });
+ }
- @Override
- public boolean matches(final Method method) {
- final String name = method.getName();
-
- final boolean isGetter = name.startsWith("set");
- final boolean isExcluded = excluded.contains(name);
- return !isGetter || !isExcluded;
- }
-
+ @Override
+ public boolean matches(final Method method) {
+ final String name = method.getName();
+ // http://code.google.com/p/google-guice/issues/detail?id=640
+ final boolean isSynth = method.isSynthetic();
+ final boolean isGetter = name.startsWith("set");
+ final boolean isExcluded = excluded.contains(name);
+ return !isSynth && (!isGetter || !isExcluded);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -20,6 +20,7 @@
package cc.kune.core.server.manager;
import java.util.List;
+import java.util.Set;
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.EmailAddressInUseException;
@@ -46,11 +47,11 @@
Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupNameInUseException,
EmailAddressInUseException;
- List<Group> findAdminInGroups(Long groupId);
+ Set<Group> findAdminInGroups(Long groupId);
Group findByShortName(String groupName);
- List<Group> findCollabInGroups(Long groupId);
+ Set<Group> findCollabInGroups(Long groupId);
List<String> findEnabledTools(Long id);
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -21,6 +21,7 @@
import java.util.Collection;
import java.util.List;
+import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
@@ -202,7 +203,7 @@
}
@Override
- public List<Group> findAdminInGroups(final Long groupId) {
+ public Set<Group> findAdminInGroups(final Long groupId) {
return finder.findAdminInGroups(groupId);
}
@@ -212,7 +213,7 @@
}
@Override
- public List<Group> findCollabInGroups(final Long groupId) {
+ public Set<Group> findCollabInGroups(final Long groupId) {
return finder.findCollabInGroups(groupId);
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -19,7 +19,7 @@
*/
package cc.kune.core.server.manager.impl;
-import java.util.List;
+import java.util.Set;
import javax.persistence.EntityManager;
@@ -74,7 +74,7 @@
throws DefaultException, AccessViolationException {
final SocialNetwork sn = inGroup.getSocialNetwork();
checkUserLoggedIsAdmin(userLogged, sn);
- final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
+ final Set<Group> pendingCollabs = sn.getPendingCollaborators().getList();
if (pendingCollabs.contains(group)) {
sn.addCollaborator(group);
sn.removePendingCollaborator(group);
@@ -161,7 +161,7 @@
throws DefaultException {
final SocialNetwork sn = inGroup.getSocialNetwork();
checkUserLoggedIsAdmin(userLogged, sn);
- final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
+ final Set<Group> pendingCollabs = sn.getPendingCollaborators().getList();
if (pendingCollabs.contains(group)) {
sn.removePendingCollaborator(group);
} else {
@@ -174,13 +174,13 @@
throws AccessViolationException {
get(userLogged, group); // check access
final Long groupId = group.getId();
- final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
+ final Set<Group> adminInGroups = finder.findAdminInGroups(groupId);
// Don't show self user group
if (group.isPersonal()) {
adminInGroups.remove(group);
}
// adminInGroups.remove(userLogged.getUserGroup());
- final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
+ final Set<Group> collabInGroups = finder.findCollabInGroups(groupId);
return new ParticipationData(adminInGroups, collabInGroups);
}
Modified: trunk/src/main/java/cc/kune/core/server/users/UserInfo.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/users/UserInfo.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/server/users/UserInfo.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -20,6 +20,7 @@
package cc.kune.core.server.users;
import java.util.List;
+import java.util.Set;
import cc.kune.domain.Group;
import cc.kune.domain.I18nCountry;
@@ -27,112 +28,112 @@
import cc.kune.domain.User;
public class UserInfo {
- private String chatName;
- private String chatPassword;
- private List<String> enabledTools;
- private List<Group> groupsIsAdmin;
- private List<Group> groupsIsCollab;
- private String homePage;
- private boolean showDeletedContent;
- private User user;
- private Group userGroup;
- private String userHash;
+ private String chatName;
+ private String chatPassword;
+ private List<String> enabledTools;
+ private Set<Group> groupsIsAdmin;
+ private Set<Group> groupsIsCollab;
+ private String homePage;
+ private boolean showDeletedContent;
+ private User user;
+ private Group userGroup;
+ private String userHash;
- public String getChatName() {
- return chatName;
- }
+ public String getChatName() {
+ return chatName;
+ }
- public String getChatPassword() {
- return chatPassword;
- }
+ public String getChatPassword() {
+ return chatPassword;
+ }
- public I18nCountry getCountry() {
- return user.getCountry();
- }
+ public I18nCountry getCountry() {
+ return user.getCountry();
+ }
- public List<String> getEnabledTools() {
- return enabledTools;
- }
+ public List<String> getEnabledTools() {
+ return enabledTools;
+ }
- public List<Group> getGroupsIsAdmin() {
- return groupsIsAdmin;
- }
+ public Set<Group> getGroupsIsAdmin() {
+ return groupsIsAdmin;
+ }
- public List<Group> getGroupsIsCollab() {
- return groupsIsCollab;
- }
+ public Set<Group> getGroupsIsCollab() {
+ return groupsIsCollab;
+ }
- public String getHomePage() {
- return homePage;
- }
+ public String getHomePage() {
+ return homePage;
+ }
- public I18nLanguage getLanguage() {
- return user.getLanguage();
- }
+ public I18nLanguage getLanguage() {
+ return user.getLanguage();
+ }
- public String getName() {
- return user.getName();
- }
+ public String getName() {
+ return user.getName();
+ }
- public String getShortName() {
- return user.getShortName();
- }
+ public String getShortName() {
+ return user.getShortName();
+ }
- public boolean getShowDeletedContent() {
- return showDeletedContent;
- }
+ public boolean getShowDeletedContent() {
+ return showDeletedContent;
+ }
- public User getUser() {
- return user;
- }
+ public User getUser() {
+ return user;
+ }
- public Group getUserGroup() {
- return userGroup;
- }
+ public Group getUserGroup() {
+ return userGroup;
+ }
- public String getUserHash() {
- return userHash;
- }
+ public String getUserHash() {
+ return userHash;
+ }
- public void setChatName(final String chatName) {
- this.chatName = chatName;
- }
+ public void setChatName(final String chatName) {
+ this.chatName = chatName;
+ }
- @Deprecated
- public void setChatPassword(final String chatPassword) {
- this.chatPassword = chatPassword;
- }
+ @Deprecated
+ public void setChatPassword(final String chatPassword) {
+ this.chatPassword = chatPassword;
+ }
- public void setEnabledTools(final List<String> enabledTools) {
- this.enabledTools = enabledTools;
- }
+ public void setEnabledTools(final List<String> enabledTools) {
+ this.enabledTools = enabledTools;
+ }
- public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
- }
+ public void setGroupsIsAdmin(final Set<Group> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
+ }
- public void setGroupsIsCollab(final List<Group> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
- }
+ public void setGroupsIsCollab(final Set<Group> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
+ }
- public void setHomePage(final String homePage) {
- this.homePage = homePage;
- }
+ public void setHomePage(final String homePage) {
+ this.homePage = homePage;
+ }
- public void setShowDeletedContent(final boolean showDeletedContent) {
- this.showDeletedContent = showDeletedContent;
- }
+ public void setShowDeletedContent(final boolean showDeletedContent) {
+ this.showDeletedContent = showDeletedContent;
+ }
- public void setUser(final User user) {
- this.user = user;
- }
+ public void setUser(final User user) {
+ this.user = user;
+ }
- public void setUserGroup(final Group userGroup) {
- this.userGroup = userGroup;
- }
+ public void setUserGroup(final Group userGroup) {
+ this.userGroup = userGroup;
+ }
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
- }
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -19,42 +19,43 @@
*/
package cc.kune.core.shared.dto;
-import java.util.List;
+import java.util.Set;
import com.google.gwt.user.client.rpc.IsSerializable;
public class GroupListDTO implements IsSerializable {
- public static final String EVERYONE = "EVERYONE";
- public static final String NOBODY = "NOBODY";
- public static final String NORMAL = "NORMAL";
- private List<GroupDTO> list;
- private String mode;
+ public static final String EVERYONE = "EVERYONE";
+ public static final String NOBODY = "NOBODY";
+ public static final String NORMAL = "NORMAL";
+ private Set<GroupDTO> list;
+ private String mode;
- public GroupListDTO() {
- this(null);
- }
+ public GroupListDTO() {
+ this(null);
+ }
- public GroupListDTO(final List<GroupDTO> list) {
- this.list = list;
- }
+ public GroupListDTO(final Set<GroupDTO> list) {
+ this.list = list;
+ }
- public List<GroupDTO> getList() {
- return list;
- }
+ public Set<GroupDTO> getList() {
+ return list;
+ }
- public String getMode() {
- return mode;
- }
+ public String getMode() {
+ return mode;
+ }
- public void setList(final List<GroupDTO> list) {
- this.list = list;
- }
+ public void setList(final Set<GroupDTO> list) {
+ this.list = list;
+ }
- public void setMode(final String mode) {
- this.mode = mode;
- }
+ public void setMode(final String mode) {
+ this.mode = mode;
+ }
- public String toString() {
- return "GroupListDTO[(" + mode + "): " + list + "]";
- }
+ @Override
+ public String toString() {
+ return "GroupListDTO[(" + mode + "): " + list + "]";
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/UserInfoDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/UserInfoDTO.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/core/shared/dto/UserInfoDTO.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -20,118 +20,119 @@
package cc.kune.core.shared.dto;
import java.util.List;
+import java.util.Set;
import com.google.gwt.user.client.rpc.IsSerializable;
public class UserInfoDTO implements IsSerializable {
- private String chatName;
- private String chatPassword;
- private List<String> enabledTools;
- private List<GroupDTO> groupsIsAdmin;
- private List<GroupDTO> groupsIsCollab;
- private String homePage;
- private boolean showDeletedContent;
- private UserSimpleDTO user;
- private GroupDTO userGroup;
- private String userHash;
+ private String chatName;
+ private String chatPassword;
+ private List<String> enabledTools;
+ private Set<GroupDTO> groupsIsAdmin;
+ private Set<GroupDTO> groupsIsCollab;
+ private String homePage;
+ private boolean showDeletedContent;
+ private UserSimpleDTO user;
+ private GroupDTO userGroup;
+ private String userHash;
- public String getChatName() {
- return chatName;
- }
+ public String getChatName() {
+ return chatName;
+ }
- @Deprecated
- public String getChatPassword() {
- return chatPassword;
- }
+ @Deprecated
+ public String getChatPassword() {
+ return chatPassword;
+ }
- public I18nCountryDTO getCountry() {
- return user.getCountry();
- }
+ public I18nCountryDTO getCountry() {
+ return user.getCountry();
+ }
- public List<String> getEnabledTools() {
- return enabledTools;
- }
+ public List<String> getEnabledTools() {
+ return enabledTools;
+ }
- public List<GroupDTO> getGroupsIsAdmin() {
- return groupsIsAdmin;
- }
+ public Set<GroupDTO> getGroupsIsAdmin() {
+ return groupsIsAdmin;
+ }
- public List<GroupDTO> getGroupsIsCollab() {
- return groupsIsCollab;
- }
+ public Set<GroupDTO> getGroupsIsCollab() {
+ return groupsIsCollab;
+ }
- public String getHomePage() {
- return homePage;
- }
+ public String getHomePage() {
+ return homePage;
+ }
- public I18nLanguageDTO getLanguage() {
- return user.getLanguage();
- }
+ public I18nLanguageDTO getLanguage() {
+ return user.getLanguage();
+ }
- public String getName() {
- return user.getName();
- }
+ public String getName() {
+ return user.getName();
+ }
- public String getShortName() {
- return user.getShortName();
- }
+ public String getShortName() {
+ return user.getShortName();
+ }
- public boolean getShowDeletedContent() {
- return showDeletedContent;
- }
+ public boolean getShowDeletedContent() {
+ return showDeletedContent;
+ }
- public UserSimpleDTO getUser() {
- return user;
- }
+ public UserSimpleDTO getUser() {
+ return user;
+ }
- public GroupDTO getUserGroup() {
- return userGroup;
- }
+ public GroupDTO getUserGroup() {
+ return userGroup;
+ }
- public String getUserHash() {
- return userHash;
- }
+ public String getUserHash() {
+ return userHash;
+ }
- public void setChatName(final String chatName) {
- this.chatName = chatName;
- }
+ public void setChatName(final String chatName) {
+ this.chatName = chatName;
+ }
- @Deprecated
- public void setChatPassword(final String password) {
- this.chatPassword = password;
+ @Deprecated
+ public void setChatPassword(final String password) {
+ this.chatPassword = password;
- }
+ }
- public void setEnabledTools(final List<String> enabledTools) {
- this.enabledTools = enabledTools;
- }
+ public void setEnabledTools(final List<String> enabledTools) {
+ this.enabledTools = enabledTools;
+ }
- public void setGroupsIsAdmin(final List<GroupDTO> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
- }
+ public void setGroupsIsAdmin(final Set<GroupDTO> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
+ }
- public void setGroupsIsCollab(final List<GroupDTO> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
- }
+ public void setGroupsIsCollab(final Set<GroupDTO> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
+ }
- public void setHomePage(final String homePage) {
- this.homePage = homePage;
- }
+ public void setHomePage(final String homePage) {
+ this.homePage = homePage;
+ }
- public void setShowDeletedContent(final boolean showDeletedContent) {
- this.showDeletedContent = showDeletedContent;
- }
+ public void setShowDeletedContent(final boolean showDeletedContent) {
+ this.showDeletedContent = showDeletedContent;
+ }
- public void setUser(final UserSimpleDTO user) {
- this.user = user;
- }
+ public void setUser(final UserSimpleDTO user) {
+ this.user = user;
+ }
- public void setUserGroup(final GroupDTO userGroup) {
- this.userGroup = userGroup;
- }
+ public void setUserGroup(final GroupDTO userGroup) {
+ this.userGroup = userGroup;
+ }
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
- }
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
+ }
}
Modified: trunk/src/main/java/cc/kune/domain/GroupList.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/GroupList.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/domain/GroupList.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -20,7 +20,8 @@
package cc.kune.domain;
import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
@@ -51,18 +52,18 @@
@Fetch(FetchMode.JOIN)
@OrderBy("shortName ASC")
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
- List<Group> list;
+ Set<Group> list;
@Enumerated(EnumType.STRING)
@Basic
private GroupListMode mode;
public GroupList() {
- this(new ArrayList<Group>());
+ this(new HashSet<Group>());
this.mode = GroupListMode.NORMAL;
}
- public GroupList(final List<Group> list) {
+ public GroupList(final Set<Group> list) {
this.list = list;
}
@@ -78,7 +79,7 @@
}
}
- public boolean checkIfIncludes(final Group group, final List<Group> list, final GroupListMode mode) {
+ public boolean checkIfIncludes(final Group group, final Set<Group> list, final GroupListMode mode) {
switch (mode) {
case NOBODY:
return false;
@@ -97,7 +98,7 @@
return id;
}
- public List<Group> getList() {
+ public Set<Group> getList() {
return list;
}
@@ -125,7 +126,7 @@
this.id = id;
}
- public void setList(final List<Group> list) {
+ public void setList(final Set<Group> list) {
this.list = list;
}
Modified: trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -20,7 +20,9 @@
package cc.kune.domain.finders;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import cc.kune.domain.Group;
@@ -29,18 +31,21 @@
public interface GroupFinder {
- @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.admins.list adm WHERE adm.id = :groupid)", returnAs = ArrayList.class)
- public List<Group> findAdminInGroups(@Named("groupid") final Long groupId);
+ @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id "
+ + "FROM g.socialNetwork.accessLists.admins.list adm WHERE adm.id = :groupid)", returnAs = HashSet.class)
+ public Set<Group> findAdminInGroups(@Named("groupid") final Long groupId);
- @Finder(query = "FROM Group g WHERE g.shortName = :shortName")
- public Group findByShortName(@Named("shortName") final String shortName);
+ @Finder(query = "FROM Group g WHERE g.shortName = :shortName")
+ public Group findByShortName(@Named("shortName") final String shortName);
- @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.editors.list AS ed WHERE ed.id = :groupid)", returnAs = ArrayList.class)
- public List<Group> findCollabInGroups(@Named("groupid") final Long groupId);
+ @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM "
+ + "g.socialNetwork.accessLists.editors.list AS ed WHERE ed.id = :groupid)", returnAs = HashSet.class)
+ public Set<Group> findCollabInGroups(@Named("groupid") final Long groupId);
- @Finder(query = "SELECT t.root.toolName FROM ToolConfiguration t WHERE t.enabled=true AND t.root.owner.id = :groupid", returnAs = ArrayList.class)
- public List<String> findEnabledTools(@Named("groupid") final Long groupId);
+ @Finder(query = "SELECT t.root.toolName FROM ToolConfiguration t "
+ + "WHERE t.enabled=true AND t.root.owner.id = :groupid", returnAs = ArrayList.class)
+ public List<String> findEnabledTools(@Named("groupid") final Long groupId);
- @Finder(query = "FROM Group", returnAs = ArrayList.class)
- public List<Group> getAll();
+ @Finder(query = "FROM Group", returnAs = ArrayList.class)
+ public List<Group> getAll();
}
Modified: trunk/src/main/java/cc/kune/domain/utils/ParticipationData.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/utils/ParticipationData.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/domain/utils/ParticipationData.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -19,37 +19,37 @@
*/
package cc.kune.domain.utils;
-import java.util.List;
+import java.util.Set;
import cc.kune.domain.Group;
public class ParticipationData {
- private List<Group> groupsIsAdmin;
- private List<Group> groupsIsCollab;
+ private Set<Group> groupsIsAdmin;
+ private Set<Group> groupsIsCollab;
- public ParticipationData() {
- this(null, null);
- }
+ public ParticipationData() {
+ this(null, null);
+ }
- public ParticipationData(final List<Group> groupsIsAdmin, final List<Group> groupsIsCollab) {
- this.groupsIsAdmin = groupsIsAdmin;
- this.groupsIsCollab = groupsIsCollab;
- }
+ public ParticipationData(final Set<Group> groupsIsAdmin, final Set<Group> groupsIsCollab) {
+ this.groupsIsAdmin = groupsIsAdmin;
+ this.groupsIsCollab = groupsIsCollab;
+ }
- public List<Group> getGroupsIsAdmin() {
- return groupsIsAdmin;
- }
+ public Set<Group> getGroupsIsAdmin() {
+ return groupsIsAdmin;
+ }
- public List<Group> getGroupsIsCollab() {
- return groupsIsCollab;
- }
+ public Set<Group> getGroupsIsCollab() {
+ return groupsIsCollab;
+ }
- public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
- }
+ public void setGroupsIsAdmin(final Set<Group> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
+ }
- public void setGroupsIsCollab(final List<Group> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
- }
+ public void setGroupsIsCollab(final Set<Group> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
+ }
}
Modified: trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -22,8 +22,8 @@
import static cc.kune.lists.shared.ListsConstants.NAME;
import static cc.kune.lists.shared.ListsConstants.ROOT_NAME;
import static cc.kune.lists.shared.ListsConstants.TYPE_LIST;
+import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import static cc.kune.lists.shared.ListsConstants.TYPE_ROOT;
-import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -60,7 +60,7 @@
registerContentTypeIcon(TYPE_ROOT, navResources.list());
registerContentTypeIcon(TYPE_LIST, navResources.list());
registerContentTypeIcon(TYPE_POST, navResources.email());
- final String noWave = i18n.t("There isn't nothing post yet, create one");
+ final String noWave = i18n.t("There is nothing posted yet. Post something");
final String noList = i18n.t("There isn't any list, create one");
registerEmptyMessages(TYPE_ROOT, noList);
registerEmptyMessages(TYPE_LIST, noWave);
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -31,24 +31,21 @@
public class UserMessagesPanel extends Composite implements UserMessagesView {
- interface MessagesPanelUiBinder extends UiBinder<Widget, UserMessagesPanel> {
- }
- private static MessagesPanelUiBinder uiBinder = GWT.create(MessagesPanelUiBinder.class);
+ interface MessagesPanelUiBinder extends UiBinder<Widget, UserMessagesPanel> {
+ }
+ private static MessagesPanelUiBinder uiBinder = GWT.create(MessagesPanelUiBinder.class);
- @UiField
- VerticalPanel vp;
+ @UiField
+ VerticalPanel vp;
- public UserMessagesPanel() {
- initWidget(uiBinder.createAndBindUi(this));
- }
+ public UserMessagesPanel() {
+ initWidget(uiBinder.createAndBindUi(this));
+ }
- @Override
- public void add(final NotifyLevel level, final String title, final String message, final String id,
- final boolean closeable, final CloseCallback closeCallback) {
- final UserMessage msg = new UserMessage(level, title, message, id, closeable, closeCallback);
- vp.add(msg);
- // final SlideUp anim = new SlideUp(msg.getElement());
- // anim.setDuration(.5);
- // anim.play();
- }
+ @Override
+ public void add(final NotifyLevel level, final String title, final String message, final String id,
+ final boolean closeable, final CloseCallback closeCallback) {
+ final UserMessage msg = new UserMessage(level, title, message, id, closeable, closeCallback);
+ vp.add(msg);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -23,7 +23,8 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import java.util.List;
+import java.util.Iterator;
+import java.util.Set;
import org.junit.Before;
import org.junit.Test;
@@ -73,13 +74,12 @@
@Inject
UserService userService;
- private void assertEqualGroupLists(final List<GroupDTO> listDTO, final List<Group> list) {
+ private void assertEqualGroupLists(final Set<GroupDTO> listDTO, final Set<Group> list) {
assertEquals(listDTO.size(), list.size());
- for (int i = 0; i < listDTO.size(); i++) {
- final Object object = listDTO.get(i);
- assertEquals(GroupDTO.class, object.getClass());
- final GroupDTO d = (GroupDTO) object;
- final Group l = list.get(i);
+ final Iterator<Group> ite = list.iterator();
+ for (final GroupDTO groupDTO : listDTO) {
+ final GroupDTO d = groupDTO;
+ final Group l = ite.next();
assertNotNull(d);
assertNotNull(l);
final GroupDTO map = mapper.map(l, GroupDTO.class);
@@ -156,8 +156,8 @@
final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
assertEquals(userInfo.getName(), userInfoDTO.getName());
assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
- final List<Group> adminsGroup = userInfo.getGroupsIsAdmin();
- final List<GroupDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
+ final Set<Group> adminsGroup = userInfo.getGroupsIsAdmin();
+ final Set<GroupDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
assertEqualGroupLists(adminsGroupDTO, adminsGroup);
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -21,7 +21,7 @@
import static org.junit.Assert.assertEquals;
-import java.util.List;
+import java.util.Set;
import org.junit.Before;
import org.junit.Test;
@@ -37,34 +37,34 @@
import com.google.inject.persist.Transactional;
public class SocialNetworkMembersTest extends IntegrationTest {
- @Inject
- UserSession session;
- @Inject
- SocialNetworkManager socialNetManager;
- @Inject
- GroupManager groupFinder;
+ private Group group;
+ @Inject
+ GroupManager groupFinder;
+ @Inject
+ UserSession session;
- private Group group;
+ @Inject
+ SocialNetworkManager socialNetManager;
- @Transactional
- @Before
- public void init() {
- new IntegrationTestHelper(this);
- group = groupFinder.findByShortName(getSiteAdminShortName());
- }
+ @Transactional
+ @Before
+ public void init() {
+ new IntegrationTestHelper(this);
+ group = groupFinder.findByShortName(getSiteAdminShortName());
+ }
- @Test
- public void testAdminMembersOfGroupFinder() throws Exception {
- doLogin();
- final List<Group> result = groupFinder.findAdminInGroups(group.getId());
- assertEquals(2, result.size());
- }
+ @Test
+ public void testAdminMembersOfGroupFinder() throws Exception {
+ doLogin();
+ final Set<Group> result = groupFinder.findAdminInGroups(group.getId());
+ assertEquals(2, result.size());
+ }
- @Test
- public void testCollabMembersOfGroupFinder() throws Exception {
- doLogin();
- final List<Group> result = groupFinder.findCollabInGroups(group.getId());
- assertEquals(0, result.size());
- }
+ @Test
+ public void testCollabMembersOfGroupFinder() throws Exception {
+ doLogin();
+ final Set<Group> result = groupFinder.findCollabInGroups(group.getId());
+ assertEquals(0, result.size());
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2011-08-11 11:40:45 UTC (rev 1491)
+++ trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2011-08-12 18:33:43 UTC (rev 1492)
@@ -26,7 +26,9 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import org.junit.Before;
import org.junit.Ignore;
@@ -86,14 +88,13 @@
}
private void assertValidAccessListsMapping(final GroupList groupList, final GroupListDTO groupListDTO) {
- final List<Group> listOrig = groupList.getList();
- final List<GroupDTO> listDto = groupListDTO.getList();
+ final Set<Group> listOrig = groupList.getList();
+ final Set<GroupDTO> listDto = groupListDTO.getList();
assertEquals(listDto.size(), listOrig.size());
- for (int i = 0; i < listDto.size(); i++) {
- final Object object = listDto.get(i);
- assertEquals(GroupDTO.class, object.getClass());
- final GroupDTO d = (GroupDTO) object;
- final Group g = listOrig.get(i);
+ final Iterator<Group> ite = listOrig.iterator();
+ for (final GroupDTO groupDTO : listDto) {
+ final GroupDTO d = groupDTO;
+ final Group g = ite.next();
assertNotNull(d);
assertNotNull(g);
final GroupDTO map = mapper.map(g, GroupDTO.class);
@@ -324,8 +325,8 @@
assertEquals(SocialNetworkVisibility.onlymembers, map.getSocialNetworkVisibility());
assertEquals(UserSNetVisibility.yourbuddies, map.getUserBuddiesVisibility());
assertEquals("test",
- map.getGroupMembers().getAccessLists().getAdmins().getList().get(0).getShortName());
- assertEquals("test", map.getUserParticipation().getGroupsIsAdmin().get(0).getShortName());
+ map.getGroupMembers().getAccessLists().getAdmins().getList().iterator().next().getShortName());
+ assertEquals("test", map.getUserParticipation().getGroupsIsAdmin().iterator().next().getShortName());
assertEquals("usertest", map.getUserBuddies().getBuddies().get(0).getShortName());
assertFalse(map.getGroupRights().isAdministrable());
assertFalse(map.getGroupRights().isEditable());
More information about the kune-commits
mailing list