[kune-commits] r1470 - in trunk: . src/main/java/cc/kune/core/client/dnd src/main/java/cc/kune/core/client/errors src/main/java/cc/kune/core/client/sn/actions src/main/java/cc/kune/core/client/state src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/licensewizard src/main/java/cc/kune/gspace/client/options/tools src/main/java/cc/kune/wave/server src/main/java/com/google/wave/splash/web/template src/main/java/org/ourproject/kune/workspace/client src/main/java/org/ourproject/kune/workspace/client/ctxnav src/main/webapp/WEB-INF src/test/java/cc/kune/core/client/state src/test/java/cc/kune/wave/server

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Fri Jul 29 00:46:28 CEST 2011


Author: vjrj_
Date: 2011-07-29 00:46:26 +0200 (Fri, 29 Jul 2011)
New Revision: 1470

Added:
   trunk/src/main/java/cc/kune/core/client/errors/UnderDevelopmentException.java
Modified:
   trunk/pom.xml
   trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
   trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/UserSNVisibilityAction.java
   trunk/src/main/java/cc/kune/core/client/state/StateManager.java
   trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
   trunk/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java
   trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
   trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
   trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java
   trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptToolsPresenter.java
   trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
   trunk/src/main/java/com/google/wave/splash/web/template/Templates.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
   trunk/src/main/webapp/WEB-INF/web.xml
   trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java
   trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
Log:
NEW - # 71: D-and-D folder into folder fails 
http://kune.ourproject.org/issues/ticket/71
CLOSED - # 73: (Edit) button in my Group don't open Wiab editor 
http://kune.ourproject.org/issues/ticket/73
NEW - # 75: Remove memory leaks in server memory usage 
http://kune.ourproject.org/issues/ticket/75

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/pom.xml	2011-07-28 22:46:26 UTC (rev 1470)
@@ -778,7 +778,7 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
-        <version>1.1.1</version>
+        <version>1.2</version>
         <executions>
           <execution>
             <phase>exec</phase>

Modified: trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -60,12 +60,12 @@
                     @Override
                     public void onFailure(final Throwable caught) {
                       erroHandler.process(caught);
-                      stateManager.reload();
+                      stateManager.refreshCurrentState();
                     }
 
                     @Override
                     public void onSuccess(final StateContainerDTO result) {
-                      stateManager.reload();
+                      stateManager.refreshCurrentState();
                     }
                   });
             } else {

Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -25,6 +25,7 @@
 import cc.kune.common.client.log.Log;
 import cc.kune.common.client.notify.NotifyLevel;
 import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.TextUtils;
 import cc.kune.core.client.notify.msgs.UserNotifyEvent;
 import cc.kune.core.client.notify.spiner.ProgressHideEvent;
 import cc.kune.core.client.state.Session;
@@ -131,6 +132,9 @@
       logException(caught);
       eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
           i18n.t("This user is already a group member")));
+    } else if (caught instanceof UnderDevelopmentException) {
+      logException(caught);
+      eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, i18n.t(TextUtils.IN_DEVELOPMENT)));
     } else {
       logException(caught, true);
       eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,

Added: trunk/src/main/java/cc/kune/core/client/errors/UnderDevelopmentException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/UnderDevelopmentException.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/UnderDevelopmentException.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.core.client.errors;
+
+public class UnderDevelopmentException extends DefaultException {
+  private static final long serialVersionUID = 7207715062129253927L;
+}

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -60,7 +60,7 @@
                         switch ((result)) {
                         case accepted:
                             NotifyUser.info(i18n.t("You are now member of this group"));
-                            stateManager.refreshCurrentGroupState();
+                            stateManager.refreshCurrentStateWithoutCache();
                             break;
                         case denied:
                             NotifyUser.important(i18n.t("Sorry this is a closed group"));

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -62,7 +62,7 @@
                     public void onSuccess(final SocialNetworkDataDTO result) {
                         NotifyUser.hideProgress();
                         NotifyUser.info(i18n.t("Member removed"));
-                        stateManager.refreshCurrentGroupState();
+                        stateManager.refreshCurrentStateWithoutCache();
                     }
                 });
     }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -63,7 +63,7 @@
                   public void onSuccess(final Void result) {
                     NotifyUser.hideProgress();
                     NotifyUser.info(i18n.t("Removed as member"));
-                    stateManager.refreshCurrentGroupState();
+                    stateManager.refreshCurrentStateWithoutCache();
                   }
                 });
           }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -73,7 +73,7 @@
                   public void onSuccess(final Void result) {
                     NotifyUser.hideProgress();
                     NotifyUser.info(i18n.t("Removed as member"));
-                    stateManager.refreshCurrentGroupState();
+                    stateManager.refreshCurrentStateWithoutCache();
                   }
                 });
           }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UserSNVisibilityAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UserSNVisibilityAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UserSNVisibilityAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -57,7 +57,7 @@
                         // NotifyUser.info(i18n.t("Visibility of your network changed to "
                         // + visibility.toString()));
                         NotifyUser.info(i18n.t("Visibility of your network changed"));
-                        stateManager.refreshCurrentGroupState();
+                        stateManager.refreshCurrentStateWithoutCache();
                     }
                 });
 

Modified: trunk/src/main/java/cc/kune/core/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManager.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManager.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -68,9 +68,9 @@
 
     void redirectOrRestorePreviousToken();
 
-    void refreshCurrentGroupState();
+    void refreshCurrentStateWithoutCache();
 
-    void reload();
+    void refreshCurrentState();
 
     void removeBeforeStateChangeListener(BeforeActionListener listener);
 

Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -90,7 +90,7 @@
         session.onUserSignOut(false, new UserSignOutEvent.UserSignOutHandler() {
           @Override
           public void onUserSignOut(final UserSignOutEvent event) {
-            refreshCurrentGroupState();
+            refreshCurrentStateWithoutCache();
           }
         });
         processCurrentHistoryToken();
@@ -333,11 +333,21 @@
 
   /**
    * <p>
+   * Reload current state (using client cache if available)
+   * </p>
+   */
+  @Override
+  public void refreshCurrentState() {
+    processHistoryToken(history.getToken());
+  }
+
+  /**
+   * <p>
    * Reload current state (not using client cache)
    * </p>
    */
   @Override
-  public void refreshCurrentGroupState() {
+  public void refreshCurrentStateWithoutCache() {
     final StateToken currentStateToken = session.getCurrentStateToken();
     if (currentStateToken == null) {
       processCurrentHistoryToken();
@@ -347,17 +357,7 @@
     }
   }
 
-  /**
-   * <p>
-   * Reload current state (using client cache if available)
-   * </p>
-   */
   @Override
-  public void reload() {
-    processHistoryToken(history.getToken());
-  }
-
-  @Override
   public void removeBeforeStateChangeListener(final BeforeActionListener listener) {
     beforeStateChangeCollection.remove(listener);
   }
@@ -378,7 +378,7 @@
   public void resumeTokenChange() {
     if (resumedHistoryToken != null) {
       // Is this reload redundant?
-      reload();
+      refreshCurrentState();
       gotoHistoryToken(resumedHistoryToken);
       resumedHistoryToken = null;
     }

Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -19,7 +19,6 @@
  */
 package cc.kune.core.server.content;
 
-
 import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.server.manager.Manager;
 import cc.kune.core.server.manager.impl.SearchResult;
@@ -30,19 +29,22 @@
 
 public interface ContainerManager extends Manager<Container, Long> {
 
-    Container createFolder(Group group, Container parent, String name, I18nLanguage language, String typeId);
+  Container createFolder(Group group, Container parent, String name, I18nLanguage language, String typeId);
 
-    Container createRootFolder(Group group, String toolName, String name, String type);
+  Container createRootFolder(Group group, String toolName, String name, String type);
 
-    Container find(Long id);
+  @Override
+  Container find(Long id);
 
-    boolean findIfExistsTitle(Container container, String title);
+  boolean findIfExistsTitle(Container container, String title);
 
-    Container renameFolder(Group group, Container container, String newName) throws DefaultException;
+  void moveContainer(Container container, Container newContainer);
 
-    SearchResult<Container> search(String search);
+  Container renameFolder(Group group, Container container, String newName) throws DefaultException;
 
-    SearchResult<Container> search(String search, Integer firstResult, Integer maxResults);
+  SearchResult<Container> search(String search);
 
-    void setAccessList(Container container, AccessLists accessList);
+  SearchResult<Container> search(String search, Integer firstResult, Integer maxResults);
+
+  void setAccessList(Container container, AccessLists accessList);
 }

Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -31,6 +31,7 @@
 
 import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.client.errors.NameInUseException;
+import cc.kune.core.client.errors.UnderDevelopmentException;
 import cc.kune.core.server.manager.file.FileUtils;
 import cc.kune.core.server.manager.impl.DefaultManager;
 import cc.kune.core.server.manager.impl.SearchResult;
@@ -50,103 +51,110 @@
 @Singleton
 public class ContainerManagerDefault extends DefaultManager<Container, Long> implements ContainerManager {
 
-    private final ContainerFinder containerFinder;
-    private final ContentFinder contentFinder;
+  private final ContainerFinder containerFinder;
+  private final ContentFinder contentFinder;
 
-    @Inject
-    public ContainerManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
-            final Provider<EntityManager> provider) {
-        super(provider, Container.class);
-        this.contentFinder = contentFinder;
-        this.containerFinder = containerFinder;
-    }
+  @Inject
+  public ContainerManagerDefault(final ContentFinder contentFinder,
+      final ContainerFinder containerFinder, final Provider<EntityManager> provider) {
+    super(provider, Container.class);
+    this.contentFinder = contentFinder;
+    this.containerFinder = containerFinder;
+  }
 
-    @Override
-    public Container createFolder(final Group group, final Container parent, final String name,
-            final I18nLanguage language, final String typeId) {
-        FilenameUtils.checkBasicFilename(name);
-        final String newtitle = findInexistentName(parent, name);
-        final List<Container> parentAbsolutePath = parent.getAbsolutePath();
-        final List<Container> childAbsolutePath = new ArrayList<Container>();
+  @Override
+  public Container createFolder(final Group group, final Container parent, final String name,
+      final I18nLanguage language, final String typeId) {
+    FilenameUtils.checkBasicFilename(name);
+    final String newtitle = findInexistentName(parent, name);
+    final List<Container> parentAbsolutePath = parent.getAbsolutePath();
+    final List<Container> childAbsolutePath = new ArrayList<Container>();
 
-        for (final Container parentRef : parentAbsolutePath) {
-            childAbsolutePath.add(parentRef);
-        }
-        // FIXME: use
-        // childAbsolutePath.addAll(parentAbsolutePath);
-        final Container child = new Container(newtitle, group, parent.getToolName());
-        childAbsolutePath.add(child);
-        child.setLanguage(language);
-        child.setAbsolutePath(childAbsolutePath);
-        child.setTypeId(typeId);
-        parent.addChild(child);
-        persist(child);
-        return child;
+    for (final Container parentRef : parentAbsolutePath) {
+      childAbsolutePath.add(parentRef);
     }
+    // FIXME: use
+    // childAbsolutePath.addAll(parentAbsolutePath);
+    final Container child = new Container(newtitle, group, parent.getToolName());
+    childAbsolutePath.add(child);
+    child.setLanguage(language);
+    child.setAbsolutePath(childAbsolutePath);
+    child.setTypeId(typeId);
+    parent.addChild(child);
+    persist(child);
+    return child;
+  }
 
-    @Override
-    public Container createRootFolder(final Group group, final String toolName, final String name, final String type) {
-        final Container container = new Container(name, group, toolName);
-        container.setTypeId(type);
-        final List<Container> absolutePath = new ArrayList<Container>();
-        absolutePath.add(container);
-        container.setAbsolutePath(absolutePath);
-        return persist(container);
-    }
+  @Override
+  public Container createRootFolder(final Group group, final String toolName, final String name,
+      final String type) {
+    final Container container = new Container(name, group, toolName);
+    container.setTypeId(type);
+    final List<Container> absolutePath = new ArrayList<Container>();
+    absolutePath.add(container);
+    container.setAbsolutePath(absolutePath);
+    return persist(container);
+  }
 
-    /** Duplicate code in ContentMD **/
-    @Override
-    public boolean findIfExistsTitle(final Container container, final String title) {
-        return (contentFinder.findIfExistsTitle(container, title) > 0)
-                || (containerFinder.findIfExistsTitle(container, title) > 0);
-    }
+  /** Duplicate code in ContentMD **/
+  @Override
+  public boolean findIfExistsTitle(final Container container, final String title) {
+    return (contentFinder.findIfExistsTitle(container, title) > 0)
+        || (containerFinder.findIfExistsTitle(container, title) > 0);
+  }
 
-    /** Duplicate code in ContentMD **/
-    private String findInexistentName(final Container container, final String title) {
-        String initialTitle = String.valueOf(title);
-        while (findIfExistsTitle(container, initialTitle)) {
-            initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
-        }
-        return initialTitle;
+  /** Duplicate code in ContentMD **/
+  private String findInexistentName(final Container container, final String title) {
+    String initialTitle = String.valueOf(title);
+    while (findIfExistsTitle(container, initialTitle)) {
+      initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
     }
+    return initialTitle;
+  }
 
-    @Override
-    public Container renameFolder(final Group group, final Container container, final String newName)
-            throws DefaultException {
-        FilenameUtils.checkBasicFilename(newName);
-        final String newNameWithoutNT = FilenameUtils.chomp(newName);
-        if (container.isRoot()) {
-            throw new DefaultException("Root folder cannot be renamed");
-        }
-        if (findIfExistsTitle(container.getParent(), newNameWithoutNT)) {
-            throw new NameInUseException();
-        }
-        container.setName(newNameWithoutNT);
-        persist(container);
-        return container;
-    }
+  @Override
+  public void moveContainer(final Container container, final Container newContainer) {
+    throw new UnderDevelopmentException();
+  }
 
-    @Override
-    public SearchResult<Container> search(final String search) {
-        return this.search(search, null, null);
+  @Override
+  public Container renameFolder(final Group group, final Container container, final String newName)
+      throws DefaultException {
+    FilenameUtils.checkBasicFilename(newName);
+    final String newNameWithoutNT = FilenameUtils.chomp(newName);
+    if (container.isRoot()) {
+      throw new DefaultException("Root folder cannot be renamed");
     }
-
-    @Override
-    public SearchResult<Container> search(final String search, final Integer firstResult, final Integer maxResults) {
-        final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "name" }, new StandardAnalyzer());
-        Query query;
-        try {
-            query = parser.parse(search);
-        } catch (final ParseException e) {
-            throw new ServerManagerException("Error parsing search");
-        }
-        return super.search(query, firstResult, maxResults);
+    if (findIfExistsTitle(container.getParent(), newNameWithoutNT)) {
+      throw new NameInUseException();
     }
+    container.setName(newNameWithoutNT);
+    persist(container);
+    return container;
+  }
 
-    @Override
-    public void setAccessList(final Container container, final AccessLists accessList) {
-        container.setAccessLists(accessList);
-        persist(container);
+  @Override
+  public SearchResult<Container> search(final String search) {
+    return this.search(search, null, null);
+  }
+
+  @Override
+  public SearchResult<Container> search(final String search, final Integer firstResult,
+      final Integer maxResults) {
+    final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "name" },
+        new StandardAnalyzer());
+    Query query;
+    try {
+      query = parser.parse(search);
+    } catch (final ParseException e) {
+      throw new ServerManagerException("Error parsing search");
     }
+    return super.search(query, firstResult, maxResults);
+  }
 
+  @Override
+  public void setAccessList(final Container container, final AccessLists accessList) {
+    container.setAccessLists(accessList);
+    persist(container);
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -26,6 +26,7 @@
 import cc.kune.chat.server.ChatManager;
 import cc.kune.core.client.errors.AccessViolationException;
 import cc.kune.core.client.errors.ContentNotFoundException;
+import cc.kune.core.client.errors.ContentNotPermittedException;
 import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.client.errors.NoDefaultContentException;
 import cc.kune.core.client.errors.ToolNotFoundException;
@@ -318,17 +319,30 @@
   @Authenticated
   @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
   @Transactional
-  public StateContainerDTO moveContent(final String userHash, final StateToken contentToken,
+  public StateContainerDTO moveContent(final String userHash, final StateToken movedToken,
       final StateToken newContainerToken) throws DefaultException {
     final User user = getCurrentUser();
     try {
-      final Content content = accessService.accessToContent(
-          ContentUtils.parseId(contentToken.getDocument()), user, AccessRol.Editor);
-      final Container newContainer = accessService.accessToContainer(
-          ContentUtils.parseId(newContainerToken.getFolder()), user, AccessRol.Editor);
-      final Container oldContainer = content.getContainer();
-      contentManager.moveContent(content, newContainer);
-      return getState(user, oldContainer);
+      if (movedToken.isComplete()) {
+        final Content content = accessService.accessToContent(
+            ContentUtils.parseId(movedToken.getDocument()), user, AccessRol.Editor);
+        final Container newContainer = accessService.accessToContainer(
+            ContentUtils.parseId(newContainerToken.getFolder()), user, AccessRol.Editor);
+        final Container oldContainer = content.getContainer();
+        contentManager.moveContent(content, newContainer);
+        return getState(user, oldContainer);
+      } else if (movedToken.hasGroupToolAndFolder()) {
+        // Folder to folder
+        final Container container = accessService.accessToContainer(
+            ContentUtils.parseId(movedToken.getFolder()), user, AccessRol.Editor);
+        final Container newContainer = accessService.accessToContainer(
+            ContentUtils.parseId(newContainerToken.getFolder()), user, AccessRol.Editor);
+        final Container oldParent = container.getParent();
+        containerManager.moveContainer(container, newContainer);
+        return getState(user, oldParent);
+      } else {
+        throw new ContentNotPermittedException();
+      }
     } catch (final NoResultException e) {
       throw new AccessViolationException();
     }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -81,7 +81,7 @@
                       // session.setCurrentState(state);
                       final StateToken parent = token.copy().clearDocument();
                       if (session.getCurrentStateToken().equals(parent)) {
-                        stateManager.refreshCurrentGroupState();
+                        stateManager.refreshCurrentStateWithoutCache();
                         // Warning: the previous action
                         // is asynchronous (it gets a
                         // content)

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -62,7 +62,9 @@
             @Override
             public void onSuccess(final Void arg) {
               NotifyUser.hideProgress();
-              stateManager.gotoStateToken(session.getCurrentStateToken());
+              stateManager.refreshCurrentStateWithoutCache();
+              // issue #73
+              // stateManager.gotoStateToken(session.getCurrentStateToken());
             }
           });
     }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -41,7 +41,7 @@
 
         @Override
         public void actionPerformed(final ActionEvent event) {
-            stateManager.refreshCurrentGroupState();
+            stateManager.refreshCurrentStateWithoutCache();
         }
 
     }

Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -66,7 +66,7 @@
 
           @Override
           public void onSuccess(final Void result) {
-            stateManager.reload();
+            stateManager.refreshCurrentState();
             callback.onSuccess();
             LicenseChangedEvent.fire(eventBus);
           }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptToolsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptToolsPresenter.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/gspace/client/options/tools/EntityOptToolsPresenter.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -139,7 +139,7 @@
 
           @Override
           public void onSuccess(final Void result) {
-            stateManager.reload();
+            stateManager.refreshCurrentState();
             // view.unmask();
           }
         });

Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -187,12 +187,19 @@
 
   @Override
   public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdds,
-      final String participant) {
+      final String newLocalParticipant) {
     final Wavelet wavelet = fetchWave(waveName, author);
+    final String newPartWithDomain = participantUtils.of(newLocalParticipant).toString();
+    for (final String current : wavelet.getParticipants()) {
+      if (current.equals(newPartWithDomain)) {
+        // Current user is a participant already (issue #73)
+        return;
+      }
+    }
     final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
         : author;
     final OperationQueue opQueue = new OperationQueue();
-    opQueue.addParticipantToWavelet(wavelet, participantUtils.of(participant).toString());
+    opQueue.addParticipantToWavelet(wavelet, newPartWithDomain);
     doOperation(whoAdd, opQueue, "add participant");
 
   }
@@ -390,7 +397,8 @@
   @Override
   public String render(final Wavelet wavelet) {
     final ClientAction clientPage = waveRenderer.render(wavelet, 0);
-    return clientPage.getHtml();
+    final String html = clientPage.getHtml();
+    return html;
   }
 
   @Override

Modified: trunk/src/main/java/com/google/wave/splash/web/template/Templates.java
===================================================================
--- trunk/src/main/java/com/google/wave/splash/web/template/Templates.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/com/google/wave/splash/web/template/Templates.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -60,7 +60,7 @@
 
   private final Markup markup;
 
-  private final boolean productionMode = false;
+  private final boolean productionMode = true;
 
   /**
    * file name of template -> compiled template lazy cache.

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -415,7 +415,7 @@
         AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
           @Override
           public void onEvent(final StateToken stateToken) {
-            stateManager.reload();
+            stateManager.refreshCurrentState();
             contextNavigator.selectItem(stateToken);
           }
         });
@@ -433,7 +433,7 @@
         AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
           @Override
           public void onEvent(final StateToken stateToken) {
-            stateManager.reload();
+            stateManager.refreshCurrentState();
             contextNavigator.selectItem(stateToken);
           }
         });

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -98,7 +98,7 @@
       @Override
       public void onEvent(final StateToken currentUploadStateToken) {
         if (currentUploadStateToken.hasSameContainer(session.getCurrentStateToken())) {
-          stateManager.reload();
+          stateManager.refreshCurrentState();
         }
       }
     });

Modified: trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/src/main/webapp/WEB-INF/web.xml	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/main/webapp/WEB-INF/web.xml	2011-07-28 22:46:26 UTC (rev 1470)
@@ -5,12 +5,12 @@
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
 
-  <!-- NOTE: if you modify this, cp for rapid testing: cp src/main/webapp/WEB-INF/web.xml 
+  <!-- NOTE: if you modify this, cp for rapid testing: cp src/main/webapp/WEB-INF/web.xml
     target/kune-PUT_HERE_VERSION/WEB-INF/web.xml -->
 
   <!-- TODO: Add <servlet> tags for each servlet here. -->
   <!-- TODO: Add <servlet-mapping> tags for each <servlet> here. -->
-  <!-- TODO: Optionally add a <welcome-file-list> tag to display a welcome 
+  <!-- TODO: Optionally add a <welcome-file-list> tag to display a welcome
     file. -->
   <display-name>ws</display-name>
   <description>kune workspace</description>
@@ -69,12 +69,12 @@
   </context-param>
   <context-param>
     <param-name>rails.root</param-name>
-    <param-value>/WEB-INF/publicspace/ 
+    <param-value>/WEB-INF/publicspace/
    </param-value>
   </context-param>
   <context-param>
     <param-name>files.prefix</param-name>
-    <param-value>/WEB-INF/publicspace/public 
+    <param-value>/WEB-INF/publicspace/public
    </param-value>
   </context-param>
   <context-param>
@@ -89,6 +89,7 @@
     <param-name>public.root</param-name>
     <param-value>/public/</param-value>
   </context-param>
+  <!-- Disabled while not used
   <filter>
     <filter-name>RackFilter</filter-name>
     <filter-class>org.jruby.rack.RackFilter</filter-class>
@@ -100,6 +101,7 @@
   <listener>
     <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
   </listener>
+   -->
   <!-- Emite xmpp proxy ======================================================================================= -->
   <!-- <servlet> -->
   <!-- <servlet-name>HttpBind</servlet-name> -->

Modified: trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -202,7 +202,7 @@
         // When a user enter reload state, also if the application is starting
         // (and the user was logged)
         Mockito.when(history.getToken()).thenReturn("");
-        stateManager.reload();
+        stateManager.refreshCurrentState();
         verifyGetServerContent();
     }
 

Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java	2011-07-28 16:01:40 UTC (rev 1469)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java	2011-07-28 22:46:26 UTC (rev 1470)
@@ -71,6 +71,22 @@
   }
 
   @Test
+  public void addParticipantTwice() throws IOException {
+    doLogin();
+    final WaveRef waveletName = createTestWave();
+    assertNotNull(waveletName);
+    manager.addParticipant(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+        NEW_PARTICIPANT);
+    manager.addParticipant(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+        NEW_PARTICIPANT);
+    final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
+    assertNotNull(fetchWavelet);
+    assertEquals(2, fetchWavelet.getParticipants().size());
+    manager.isParticipant(fetchWavelet, NEW_PARTICIPANT);
+    manager.isParticipant(fetchWavelet, "newparti");
+  }
+
+  @Test
   public void authorAddParticipant() throws DefaultException, IOException {
     final String whoAdds = getSiteAdminShortName();
     addParticipant(whoAdds);




More information about the kune-commits mailing list