[kune-commits] r962 - in trunk: .
src/main/java/org/ourproject/kune/app/public/css
src/main/java/org/ourproject/kune/platf/client/dto
src/main/java/org/ourproject/kune/platf/client/rpc
src/main/java/org/ourproject/kune/platf/client/state
src/main/java/org/ourproject/kune/platf/server/domain
src/main/java/org/ourproject/kune/platf/server/manager
src/main/java/org/ourproject/kune/platf/server/manager/impl
src/main/java/org/ourproject/kune/platf/server/rpc
src/main/java/org/ourproject/kune/platf/server/sn
src/main/java/org/ourproject/kune/platf/server/state
src/main/java/org/ourproject/kune/workspace/client/socialnet
src/main/resources
src/test/java/org/ourproject/kune/platf/integration/socialnet
src/test/java/org/ourproject/kune/platf/server/mapper
vjrj
vjrj at ourproject.org
Sat Nov 22 17:44:47 CET 2008
Author: vjrj
Date: 2008-11-22 17:44:37 +0100 (Sat, 22 Nov 2008)
New Revision: 962
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetworkData.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java
Modified:
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkVisibilityDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesVisibilityDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/resources/dozerBeanMapping.xml
trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
Log:
Complete - task SocialNet visibility (group members and user buddies are showed to anybody or only to members/buddies or only to admins/you)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/pom.xml 2008-11-22 16:44:37 UTC (rev 962)
@@ -379,8 +379,8 @@
<version>2.0-beta23</version>
<configuration>
<logLevel>INFO</logLevel>
- <style>PRETTY</style>
- <!-- <style>OBF</style> -->
+ <style>OBF</style>
+ <!-- <style>PRETTY</style> -->
<runTarget>
org.ourproject.kune.app.Kune/Kune.html
</runTarget>
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-11-22 16:44:37 UTC (rev 962)
@@ -41,4 +41,4 @@
padding: 1px 0px 1px 1px;
text-decoration:none;
}
-*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-bsp-buddie{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-bsp-buddie td{padding:2px 3px;}
\ No newline at end of file
+*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-bsp-buddie{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-bsp-buddie td{padding:2px 3px;}.k-text-gray{color:gray;}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-11-22 16:44:37 UTC (rev 962)
@@ -793,4 +793,8 @@
.k-bsp-buddie td {
padding: 2px 3px 2px 3px;
+}
+
+.k-text-gray {
+ color: gray;
}
\ No newline at end of file
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java (from rev 961, trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -0,0 +1,137 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class SocialNetworkDataDTO implements IsSerializable {
+
+ private SocialNetworkVisibilityDTO socialNetworkVisibility;
+ private SocialNetworkDTO groupMembers;
+ private ParticipationDataDTO userParticipation;
+ private UserBuddiesVisibilityDTO userBuddiesVisibility;
+ private UserBuddiesDataDTO userBuddies;
+ private AccessRightsDTO groupRights;
+ private boolean isBuddiesVisible;
+ private boolean isMembersVisible;
+
+ public SocialNetworkDataDTO() {
+ this(null, null, null, null, null, null, false, false);
+ }
+
+ public SocialNetworkDataDTO(SocialNetworkVisibilityDTO socialNetworkVisibility,
+ final SocialNetworkDTO groupMembers, final ParticipationDataDTO userParticipation,
+ UserBuddiesVisibilityDTO userBuddiesVisibility, final UserBuddiesDataDTO userBuddies,
+ AccessRightsDTO groupRights, boolean isBuddiesVisible, boolean isMembersVisible) {
+ this.socialNetworkVisibility = socialNetworkVisibility;
+ this.groupMembers = groupMembers;
+ this.userParticipation = userParticipation;
+ this.userBuddiesVisibility = userBuddiesVisibility;
+ this.userBuddies = userBuddies;
+ this.groupRights = groupRights;
+ this.isBuddiesVisible = isBuddiesVisible;
+ this.isMembersVisible = isMembersVisible;
+ }
+
+ public SocialNetworkDTO getGroupMembers() {
+ return groupMembers;
+ }
+
+ public AccessRightsDTO getGroupRights() {
+ return groupRights;
+ }
+
+ public boolean getIsBuddiesVisible() {
+ return isBuddiesVisible;
+ }
+
+ public boolean getIsMembersVisible() {
+ return isMembersVisible;
+ }
+
+ public SocialNetworkVisibilityDTO getSocialNetworkVisibility() {
+ return socialNetworkVisibility;
+ }
+
+ public UserBuddiesDataDTO getUserBuddies() {
+ return userBuddies;
+ }
+
+ public UserBuddiesVisibilityDTO getUserBuddiesVisibility() {
+ return userBuddiesVisibility;
+ }
+
+ public ParticipationDataDTO getUserParticipation() {
+ return userParticipation;
+ }
+
+ public boolean isBuddiesVisible() {
+ return isBuddiesVisible;
+ }
+
+ public boolean isMembersVisible() {
+ return isMembersVisible;
+ }
+
+ public void setBuddiesVisible(boolean isBuddiesVisible) {
+ this.isBuddiesVisible = isBuddiesVisible;
+ }
+
+ public void setGroupMembers(final SocialNetworkDTO groupMembers) {
+ this.groupMembers = groupMembers;
+ }
+
+ public void setGroupRights(AccessRightsDTO groupRights) {
+ this.groupRights = groupRights;
+ }
+
+ public void setIsBuddiesVisible(boolean isBuddiesVisible) {
+ setBuddiesVisible(isBuddiesVisible);
+ }
+
+ public void setIsMembersVisible(boolean isMembersVisible) {
+ setMembersVisible(isMembersVisible);
+ }
+
+ public void setMembersVisible(boolean isMembersVisible) {
+ this.isMembersVisible = isMembersVisible;
+ }
+
+ public void setSocialNetworkVisibility(SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
+ this.socialNetworkVisibility = socialNetworkVisibilityDTO;
+ }
+
+ public void setUserBuddies(UserBuddiesDataDTO userBuddies) {
+ this.userBuddies = userBuddies;
+ }
+
+ public void setUserBuddiesVisibility(UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
+ this.userBuddiesVisibility = userBuddiesVisibilityDTO;
+ }
+
+ public void setUserParticipation(final ParticipationDataDTO userParticipation) {
+ this.userParticipation = userParticipation;
+ }
+
+ @Override
+ public String toString() {
+ return "SocialNetworkResultDTO[members: " + groupMembers + "; participation: " + userParticipation + "]";
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkResultDTO.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -1,100 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.dto;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-public class SocialNetworkResultDTO implements IsSerializable {
-
- SocialNetworkDTO groupMembers;
- SocialNetworkVisibilityDTO socialNetworkVisibilityDTO;
-
- ParticipationDataDTO userParticipation;
-
- UserBuddiesDataDTO userBuddies;
- UserBuddiesVisibilityDTO userBuddiesVisibilityDTO;
-
- AccessRightsDTO groupRights;
-
- public SocialNetworkResultDTO() {
- this(null, null, null, null);
- }
-
- public SocialNetworkResultDTO(final SocialNetworkDTO groupMembers, final ParticipationDataDTO userParticipation,
- final UserBuddiesDataDTO userBuddies, AccessRightsDTO groupRights) {
- this.groupMembers = groupMembers;
- this.userParticipation = userParticipation;
- this.userBuddies = userBuddies;
- this.groupRights = groupRights;
- }
-
- public SocialNetworkDTO getGroupMembers() {
- return groupMembers;
- }
-
- public AccessRightsDTO getGroupRights() {
- return groupRights;
- }
-
- public SocialNetworkVisibilityDTO getSocialNetworkVisibilityDTO() {
- return socialNetworkVisibilityDTO;
- }
-
- public UserBuddiesDataDTO getUserBuddies() {
- return userBuddies;
- }
-
- public UserBuddiesVisibilityDTO getUserBuddiesVisibilityDTO() {
- return userBuddiesVisibilityDTO;
- }
-
- public ParticipationDataDTO getUserParticipation() {
- return userParticipation;
- }
-
- public void setGroupMembers(final SocialNetworkDTO groupMembers) {
- this.groupMembers = groupMembers;
- }
-
- public void setGroupRights(AccessRightsDTO groupRights) {
- this.groupRights = groupRights;
- }
-
- public void setSocialNetworkVisibilityDTO(SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
- this.socialNetworkVisibilityDTO = socialNetworkVisibilityDTO;
- }
-
- public void setUserBuddies(UserBuddiesDataDTO userBuddies) {
- this.userBuddies = userBuddies;
- }
-
- public void setUserBuddiesVisibilityDTO(UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
- this.userBuddiesVisibilityDTO = userBuddiesVisibilityDTO;
- }
-
- public void setUserParticipation(final ParticipationDataDTO userParticipation) {
- this.userParticipation = userParticipation;
- }
-
- @Override
- public String toString() {
- return "SocialNetworkResultDTO[members: " + groupMembers + "; participation: " + userParticipation + "]";
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkVisibilityDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkVisibilityDTO.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkVisibilityDTO.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.dto;
-public enum SocialNetworkVisibilityDTO {
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public enum SocialNetworkVisibilityDTO implements IsSerializable {
anyone, onlymembers, onlyadmins
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -27,12 +27,9 @@
private List<String> enabledTools;
private GroupDTO group;
- private SocialNetworkDTO groupMembers;
- private AccessRightsDTO groupRights;
- private ParticipationDataDTO participation;
- private UserBuddiesDataDTO userBuddies;
private StateToken stateToken;
private String title;
+ private SocialNetworkDataDTO socialNetworkData;
public StateAbstractDTO() {
}
@@ -46,17 +43,21 @@
}
public SocialNetworkDTO getGroupMembers() {
- return groupMembers;
+ return socialNetworkData.getGroupMembers();
}
public AccessRightsDTO getGroupRights() {
- return groupRights;
+ return socialNetworkData.getGroupRights();
}
public ParticipationDataDTO getParticipation() {
- return participation;
+ return socialNetworkData.getUserParticipation();
}
+ public SocialNetworkDataDTO getSocialNetworkData() {
+ return socialNetworkData;
+ }
+
public StateToken getStateToken() {
return stateToken;
}
@@ -66,7 +67,7 @@
}
public UserBuddiesDataDTO getUserBuddies() {
- return userBuddies;
+ return socialNetworkData.getUserBuddies();
}
public void setEnabledTools(List<String> enabledTools) {
@@ -77,18 +78,10 @@
this.group = group;
}
- public void setGroupMembers(SocialNetworkDTO groupMembers) {
- this.groupMembers = groupMembers;
+ public void setSocialNetworkData(SocialNetworkDataDTO socialNetworkData) {
+ this.socialNetworkData = socialNetworkData;
}
- public void setGroupRights(AccessRightsDTO groupRights) {
- this.groupRights = groupRights;
- }
-
- public void setParticipation(ParticipationDataDTO participation) {
- this.participation = participation;
- }
-
public void setStateToken(StateToken stateToken) {
this.stateToken = stateToken;
}
@@ -97,10 +90,6 @@
this.title = title;
}
- public void setUserBuddies(UserBuddiesDataDTO userBuddies) {
- this.userBuddies = userBuddies;
- }
-
@Override
public String toString() {
return "StateDTO[" + getStateToken() + "]";
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesVisibilityDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesVisibilityDTO.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesVisibilityDTO.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.dto;
-public enum UserBuddiesVisibilityDTO {
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public enum UserBuddiesVisibilityDTO implements IsSerializable {
anyone, yourbuddies, onlyyou
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -20,7 +20,7 @@
package org.ourproject.kune.platf.client.rpc;
import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.errors.DefaultException;
@@ -28,33 +28,33 @@
public interface SocialNetworkService extends RemoteService {
- SocialNetworkResultDTO acceptJoinGroup(String hash, StateToken groupToken, String groupToAcceptShortName)
+ SocialNetworkDataDTO acceptJoinGroup(String hash, StateToken groupToken, String groupToAcceptShortName)
throws DefaultException;
- SocialNetworkResultDTO addAdminMember(String hash, StateToken groupToken, String groupToAddShortName)
+ SocialNetworkDataDTO addAdminMember(String hash, StateToken groupToken, String groupToAddShortName)
throws DefaultException;
- SocialNetworkResultDTO addCollabMember(String hash, StateToken groupToken, String groupToAddShortName)
+ SocialNetworkDataDTO addCollabMember(String hash, StateToken groupToken, String groupToAddShortName)
throws DefaultException;
- SocialNetworkResultDTO addViewerMember(String hash, StateToken groupToken, String groupToAddShortName)
+ SocialNetworkDataDTO addViewerMember(String hash, StateToken groupToken, String groupToAddShortName)
throws DefaultException;
- SocialNetworkResultDTO deleteMember(String hash, StateToken groupToken, String groupToDeleteShortName)
+ SocialNetworkDataDTO deleteMember(String hash, StateToken groupToken, String groupToDeleteShortName)
throws DefaultException;
- SocialNetworkResultDTO denyJoinGroup(String hash, StateToken groupToken, String groupToDenyShortName)
+ SocialNetworkDataDTO denyJoinGroup(String hash, StateToken groupToken, String groupToDenyShortName)
throws DefaultException;
- SocialNetworkResultDTO getSocialNetwork(String hash, StateToken groupToken) throws DefaultException;
+ SocialNetworkDataDTO getSocialNetwork(String hash, StateToken groupToken) throws DefaultException;
SocialNetworkRequestResult requestJoinGroup(String hash, StateToken groupToken) throws DefaultException;
- SocialNetworkResultDTO setAdminAsCollab(String hash, StateToken groupToken, String groupToSetCollabShortName)
+ SocialNetworkDataDTO setAdminAsCollab(String hash, StateToken groupToken, String groupToSetCollabShortName)
throws DefaultException;
- SocialNetworkResultDTO setCollabAsAdmin(String hash, StateToken groupToken, String groupToSetAdminShortName)
+ SocialNetworkDataDTO setCollabAsAdmin(String hash, StateToken groupToken, String groupToSetAdminShortName)
throws DefaultException;
- SocialNetworkResultDTO unJoinGroup(String hash, StateToken groupToken) throws DefaultException;
+ SocialNetworkDataDTO unJoinGroup(String hash, StateToken groupToken) throws DefaultException;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -19,7 +19,7 @@
*/
package org.ourproject.kune.platf.client.rpc;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -27,32 +27,32 @@
public interface SocialNetworkServiceAsync {
void acceptJoinGroup(String hash, StateToken groupToken, String groupToAcceptShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void addAdminMember(String hash, StateToken groupToken, String groupToAddShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void addCollabMember(String hash, StateToken groupToken, String groupToAddShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void addViewerMember(String hash, StateToken groupToken, String groupToAddShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void deleteMember(String hash, StateToken groupToken, String groupToDeleteShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void denyJoinGroup(String hash, StateToken groupToken, String groupToDenyShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
- void getSocialNetwork(String hash, StateToken groupToken, AsyncCallback<SocialNetworkResultDTO> callback);
+ void getSocialNetwork(String hash, StateToken groupToken, AsyncCallback<SocialNetworkDataDTO> callback);
void requestJoinGroup(String hash, StateToken groupToken, AsyncCallback<?> callback);
void setAdminAsCollab(String hash, StateToken groupToken, String groupToSetCollabShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
void setCollabAsAdmin(String hash, StateToken groupToken, String groupToSetAdminShortName,
- AsyncCallback<SocialNetworkResultDTO> callback);
+ AsyncCallback<SocialNetworkDataDTO> callback);
- void unJoinGroup(String hash, StateToken groupToken, AsyncCallback<SocialNetworkResultDTO> callback);
+ void unJoinGroup(String hash, StateToken groupToken, AsyncCallback<SocialNetworkDataDTO> callback);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -20,7 +20,7 @@
package org.ourproject.kune.platf.client.state;
import org.ourproject.kune.platf.client.actions.BeforeActionListener;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
@@ -58,6 +58,6 @@
void setRetrievedState(StateAbstractDTO state);
- void setSocialNetwork(SocialNetworkResultDTO socialNet);
+ void setSocialNetwork(SocialNetworkDataDTO socialNet);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -24,12 +24,9 @@
import org.ourproject.kune.platf.client.actions.BeforeActionCollection;
import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.workspace.client.site.Site;
@@ -177,18 +174,13 @@
setState(newState);
}
- public void setSocialNetwork(final SocialNetworkResultDTO socialNet) {
+ public void setSocialNetwork(final SocialNetworkDataDTO socialNet) {
StateAbstractDTO state;
if (session != null && (state = session.getCurrentState()) != null) {
// After a SN operation, usually returns a SocialNetworkResultDTO
// with new SN data and we refresh the state
// to avoid to reload() again the state
- final SocialNetworkDTO groupMembers = socialNet.getGroupMembers();
- final ParticipationDataDTO userParticipation = socialNet.getUserParticipation();
- final UserBuddiesDataDTO userBuddies = socialNet.getUserBuddies();
- state.setGroupMembers(groupMembers);
- state.setParticipation(userParticipation);
- state.setUserBuddies(userBuddies);
+ state.setSocialNetworkData(socialNet);
onSocialNetworkChanged.fire(state);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetwork.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -29,6 +29,8 @@
@Entity
@Table(name = "social_networks")
public class SocialNetwork {
+ public static final SocialNetwork EMPTY = new SocialNetwork(SocialNetworkVisibility.onlyadmins);
+
@Id
@GeneratedValue
Long id;
@@ -47,6 +49,12 @@
visibility = SocialNetworkVisibility.anyone;
}
+ public SocialNetwork(SocialNetworkVisibility visibility) {
+ accessLists = new AccessLists();
+ pendingCollaborators = new GroupList();
+ this.visibility = visibility;
+ }
+
public void addAdmin(final Group group) {
accessLists.addAdmin(group);
}
Added: trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetworkData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetworkData.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/SocialNetworkData.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -0,0 +1,114 @@
+package org.ourproject.kune.platf.server.domain;
+
+import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.sn.ParticipationData;
+import org.ourproject.kune.platf.server.sn.UserBuddiesData;
+
+public class SocialNetworkData {
+ private SocialNetworkVisibility socialNetworkVisibility;
+ private SocialNetwork groupMembers;
+ private ParticipationData userParticipation;
+ private UserBuddiesVisibility userBuddiesVisibility;
+ private UserBuddiesData userBuddies;
+ private AccessRights groupRights;
+ private boolean isBuddiesVisible;
+ private boolean isMembersVisible;
+
+ public SocialNetworkData() {
+ this(null, null, null, null, null, null, false, false);
+ }
+
+ public SocialNetworkData(SocialNetworkVisibility socialNetworkVisibility, SocialNetwork groupMembers,
+ ParticipationData userParticipation, UserBuddiesVisibility userBuddiesVisibility,
+ UserBuddiesData userBuddies, AccessRights groupRights, boolean isBuddiesVisible, boolean isMembersVisible) {
+ this.socialNetworkVisibility = socialNetworkVisibility;
+ this.groupMembers = groupMembers;
+ this.userParticipation = userParticipation;
+ this.userBuddiesVisibility = userBuddiesVisibility;
+ this.userBuddies = userBuddies;
+ this.groupRights = groupRights;
+ this.isBuddiesVisible = isBuddiesVisible;
+ this.isMembersVisible = isMembersVisible;
+ }
+
+ public SocialNetwork getGroupMembers() {
+ return groupMembers;
+ }
+
+ public AccessRights getGroupRights() {
+ return groupRights;
+ }
+
+ public boolean getIsBuddiesVisible() {
+ return isBuddiesVisible;
+ }
+
+ public boolean getIsMembersVisible() {
+ return isMembersVisible;
+ }
+
+ public SocialNetworkVisibility getSocialNetworkVisibility() {
+ return socialNetworkVisibility;
+ }
+
+ public UserBuddiesData getUserBuddies() {
+ return userBuddies;
+ }
+
+ public UserBuddiesVisibility getUserBuddiesVisibility() {
+ return userBuddiesVisibility;
+ }
+
+ public ParticipationData getUserParticipation() {
+ return userParticipation;
+ }
+
+ public boolean isBuddiesVisible() {
+ return isBuddiesVisible;
+ }
+
+ public boolean isMembersVisible() {
+ return isMembersVisible;
+ }
+
+ public void setBuddiesVisible(boolean isBuddiesVisible) {
+ this.isBuddiesVisible = isBuddiesVisible;
+ }
+
+ public void setGroupMembers(SocialNetwork groupMembers) {
+ this.groupMembers = groupMembers;
+ }
+
+ public void setGroupRights(AccessRights groupRights) {
+ this.groupRights = groupRights;
+ }
+
+ public void setIsBuddiesVisible(boolean isBuddiesVisible) {
+ setBuddiesVisible(isBuddiesVisible);
+ }
+
+ public void setIsMembersVisible(boolean isMembersVisible) {
+ setMembersVisible(isMembersVisible);
+ }
+
+ public void setMembersVisible(boolean isMembersVisible) {
+ this.isMembersVisible = isMembersVisible;
+ }
+
+ public void setSocialNetworkVisibility(SocialNetworkVisibility socialNetworkVisibility) {
+ this.socialNetworkVisibility = socialNetworkVisibility;
+ }
+
+ public void setUserBuddies(UserBuddiesData userBuddies) {
+ this.userBuddies = userBuddies;
+ }
+
+ public void setUserBuddiesVisibility(UserBuddiesVisibility userBuddiesVisibility) {
+ this.userBuddiesVisibility = userBuddiesVisibility;
+ }
+
+ public void setUserParticipation(ParticipationData userParticipation) {
+ this.userParticipation = userParticipation;
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -24,6 +24,7 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
+import org.ourproject.kune.platf.server.domain.SocialNetworkData;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.sn.ParticipationData;
@@ -45,6 +46,8 @@
SocialNetwork get(User userLogged, Group group) throws DefaultException;
+ SocialNetworkData getSocialNetworkData(User userLogged, Group group);
+
SocialNetworkRequestResult requestToJoin(User user, Group inGroup) throws DefaultException;
void setAdminAsCollab(User userLogged, Group group, Group inGroup) throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -50,6 +50,8 @@
*/
User find(Long userId);
+ User findByShortname(String shortName);
+
UserBuddiesData getUserBuddies(String shortName);
User login(String nickOrEmail, String passwd);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -31,14 +31,20 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
+import org.ourproject.kune.platf.server.access.AccessRights;
import org.ourproject.kune.platf.server.access.AccessRightsService;
import org.ourproject.kune.platf.server.domain.AdmissionType;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.GroupListMode;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
+import org.ourproject.kune.platf.server.domain.SocialNetworkData;
+import org.ourproject.kune.platf.server.domain.SocialNetworkVisibility;
import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.domain.UserBuddiesVisibility;
import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
+import org.ourproject.kune.platf.server.manager.UserManager;
import org.ourproject.kune.platf.server.sn.ParticipationData;
+import org.ourproject.kune.platf.server.sn.UserBuddiesData;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -49,13 +55,15 @@
private final Group finder;
private final AccessRightsService accessRightsService;
+ private final UserManager userManager;
@Inject
public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final Group finder,
- final AccessRightsService accessRightsService) {
+ final AccessRightsService accessRightsService, final UserManager userManager) {
super(provider, SocialNetwork.class);
this.finder = finder;
this.accessRightsService = accessRightsService;
+ this.userManager = userManager;
}
public void acceptJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
@@ -147,6 +155,61 @@
return sn;
}
+ public SocialNetworkData getSocialNetworkData(User userLogged, Group group) {
+ SocialNetworkData socialNetData = new SocialNetworkData();
+ socialNetData.setGroupMembers(get(userLogged, group));
+ AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
+ socialNetData.setGroupRights(groupRights);
+ socialNetData.setUserParticipation(findParticipation(userLogged, group));
+ socialNetData.setGroupMembers(get(userLogged, group));
+ if (group.getGroupType().equals(GroupType.PERSONAL)) {
+ UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
+ User userGroup = userManager.findByShortname(group.getShortName());
+ socialNetData.setUserBuddies(userBuddies);
+ UserBuddiesVisibility buddiesVisibility = userGroup.getBuddiesVisibility();
+ socialNetData.setIsBuddiesVisible(true);
+ switch (buddiesVisibility) {
+ case anyone:
+ break;
+ case onlyyou:
+ if (userLogged == User.UNKNOWN_USER || !userLogged.getUserGroup().equals(group)) {
+ socialNetData.setIsBuddiesVisible(false);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
+ }
+ break;
+ case yourbuddies:
+ if (!userBuddies.contains(userLogged.getShortName())) {
+ socialNetData.setIsBuddiesVisible(false);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
+ }
+ break;
+ }
+ socialNetData.setUserBuddiesVisibility(buddiesVisibility);
+ } else {
+ SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
+ socialNetData.setIsMembersVisible(true);
+ switch (visibility) {
+ case anyone:
+ break;
+ case onlyadmins:
+ if (!groupRights.isAdministrable()) {
+ socialNetData.setIsMembersVisible(false);
+ socialNetData.setGroupMembers(SocialNetwork.EMPTY);
+ }
+ break;
+ case onlymembers:
+ if (!groupRights.isEditable()) {
+ socialNetData.setIsMembersVisible(false);
+ socialNetData.setGroupMembers(SocialNetwork.EMPTY);
+ }
+ break;
+ }
+ socialNetData.setSocialNetworkVisibility(visibility);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
+ }
+ return socialNetData;
+ }
+
public SocialNetworkRequestResult requestToJoin(final User userLogged, final Group inGroup)
throws DefaultException, UserMustBeLoggedException {
final SocialNetwork sn = inGroup.getSocialNetwork();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -85,14 +85,18 @@
return userId != null ? super.find(userId) : User.UNKNOWN_USER;
}
- public List<User> getAll() {
- return finder.getAll();
+ public User findByShortname(String shortName) {
+ return finder.getByShortName(shortName);
}
- public User getByShortName(final String shortName) {
+ public User findByShortName(final String shortName) {
return finder.getByShortName(shortName);
}
+ public List<User> getAll() {
+ return finder.getAll();
+ }
+
public UserBuddiesData getUserBuddies(final String shortName) {
// XEP-133 get roster by admin part is not implemented in openfire
// also access to the openfire db is not easy with hibernate (the use of
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -19,32 +19,20 @@
*/
package org.ourproject.kune.platf.server.rpc;
-import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
-import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkVisibilityDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
-import org.ourproject.kune.platf.client.dto.UserBuddiesVisibilityDTO;
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.AccessRights;
-import org.ourproject.kune.platf.server.access.AccessRightsService;
import org.ourproject.kune.platf.server.access.AccessRol;
import org.ourproject.kune.platf.server.auth.ActionLevel;
import org.ourproject.kune.platf.server.auth.Authenticated;
import org.ourproject.kune.platf.server.auth.Authorizated;
import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.SocialNetworkVisibility;
import org.ourproject.kune.platf.server.domain.User;
-import org.ourproject.kune.platf.server.domain.UserBuddiesVisibility;
import org.ourproject.kune.platf.server.manager.GroupManager;
import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
-import org.ourproject.kune.platf.server.manager.UserManager;
import org.ourproject.kune.platf.server.mapper.Mapper;
import com.google.inject.Inject;
@@ -60,25 +48,20 @@
private final GroupManager groupManager;
private final SocialNetworkManager socialNetworkManager;
private final Mapper mapper;
- private final UserManager userManager;
- private final AccessRightsService accessRightsService;
@Inject
- public SocialNetworkRPC(final Provider<UserSession> userSessionProvider, final UserManager userManager,
- final GroupManager groupManager, final SocialNetworkManager socialNetworkManager, final Mapper mapper,
- AccessRightsService accessRightsService) {
+ public SocialNetworkRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
+ final SocialNetworkManager socialNetworkManager, final Mapper mapper) {
this.userSessionProvider = userSessionProvider;
- this.userManager = userManager;
this.groupManager = groupManager;
this.socialNetworkManager = socialNetworkManager;
this.mapper = mapper;
- this.accessRightsService = accessRightsService;
}
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO acceptJoinGroup(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO acceptJoinGroup(final String hash, final StateToken groupToken,
final String groupToAcceptShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -91,7 +74,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO addAdminMember(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO addAdminMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -104,7 +87,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO addCollabMember(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO addCollabMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -117,7 +100,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO addViewerMember(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO addViewerMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -130,7 +113,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO deleteMember(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO deleteMember(final String hash, final StateToken groupToken,
final String groupToDeleleShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -143,7 +126,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO denyJoinGroup(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO denyJoinGroup(final String hash, final StateToken groupToken,
final String groupToDenyShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -157,7 +140,7 @@
// At least you can access as Viewer to the Group
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
@Transactional(type = TransactionType.READ_ONLY)
- public SocialNetworkResultDTO getSocialNetwork(final String hash, final StateToken groupToken)
+ public SocialNetworkDataDTO getSocialNetwork(final String hash, final StateToken groupToken)
throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
@@ -178,7 +161,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO setAdminAsCollab(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO setAdminAsCollab(final String hash, final StateToken groupToken,
final String groupToSetCollabShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -191,7 +174,7 @@
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
+ public SocialNetworkDataDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
final String groupToSetAdminShortName) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -203,7 +186,7 @@
@Authenticated
@Transactional(type = TransactionType.READ_WRITE)
- public SocialNetworkResultDTO unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
+ public SocialNetworkDataDTO unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
@@ -211,65 +194,10 @@
return generateResponse(userLogged, group);
}
- private SocialNetworkResultDTO generateResponse(final User userLogged, final Group group) {
- AccessRights groupRights = accessRightsService.get(userLogged, group.getSocialNetwork().getAccessLists());
- if (group.getGroupType().equals(GroupType.PERSONAL)) {
- UserBuddiesDataDTO userBuddies = getUserBuddies(group);
- SocialNetworkResultDTO result = new SocialNetworkResultDTO(getGroupMembers(userLogged, group),
- getParticipation(userLogged, group), userBuddies, mapper.map(groupRights, AccessRightsDTO.class));
- UserBuddiesVisibility buddiesVisibility = userLogged.getBuddiesVisibility();
- switch (buddiesVisibility) {
- case anyone:
- break;
- case onlyyou:
- if (userLogged == null || !userLogged.getUserGroup().equals(group)) {
- result.setUserBuddies(null);
- }
- break;
- case yourbuddies:
- if (!userBuddies.contains(userLogged.getShortName())) {
- result.setUserBuddies(null);
- }
- break;
- }
- result.setUserBuddiesVisibilityDTO(mapper.map(buddiesVisibility, UserBuddiesVisibilityDTO.class));
- return result;
- } else {
- SocialNetworkResultDTO result = new SocialNetworkResultDTO(getGroupMembers(userLogged, group),
- getParticipation(userLogged, group), UserBuddiesDataDTO.NO_BUDDIES, mapper.map(groupRights,
- AccessRightsDTO.class));
- SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
- switch (visibility) {
- case anyone:
- break;
- case onlyadmins:
- if (!groupRights.isAdministrable()) {
- result.setGroupMembers(null);
- }
- break;
- case onlymembers:
- if (!groupRights.isEditable()) {
- result.setGroupMembers(null);
- }
- break;
- }
- result.setSocialNetworkVisibilityDTO(mapper.map(visibility, SocialNetworkVisibilityDTO.class));
- return result;
- }
+ private SocialNetworkDataDTO generateResponse(final User userLogged, final Group group) {
+ return mapper.map(socialNetworkManager.getSocialNetworkData(userLogged, group), SocialNetworkDataDTO.class);
}
- private SocialNetworkDTO getGroupMembers(final User user, final Group group) throws DefaultException {
- return mapper.map(socialNetworkManager.get(user, group), SocialNetworkDTO.class);
- }
-
- private ParticipationDataDTO getParticipation(final User user, final Group group) throws DefaultException {
- return mapper.map(socialNetworkManager.findParticipation(user, group), ParticipationDataDTO.class);
- }
-
- private UserBuddiesDataDTO getUserBuddies(final Group group) {
- return mapper.map(userManager.getUserBuddies(group.getShortName()), UserBuddiesDataDTO.class);
- }
-
private UserSession getUserSession() {
return userSessionProvider.get();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -25,6 +25,8 @@
public class UserBuddiesData {
+ public static UserBuddiesData EMPTY = new UserBuddiesData();
+
private List<User> buddies;
int otherExternalBuddies;
@@ -33,6 +35,15 @@
buddies = new ArrayList<User>();
}
+ public boolean contains(String shortName) {
+ for (User buddie : buddies) {
+ if (buddie.getShortName().equals(shortName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public List<User> getBuddies() {
return buddies;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -24,6 +24,7 @@
import org.ourproject.kune.platf.server.access.AccessRights;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
+import org.ourproject.kune.platf.server.domain.SocialNetworkData;
import org.ourproject.kune.platf.server.sn.ParticipationData;
import org.ourproject.kune.platf.server.sn.UserBuddiesData;
@@ -31,12 +32,9 @@
private List<String> enabledTools;
private Group group;
- private SocialNetwork groupMembers;
- private AccessRights groupRights;
- private ParticipationData participation;
- private UserBuddiesData userBuddies;
private StateToken stateToken;
private String title;
+ private SocialNetworkData socialNetworkData;
public StateAbstract() {
}
@@ -50,17 +48,21 @@
}
public SocialNetwork getGroupMembers() {
- return groupMembers;
+ return socialNetworkData.getGroupMembers();
}
public AccessRights getGroupRights() {
- return groupRights;
+ return socialNetworkData.getGroupRights();
}
public ParticipationData getParticipation() {
- return participation;
+ return socialNetworkData.getUserParticipation();
}
+ public SocialNetworkData getSocialNetworkData() {
+ return socialNetworkData;
+ }
+
public StateToken getStateToken() {
return stateToken;
}
@@ -70,7 +72,7 @@
}
public UserBuddiesData getUserBuddies() {
- return userBuddies;
+ return socialNetworkData.getUserBuddies();
}
public void setEnabledTools(List<String> enabledTools) {
@@ -81,18 +83,10 @@
this.group = group;
}
- public void setGroupMembers(SocialNetwork groupMembers) {
- this.groupMembers = groupMembers;
+ public void setSocialNetworkData(SocialNetworkData socialNetworkData) {
+ this.socialNetworkData = socialNetworkData;
}
- public void setGroupRights(AccessRights groupRights) {
- this.groupRights = groupRights;
- }
-
- public void setParticipation(ParticipationData participation) {
- this.participation = participation;
- }
-
public void setStateToken(StateToken stateToken) {
this.stateToken = stateToken;
}
@@ -101,10 +95,6 @@
this.title = title;
}
- public void setUserBuddies(UserBuddiesData userBuddies) {
- this.userBuddies = userBuddies;
- }
-
@Override
public String toString() {
return "State[" + getStateToken() + "]";
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -32,7 +32,6 @@
import org.ourproject.kune.platf.server.manager.GroupManager;
import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
import org.ourproject.kune.platf.server.manager.TagManager;
-import org.ourproject.kune.platf.server.manager.UserManager;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -41,7 +40,6 @@
public class StateServiceDefault implements StateService {
private final AccessRightsService rightsService;
- private final UserManager userManager;
private final SocialNetworkManager socialNetworkManager;
private final GroupManager groupManager;
private final TagManager tagManager;
@@ -49,10 +47,9 @@
private final I18nTranslationService i18n;
@Inject
- public StateServiceDefault(UserManager userManager, GroupManager groupManager,
- SocialNetworkManager socialNetworkManager, ContentManager contentManager, TagManager tagManager,
- AccessRightsService rightsService, I18nTranslationService i18n) {
- this.userManager = userManager;
+ public StateServiceDefault(GroupManager groupManager, SocialNetworkManager socialNetworkManager,
+ ContentManager contentManager, TagManager tagManager, AccessRightsService rightsService,
+ I18nTranslationService i18n) {
this.groupManager = groupManager;
this.socialNetworkManager = socialNetworkManager;
this.contentManager = contentManager;
@@ -115,7 +112,6 @@
assert (group.getGroupType().equals(GroupType.PERSONAL));
StateNoContent state = new StateNoContent();
state.setGroup(group);
- state.setGroupRights(rightsService.get(userLogged, group.getAccessLists()));
state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
setSocialNetwork(state, userLogged, group);
state.setStateToken(group.getStateToken());
@@ -131,7 +127,6 @@
state.setToolName(container.getToolName());
state.setGroup(group);
state.setContainer(container);
- state.setGroupRights(rightsService.get(userLogged, group.getAccessLists()));
state.setContainerRights(rightsService.get(userLogged, container.getAccessLists()));
state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
state.setTagCloudResult(tagManager.getTagCloudResultByGroup(group));
@@ -139,10 +134,6 @@
}
private void setSocialNetwork(StateAbstract state, User userLogged, Group group) {
- state.setGroupMembers(socialNetworkManager.get(userLogged, group));
- state.setParticipation(socialNetworkManager.findParticipation(userLogged, group));
- if (group.getGroupType().equals(GroupType.PERSONAL)) {
- state.setUserBuddies(userManager.getUserBuddies(group.getShortName()));
- }
+ state.setSocialNetworkData(socialNetworkManager.getSocialNetworkData(userLogged, group));
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -27,7 +27,6 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarView;
import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.workspace.client.skel.SimpleToolbar;
import org.ourproject.kune.workspace.client.skel.SummaryPanel;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -54,7 +53,8 @@
VerticalPanel vp = new VerticalPanel();
avatar = new Image();
if (avatarUrl.equals(NOAVATAR)) {
- Images.App.getInstance().personAvatarDef().applyTo(avatar);
+ // Images.App.getInstance().personAvatarDef().applyTo(avatar);
+ avatar.setUrl("images/persons/person2-32.png");
} else {
avatar.setUrl(avatarUrl);
}
@@ -80,12 +80,15 @@
nick.setText(nickName);
}
}
+
+ public static final String NOT_PUBLIC = "The buddies of this user are not public";
private final MenuItemsContainer<UserSimpleDTO> menuItemsContainer;
private final FlowPanel flowPanel;
private final Label otherBuddiesLabel;
private final I18nTranslationService i18n;
private final ActionManager actionManager;
private final SimpleToolbar toolbar;
+ private final Label noBuddiesPublic;
public BuddiesSummaryPanel(final BuddiesSummaryPresenter presenter, final WorkspaceSkeleton ws,
I18nTranslationService i18n, ActionManager actionManager, ActionToolbarView<UserSimpleDTO> actionToolbarView) {
@@ -104,6 +107,9 @@
vp.add(toolbar);
super.add(vp);
addInSummary();
+ noBuddiesPublic = new Label(i18n.t(NOT_PUBLIC));
+ noBuddiesPublic.addStyleName("kune-Margin-7-trbl");
+ noBuddiesPublic.addStyleName("k-text-gray");
}
public void addBuddie(final UserSimpleDTO user, ActionItemCollection<UserSimpleDTO> actionCollection,
@@ -147,6 +153,10 @@
otherBuddiesLabel.setText(text);
}
+ public void showBuddiesNotVisible() {
+ flowPanel.add(noBuddiesPublic);
+ }
+
private void doAction(final ActionItem<UserSimpleDTO> actionItem) {
actionManager.doAction(actionItem);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -23,6 +23,7 @@
import org.ourproject.kune.chat.client.ChatEngine;
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.ActionAddCondition;
+import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
@@ -96,7 +97,7 @@
if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
view.clear();
UserBuddiesDataDTO userBuddies = state.getUserBuddies();
- if (userBuddies != UserBuddiesDataDTO.NO_BUDDIES) {
+ if (state.getSocialNetworkData().isBuddiesVisible()) {
List<UserSimpleDTO> buddies = userBuddies.getBuddies();
for (UserSimpleDTO user : buddies) {
String avatarUrl = user.hasLogo() ? fileDownUtilsProvider.get().getLogoImageUrl(
@@ -128,7 +129,7 @@
toolbar.attach();
view.show();
} else {
- view.hide();
+ view.showBuddiesNotVisible();
}
} else {
view.hide();
@@ -136,7 +137,7 @@
}
private void createSetBuddiesVisibilityAction(String textDescription, final UserBuddiesVisibilityDTO visibility) {
- ActionToolbarMenuDescriptor<UserSimpleDTO> showBuddies = new ActionToolbarMenuDescriptor<UserSimpleDTO>(
+ ActionToolbarMenuDescriptor<UserSimpleDTO> buddiesVisibilityAction = new ActionToolbarMenuDescriptor<UserSimpleDTO>(
AccessRolDTO.Administrator, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() {
public void onEvent(UserSimpleDTO parameter) {
userServiceAsync.get().setBuddiesVisibility(session.getUserHash(),
@@ -148,10 +149,10 @@
});
}
});
- showBuddies.setTextDescription(textDescription);
- showBuddies.setParentMenuTitle(i18n.t("Options"));
- showBuddies.setParentSubMenuTitle(i18n.t("Who can view your buddies list"));
- actionRegistry.addAction(showBuddies);
+ buddiesVisibilityAction.setTextDescription(textDescription);
+ buddiesVisibilityAction.setParentMenuTitle(i18n.t("Options"));
+ buddiesVisibilityAction.setParentSubMenuTitle(i18n.t("Who can view your buddies list"));
+ actionRegistry.addAction(buddiesVisibilityAction);
}
private void registerActions() {
@@ -169,6 +170,11 @@
return !session.getCurrentUserInfo().getShortName().equals(item.getShortName());
}
});
+ addAsBuddie.setEnableCondition(new ActionEnableCondition<UserSimpleDTO>() {
+ public boolean mustBeEnabled(UserSimpleDTO item) {
+ return !session.getCurrentUserInfo().getShortName().equals(item.getShortName());
+ }
+ });
actionRegistry.addAction(addAsBuddie);
final ActionMenuItemDescriptor<UserSimpleDTO> go = new ActionMenuItemDescriptor<UserSimpleDTO>(
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -40,4 +40,6 @@
void setOtherUsers(String text);
void show();
+
+ void showBuddiesNotVisible();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -36,16 +36,19 @@
import com.calclab.suco.client.listener.Listener;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.ui.Label;
import com.gwtext.client.widgets.BoxComponent;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
public class GroupMembersSummaryPanel extends SummaryPanel implements GroupMembersSummaryView {
+ public static final String NOT_PUBLIC = "The members of this group are not public";
// private static final int MAX_HEIGHT = 110;
private final GridMenuPanel<GroupDTO> gridMenuPanel;
private final I18nUITranslationService i18n;
private final GroupMembersSummaryPresenter presenter;
private final SimpleToolbar toolbar;
+ private final Label noMembersPublic;
public GroupMembersSummaryPanel(final GroupMembersSummaryPresenter presenter, final I18nUITranslationService i18n,
final WorkspaceSkeleton ws, ActionToolbarView<StateToken> actionToolbarView) {
@@ -67,6 +70,13 @@
gridMenuPanel.onDoubleClick(go);
gridMenuPanel.getBottomBar().setCls("k-blank-toolbar");
super.add(gridMenuPanel);
+
+ noMembersPublic = new Label(i18n.t(NOT_PUBLIC));
+ noMembersPublic.addStyleName("kune-Margin-7-trbl");
+ noMembersPublic.addStyleName("k-text-gray");
+ noMembersPublic.setVisible(false);
+ super.add(noMembersPublic);
+
toolbar = ((ActionToolbarPanel<StateToken>) actionToolbarView).getToolbar(ActionToolbarPosition.bottombar);
toolbar.setCleanStyle();
super.add(toolbar);
@@ -81,6 +91,7 @@
}
public void addItem(final GridItem<GroupDTO> gridItem) {
+ gridMenuPanel.setVisible(true);
gridMenuPanel.addItem(gridItem);
doLayoutIfNeeded();
}
@@ -89,6 +100,7 @@
public void clear() {
gridMenuPanel.removeAll();
toolbar.removeAll();
+ noMembersPublic.setVisible(false);
doLayoutIfNeeded();
}
@@ -116,4 +128,10 @@
public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
// super.setTheme(oldTheme, newTheme);
}
+
+ public void showMembersNotVisible() {
+ noMembersPublic.setVisible(true);
+ gridMenuPanel.setVisible(false);
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -33,7 +33,7 @@
import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkVisibilityDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
@@ -135,8 +135,8 @@
public void addCollab(final String groupShortName) {
Site.showProgressProcessing();
snServiceProvider.get().addCollabMember(session.getUserHash(), session.getCurrentState().getStateToken(),
- groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ groupShortName, new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member added as collaborator"));
stateManager.setSocialNetwork(result);
@@ -232,7 +232,12 @@
if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
view.setVisible(false);
} else {
- setGroupMembers(state.getGroupMembers(), state.getGroupRights());
+ if (state.getSocialNetworkData().isMembersVisible()) {
+ setGroupMembers(state.getGroupMembers(), state.getGroupRights());
+ } else {
+ view.clear();
+ view.showMembersNotVisible();
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryView.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryView.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -36,4 +36,6 @@
void setVisible(boolean visible);
+ void showMembersNotVisible();
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -28,7 +28,7 @@
import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
@@ -235,8 +235,8 @@
Site.showProgressProcessing();
snServiceProvider.get().setAdminAsCollab(session.getUserHash(),
session.getCurrentState().getStateToken(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Type of member changed"));
stateManager.setSocialNetwork(result);
@@ -250,8 +250,8 @@
Site.showProgressProcessing();
snServiceProvider.get().deleteMember(session.getUserHash(),
session.getCurrentState().getStateToken(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member removed"));
stateManager.reload();
@@ -273,8 +273,8 @@
Site.showProgressProcessing();
snServiceProvider.get().setCollabAsAdmin(session.getUserHash(),
session.getCurrentState().getStateToken(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Type of member changed"));
stateManager.setSocialNetwork(result);
@@ -288,8 +288,8 @@
Site.showProgressProcessing();
snServiceProvider.get().acceptJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member accepted"));
stateManager.setSocialNetwork(result);
@@ -303,8 +303,8 @@
Site.showProgressProcessing();
snServiceProvider.get().denyJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member rejected"));
stateManager.setSocialNetwork(result);
@@ -325,8 +325,8 @@
private void removeMemberAction(final GroupDTO groupDTO) {
Site.showProgressProcessing();
snServiceProvider.get().unJoinGroup(session.getUserHash(), new StateToken(groupDTO.getShortName()),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ public void onSuccess(final SocialNetworkDataDTO result) {
Site.hideProgress();
Site.info(i18n.t("Removed as member"));
stateManager.reload();
Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/main/resources/dozerBeanMapping.xml 2008-11-22 16:44:37 UTC (rev 962)
@@ -500,4 +500,13 @@
org.ourproject.kune.platf.server.sn.UserBuddiesData
</class-b>
</mapping>
+
+ <mapping>
+ <class-a>
+ org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO
+ </class-a>
+ <class-b>
+ org.ourproject.kune.platf.server.domain.SocialNetworkData
+ </class-b>
+ </mapping>
</mappings>
\ No newline at end of file
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -4,7 +4,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
@@ -31,13 +31,13 @@
@Test
public void testGetGroupMembersNotLogged() throws Exception {
- final SocialNetworkResultDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
+ final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
assertNotNull(sn.getGroupMembers());
}
@Test
public void testGetParticipationNotLogged() throws Exception {
- final SocialNetworkResultDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
+ final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
assertNotNull(sn.getUserParticipation());
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-11-22 04:29:34 UTC (rev 961)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-11-22 16:44:37 UTC (rev 962)
@@ -18,8 +18,11 @@
import org.ourproject.kune.platf.client.dto.GroupListDTO;
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.LinkDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkVisibilityDTO;
import org.ourproject.kune.platf.client.dto.StateContentDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.dto.UserBuddiesVisibilityDTO;
import org.ourproject.kune.platf.server.TestDomainHelper;
import org.ourproject.kune.platf.server.TestHelper;
import org.ourproject.kune.platf.server.access.AccessRights;
@@ -32,8 +35,14 @@
import org.ourproject.kune.platf.server.domain.GroupListMode;
import org.ourproject.kune.platf.server.domain.License;
import org.ourproject.kune.platf.server.domain.Revision;
+import org.ourproject.kune.platf.server.domain.SocialNetwork;
+import org.ourproject.kune.platf.server.domain.SocialNetworkData;
+import org.ourproject.kune.platf.server.domain.SocialNetworkVisibility;
import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.domain.UserBuddiesVisibility;
import org.ourproject.kune.platf.server.manager.GroupManager;
+import org.ourproject.kune.platf.server.sn.ParticipationData;
+import org.ourproject.kune.platf.server.sn.UserBuddiesData;
import org.ourproject.kune.platf.server.state.StateContent;
import com.google.inject.Inject;
@@ -230,6 +239,36 @@
}
@Test
+ public void testSnResultMap() {
+ Group group = new Group("test", "this is a test");
+ SocialNetwork sn = new SocialNetwork();
+ sn.addAdmin(group);
+ ParticipationData part = new ParticipationData();
+ part.setGroupsIsAdmin(sn.getAccessLists().getAdmins().getList());
+ UserBuddiesData budData = new UserBuddiesData();
+ ArrayList<User> buddies = new ArrayList<User>();
+ final User user = new User();
+ user.setShortName("usertest");
+ user.setUserGroup(new Group("test2", "this is test2"));
+ buddies.add(user);
+ budData.setBuddies(buddies);
+ SocialNetworkData snResult = new SocialNetworkData(SocialNetworkVisibility.onlymembers, sn, part,
+ UserBuddiesVisibility.onlyyou, budData, new AccessRights(false, false, true), true, true);
+ SocialNetworkDataDTO map = mapper.map(snResult, SocialNetworkDataDTO.class);
+ assertNotNull(map);
+ assertEquals(SocialNetworkVisibilityDTO.onlymembers, map.getSocialNetworkVisibility());
+ assertEquals(UserBuddiesVisibilityDTO.onlyyou, map.getUserBuddiesVisibility());
+ assertEquals("test", map.getGroupMembers().getAccessLists().getAdmins().getList().get(0).getShortName());
+ assertEquals("test", map.getUserParticipation().getGroupsIsAdmin().get(0).getShortName());
+ assertEquals("usertest", map.getUserBuddies().getBuddies().get(0).getShortName());
+ assertFalse(map.getGroupRights().isAdministrable());
+ assertFalse(map.getGroupRights().isEditable());
+ assertTrue(map.getGroupRights().isVisible());
+ assertTrue(map.isMembersVisible());
+ assertTrue(map.isBuddiesVisible());
+ }
+
+ @Test
public void testStateTokenInStateMap() {
final StateToken stateToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "2");
final StateToken stateTokenMapped = mapper.map(stateToken, StateToken.class);
More information about the kune-commits
mailing list