[kune-commits] r1813 - in trunk: . debian src/main/java/cc/kune/barters/client/actions src/main/java/cc/kune/blogs/client/actions src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/client/state/impl src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/core/server/tool src/main/java/cc/kune/docs/client/actions src/main/java/cc/kune/domain src/main/java/cc/kune/events/client/actions src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/lists/client/actions src/main/java/cc/kune/tasks/client/actions src/test/java/cc/kune/core/server/integration/content src/test/java/cc/kune/core/server/manager

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Sat Mar 31 23:43:22 CEST 2012


Author: vjrj_
Date: 2012-03-31 23:43:21 +0200 (Sat, 31 Mar 2012)
New Revision: 1813

Added:
   trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerBtn.java
   trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerMenuItem.java
Removed:
   trunk/debian/files
   trunk/debian/kune.postinst.debhelper
   trunk/debian/kune.postrm.debhelper
   trunk/debian/kune.prerm.debhelper
Modified:
   trunk/debian/kune.debhelper.log
   trunk/debian/kune.substvars
   trunk/pom.xml
   trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
   trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
   trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java
   trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
   trunk/src/main/java/cc/kune/domain/Container.java
   trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
   trunk/src/main/java/cc/kune/gspace/client/actions/ActionUtils.java
   trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
   trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
   trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
   trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
   trunk/src/test/java/cc/kune/core/server/manager/ContainerManagerDefaultTest.java
   trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
Log:
NEW - # 222: Create a trash folder icon and improve contents delete functionality 
http://kune.ourproject.org/issues/ticket/222

Deleted: trunk/debian/files
===================================================================
--- trunk/debian/files	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/files	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1 +0,0 @@
-kune_0.1.0+b4_all.deb java optional

Modified: trunk/debian/kune.debhelper.log
===================================================================
--- trunk/debian/kune.debhelper.log	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/kune.debhelper.log	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1,34 +1,3 @@
 dh_prep
 dh_installdirs
 dh_installdirs
-dh_installdocs
-dh_installexamples
-dh_installman
-dh_installinfo
-dh_installmenu
-dh_installcron
-dh_installinit
-dh_installdebconf
-dh_installemacsen
-dh_installcatalogs
-dh_installpam
-dh_installlogrotate
-dh_installlogcheck
-dh_installchangelogs
-dh_installudev
-dh_lintian
-dh_bugfiles
-dh_install
-dh_link
-dh_installmime
-dh_installgsettings
-dh_strip
-dh_compress
-dh_fixperms
-dh_makeshlibs
-dh_installdeb
-dh_perl
-dh_shlibdeps
-dh_gencontrol
-dh_md5sums
-dh_builddeb

Deleted: trunk/debian/kune.postinst.debhelper
===================================================================
--- trunk/debian/kune.postinst.debhelper	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/kune.postinst.debhelper	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1,6 +0,0 @@
-# Automatically added by dh_installinit
-if [ -x "/etc/init.d/kune" ]; then
-	update-rc.d kune defaults >/dev/null
-	invoke-rc.d kune start || exit $?
-fi
-# End automatically added section

Deleted: trunk/debian/kune.postrm.debhelper
===================================================================
--- trunk/debian/kune.postrm.debhelper	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/kune.postrm.debhelper	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1,11 +0,0 @@
-# Automatically added by dh_installdebconf
-if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
-	. /usr/share/debconf/confmodule
-	db_purge
-fi
-# End automatically added section
-# Automatically added by dh_installinit
-if [ "$1" = "purge" ] ; then
-	update-rc.d kune remove >/dev/null
-fi
-# End automatically added section

Deleted: trunk/debian/kune.prerm.debhelper
===================================================================
--- trunk/debian/kune.prerm.debhelper	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/kune.prerm.debhelper	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1,5 +0,0 @@
-# Automatically added by dh_installinit
-if [ -x "/etc/init.d/kune" ]; then
-	invoke-rc.d kune stop || exit $?
-fi
-# End automatically added section

Modified: trunk/debian/kune.substvars
===================================================================
--- trunk/debian/kune.substvars	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/debian/kune.substvars	2012-03-31 21:43:21 UTC (rev 1813)
@@ -1 +0,0 @@
-misc:Depends=debconf (>= 0.5) | debconf-2.0

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/pom.xml	2012-03-31 21:43:21 UTC (rev 1813)
@@ -291,7 +291,9 @@
       <groupId>com.calclab.emite</groupId>
       <artifactId>emite</artifactId>
       <version>r1694</version>
+      <!-- Used in server side also
       <scope>provided</scope>
+      -->
     </dependency>
     <dependency>
       <groupId>com.calclab.emite</groupId>
@@ -711,7 +713,9 @@
       <groupId>com.bradrydzewski</groupId>
       <artifactId>gwt-cal</artifactId>
       <version>0.9.3-dndCreation</version>
+      <!-- Used in server side also
       <scope>provided</scope>
+       -->
     </dependency>
     <dependency>
       <groupId>org.mnode.ical4j</groupId>

Modified: trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -38,6 +38,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -71,7 +73,9 @@
       final Provider<ParticipateInContentBtn> participateBtn,
       final Provider<DelFolderMenuItem> delFolderMenuItem,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
-      final Provider<RefreshContentMenuItem> refresh, final Provider<CopyContentMenuItem> copyContent,
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn, final Provider<RefreshContentMenuItem> refresh,
+      final Provider<CopyContentMenuItem> copyContent,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, optionsMenuContent, all);
@@ -102,6 +106,10 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -42,6 +42,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -81,6 +83,8 @@
       final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelBlogMenuItem> delFolderMenuItem,
       final Provider<CopyContentMenuItem> copyContent,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants,
       final Provider<SetAsHomePageMenuItem> setAsHomePage) {
     super(session, stateManager, i18n, registry);
@@ -116,6 +120,10 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
     newMenusRegistry.register(TYPE_BLOG, blogNewMenu.get());
     newMenusRegistry.register(TYPE_POST,
         (MenuDescriptor) postNewMenu.get().withText(i18n.t("Add Gadget")));

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -77,8 +77,6 @@
   StateContainerDTO moveContent(String userHash, StateToken contentToken, StateToken newContainerToken)
       throws DefaultException;
 
-  StateContainerDTO purgeContainer(String userHash, StateToken token);
-
   StateContainerDTO purgeContent(String userHash, StateToken token);
 
   RateResult rateContent(String userHash, StateToken token, Double value) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -77,8 +77,6 @@
   void moveContent(String userHash, StateToken contentToken, StateToken newContainerToken,
       AsyncCallback<StateContainerDTO> asyncCallback);
 
-  void purgeContainer(String userHash, StateToken token, AsyncCallback<StateContainerDTO> callback);
-
   void purgeContent(String userHash, StateToken token, AsyncCallback<StateContainerDTO> callback);
 
   void rateContent(String userHash, StateToken token, Double value,

Modified: trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -79,7 +79,6 @@
   private final HistoryWrapper history;
   private StateToken previousGroupToken;
   private String previousHash;
-  private String previousTool;
   /**
    * When a historyChanged is interrupted (for instance because you are editing
    * something), the new history token is stored here
@@ -101,7 +100,6 @@
     this.history = history;
     this.signIn = signIn;
     this.previousGroupToken = null;
-    this.previousTool = null;
     this.previousHash = null;
     this.resumedHistoryToken = null;
     tokenMatcher.init(GwtWaverefEncoder.INSTANCE);
@@ -156,7 +154,7 @@
       GroupChangedEvent.fire(eventBus, previousGroup, newGroup);
     }
     final String previousToolName = getPreviousTool();
-    final String newTokenTool = newState.getToolName();
+    final String newTokenTool = newState.getStateToken().getTool();
     final String newToolName = newTokenTool == null ? "" : newTokenTool;
     if (startingUp() || previousToolName == null || !previousToolName.equals(newToolName)) {
       ToolChangedEvent.fire(eventBus, previousGroupToken, newState.getStateToken());
@@ -247,7 +245,7 @@
   }
 
   private String getPreviousTool() {
-    final String previousTool = startingUp() ? "" : this.previousTool;
+    final String previousTool = startingUp() ? "" : previousGroupToken.getTool();
     return previousTool;
   }
 
@@ -547,7 +545,6 @@
     StateChangedEvent.fire(eventBus, newState);
     checkGroupAndToolChange(newState);
     previousGroupToken = newToken.copy();
-    previousTool = newState.getToolName();
     eventBus.fireEvent(new ProgressHideEvent());
   }
 

Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -42,7 +42,6 @@
 import cc.kune.domain.I18nLanguage;
 import cc.kune.domain.finders.ContainerFinder;
 import cc.kune.domain.finders.ContentFinder;
-import cc.kune.trash.server.TrashServerUtils;
 import cc.kune.trash.shared.TrashToolConstants;
 
 import com.google.common.base.Preconditions;
@@ -134,8 +133,9 @@
 
   @Override
   public Container purgeContainer(final Container container) {
-    Preconditions.checkState(TrashServerUtils.inTrash(container),
-        "Trying to purge a not deleted container: " + container);
+    // Enable this precondition ASAP
+    // Preconditions.checkState(TrashServerUtils.inTrash(container),
+    // "Trying to purge a not deleted container: " + container);
     Preconditions.checkState(!container.isRoot(), "Trying to purge a root folder: " + container);
     Preconditions.checkState(container.getChilds().size() == 0, "Container has folder childs");
     Preconditions.checkState(container.getContents().size() == 0, "Container has content childs");
@@ -144,9 +144,6 @@
     container.setParent(null);
     persist(parent);
     container.setOwner(null);
-    // persist(parent);
-    // merge(container);
-    // flush();
     remove(container);
     return parent;
   }

Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -103,6 +103,7 @@
   private final NotificationService notifyService;
   private final ParticipantUtils participantUtils;
   private final KuneBasicProperties properties;
+  private final SocialNetworkCache snCache;
   private final UserFinder userFinder;
   private final AccountStore waveAccountStore;
   private final CustomUserRegistrationServlet waveUserRegister;
@@ -117,7 +118,8 @@
       final CustomUserRegistrationServlet waveUserRegister, final AccountStore waveAccountStore,
       final KuneWaveService kuneWaveManager, final ParticipantUtils participantUtils,
       final KuneBasicProperties properties, final GroupManager groupManager,
-      final NotificationService notifyService, final XmppRosterProvider xmppRoster) {
+      final NotificationService notifyService, final XmppRosterProvider xmppRoster,
+      final SocialNetworkCache snCache) {
     super(provider, User.class);
     this.userFinder = finder;
     this.languageManager = languageManager;
@@ -133,6 +135,7 @@
     this.groupManager = groupManager;
     this.notifyService = notifyService;
     this.xmppRoster = xmppRoster;
+    this.snCache = snCache;
   }
 
   /*
@@ -434,6 +437,7 @@
   @Override
   public void setSNetVisibility(final User user, final UserSNetVisibility visibility) {
     user.setSNetVisibility(visibility);
+    snCache.expire(user.getUserGroup());
     persist(user);
   }
 

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -454,22 +454,17 @@
   @Authenticated
   @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Administrator)
   @KuneTransactional
-  public StateContainerDTO purgeContainer(final String userHash, final StateToken token) {
-    final User user = getCurrentUser();
-    final Long containerId = ContentUtils.parseId(token.getFolder());
-    final Container container = containerManager.purgeContainer(finderService.getContainer(containerId));
-    return mapState(stateService.create(user, container), user);
-  }
-
-  @Override
-  @Authenticated
-  @Authorizated(actionLevel = ActionLevel.content, accessRolRequired = AccessRol.Administrator)
-  @KuneTransactional
   public StateContainerDTO purgeContent(final String userHash, final StateToken token) {
     final User user = getCurrentUser();
-    final Long contentId = ContentUtils.parseId(token.getDocument());
-    final Container container = contentManager.purgeContent(finderService.getContent(contentId));
-    return mapState(stateService.create(user, container), user);
+    if (token.isComplete()) {
+      final Long contentId = ContentUtils.parseId(token.getDocument());
+      final Container container = contentManager.purgeContent(finderService.getContent(contentId));
+      return mapState(stateService.create(user, container), user);
+    } else {
+      final Long containerId = ContentUtils.parseId(token.getFolder());
+      final Container container = containerManager.purgeContainer(finderService.getContainer(containerId));
+      return mapState(stateService.create(user, container), user);
+    }
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -132,12 +132,6 @@
   }
 
   @Override
-  public StateContainerDTO purgeContainer(final String userHash, final StateToken token) {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
   public StateContainerDTO purgeContent(final String userHash, final StateToken token) {
     // TODO Auto-generated method stub
     return null;

Modified: trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -24,6 +24,10 @@
   private final String name;
   private final String rootName;
 
+  public ToolSimple() {
+    this(null, null);
+  }
+
   public ToolSimple(final String name, final String rootName) {
     this.name = name;
     this.rootName = rootName;

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -42,6 +42,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -83,6 +85,8 @@
       final Provider<CopyContentMenuItem> copyContent,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn,
       final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu foldersNewMenu,
       final DocsNewMenu docsNewMenu) {
     super(session, stateManager, i18n, registry);
@@ -120,6 +124,11 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
+
     newMenusRegistry.register(TYPE_FOLDER, foldersNewMenu.get());
     newMenusRegistry.register(TYPE_ROOT, foldersNewMenu.get());
     newMenusRegistry.register(TYPE_DOCUMENT,

Modified: trunk/src/main/java/cc/kune/domain/Container.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Container.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/domain/Container.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -158,6 +158,27 @@
     } else if (!id.equals(other.id)) {
       return false;
     }
+    if (name == null) {
+      if (other.name != null) {
+        return false;
+      }
+    } else if (!name.equals(other.name)) {
+      return false;
+    }
+    if (toolName == null) {
+      if (other.toolName != null) {
+        return false;
+      }
+    } else if (!toolName.equals(other.toolName)) {
+      return false;
+    }
+    if (typeId == null) {
+      if (other.typeId != null) {
+        return false;
+      }
+    } else if (!typeId.equals(other.typeId)) {
+      return false;
+    }
     return true;
   }
 
@@ -252,14 +273,6 @@
     return accessLists != null;
   }
 
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + ((id == null) ? 0 : id.hashCode());
-    return result;
-  }
-
   @Transient
   public boolean isLeaf() {
     return childs.size() == 0 && contents.size() == 0;
@@ -271,9 +284,9 @@
   }
 
   public void removeChild(final Container child) {
-    childs.size();
+    // Adding hash and equals to Container breaks move and delete
+    child.setParent(null);
     childs.remove(child);
-    // child.setParent(null);
   }
 
   public void removeContent(final Content content) {

Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -37,6 +37,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -76,9 +78,10 @@
       final Provider<CopyContentMenuItem> copyContent, final Provider<TutorialContainerBtn> tutorialBtn,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
-      final Provider<ExportCalendarMenuItem> export, final Provider<CalendarGoNextBtn> calNextBtn,
-      final CalendarOnOverMenu onOverMenu, final Provider<CalendarGoTodayBtn> goToday,
-      final Provider<RefreshContentMenuItem> refresh) {
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn, final Provider<ExportCalendarMenuItem> export,
+      final Provider<CalendarGoNextBtn> calNextBtn, final CalendarOnOverMenu onOverMenu,
+      final Provider<CalendarGoTodayBtn> goToday, final Provider<RefreshContentMenuItem> refresh) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, optionsMenuContent, all);
     actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, refresh, all);
@@ -105,6 +108,10 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
 
     eventOpenMenuItem.get();
     eventAddMenuItem.get();

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ActionUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ActionUtils.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ActionUtils.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -39,4 +39,5 @@
         : ((AbstractContentSimpleDTO) event.getTarget()).getStateToken();
     return token;
   }
+
 }

Added: trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerBtn.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.gspace.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.i18n.I18n;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.ContentServiceHelper;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+import com.google.inject.Inject;
+
+public class PurgeContainerBtn extends ButtonDescriptor {
+
+  public static class PurgeCurrentContainerAction extends RolAction {
+
+    private final ContentServiceHelper contentService;
+    private final Session session;
+
+    @Inject
+    public PurgeCurrentContainerAction(final ContentServiceHelper contentService,
+        final CoreResources res, final Session session) {
+      super(AccessRolDTO.Administrator, true);
+      this.contentService = contentService;
+      this.session = session;
+      this.withText(I18n.t("Delete permanently")).withIcon(res.cancel());
+    }
+
+    @Override
+    public void actionPerformed(final ActionEvent event) {
+      contentService.purgeContent(session.getCurrentStateToken());
+    }
+
+  }
+
+  @Inject
+  public PurgeContainerBtn(final PurgeCurrentContainerAction action) {
+    super(action);
+  }
+
+}

Added: trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerMenuItem.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/PurgeContainerMenuItem.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.gspace.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.i18n.I18n;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.ContentServiceHelper;
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+import com.google.inject.Inject;
+
+public class PurgeContainerMenuItem extends MenuItemDescriptor {
+  public static class PurgeContainerAction extends RolAction {
+
+    private final ContentServiceHelper contentService;
+
+    @Inject
+    public PurgeContainerAction(final ContentServiceHelper contentService, final CoreResources res) {
+      super(AccessRolDTO.Administrator, true);
+      this.contentService = contentService;
+      this.withText(I18n.t("Delete permanently")).withIcon(res.cancel());
+    }
+
+    @Override
+    public void actionPerformed(final ActionEvent event) {
+      contentService.purgeContent(ActionUtils.getActionToken(event));
+    }
+
+  }
+
+  @Inject
+  public PurgeContainerMenuItem(final I18nTranslationService i18n, final PurgeContainerAction action,
+      final CoreResources res) {
+    super(action);
+  }
+
+}

Modified: trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -41,6 +41,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -82,6 +84,8 @@
       final Provider<CopyContentMenuItem> copyContent,
       final Provider<RefreshContentMenuItem> refreshPost,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants, final ListsNewMenu listNewMenu,
       final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry,
       final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelListMenuItem> delFolderMenuItem,
@@ -125,6 +129,10 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
     newMenusRegistry.register(TYPE_LIST, listNewMenu.get());
     newMenusRegistry.register(TYPE_ROOT, listNewMenu.get());
     newMenusRegistry.register(TYPE_POST,

Modified: trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -42,6 +42,8 @@
 import cc.kune.gspace.client.actions.ContentViewerShareMenu;
 import cc.kune.gspace.client.actions.CopyContentMenuItem;
 import cc.kune.gspace.client.actions.ParticipateInContentBtn;
+import cc.kune.gspace.client.actions.PurgeContainerBtn;
+import cc.kune.gspace.client.actions.PurgeContainerMenuItem;
 import cc.kune.gspace.client.actions.PurgeContentBtn;
 import cc.kune.gspace.client.actions.PurgeContentMenuItem;
 import cc.kune.gspace.client.actions.RefreshContentMenuItem;
@@ -80,7 +82,9 @@
       final Provider<AddCollabMembersToContentMenuItem> addCollabMembersMenuItem,
       final Provider<AddPublicToContentMenuItem> addPublicMenuItem,
       final Provider<PurgeContentMenuItem> purgeMenuItem, final Provider<PurgeContentBtn> purgeBtn,
-      final Provider<ChatAboutContentBtn> chatAbout, final Provider<CopyContentMenuItem> copyContent,
+      final Provider<PurgeContainerMenuItem> purgeFolderMenuItem,
+      final Provider<PurgeContainerBtn> purgeFolderBtn, final Provider<ChatAboutContentBtn> chatAbout,
+      final Provider<CopyContentMenuItem> copyContent,
       final Provider<WriteToParticipantsMenuItem> writeToParticipants,
       final TasksFolderNewMenu taskFolderNewMenu, final TasksNewMenu taskNewMenu,
       final NewMenusForTypeIdsRegistry newMenusRegistry,
@@ -127,6 +131,10 @@
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeBtn, contents);
     actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeMenuItem,
         contents);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.TOPBAR, purgeFolderBtn,
+        containersNoRoot);
+    actionsRegistry.addAction(TrashToolConstants.TOOL_NAME, ActionGroups.ITEM_MENU, purgeFolderMenuItem,
+        containersNoRoot);
     // Currently new menu in folders has no sense (because we have buttons for
     // the same contents)
     // newMenusRegistry.register(TYPE_FOLDER, taskFolderNewMenu.get());

Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -19,6 +19,7 @@
  */
 package cc.kune.core.server.integration.content;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -51,7 +52,7 @@
         getSiteDefaultContent().getStateToken());
     assertNotNull(response.getContentRights());
     assertTrue(response.getContentRights().isEditable());
-    assertTrue(response.getAccessLists().getAdmins().getList().size() == 1);
+    assertEquals(1, response.getAccessLists().getAdmins().getList().size());
   }
 
   @Before
@@ -68,15 +69,13 @@
     assertNotNull(content.getContainer().getId());
     assertNotNull(content.getToolName());
     assertNotNull(content.getDocumentId());
-    assertNotNull(content.getRateByUsers());
-    assertNotNull(content.getRate());
   }
 
   @Test
   public void defContentOfUserWithNoHomePage() throws Exception {
-    final String userHash = doLogin().getUserHash();
-    final StateAbstractDTO response = contentService.getContent(userHash, new StateToken());
-    assertTrue(response.getStateToken().equals(getSiteDefaultContent().getStateToken()));
+    doLogin();
+    final StateAbstractDTO response = contentService.getContent(session.getHash(), new StateToken());
+    assertEquals(response.getStateToken(), getSiteDefaultContent().getStateToken());
   }
 
   @Test

Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -131,8 +131,31 @@
   }
 
   @Test
-  public void delAndPurgeContainer() throws Exception {
+  public void delAndPurgeContent() throws Exception {
     doLogin();
+    final StateContainerDTO trash = getTrash();
+    final StateContainerDTO added = createNewContent();
+    final StateAbstractDTO retrievedContent = contentService.getContent(session.getHash(),
+        added.getStateToken());
+    assertNotNull(retrievedContent.getStateToken());
+    final StateContainerDTO deleledContainer = contentService.delContent(session.getHash(),
+        retrievedContent.getStateToken());
+    assertEquals(1, defaultContent.getContainer().getContents().size());
+    assertEquals(1, deleledContainer.getContainer().getContents().size());
+    final StateContentDTO deletedContent = (StateContentDTO) contentService.getContent(
+        session.getHash(),
+        retrievedContent.getStateToken().setTool(TrashToolConstants.TOOL_NAME).setFolder(
+            trash.getStateToken().getFolder()));
+    assertEquals(TrashToolConstants.TOOL_NAME, deletedContent.getToolName());
+    assertEquals(1, deletedContent.getContainer().getContents().size());
+    final StateContainerDTO trashAfterPurge = contentService.purgeContent(session.getHash(),
+        deletedContent.getStateToken());
+    assertEquals(0, trashAfterPurge.getContainer().getContents().size());
+  }
+
+  @Test
+  public void delAndyPurgeContainer() throws Exception {
+    doLogin();
     final StateContainerDTO state = contentService.addFolder(session.getHash(),
         defaultContent.getStateToken(), "some folder", DocsToolConstants.TYPE_FOLDER);
     final ContainerDTO newFolder = state.getContainer();
@@ -149,36 +172,13 @@
         session.getHash(),
         newFolder.getStateToken().setTool(TrashToolConstants.TOOL_NAME).setFolder(
             newFolder.getStateToken().getFolder()));
-    contentService.purgeContainer(session.getHash(), deletedFolder.getStateToken());
+    contentService.purgeContent(session.getHash(), deletedFolder.getStateToken());
     final StateContainerDTO trashAfterPurge = getTrash();
     assertEquals(0, trashAfterPurge.getContainer().getContents().size());
     assertEquals(0, trashAfterPurge.getContainer().getChilds().size());
   }
 
   @Test
-  public void delAndPurgeContent() throws Exception {
-    doLogin();
-    final StateContainerDTO trash = getTrash();
-    final StateContainerDTO added = createNewContent();
-    final StateAbstractDTO retrievedContent = contentService.getContent(session.getHash(),
-        added.getStateToken());
-    assertNotNull(retrievedContent.getStateToken());
-    final StateContainerDTO deleledContainer = contentService.delContent(session.getHash(),
-        retrievedContent.getStateToken());
-    assertEquals(1, defaultContent.getContainer().getContents().size());
-    assertEquals(1, deleledContainer.getContainer().getContents().size());
-    final StateContentDTO deletedContent = (StateContentDTO) contentService.getContent(
-        session.getHash(),
-        retrievedContent.getStateToken().setTool(TrashToolConstants.TOOL_NAME).setFolder(
-            trash.getStateToken().getFolder()));
-    assertEquals(TrashToolConstants.TOOL_NAME, deletedContent.getToolName());
-    assertEquals(1, deletedContent.getContainer().getContents().size());
-    final StateContainerDTO trashAfterPurge = contentService.purgeContent(session.getHash(),
-        deletedContent.getStateToken());
-    assertEquals(0, trashAfterPurge.getContainer().getContents().size());
-  }
-
-  @Test
   public void folderRename() throws Exception {
     doLogin();
     defaultContent = getSiteDefaultContent();

Modified: trunk/src/test/java/cc/kune/core/server/manager/ContainerManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContainerManagerDefaultTest.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContainerManagerDefaultTest.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -99,8 +99,8 @@
     assertEquals(1, parentFolder.getChilds().size());
     containerManager.moveContainer(folderToMove, rootFolder);
     assertEquals(rootFolder, folderToMove.getParent());
+    assertEquals(2, rootFolder.getChilds().size());
     assertEquals(0, parentFolder.getChilds().size());
-    assertEquals(2, rootFolder.getChilds().size());
     assertEquals(2, folderToMove.getAbsolutePath().size());
     assertEquals(rootFolder, folderToMove.getAbsolutePath().get(0));
     assertEquals(folderToMove, folderToMove.getAbsolutePath().get(1));

Modified: trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java	2012-03-31 19:22:39 UTC (rev 1812)
+++ trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java	2012-03-31 21:43:21 UTC (rev 1813)
@@ -87,13 +87,6 @@
     assertNotNull(result.getId());
   }
 
-  @Test(expected = InvalidStateException.class)
-  public void passwdLengthIncorrect() {
-    user = new User("test1", "test1 name", "test at example.com", "diggest".getBytes(), "salt".getBytes(),
-        english, gb, getTimeZone());
-    persist(user);
-  }
-
   /**
    * This was not working:
    * http://opensource.atlassian.com/projects/hibernate/browse/EJB-382




More information about the kune-commits mailing list