r834 - in trunk: img src/main/java/org/ourproject/kune/app/client src/main/java/org/ourproject/kune/app/public/css src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/platf/client/app 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/services src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/ku
Author: vjrj Date: 2008-08-08 06:20:12 +0200 (Fri, 08 Aug 2008) New Revision: 834 Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java Removed: trunk/img/emite-groups-logo.svg trunk/img/emite-groups.png trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 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/app/public/css/workspace.css trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java trunk/src/main/resources/dozerBeanMapping.xml trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java Log: Complete - task 37: Resolve SN Rights problems Enums use in UI. Some SN adjusts. Deleted: trunk/img/emite-groups-logo.svg =================================================================== --- trunk/img/emite-groups-logo.svg 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/img/emite-groups-logo.svg 2008-08-08 04:20:12 UTC (rev 834) @@ -1,125 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://web.resource.org/cc/" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="42" - height="42" - id="svg2533" - sodipodi:version="0.32" - inkscape:version="0.45.1" - version="1.0" - inkscape:export-filename="/Users/vjrj/Desktop/emite-groups.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90" - sodipodi:docbase="/Users/vjrj/Desktop" - sodipodi:docname="emite-groups-logo.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape"> - <defs - id="defs2535" /> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="9.45" - inkscape:cx="29.482892" - inkscape:cy="20" - inkscape:current-layer="layer1" - showgrid="true" - inkscape:grid-bbox="true" - inkscape:document-units="px" - width="42px" - height="42px" - inkscape:window-width="756" - inkscape:window-height="581" - inkscape:window-x="354" - inkscape:window-y="104" /> - <metadata - id="metadata2538"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <text - xml:space="preserve" - style="font-size:23.88686371px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem" - x="-0.14885554" - y="28.014141" - id="text2516" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2518" - x="-0.14885554" - y="28.014141" - dy="0 0 -0.57697296"><tspan - style="fill:#ff6600" - id="tspan2520">((</tspan>e<tspan - style="fill:#ff6600" - id="tspan2522" - dy="0.57697296">))</tspan></tspan></text> - <g - id="g2551" - transform="matrix(0.126788,0,0,0.126788,107.24045,44.350445)"> - <g - transform="matrix(1.7831728,0,0,1.7831728,-79.227654,-1724.5839)" - id="g2524"> - <text - xml:space="preserve" - style="font-size:49.60492325px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#784421;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem" - x="-219.35106" - y="817.05505" - id="text2526" - sodipodi:linespacing="89.999998%" - transform="scale(0.9684286,1.0326006)"><tspan - sodipodi:role="line" - x="-219.35106" - y="817.05505" - id="tspan2528">emite</tspan></text> - <text - xml:space="preserve" - style="font-size:23.32044411px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#784421;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem" - x="-217.47432" - y="839.24841" - id="text2530" - sodipodi:linespacing="89.999998%" - transform="scale(0.9684286,1.0326006)"><tspan - sodipodi:role="line" - x="-217.47432" - y="839.24841" - id="tspan2532">xmpp & gwt</tspan></text> - </g> - <text - inkscape:export-ydpi="32.508678" - inkscape:export-xdpi="32.508678" - inkscape:export-filename="/home/vjrj/proyectos/ourproject.org/kune/dev/emite/emite/img/emite-ui.png" - transform="scale(0.9684286,1.0326006)" - sodipodi:linespacing="89.999998%" - id="text2534" - y="-133.38048" - x="-471.8595" - style="font-size:34.96242523px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem" - xml:space="preserve"><tspan - id="tspan2536" - y="-133.38048" - x="-471.8595" - sodipodi:role="line">ui application</tspan></text> - </g> - </g> -</svg> Deleted: trunk/img/emite-groups.png =================================================================== (Binary files differ) Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-08-08 04:20:12 UTC (rev 834) @@ -46,6 +46,5 @@ public void onModuleLoadCont() { Kune.create(); - // RootPanel.getBodyElement().setClassName("kunebody"); } } 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-08 04:20:12 UTC (rev 834) @@ -2699,25 +2699,9 @@ background-image: url(img/language.gif) !important; } -.chat-icon { - background-image: url(img/chat.gif) !important; -} -.group-icon { - background-image: url(img/group.gif) !important; -} -.user-icon { - background-image: url(img/user.gif) !important; -} -.userf-icon { - background-image: url(img/userf.gif) !important; -} - - - - /* RTE Text editor */ .kune-TexEditorPanel-TextArea { margin: 3px; @@ -3484,13 +3468,13 @@ } .k-toolselectoritem-notsel a { - color: blue; + color: #0000FF; padding: 0 9px; text-decoration: none; } .k-toolselectoritem-notsel a:hover { - text-decoration: none; + text-decoration: underline; } 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-08-08 04:20:12 UTC (rev 834) @@ -618,11 +618,11 @@ } .k-toolselectoritem-notsel a { - color: blue; + color: #0000FF; padding: 0 9px; text-decoration: none; } .k-toolselectoritem-notsel a:hover { - text-decoration: none; + text-decoration: underline; } Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-08 04:20:12 UTC (rev 834) @@ -790,19 +790,3 @@ .i18n-icon { background-image: url(img/language.gif) !important; } - -.chat-icon { - background-image: url(img/chat.gif) !important; -} - -.group-icon { - background-image: url(img/group.gif) !important; -} - -.user-icon { - background-image: url(img/user.gif) !important; -} - -.userf-icon { - background-image: url(img/userf.gif) !important; -} Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-08 04:20:12 UTC (rev 834) @@ -35,7 +35,6 @@ public class ChatClientNewModule extends AbstractModule { public ChatClientNewModule() { - super(ChatClientNewModule.class); } @Override Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-08 04:20:12 UTC (rev 834) @@ -65,7 +65,7 @@ initData.getChatRoomHost()); chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws); groupMembersSummaryProvider.get().addUserOperation( - new MenuItem<GroupDTO>("images/chat-basic.gif", i18n.t("Start a chat with this member"), + new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"), new Slot<GroupDTO>() { public void onEvent(final GroupDTO group) { emiteUIDialog.show(); Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-08 04:20:12 UTC (rev 834) @@ -82,7 +82,8 @@ if (traybarButton == null) { traybarButton = new ToolbarButton(); traybarButton.setTooltip(i18n.t("Show/hide the chat window")); - traybarButton.setIcon("images/emite-chat.gif"); + // traybarButton.setIcon("images/emite-chat.gif"); + traybarButton.setIcon("images/e-icon.gif"); traybarButton.addListener(new ButtonListenerAdapter() { @Override public void onClick(final Button button, final EventObject e) { @@ -92,9 +93,18 @@ emiteDialog.show(); } } - }); ws.getSiteTraybar().addButton(traybarButton); + emiteDialog.onChatAttended(new Slot<String>() { + public void onEvent(final String parameter) { + traybarButton.setIcon("images/e-icon.gif"); + } + }); + emiteDialog.onChatUnattendedWithActivity(new Slot<String>() { + public void onEvent(final String parameter) { + traybarButton.setIcon("images/e-icon-a.gif"); + } + }); } emiteDialog.setEnableStatusUI(true); emiteDialog.hide(); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-08 04:20:12 UTC (rev 834) @@ -45,7 +45,6 @@ public class DocumentClientNewModule extends AbstractModule { public DocumentClientNewModule() { - super(DocumentClientNewModule.class); } @Override Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-08 04:20:12 UTC (rev 834) @@ -24,7 +24,6 @@ import java.util.HashMap; import org.ourproject.kune.platf.client.dispatch.ActionEvent; -import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.tool.ClientTool; import com.calclab.suco.client.signal.Slot0; @@ -33,7 +32,7 @@ ClientTool getTool(String toolName); - void init(StateManager stateManager, HashMap<String, ClientTool> tools); + void init(HashMap<String, ClientTool> tools); void onApplicationStart(Slot0 slot); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-08 04:20:12 UTC (rev 834) @@ -32,7 +32,6 @@ import org.ourproject.kune.platf.client.rpc.SiteServiceAsync; import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.tool.ClientTool; import org.ourproject.kune.platf.client.ui.WindowUtils; import org.ourproject.kune.platf.client.utils.PrefetchUtilities; @@ -54,7 +53,6 @@ private final Session session; private final Signal0 onApplicationStart; private final Signal0 onApplicationStop; - private StateManager stateManager; public ApplicationDefault(final Session session, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) { this.session = session; @@ -76,8 +74,7 @@ return tools.get(toolName); } - public void init(final StateManager stateManager, final HashMap<String, ClientTool> tools) { - this.stateManager = stateManager; + public void init(final HashMap<String, ClientTool> tools) { this.tools = tools; } @@ -127,7 +124,6 @@ checkChatDomain(initData.getChatDomain()); session.setInitData(initData); session.setCurrentUserInfo(initData.getUserInfo()); - stateManager.reload(); RootPanel.get("kuneinitialcurtain").setVisible(false); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-08-08 04:20:12 UTC (rev 834) @@ -20,20 +20,16 @@ package org.ourproject.kune.platf.client.dto; + import com.google.gwt.user.client.rpc.IsSerializable; public class GroupDTO implements IsSerializable { - public static final String ORGANIZATION = "ORGANIZATION"; - public static final String COMMUNITY = "COMMUNITY"; - public static final String PROJECT = "PROJECT"; - public static final String ORPHANED_PROJECT = "ORPHANED_PROJECT"; - public static final String PERSONAL = "PERSONAL"; private Long id; private String shortName; private String longName; private String publicDesc; - private String type; + private GroupType type; private String defaultToolName; private Long defaultFolderId; private Long defaultContentId; @@ -42,10 +38,10 @@ private String tags; public GroupDTO() { - this(null, null, null, ORGANIZATION); + this(null, null, null, GroupType.ORGANIZATION); } - public GroupDTO(final String shortName, final String longName, final String publicDesc, final String type) { + public GroupDTO(final String shortName, final String longName, final String publicDesc, final GroupType type) { this.shortName = shortName; this.longName = longName; this.publicDesc = publicDesc; @@ -158,7 +154,7 @@ return tags; } - public String getType() { + public GroupType getType() { return type; } @@ -217,7 +213,7 @@ this.tags = tags; } - public void setType(final String type) { + public void setType(final GroupType type) { this.type = type; } Copied: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-05 01:27:25 UTC (rev 827) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,26 @@ +/* + * + * 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 enum GroupType implements IsSerializable { + ORGANIZATION, COMMUNITY, PROJECT, ORPHANED_PROJECT, PERSONAL +} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-08-08 04:20:12 UTC (rev 834) @@ -23,10 +23,6 @@ public class SocialNetworkDTO implements IsSerializable { - public static final String REQ_JOIN_WAITING_MODERATION = "MODERATED"; - public static final String REQ_JOIN_ACEPTED = "ACEPTED"; - public static final String REQ_JOIN_DENIED = "DENIED"; - AccessListsDTO accessLists; GroupListDTO pendingCollaborators; @@ -40,14 +36,14 @@ return accessLists; } - public void setAccessLists(final AccessListsDTO accessLists) { - this.accessLists = accessLists; - } - public GroupListDTO getPendingCollaborators() { return pendingCollaborators; } + public void setAccessLists(final AccessListsDTO accessLists) { + this.accessLists = accessLists; + } + public void setPendingCollaborators(final GroupListDTO pendingCollaborators) { this.pendingCollaborators = pendingCollaborators; } Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,7 @@ +package org.ourproject.kune.platf.client.dto; + +import com.google.gwt.user.client.rpc.IsSerializable; + +public enum SocialNetworkRequestResult implements IsSerializable { + accepted, denied, moderated +} 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java 2008-08-08 04:20:12 UTC (rev 834) @@ -21,6 +21,7 @@ import org.ourproject.kune.platf.client.dto.ParticipationDataDTO; import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; +import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult; import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO; import org.ourproject.kune.platf.client.errors.DefaultException; @@ -50,7 +51,7 @@ ParticipationDataDTO getParticipation(String hash, String groupShortName) throws DefaultException; - String requestJoinGroup(String hash, String groupShortName) throws DefaultException; + SocialNetworkRequestResult requestJoinGroup(String hash, String groupShortName) throws DefaultException; SocialNetworkResultDTO setAdminAsCollab(String hash, String groupShortName, String groupToSetCollabShortName) throws DefaultException; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-08-08 04:20:12 UTC (rev 834) @@ -24,12 +24,13 @@ import com.calclab.suco.client.container.Container; import com.calclab.suco.client.container.DelegatedContainer; import com.calclab.suco.client.modules.Module; +import com.calclab.suco.client.modules.ModuleManager.ProviderRegisterStrategy; public class Kune extends DelegatedContainer { public static Kune create(final Module... modules) { final Container container = Suco.create(modules); - Suco.add(container, new KuneModule()); + Suco.install(container, ProviderRegisterStrategy.registerOnlyIfNotRegistered, new KuneModule()); return container.getInstance(Kune.class); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-08 04:20:12 UTC (rev 834) @@ -37,6 +37,7 @@ import com.calclab.suco.client.signal.Signal0; import com.calclab.suco.client.signal.Slot0; import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException; public class KuneErrorHandler { private final Session session; @@ -83,6 +84,8 @@ logException(e); Site.error(i18n.t("Group not found")); stateManagerProvider.get().gotoToken(""); + } catch (final IncompatibleRemoteServiceException e) { + Site.error(i18n.t("Your browser is outdated from the server software. Please reload this page.")); } catch (final ContentNotFoundException e) { logException(e); Site.error(i18n.t("Content not found")); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 04:20:12 UTC (rev 834) @@ -133,6 +133,7 @@ import com.calclab.emiteuimodule.client.EmiteUIModule; import com.calclab.suco.client.container.Container; import com.calclab.suco.client.modules.AbstractModule; +import com.calclab.suco.client.modules.ModuleManager.ProviderRegisterStrategy; import com.calclab.suco.client.provider.Factory; import com.calclab.suco.client.scopes.SingletonScope; import com.calclab.suco.client.signal.Slot; @@ -143,9 +144,6 @@ import com.google.gwt.user.client.rpc.ServiceDefTarget; public class KuneModule extends AbstractModule { - public KuneModule() { - super(KuneModule.class); - } @Override public void onLoad() { @@ -594,7 +592,8 @@ } }); - load(new EmiteUIModule(), new DocumentClientNewModule(), new ChatClientNewModule()); + install(ProviderRegisterStrategy.registerOnlyIfNotRegistered, new EmiteUIModule(), + new DocumentClientNewModule(), new ChatClientNewModule()); $(SitePublicSpaceLink.class); $(SiteMessage.class); @@ -632,7 +631,7 @@ }); final KunePlatform platform = $(KunePlatform.class); - $(Application.class).init($(StateManager.class), platform.getIndexedTools()); + $(Application.class).init(platform.getIndexedTools()); $(Application.class).subscribeActions(platform.getActions()); $(Application.class).start(); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-08 04:20:12 UTC (rev 834) @@ -67,7 +67,7 @@ panel.add(widget); if (panel.isRendered()) { panel.syncSize(); - panel.doLayout(); + panel.doLayout(false); } doLayoutIfNeeded(); } @@ -127,4 +127,8 @@ add(panel, widget); doLayoutIfNeeded(); } + + public void syncSize() { + mainPanel.syncSize(); + } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-08 04:20:12 UTC (rev 834) @@ -22,8 +22,10 @@ import com.gwtext.client.dd.DropTarget; import com.gwtext.client.dd.DropTargetConfig; import com.gwtext.client.util.Format; +import com.gwtext.client.widgets.Component; import com.gwtext.client.widgets.Panel; import com.gwtext.client.widgets.Toolbar; +import com.gwtext.client.widgets.event.BoxComponentListenerAdapter; import com.gwtext.client.widgets.grid.CellMetadata; import com.gwtext.client.widgets.grid.ColumnConfig; import com.gwtext.client.widgets.grid.ColumnModel; @@ -107,6 +109,12 @@ } menuMap = new HashMap<String, GridMenu<T>>(); recordMap = new HashMap<T, Record>(); + super.addListener(new BoxComponentListenerAdapter() { + @Override + public void onRender(final Component component) { + // Log.warn("Render grid -------------------"); + } + }); createGrid(emptyText, gridDragConfiguration, gridDropConfiguration); } @@ -168,6 +176,7 @@ public void doLayout(final boolean shallow) { // Grid rendered problems with shallow false super.doLayout(); + grid.doLayout(); } public void doLayoutIfNeeded() { @@ -195,9 +204,7 @@ } public void removeAll() { - if (grid != null) { - store.removeAll(); - } + store.removeAll(); recordMap.clear(); menuMap.clear(); } @@ -223,12 +230,10 @@ @Override public void setWidth(final int width) { - if (grid != null) { - // grid.setWidth(width - 27); - grid.setWidth(width - 27); - // super.setWidth(width - 11); - doLayoutIfNeeded(); - } + // grid.setWidth(width - 27); + grid.setWidth(width - 27); + // super.setWidth(width - 11); + doLayoutIfNeeded(); } public void sort() { @@ -455,4 +460,5 @@ final Record record = store.getRecordAt(rowIndex); onDoubleClick.fire(record.getAsString(ID)); } + } Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,44 @@ +/* + * + * 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.server.auth; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import org.ourproject.kune.platf.server.access.AccessType; + +import com.google.inject.BindingAnnotation; + +/** + * Use in RPC methods, for instance: <code> + * Authorizated(authLevelRequired = AuthLevelRequired.COLLAB, checkContent = true) </code> + * + * The first parameter in the method must be the userHash, the second parameter + * must be a content token + * + */ +@BindingAnnotation +@Retention(RetentionPolicy.RUNTIME) +public @interface ContentAuthorizated { + + AccessType accessTypeRequired() default AccessType.READ; + +} Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,85 @@ +/* + * + * 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.server.auth; + +import javax.persistence.NoResultException; + +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.errors.AccessViolationException; +import org.ourproject.kune.platf.client.errors.ContentNotFoundException; +import org.ourproject.kune.platf.server.UserSession; +import org.ourproject.kune.platf.server.access.AccessService; +import org.ourproject.kune.platf.server.access.AccessType; +import org.ourproject.kune.platf.server.domain.Content; +import org.ourproject.kune.platf.server.domain.Group; +import org.ourproject.kune.platf.server.domain.User; +import org.ourproject.kune.platf.server.manager.GroupManager; + +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class ContentAuthorizatedMethodInterceptor implements MethodInterceptor { + + @Inject + Provider<UserSession> userSessionProvider; + @Inject + Provider<GroupManager> groupManagerProvider; + @Inject + Provider<AccessService> accessServiceProvider; + + public Object invoke(final MethodInvocation invocation) throws Throwable { + final Object[] arguments = invocation.getArguments(); + final String groupShortName = (String) arguments[1]; + + final UserSession userSession = userSessionProvider.get(); + final GroupManager groupManager = groupManagerProvider.get(); + final AccessService accessService = accessServiceProvider.get(); + + final ContentAuthorizated authoAnnotation = invocation.getStaticPart().getAnnotation(ContentAuthorizated.class); + final AccessType accessType = authoAnnotation.accessTypeRequired(); + + final User user = userSession.getUser(); + Group group = Group.NO_GROUP; + try { + group = groupManager.findByShortName(groupShortName); + } catch (final NoResultException e) { + // continue, and check later + } + final StateToken contentToken = (StateToken) arguments[2]; + final Long contentId = parseId(contentToken.getDocument()); + + final Content content = accessService.accessToContent(contentId, user, accessType); + if (!content.getContainer().getOwner().equals(group)) { + throw new AccessViolationException(); + } + final Object result = invocation.proceed(); + return result; + } + + private Long parseId(final String documentId) throws ContentNotFoundException { + try { + return new Long(documentId); + } catch (final NumberFormatException e) { + throw new ContentNotFoundException(); + } + } +} Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-08-08 04:20:12 UTC (rev 834) @@ -42,6 +42,7 @@ import org.hibernate.search.annotations.Store; import org.hibernate.validator.Length; import org.hibernate.validator.Pattern; +import org.ourproject.kune.platf.client.dto.GroupType; import com.google.inject.name.Named; import com.wideplay.warp.persist.dao.Finder; Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-08 04:20:12 UTC (rev 834) @@ -1,24 +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.server.domain; - -public enum GroupType { - ORGANIZATION, COMMUNITY, PROJECT, ORPHANED_PROJECT, PERSONAL -} Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-08-08 04:20:12 UTC (rev 834) @@ -24,11 +24,11 @@ import javax.persistence.NoResultException; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException; import org.ourproject.kune.platf.server.content.ContentManager; import org.ourproject.kune.platf.server.domain.Content; import org.ourproject.kune.platf.server.domain.Group; -import org.ourproject.kune.platf.server.domain.GroupType; import org.ourproject.kune.platf.server.domain.I18nCountry; import org.ourproject.kune.platf.server.domain.I18nLanguage; import org.ourproject.kune.platf.server.domain.I18nTranslation; 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-08-08 04:20:12 UTC (rev 834) @@ -20,6 +20,7 @@ package org.ourproject.kune.platf.server.manager; +import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult; import org.ourproject.kune.platf.client.errors.AccessViolationException; import org.ourproject.kune.platf.client.errors.DefaultException; import org.ourproject.kune.platf.server.ParticipationData; @@ -47,7 +48,7 @@ ParticipationData findParticipation(User user, Group group) throws DefaultException; - String requestToJoin(User user, Group inGroup) throws DefaultException; + 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/impl/GroupManagerDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-08 04:20:12 UTC (rev 834) @@ -30,6 +30,7 @@ import org.apache.lucene.queryParser.MultiFieldQueryParser; import org.apache.lucene.queryParser.ParseException; import org.apache.lucene.search.Query; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.errors.AccessViolationException; import org.ourproject.kune.platf.client.errors.EmailAddressInUseException; import org.ourproject.kune.platf.client.errors.GroupNameInUseException; @@ -38,7 +39,6 @@ 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.GroupType; import org.ourproject.kune.platf.server.domain.License; import org.ourproject.kune.platf.server.domain.SocialNetwork; import org.ourproject.kune.platf.server.domain.User; 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-08 04:20:12 UTC (rev 834) @@ -26,7 +26,8 @@ import javax.persistence.EntityManager; -import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; +import org.ourproject.kune.platf.client.dto.GroupType; +import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult; import org.ourproject.kune.platf.client.errors.AccessViolationException; import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException; import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException; @@ -38,7 +39,6 @@ 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.GroupType; import org.ourproject.kune.platf.server.domain.SocialNetwork; import org.ourproject.kune.platf.server.domain.User; import org.ourproject.kune.platf.server.manager.SocialNetworkManager; @@ -171,7 +171,7 @@ return new ParticipationData(groupsIsAdmin, groupsIsCollab); } - public String requestToJoin(final User user, final Group inGroup) throws DefaultException, + public SocialNetworkRequestResult requestToJoin(final User user, final Group inGroup) throws DefaultException, UserMustBeLoggedException { final SocialNetwork sn = inGroup.getSocialNetwork(); if (!User.isKnownUser(user)) { @@ -185,7 +185,7 @@ checkGroupIsNotAlreadyAMember(userGroup, sn); if (isModerated(admissionType)) { sn.addPendingCollaborator(userGroup); - return SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION; + return SocialNetworkRequestResult.moderated; } else if (isOpen(admissionType)) { if (inGroup.getType().equals(GroupType.ORPHANED_PROJECT)) { sn.addAdmin(userGroup); @@ -195,9 +195,9 @@ } else { sn.addCollaborator(userGroup); } - return SocialNetworkDTO.REQ_JOIN_ACEPTED; + return SocialNetworkRequestResult.accepted; } else if (isClosed(admissionType)) { - return SocialNetworkDTO.REQ_JOIN_DENIED; + return SocialNetworkRequestResult.denied; } else { throw new DefaultException("State not expected in SocialNetworkManagerDefault class"); } @@ -233,7 +233,12 @@ if (sn.isAdmin(groupToUnJoin)) { if (sn.getAccessLists().getAdmins().getList().size() == 1) { - throw new LastAdminInGroupException(); + if (sn.getAccessLists().getEditors().getList().size() > 0) { + throw new LastAdminInGroupException(); + } else { + inGroup.setType(GroupType.ORPHANED_PROJECT); + inGroup.setAdmissionType(AdmissionType.Open); + } } sn.removeAdmin(groupToUnJoin); } else if (sn.isCollab(groupToUnJoin)) { Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java 2008-08-08 04:20:12 UTC (rev 834) @@ -1,66 +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.server.mapper; - -import java.text.MessageFormat; -import java.util.HashMap; - -import net.sf.dozer.util.mapping.MappingException; -import net.sf.dozer.util.mapping.converters.CustomConverter; - -import org.ourproject.kune.platf.server.domain.GroupType; - -public class GroupTypeConverter implements CustomConverter { - private final HashMap<String, GroupType> stringToEnum; - private final HashMap<GroupType, String> enumToString; - - public GroupTypeConverter() { - this.stringToEnum = new HashMap<String, GroupType>(); - this.enumToString = new HashMap<GroupType, String>(); - add(GroupType.PERSONAL); - add(GroupType.PROJECT); - add(GroupType.COMMUNITY); - add(GroupType.ORGANIZATION); - add(GroupType.ORPHANED_PROJECT); - } - - @SuppressWarnings("unchecked") - public Object convert(final Object destination, final Object source, final Class destinationClass, - final Class sourceClass) { - if (source == null) { - return null; - } else if (sourceClass.equals(String.class) && destinationClass.equals(GroupType.class)) { - return stringToEnum.get(source); - } else if (sourceClass.equals(GroupType.class) && destinationClass.equals(String.class)) { - return enumToString.get(source); - } else { - final String msg = MessageFormat.format("couldn't map {0} ({1}) to {2} ({3})", source, sourceClass, - destination, destinationClass); - throw new MappingException(msg); - } - - } - - private void add(final GroupType mode) { - enumToString.put(mode, mode.toString()); - stringToEnum.put(mode.toString(), mode); - } - -} 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-08-08 04:20:12 UTC (rev 834) @@ -21,6 +21,7 @@ import org.ourproject.kune.platf.client.dto.ParticipationDataDTO; import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; +import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult; import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO; import org.ourproject.kune.platf.client.errors.DefaultException; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; @@ -160,7 +161,8 @@ @Authenticated @Transactional(type = TransactionType.READ_WRITE) - public String requestJoinGroup(final String hash, final String groupShortName) throws DefaultException { + public SocialNetworkRequestResult requestJoinGroup(final String hash, final String groupShortName) + throws DefaultException { final UserSession userSession = getUserSession(); final User user = userSession.getUser(); final Group group = groupManager.findByShortName(groupShortName); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-08-08 04:20:12 UTC (rev 834) @@ -21,6 +21,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.errors.GroupNameInUseException; @@ -151,15 +152,15 @@ view.setMessage(message, type); } - private String getTypeOfGroup() { + private GroupType getTypeOfGroup() { if (view.isProject()) { - return GroupDTO.PROJECT; + return GroupType.PROJECT; } else if (view.isOrphanedProject()) { - return GroupDTO.ORPHANED_PROJECT; + return GroupType.ORPHANED_PROJECT; } else if (view.isOrganization()) { - return GroupDTO.ORGANIZATION; + return GroupType.ORGANIZATION; } else { - return GroupDTO.COMMUNITY; + return GroupType.COMMUNITY; } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java 2008-08-08 04:20:12 UTC (rev 834) @@ -49,12 +49,12 @@ private static final int PAGINATION_SIZE = 10; private final EntityLiveSearcherPresenter presenter; private BasicDialog dialog; - private final int searchType; + private final EntityLiveSearcherType searchType; private FormPanel searchForm; private final I18nTranslationService i18n; - public EntityLiveSearcherPanel(final EntityLiveSearcherPresenter presenter, final int searchType, - final I18nTranslationService i18n) { + public EntityLiveSearcherPanel(final EntityLiveSearcherPresenter presenter, + final EntityLiveSearcherType searchType, final I18nTranslationService i18n) { this.presenter = presenter; this.searchType = searchType; this.i18n = i18n; @@ -77,9 +77,9 @@ dialog.center(); } - private void createGroupSearchDialog(final int searchType) { + private void createGroupSearchDialog(final EntityLiveSearcherType searchType) { String title; - if (searchType == EntityLiveSearcherView.SEARCH_GROUPS) { + if (searchType.equals(EntityLiveSearcherType.groups)) { title = i18n.t("Search existing users and groups"); } else { title = i18n.t("Search existing users"); @@ -90,10 +90,10 @@ DataProxy dataProxy = null; switch (searchType) { - case EntityLiveSearcherView.SEARCH_GROUPS: + case groups: dataProxy = new HttpProxy("/kune/json/GroupJSONService/search", Connection.POST); break; - case EntityLiveSearcherView.SEARCH_USERS: + case users: dataProxy = new HttpProxy("/kune/json/UserJSONService/search", Connection.POST); break; default: Added: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,5 @@ +package org.ourproject.kune.workspace.client.search; + +public enum EntityLiveSearcherType { + groups, users +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java 2008-08-08 04:20:12 UTC (rev 834) @@ -23,13 +23,10 @@ public interface EntityLiveSearcherView extends View { - final public static int SEARCH_GROUPS = 1; - final public static int SEARCH_USERS = 2; + void center(); - void show(); - void hide(); - void center(); + void show(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java 2008-08-08 04:20:12 UTC (rev 834) @@ -24,7 +24,7 @@ public class GroupLiveSearchPanel extends EntityLiveSearcherPanel { public GroupLiveSearchPanel(final EntityLiveSearcherPresenter presenter, final I18nTranslationService i18n) { - super(presenter, EntityLiveSearcherView.SEARCH_GROUPS, i18n); + super(presenter, EntityLiveSearcherType.groups, i18n); } } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java 2008-08-08 04:20:12 UTC (rev 834) @@ -24,7 +24,7 @@ public class UserLiveSearcherPanel extends EntityLiveSearcherPanel { public UserLiveSearcherPanel(final EntityLiveSearcherPresenter presenter, final I18nTranslationService i18n) { - super(presenter, EntityLiveSearcherView.SEARCH_USERS, i18n); + super(presenter, EntityLiveSearcherType.users, i18n); } } 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-08 04:20:12 UTC (rev 834) @@ -5,6 +5,7 @@ import org.ourproject.kune.platf.client.dto.AccessListsDTO; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.dto.LinkDTO; import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO; @@ -173,7 +174,7 @@ } private void setState(final StateDTO state) { - if (state.getGroup().getType().equals(GroupDTO.PERSONAL)) { + if (state.getGroup().getType().equals(GroupType.PERSONAL)) { view.setVisible(false); } else { setGroupMembers(state.getGroupMembers(), state.getGroupRights()); 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-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 04:20:12 UTC (rev 834) @@ -2,7 +2,8 @@ import org.ourproject.kune.platf.client.dto.AccessRightsDTO; import org.ourproject.kune.platf.client.dto.GroupDTO; -import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; +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.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; @@ -106,16 +107,18 @@ session.getCurrentState().getGroup().getShortName(), new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { Site.hideProgress(); - final String resultType = (String) result; - if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) { + final SocialNetworkRequestResult resultType = (SocialNetworkRequestResult) result; + switch (resultType) { + case accepted: Site.info(i18n.t("You are now member of this group")); stateManager.reload(); - } - if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) { + break; + case denied: Site.important(i18n.t("Sorry this is a closed group")); - } - if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) { + break; + case moderated: Site.info(i18n.t("Requested. Waiting for admins decision")); + break; } } }); @@ -133,20 +136,20 @@ private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) { final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group); final String longName = group.getLongName(); - final String toolTip = i18n.t(group.getType().equals(GroupDTO.PERSONAL) ? "User nickname: [%s]" + final String toolTip = i18n.t(group.getType().equals(GroupType.PERSONAL) ? "User nickname: [%s]" : "Group short name: [%s]", group.getShortName()); final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils .getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, toolTip, menu); - if (!group.getType().equals(GroupDTO.PERSONAL)) { + if (!group.getType().equals(GroupType.PERSONAL)) { menu.addMenuItemList(otherOperations); } - if (session.isLogged() && !group.getType().equals(GroupDTO.PERSONAL)) { + if (session.isLogged() && !group.getType().equals(GroupType.PERSONAL)) { menu.addMenuItemList(otherLoggedOperations); } - if (group.getType().equals(GroupDTO.PERSONAL)) { + if (group.getType().equals(GroupType.PERSONAL)) { menu.addMenuItemList(otherOperationsUsers); } - if (session.isLogged() && group.getType().equals(GroupDTO.PERSONAL)) { + if (session.isLogged() && group.getType().equals(GroupType.PERSONAL)) { menu.addMenuItemList(otherLoggedOperationsUsers); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java 2008-08-08 04:20:12 UTC (rev 834) @@ -88,7 +88,7 @@ public EntityLogoPanel(final I18nTranslationService i18n, final WorkspaceSkeleton ws) { this.i18n = i18n; - ws.getEntityMainHeader().add(this); + ws.addToEntityMainHeader(this); } public void setLogo(final Image image) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java 2008-08-08 04:20:12 UTC (rev 834) @@ -3,7 +3,9 @@ import org.ourproject.kune.platf.client.ui.DefaultBorderLayout; import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme; +import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.widgets.Panel; +import com.gwtext.client.widgets.layout.FitLayout; public class Entity extends DefaultBorderLayout { @@ -14,6 +16,7 @@ public Entity() { entityMainHeader = new Panel(); entityMainHeader.setBorder(false); + entityMainHeader.setLayout(new FitLayout()); entitySummary = new EntitySummary(); entityWorkspace = new EntityWorkspace(); add(entityMainHeader, DefaultBorderLayout.Position.NORTH, 65); @@ -21,8 +24,9 @@ add(entitySummary.getPanel(), DefaultBorderLayout.Position.EAST, true, 150); } - public Panel getEntityMainHeader() { - return entityMainHeader; + public void addToEntityMainHeader(final Widget widget) { + entityMainHeader.add(widget); + doLayoutIfNeeded(); } public EntitySummary getEntitySummary() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 04:20:12 UTC (rev 834) @@ -6,6 +6,7 @@ import com.gwtext.client.widgets.Panel; import com.gwtext.client.widgets.Toolbar; import com.gwtext.client.widgets.event.ContainerListener; +import com.gwtext.client.widgets.layout.FitLayout; public class EntitySummary { private final Panel entityTools; @@ -16,13 +17,14 @@ public EntitySummary() { mainPanel = new DefaultBorderLayout(); entityTools = new Panel(); + entityTools.setLayout(new FitLayout()); entityTools.setAutoHeight(true); entitySummary = new Panel(); - entitySummary.setCls("k-entity-summary"); entityTools.setBorder(false); entitySummary.setBorder(false); entityTools.setAutoScroll(false); entitySummary.setAutoScroll(true); + entitySummary.setCls("k-entity-summary"); trayBar = mainPanel.createBottomBar(entitySummary, "k-site-traybar"); mainPanel.add(entityTools, DefaultBorderLayout.Position.NORTH); mainPanel.add(entitySummary, DefaultBorderLayout.Position.CENTER); @@ -31,15 +33,16 @@ public void addInSummary(final Widget widget) { entitySummary.add(widget); + entitySummary.syncSize(); mainPanel.doLayoutIfNeeded(); } public void addInTools(final Widget widget) { entityTools.add(widget); + mainPanel.syncSize(); if (entityTools.isRendered()) { entityTools.doLayout(false); } - mainPanel.doLayoutIfNeeded(); } public void addListener(final ContainerListener listener) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-08-08 04:20:12 UTC (rev 834) @@ -5,6 +5,7 @@ import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.core.ExtElement; import com.gwtext.client.widgets.MessageBox; import com.gwtext.client.widgets.Panel; @@ -35,8 +36,8 @@ new Viewport(container); } - public Panel getEntityMainHeader() { - return entity.getEntityMainHeader(); + public void addToEntityMainHeader(final Widget widget) { + entity.addToEntityMainHeader(widget); } public EntitySummary getEntitySummary() { Modified: trunk/src/main/resources/dozerBeanMapping.xml =================================================================== --- trunk/src/main/resources/dozerBeanMapping.xml 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/main/resources/dozerBeanMapping.xml 2008-08-08 04:20:12 UTC (rev 834) @@ -41,12 +41,7 @@ <mapping> <class-a>org.ourproject.kune.platf.client.dto.GroupDTO</class-a> - <class-b>org.ourproject.kune.platf.server.domain.Group</class-b> - <field - custom-converter="org.ourproject.kune.platf.server.mapper.GroupTypeConverter"> - <a>type</a> - <b>type</b> - </field> + <class-b>org.ourproject.kune.platf.server.domain.Group</class-b> </mapping> <mapping> Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-08 04:20:12 UTC (rev 834) @@ -25,7 +25,7 @@ bindScope(SessionScoped.class, Scopes.SINGLETON); // test: use memory // test_db: use mysql - bindConstant().annotatedWith(JpaUnit.class).to("test"); + bindConstant().annotatedWith(JpaUnit.class).to("test_db"); bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties"); bind(HttpServletRequest.class).to(HttpServletRequestMocked.class); } Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2008-08-08 04:20:12 UTC (rev 834) @@ -5,6 +5,7 @@ import org.junit.Before; import org.junit.Test; import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException; import org.ourproject.kune.platf.client.rpc.GroupService; @@ -13,7 +14,6 @@ import org.ourproject.kune.platf.server.UserSession; import org.ourproject.kune.platf.server.domain.AdmissionType; import org.ourproject.kune.platf.server.domain.Group; -import org.ourproject.kune.platf.server.domain.GroupType; import com.google.inject.Inject; @@ -33,7 +33,7 @@ doLogin(); final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.COMMUNITY); + GroupType.COMMUNITY); final LicenseDTO license = new LicenseDTO(); license.setShortName("by-sa"); @@ -51,7 +51,7 @@ @Test(expected = Exception.class) public void createGroupNotLogged() throws Exception { final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.PROJECT); + GroupType.PROJECT); service.createNewGroup(session.getHash(), group); } @@ -59,7 +59,7 @@ public void createGroupNullUserHash() throws Exception { doLogin(); final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.PROJECT); + GroupType.PROJECT); service.createNewGroup(null, group); } @@ -68,7 +68,7 @@ doLogin(); final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.PROJECT); + GroupType.PROJECT); final LicenseDTO license = new LicenseDTO(); license.setShortName("by-sa"); @@ -88,7 +88,7 @@ doLogin(); final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.ORGANIZATION); + GroupType.ORGANIZATION); final LicenseDTO license = new LicenseDTO(); license.setShortName("by-sa"); @@ -108,7 +108,7 @@ doLogin(); final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc", - GroupDTO.ORPHANED_PROJECT); + GroupType.ORPHANED_PROJECT); final LicenseDTO license = new LicenseDTO(); license.setShortName("by-sa"); Added: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2008-08-08 04:20:12 UTC (rev 834) @@ -0,0 +1,31 @@ +package org.ourproject.kune.platf.server.auth; + +import java.lang.reflect.AccessibleObject; + +import org.aopalliance.intercept.MethodInvocation; +import org.junit.Before; +import org.mockito.Mockito; +import org.ourproject.kune.platf.integration.IntegrationTest; +import org.ourproject.kune.platf.integration.IntegrationTestHelper; + +public class AuthorizatedMethodInterceptorTest extends IntegrationTest { + + private AuthorizatedMethodInterceptor auth; + private MethodInvocation invocation; + private Authorizated authAnnotation; + + @Before + public void before() { + auth = new AuthorizatedMethodInterceptor(); + new IntegrationTestHelper(auth, this); + invocation = Mockito.mock(MethodInvocation.class); + final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class); + Mockito.stub(invocation.getMethod()).toReturn(this.getClass().getMethods()[0]); + Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject); + authAnnotation = Mockito.mock(Authorizated.class); + Mockito.stub(accessibleObject.getAnnotation(Authorizated.class)).toReturn(authAnnotation); + // AccessType accessType = authoAnnotation.accessTypeRequired(); + // boolean checkContent = authoAnnotation.checkContent(); + } + +} Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-08-08 04:20:12 UTC (rev 834) @@ -9,13 +9,13 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.client.errors.EmailAddressInUseException; import org.ourproject.kune.platf.client.errors.GroupNameInUseException; import org.ourproject.kune.platf.client.errors.I18nNotFoundException; import org.ourproject.kune.platf.server.PersistenceTest; import org.ourproject.kune.platf.server.domain.AccessLists; import org.ourproject.kune.platf.server.domain.Group; -import org.ourproject.kune.platf.server.domain.GroupType; import org.ourproject.kune.platf.server.domain.I18nCountry; import org.ourproject.kune.platf.server.domain.I18nLanguage; import org.ourproject.kune.platf.server.domain.License; Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-08-08 04:20:12 UTC (rev 834) @@ -7,7 +7,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; +import org.ourproject.kune.platf.client.dto.GroupType; +import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult; import org.ourproject.kune.platf.client.errors.AccessViolationException; import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException; import org.ourproject.kune.platf.client.errors.LastAdminInGroupException; @@ -180,11 +181,22 @@ } @Test(expected = LastAdminInGroupException.class) - public void lastAdminUnjoinGroupFails() throws Exception { + public void lastAdminUnjoinGroupWithCollabsFails() throws Exception { socialNetworkManager.addAdmin(admin, group); + socialNetworkManager.requestToJoin(user, group); + socialNetworkManager.acceptJoinGroup(admin, userGroup, group); socialNetworkManager.unJoinGroup(admin.getUserGroup(), group); } + @Test + public void lastAdminUnjoinGroupWithoutCollabsOrphaned() throws Exception { + socialNetworkManager.addAdmin(admin, group); + socialNetworkManager.unJoinGroup(admin.getUserGroup(), group); + assertEquals(GroupType.ORPHANED_PROJECT, group.getType()); + assertEquals(0, group.getSocialNetwork().getAccessLists().getAdmins().getList().size()); + assertEquals(0, group.getSocialNetwork().getAccessLists().getEditors().getList().size()); + } + @Test(expected = AccessViolationException.class) public void notAdminTryDeleteMember() throws Exception { socialNetworkManager.requestToJoin(user, group); @@ -197,8 +209,8 @@ public void requestJoinAClosedGroupDeny() throws Exception { group.setAdmissionType(AdmissionType.Closed); - final String result = socialNetworkManager.requestToJoin(user, group); - assertEquals(result, SocialNetworkDTO.REQ_JOIN_DENIED); + final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group); + assertEquals(result, SocialNetworkRequestResult.denied); closeTransaction(); } @@ -206,8 +218,8 @@ public void requestJoinAModeratedGroupAddUserGroupToPending() throws Exception { group.setAdmissionType(AdmissionType.Moderated); - final String result = socialNetworkManager.requestToJoin(user, group); - assertEquals(result, SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION); + final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group); + assertEquals(result, SocialNetworkRequestResult.moderated); assertTrue(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup)); closeTransaction(); } @@ -216,8 +228,8 @@ public void requestJoinAOpenGroupAddUserGroupToEditors() throws Exception { group.setAdmissionType(AdmissionType.Open); - final String result = socialNetworkManager.requestToJoin(user, group); - assertEquals(result, SocialNetworkDTO.REQ_JOIN_ACEPTED); + final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group); + assertEquals(result, SocialNetworkRequestResult.accepted); assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup)); assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL); closeTransaction(); @@ -227,8 +239,8 @@ public void requestJoinAOrphanedGroupAddUserGroupToAdmins() throws Exception { orphanedGroup.setAdmissionType(AdmissionType.Open); - final String result = socialNetworkManager.requestToJoin(user, orphanedGroup); - assertEquals(result, SocialNetworkDTO.REQ_JOIN_ACEPTED); + final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup); + assertEquals(result, SocialNetworkRequestResult.accepted); assertTrue(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup)); assertEquals(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL); @@ -240,8 +252,8 @@ public void requestJoinTwiceAOrphanedGroupAddUserGroupToAdmins() throws Exception { orphanedGroup.setAdmissionType(AdmissionType.Open); - final String result = socialNetworkManager.requestToJoin(user, orphanedGroup); - assertEquals(SocialNetworkDTO.REQ_JOIN_ACEPTED, result); + final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup); + assertEquals(SocialNetworkRequestResult.accepted, result); socialNetworkManager.requestToJoin(user, orphanedGroup); } Modified: trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java 2008-08-07 12:07:05 UTC (rev 833) +++ trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java 2008-08-08 04:20:12 UTC (rev 834) @@ -3,9 +3,9 @@ import java.util.HashMap; import java.util.TimeZone; +import org.ourproject.kune.platf.client.dto.GroupType; import org.ourproject.kune.platf.server.domain.AccessLists; import org.ourproject.kune.platf.server.domain.Group; -import org.ourproject.kune.platf.server.domain.GroupType; import org.ourproject.kune.platf.server.domain.I18nCountry; import org.ourproject.kune.platf.server.domain.I18nLanguage; import org.ourproject.kune.platf.server.domain.SocialNetwork;
participants (1)
-
vjrj