[kune-commits] r923 - in trunk: img src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/chat/client/cnt src/main/java/org/ourproject/kune/chat/client/ctx src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/docs/client/cnt src/main/java/org/ourproject/kune/docs/client/ctx src/main/java/org/ourproject/kune/docs/client/ctx/admin 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/state src/main/java/org/ourproject/kune/platf/client/tool src/main/java/org/ourproject/kune/platf/client/ui/rate src/main/java/org/ourproject/kune/platf/server/access src/main/java/org/ourproject/kune/platf/server/content src/main/java/org/ourproject/kune/platf/server/domain src/main/java/org/ourproject/kune/platf/server/rpc src/main/java/org/ourproject/kune/platf/server/state src/main/java/org/ourproject/kune/workspace/client/ctxnav src/main/java/org/ourproject/kune/workspace/client/entitylogo src/main/java/org/ourproject/kune/workspace/client/licensefoot src/main/java/org/ourproject/kune/workspace/client/nohomepage src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic src/main/java/org/ourproject/kune/workspace/client/socialnet src/main/java/org/ourproject/kune/workspace/client/summary src/main/java/org/ourproject/kune/workspace/client/tags src/main/java/org/ourproject/kune/workspace/client/themes src/main/java/org/ourproject/kune/workspace/client/title src/main/resources src/test/java/org/ourproject/kune/platf/client/state src/test/java/org/ourproject/kune/platf/client/tool src/test/java/org/ourproject/kune/platf/integration/content src/test/java/org/ourproject/kune/platf/server/manager/file src/test/java/org/ourproject/kune/platf/server/mapper src/test/java/org/ourproject/kune/workspace/client/tags

vjrj vjrj at ourproject.org
Fri Oct 24 03:37:50 CEST 2008


Author: vjrj
Date: 2008-10-24 03:37:05 +0200 (Fri, 24 Oct 2008)
New Revision: 923

Added:
   trunk/img/kune-hibernate-diagram-oct-08.png
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateNoContentDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
Modified:
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContentDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.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/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProvider.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/FinderServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContent.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateNoContent.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
   trunk/src/main/resources/dozerBeanMapping.xml
   trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java
Log:
Incomplete - task Tools must me optional and User/Group creation must reflect this 

State refactorization


Added: trunk/img/kune-hibernate-diagram-oct-08.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/kune-hibernate-diagram-oct-08.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -44,7 +44,7 @@
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.state.Session;
@@ -136,11 +136,11 @@
         return NAME;
     }
 
-    public void setContent(final StateDTO state) {
+    public void setContent(final StateContainerDTO state) {
         chatContentProvider.get().setState(state);
     }
 
-    public void setContext(final StateDTO state) {
+    public void setContext(final StateContainerDTO state) {
         chatContextProvider.get().setState(state);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,10 +39,10 @@
 
 package org.ourproject.kune.chat.client.cnt;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 
 public interface ChatContent {
 
-    void setState(StateDTO state);
+    void setState(StateContainerDTO state);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -43,7 +43,7 @@
 import org.ourproject.kune.chat.client.cnt.info.ChatInfo;
 import org.ourproject.kune.chat.client.cnt.room.ChatRoom;
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
 
 import com.allen_sauer.gwt.log.client.Log;
@@ -54,7 +54,7 @@
 public class ChatContentPresenter implements ChatContent {
 
     private final WorkspaceDeckView view;
-    private StateDTO state;
+    private StateContainerDTO state;
     private final EmiteUIDialog emiteUIDialog;
     private final Provider<ChatInfo> chatInfoProvider;
     private final Provider<ChatRoom> chatRoomProvider;
@@ -76,7 +76,7 @@
         emiteUIDialog.joinRoom(XmppURI.uri(roomName));
     }
 
-    public void setState(final StateDTO state) {
+    public void setState(final StateContainerDTO state) {
         this.state = state;
         final String typeId = state.getTypeId();
         if (typeId.equals(ChatClientTool.TYPE_ROOT)) {

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContext.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,10 +39,10 @@
 
 package org.ourproject.kune.chat.client.ctx;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 
 public interface ChatContext {
 
-    void setState(StateDTO state);
+    void setState(StateContainerDTO state);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -41,7 +41,7 @@
 
 import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin;
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
 
 import com.calclab.suco.client.ioc.Provider;
@@ -60,7 +60,7 @@
         return view;
     }
 
-    public void setState(final StateDTO state) {
+    public void setState(final StateContainerDTO state) {
         final RoomsAdmin rooms = roomAdminsProvider.get();
         rooms.showRoom(state.getStateToken(), state.getContainer(), state.getContainerRights());
         view.show(rooms.getView());

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,7 +46,8 @@
 import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.SessionExpiredException;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
@@ -126,8 +127,8 @@
                         Site.showProgressProcessing();
                         contentServiceProvider.get().addContent(session.getUserHash(),
                                 session.getCurrentState().getStateToken(), i18n.t("New document"),
-                                new AsyncCallbackSimple<StateDTO>() {
-                                    public void onSuccess(final StateDTO state) {
+                                new AsyncCallbackSimple<StateContentDTO>() {
+                                    public void onSuccess(final StateContentDTO state) {
                                         contextNavigator.setEditOnNextStateChange(true);
                                         stateManager.setRetrievedState(state);
                                     }
@@ -309,7 +310,7 @@
         setGroupLogo.setIconUrl("images/nav/picture.png");
         setGroupLogo.setEnableCondition(new ActionEnableCondition<StateToken>() {
             public boolean mustBeEnabled(final StateToken itemToken) {
-                final BasicMimeTypeDTO mime = session.getCurrentState().getMimeType();
+                final BasicMimeTypeDTO mime = session.getContentState().getMimeType();
                 return mime != null && mime.getType().equals("image");
             }
         });
@@ -343,7 +344,7 @@
                             public void onSuccess(final Object result) {
                                 final TextEditor editor = textEditorProvider.get();
                                 documentContent.detach();
-                                editor.editContent(session.getCurrentState().getContent(), new Listener<String>() {
+                                editor.editContent(session.getContentState().getContent(), new Listener<String>() {
                                     public void onEvent(final String html) {
                                         Site.showProgressSaving();
                                         contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
@@ -363,8 +364,8 @@
 
                                                     public void onSuccess(final Integer newVersion) {
                                                         Site.hideProgress();
-                                                        session.getCurrentState().setVersion(newVersion);
-                                                        session.getCurrentState().setContent(html);
+                                                        session.getContentState().setVersion(newVersion);
+                                                        session.getContentState().setContent(html);
                                                         editor.onSaved();
                                                     }
                                                 });
@@ -429,8 +430,8 @@
                     public void onEvent(final StateToken stateToken) {
                         Site.showProgressProcessing();
                         contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName,
-                                contentTypeId, new AsyncCallbackSimple<StateDTO>() {
-                                    public void onSuccess(final StateDTO state) {
+                                contentTypeId, new AsyncCallbackSimple<StateContainerDTO>() {
+                                    public void onSuccess(final StateContainerDTO state) {
                                         contextNavigator.setEditOnNextStateChange(true);
                                         stateManager.setRetrievedState(state);
                                     }
@@ -478,7 +479,7 @@
                     public void onEvent(final StateToken stateToken) {
                         final AsyncCallbackSimple<Object> callback = new AsyncCallbackSimple<Object>() {
                             public void onSuccess(final Object result) {
-                                session.getCurrentState().setStatus(status);
+                                session.getContentState().setStatus(status);
                             }
                         };
                         if (status.equals(ContentStatusDTO.publishedOnline) || status.equals(ContentStatusDTO.rejected)) {

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -45,7 +45,9 @@
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
 import org.ourproject.kune.platf.client.actions.ActionRegistry;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
@@ -57,7 +59,6 @@
 
 public class DocumentContentPresenter implements DocumentContent {
     private DocumentContentView view;
-    private StateDTO content;
     private final Session session;
     private final Provider<DocumentReader> docReaderProvider;
     private final Provider<TextEditor> textEditorProvider;
@@ -75,11 +76,9 @@
         this.folderViewerProvider = folderViewerProvider;
         this.toolbar = toolbar;
         this.actionRegistry = actionRegistry;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                if (state.getToolName().equals(DocumentClientTool.NAME)) {
-                    setState(state);
-                }
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                setState(state);
             }
         });
         stateManager.onToolChanged(new Listener2<String, String>() {
@@ -103,34 +102,41 @@
         setState(session.getCurrentState());
     }
 
-    private void setState(final StateDTO state) {
-        content = state;
-        final String typeId = content.getTypeId();
-        ActionItemCollection<StateToken> collection;
-        if (content.hasDocument()) {
-            collection = actionRegistry.getCurrentActions(content.getStateToken(), typeId, session.isLogged(),
-                    content.getContentRights(), true);
-        } else {
-            collection = actionRegistry.getCurrentActions(content.getStateToken(), typeId, session.isLogged(),
-                    content.getContainerRights(), true);
+    private void setState(final StateAbstractDTO state) {
+        if (state instanceof StateContainerDTO) {
+            StateContainerDTO stateCntCtx = (StateContainerDTO) state;
+            if (stateCntCtx.getToolName().equals(DocumentClientTool.NAME)) {
+                // This tool
+                if (stateCntCtx instanceof StateContentDTO) {
+                    setState((StateContentDTO) stateCntCtx);
+                } else if (stateCntCtx instanceof StateContainerDTO) {
+                    setState(stateCntCtx);
+                }
+            }
         }
+    }
+
+    private void setState(final StateContainerDTO state) {
+        ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(),
+                state.getTypeId(), session.isLogged(), state.getContainerRights(), true);
+        setToolbar(collection);
+        final FolderViewer viewer = folderViewerProvider.get();
+        viewer.setFolder(state.getContainer());
+        view.setContent(viewer.getView());
+    }
+
+    private void setState(final StateContentDTO state) {
+        ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(),
+                state.getTypeId(), session.isLogged(), state.getContentRights(), true);
+        setToolbar(collection);
+        docReaderProvider.get().showDocument(state.getStateToken(), state.getContent(), state.getTypeId(),
+                state.getMimeType());
+        textEditorProvider.get().reset();
+    }
+
+    private void setToolbar(ActionItemCollection<StateToken> collection) {
         toolbar.disableMenusAndClearButtons();
         toolbar.setActions(collection);
         toolbar.attach();
-        showContent();
     }
-
-    private void showContent() {
-        // textEditorProvider.get().setToolbarVisible(false);
-        if (content.hasDocument()) {
-            docReaderProvider.get().showDocument(content.getStateToken(), content.getContent(), content.getTypeId(),
-                    content.getMimeType());
-            textEditorProvider.get().reset();
-        } else {
-            final FolderViewer viewer = folderViewerProvider.get();
-            viewer.setFolder(content.getContainer());
-            view.setContent(viewer.getView());
-        }
-    }
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -41,7 +41,9 @@
 
 import org.ourproject.kune.docs.client.DocumentClientTool;
 import org.ourproject.kune.docs.client.ctx.admin.AdminContext;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
 
@@ -57,10 +59,17 @@
             final Provider<ContextNavigator> contextNavigatorProvider, final Provider<AdminContext> adminContextProvider) {
         this.contextNavigatorProvider = contextNavigatorProvider;
         this.adminContextProvider = adminContextProvider;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                if (DocumentClientTool.NAME.equals(state.getToolName())) {
-                    setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    StateContainerDTO stateCntCtx = (StateContainerDTO) state;
+                    if (DocumentClientTool.NAME.equals(stateCntCtx.getToolName())) {
+                        setState(stateCntCtx);
+                    }
+                } else {
+                    // TODO detach
+                    contextNavigatorProvider.get().clear();
+                    adminContextProvider.get().clear();
                 }
             }
         });
@@ -79,9 +88,11 @@
         view.setContainer(contextNavigatorProvider.get().getView());
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateContainerDTO state) {
         contextNavigatorProvider.get().setState(state, true);
-        adminContextProvider.get().setState(state);
+        if (state instanceof StateContentDTO) {
+            adminContextProvider.get().setState((StateContentDTO) state);
+        }
         showFolders();
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -40,10 +40,12 @@
 package org.ourproject.kune.docs.client.ctx.admin;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 
 public interface AdminContext {
+    void clear();
+
     View getView();
 
-    void setState(StateDTO content);
+    void setState(StateContentDTO content);
 }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -45,7 +45,8 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.AccessListsDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
@@ -83,7 +84,7 @@
 
     public void addAuthor(final String authorShortName) {
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateContainerDTO currentState = session.getContentState();
         contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
                 new AsyncCallbackSimple<Object>() {
                     public void onSuccess(final Object result) {
@@ -93,9 +94,13 @@
                 });
     }
 
+    public void clear() {
+        // TODO Auto-generated method stub
+    }
+
     public void delAuthor(final String authorShortName) {
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateContainerDTO currentState = session.getContentState();
         contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
                 new AsyncCallbackSimple<Object>() {
                     public void onSuccess(final Object result) {
@@ -107,7 +112,7 @@
 
     public void doChangeLanguage(final String langCode) {
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateContainerDTO currentState = session.getContentState();
         contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
                 new AsyncCallbackSimple<I18nLanguageDTO>() {
                     public void onSuccess(final I18nLanguageDTO lang) {
@@ -127,7 +132,7 @@
 
     public void setPublishedOn(final Date publishedOn) {
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateContainerDTO currentState = session.getContentState();
         contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
                 new AsyncCallbackSimple<Object>() {
                     public void onSuccess(final Object result) {
@@ -138,7 +143,7 @@
 
     }
 
-    public void setState(final StateDTO content) {
+    public void setState(final StateContentDTO content) {
         // In the future check the use of these components by each tool
         final I18nLanguageDTO language = content.getLanguage();
         final AccessListsDTO accessLists = content.getAccessLists();
@@ -146,38 +151,36 @@
         final String tags = content.getTags();
         final List<UserSimpleDTO> authors = content.getAuthors();
 
-        if (content.hasDocument()) {
-            if (tags != null) {
-                view.setTags(tags);
-            } else {
-                view.removeTagsComponent();
-            }
-            if (language != null) {
-                view.setLanguage(language);
-            } else {
-                view.removeLangComponent();
-            }
-            if (authors != null) {
-                view.setAuthors(authors);
-            } else {
-                view.removeAuthorsComponent();
-            }
-            if (publishedOn != null) {
-                view.setPublishedOn(publishedOn);
-            } else {
-                view.removePublishedOnComponent();
-            }
-            if (accessLists != null) {
-                view.setAccessLists(accessLists);
-            } else {
-                view.removeAccessListComponent();
-            }
+        if (tags != null) {
+            view.setTags(tags);
+        } else {
+            view.removeTagsComponent();
         }
+        if (language != null) {
+            view.setLanguage(language);
+        } else {
+            view.removeLangComponent();
+        }
+        if (authors != null) {
+            view.setAuthors(authors);
+        } else {
+            view.removeAuthorsComponent();
+        }
+        if (publishedOn != null) {
+            view.setPublishedOn(publishedOn);
+        } else {
+            view.removePublishedOnComponent();
+        }
+        if (accessLists != null) {
+            view.setAccessLists(accessLists);
+        } else {
+            view.removeAccessListComponent();
+        }
     }
 
     public void setTags(final String tagsString) {
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateContainerDTO currentState = session.getContentState();
         contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
                 new AsyncCallbackSimple<List<TagResultDTO>>() {
                     public void onSuccess(final List<TagResultDTO> result) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateAbstractDTO.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -2,20 +2,20 @@
 
 import java.util.List;
 
-public abstract class StateAbstractDTO {
+import com.google.gwt.user.client.rpc.IsSerializable;
 
-    private AccessListsDTO accessLists;
+public abstract class StateAbstractDTO implements IsSerializable {
+
     private List<String> enabledTools;
     private GroupDTO group;
     private SocialNetworkDTO groupMembers;
+    private AccessRightsDTO groupRights;
     private ParticipationDataDTO participation;
     private UserBuddiesDataDTO userBuddies;
     private StateToken stateToken;
     private String title;
-    private AccessRightsDTO groupRights;
 
-    public AccessListsDTO getAccessLists() {
-        return accessLists;
+    public StateAbstractDTO() {
     }
 
     public List<String> getEnabledTools() {
@@ -23,7 +23,7 @@
     }
 
     public GroupDTO getGroup() {
-        return this.group;
+        return group;
     }
 
     public SocialNetworkDTO getGroupMembers() {
@@ -50,35 +50,31 @@
         return userBuddies;
     }
 
-    public void setAccessLists(final AccessListsDTO accessLists) {
-        this.accessLists = accessLists;
-    }
-
     public void setEnabledTools(List<String> enabledTools) {
         this.enabledTools = enabledTools;
     }
 
-    public void setGroup(final GroupDTO group) {
+    public void setGroup(GroupDTO group) {
         this.group = group;
     }
 
-    public void setGroupMembers(final SocialNetworkDTO groupMembers) {
+    public void setGroupMembers(SocialNetworkDTO groupMembers) {
         this.groupMembers = groupMembers;
     }
 
-    public void setGroupRights(final AccessRightsDTO groupRights) {
+    public void setGroupRights(AccessRightsDTO groupRights) {
         this.groupRights = groupRights;
     }
 
-    public void setParticipation(final ParticipationDataDTO participation) {
+    public void setParticipation(ParticipationDataDTO participation) {
         this.participation = participation;
     }
 
-    public void setStateToken(final StateToken stateToken) {
+    public void setStateToken(StateToken stateToken) {
         this.stateToken = stateToken;
     }
 
-    public void setTitle(final String title) {
+    public void setTitle(String title) {
         this.title = title;
     }
 
@@ -86,4 +82,9 @@
         this.userBuddies = userBuddies;
     }
 
+    @Override
+    public String toString() {
+        return "StateDTO[" + getStateToken() + "]";
+    }
+
 }

Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -0,0 +1,99 @@
+package org.ourproject.kune.platf.client.dto;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class StateContainerDTO extends StateAbstractDTO implements IsSerializable {
+
+    private I18nLanguageDTO language;
+    private String typeId;
+    private String toolName;
+    private ContainerDTO container;
+    private ContainerDTO rootContainer;
+    private AccessRightsDTO containerRights;
+    private LicenseDTO license;
+    private List<TagResultDTO> groupTags;
+    private AccessListsDTO accessLists;
+
+    public StateContainerDTO() {
+    }
+
+    public ContainerDTO getContainer() {
+        return container;
+    }
+
+    public AccessRightsDTO getContainerRights() {
+        return containerRights;
+    }
+
+    public List<TagResultDTO> getGroupTags() {
+        return groupTags;
+    }
+
+    public I18nLanguageDTO getLanguage() {
+        return language;
+    }
+
+    public LicenseDTO getLicense() {
+        return license;
+    }
+
+    public ContainerDTO getRootContainer() {
+        return rootContainer;
+    }
+
+    public String getToolName() {
+        return toolName;
+    }
+
+    public String getTypeId() {
+        return typeId;
+    }
+
+    public void setContainer(ContainerDTO container) {
+        this.container = container;
+    }
+
+    public void setContainerRights(AccessRightsDTO containerRights) {
+        this.containerRights = containerRights;
+    }
+
+    public void setGroupTags(List<TagResultDTO> groupTags) {
+        this.groupTags = groupTags;
+    }
+
+    public void setLanguage(I18nLanguageDTO language) {
+        this.language = language;
+    }
+
+    public void setLicense(LicenseDTO license) {
+        this.license = license;
+    }
+
+    public void setRootContainer(ContainerDTO rootContainer) {
+        this.rootContainer = rootContainer;
+    }
+
+    public void setToolName(String toolName) {
+        this.toolName = toolName;
+    }
+
+    public void setTypeId(String typeId) {
+        this.typeId = typeId;
+    }
+
+    @Override
+    public String toString() {
+        return "StateDTO[" + getStateToken() + "/" + getTypeId() + "]";
+    }
+
+    public AccessListsDTO getAccessLists() {
+        return accessLists;
+    }
+
+    public void setAccessLists(AccessListsDTO accessLists) {
+        this.accessLists = accessLists;
+    }
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContentDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContentDTO.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContentDTO.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,32 +1,136 @@
 package org.ourproject.kune.platf.client.dto;
 
-public abstract class StateContentDTO extends StateAbstractDTO {
+import java.util.Date;
+import java.util.List;
 
-    private I18nLanguageDTO language;
-    private String toolName;
-    private String typeId;
+import com.google.gwt.user.client.rpc.IsSerializable;
 
-    public I18nLanguageDTO getLanguage() {
-        return language;
+public class StateContentDTO extends StateContainerDTO implements IsSerializable {
+
+    private String documentId;
+    private int version;
+    private String content;
+    private AccessRightsDTO contentRights;
+    private ContentStatusDTO status;
+    private boolean isRateable;
+    private Double rate;
+    private Integer rateByUsers;
+    private Double currentUserRate;
+    private BasicMimeTypeDTO mimeType;
+    private Date publishedOn;
+    private String tags;
+    private List<UserSimpleDTO> authors;
+
+    public StateContentDTO() {
     }
 
-    public String getToolName() {
-        return toolName;
+    public List<UserSimpleDTO> getAuthors() {
+        return authors;
     }
 
-    public String getTypeId() {
-        return typeId;
+    public String getContent() {
+        return content;
     }
 
-    public void setLanguage(final I18nLanguageDTO language) {
-        this.language = language;
+    public AccessRightsDTO getContentRights() {
+        return contentRights;
     }
 
-    public void setToolName(final String toolName) {
-        this.toolName = toolName;
+    public Double getCurrentUserRate() {
+        return currentUserRate;
     }
 
-    public void setTypeId(final String typeId) {
-        this.typeId = typeId;
+    public String getDocumentId() {
+        return documentId;
     }
+
+    public BasicMimeTypeDTO getMimeType() {
+        return mimeType;
+    }
+
+    public Date getPublishedOn() {
+        return publishedOn;
+    }
+
+    public Double getRate() {
+        return rate;
+    }
+
+    public Integer getRateByUsers() {
+        return rateByUsers;
+    }
+
+    public ContentStatusDTO getStatus() {
+        return status;
+    }
+
+    public String getTags() {
+        return tags;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public boolean isRateable() {
+        return isRateable;
+    }
+
+    public void setAuthors(List<UserSimpleDTO> authors) {
+        this.authors = authors;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public void setContentRights(AccessRightsDTO contentRights) {
+        this.contentRights = contentRights;
+    }
+
+    public void setCurrentUserRate(Double currentUserRate) {
+        this.currentUserRate = currentUserRate;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId;
+    }
+
+    public void setMimeType(BasicMimeTypeDTO mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    public void setPublishedOn(Date publishedOn) {
+        this.publishedOn = publishedOn;
+    }
+
+    public void setRate(Double rate) {
+        this.rate = rate;
+    }
+
+    public void setRateable(boolean isRateable) {
+        this.isRateable = isRateable;
+    }
+
+    public void setRateByUsers(Integer rateByUsers) {
+        this.rateByUsers = rateByUsers;
+    }
+
+    public void setStatus(ContentStatusDTO status) {
+        this.status = status;
+    }
+
+    public void setTags(String tags) {
+        this.tags = tags;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    @Override
+    public String toString() {
+        return "StateDTO[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "") + "]";
+    }
+
 }

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,240 +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/>.
- *
- */
-/*
- *
- * 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 java.util.Date;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-public class StateDTO extends StateContentDTO implements IsSerializable {
-    private String documentId;
-    private int version;
-    private String content;
-    private ContainerDTO container;
-    private ContainerDTO rootContainer;
-    private SocialNetworkDTO socialNetwork;
-    private AccessRightsDTO contentRights;
-    private AccessRightsDTO containerRights;
-    private ContentStatusDTO status;
-    private boolean isRateable;
-    private Double rate;
-    private Integer rateByUsers;
-    private Double currentUserRate;
-    private BasicMimeTypeDTO mimeType;
-    private LicenseDTO license;
-    private Date publishedOn;
-    private String tags;
-    private List<UserSimpleDTO> authors;
-    private List<TagResultDTO> groupTags;
-
-    public StateDTO() {
-        this(null, null, null);
-    }
-
-    public StateDTO(final String docRef, final String title, final String content) {
-        this.documentId = docRef;
-        this.content = content;
-        setTitle(title);
-    }
-
-    public List<UserSimpleDTO> getAuthors() {
-        return authors;
-    }
-
-    public ContainerDTO getContainer() {
-        return container;
-    }
-
-    public AccessRightsDTO getContainerRights() {
-        return containerRights;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public AccessRightsDTO getContentRights() {
-        return this.contentRights;
-    }
-
-    public Double getCurrentUserRate() {
-        return currentUserRate;
-    }
-
-    public String getDocumentId() {
-        return documentId;
-    }
-
-    public List<TagResultDTO> getGroupTags() {
-        return groupTags;
-    }
-
-    public LicenseDTO getLicense() {
-        return license;
-    }
-
-    public BasicMimeTypeDTO getMimeType() {
-        return mimeType;
-    }
-
-    public Date getPublishedOn() {
-        return publishedOn;
-    }
-
-    public Double getRate() {
-        return rate;
-    }
-
-    public Integer getRateByUsers() {
-        return rateByUsers;
-    }
-
-    public ContainerDTO getRootContainer() {
-        return rootContainer;
-    }
-
-    public SocialNetworkDTO getSocialNetwork() {
-        return socialNetwork;
-    }
-
-    public ContentStatusDTO getStatus() {
-        return status;
-    }
-
-    public String getTags() {
-        return tags;
-    }
-
-    public int getVersion() {
-        return version;
-    }
-
-    // FIXME: maybe a tag in the content showing the type, think about this
-    public boolean hasDocument() {
-        return documentId != null;
-    }
-
-    public boolean isRateable() {
-        return isRateable;
-    }
-
-    public void setAuthors(final List<UserSimpleDTO> authors) {
-        this.authors = authors;
-    }
-
-    public void setContainer(final ContainerDTO container) {
-        this.container = container;
-    }
-
-    public void setContainerRights(final AccessRightsDTO containerRights) {
-        this.containerRights = containerRights;
-    }
-
-    public void setContent(final String content) {
-        this.content = content;
-    }
-
-    public void setContentRights(final AccessRightsDTO accessRights) {
-        this.contentRights = accessRights;
-    }
-
-    public void setCurrentUserRate(final Double currentUserRate) {
-        this.currentUserRate = currentUserRate;
-    }
-
-    public void setDocumentId(final String docRef) {
-        this.documentId = docRef;
-    }
-
-    public void setGroupTags(final List<TagResultDTO> groupTags) {
-        this.groupTags = groupTags;
-    }
-
-    public void setLicense(final LicenseDTO license) {
-        this.license = license;
-    }
-
-    public void setMimeType(final BasicMimeTypeDTO mimeType) {
-        this.mimeType = mimeType;
-    }
-
-    public void setPublishedOn(final Date publishedOn) {
-        this.publishedOn = publishedOn;
-    }
-
-    public void setRate(final Double rate) {
-        this.rate = rate;
-    }
-
-    public void setRateable(final boolean isRateable) {
-        this.isRateable = isRateable;
-    }
-
-    public void setRateByUsers(final Integer rateByUsers) {
-        this.rateByUsers = rateByUsers;
-    }
-
-    public void setRootContainer(final ContainerDTO rootContainer) {
-        this.rootContainer = rootContainer;
-    }
-
-    public void setSocialNetwork(final SocialNetworkDTO socialNetwork) {
-        this.socialNetwork = socialNetwork;
-    }
-
-    public void setStatus(final ContentStatusDTO status) {
-        this.status = status;
-    }
-
-    public void setTags(final String tags) {
-        this.tags = tags;
-    }
-
-    public void setVersion(final int version) {
-        this.version = version;
-    }
-
-    @Override
-    public String toString() {
-        return "StateDTO[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "") + "]";
-    }
-
-}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateNoContentDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateNoContentDTO.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateNoContentDTO.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Used for contents not found or users without homepage
+ */
+public class StateNoContentDTO extends StateAbstractDTO implements IsSerializable {
+}
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,7 +46,9 @@
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.errors.DefaultException;
@@ -62,15 +64,16 @@
 
     CommentDTO addComment(String userHash, StateToken token, String commentText) throws DefaultException;
 
-    StateDTO addContent(String user, StateToken parentToken, String name) throws DefaultException;
+    StateContentDTO addContent(String user, StateToken parentToken, String name) throws DefaultException;
 
-    StateDTO addFolder(String hash, StateToken parentToken, String typeId, String title) throws DefaultException;
+    StateContainerDTO addFolder(String hash, StateToken parentToken, String typeId, String title)
+            throws DefaultException;
 
-    StateDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
+    StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
 
     void delContent(String userHash, StateToken token) throws DefaultException;
 
-    StateDTO getContent(String userHash, StateToken token) throws DefaultException;
+    StateAbstractDTO getContent(String userHash, StateToken token) throws DefaultException;
 
     List<TagResultDTO> getSummaryTags(String userHash, StateToken groupToken) throws DefaultException;
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,7 +46,9 @@
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 
@@ -61,15 +63,16 @@
 
     void addComment(String userHash, StateToken token, String commentText, AsyncCallback<CommentDTO> asyncCallback);
 
-    void addContent(String user, StateToken parentToken, String name, AsyncCallback<StateDTO> callback);
+    void addContent(String user, StateToken parentToken, String name, AsyncCallback<StateContentDTO> callback);
 
-    void addFolder(String hash, StateToken parentToken, String title, String typeId, AsyncCallback<StateDTO> callback);
+    void addFolder(String hash, StateToken parentToken, String title, String typeId,
+            AsyncCallback<StateContainerDTO> callback);
 
-    void addRoom(String user, StateToken parentToken, String name, AsyncCallback<StateDTO> callback);
+    void addRoom(String user, StateToken parentToken, String name, AsyncCallback<StateContainerDTO> callback);
 
     void delContent(String userHash, StateToken token, AsyncCallback<?> asyncCallback);
 
-    void getContent(String user, StateToken newState, AsyncCallback<StateDTO> callback);
+    void getContent(String user, StateToken newState, AsyncCallback<StateAbstractDTO> callback);
 
     void getSummaryTags(String userHash, StateToken groupToken, AsyncCallback<List<TagResultDTO>> asyncCallback);
 

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-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -45,7 +45,6 @@
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.client.errors.GroupNotFoundException;
 import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
-import org.ourproject.kune.platf.client.errors.NoDefaultContentException;
 import org.ourproject.kune.platf.client.errors.SessionExpiredException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.client.state.Session;
@@ -67,7 +66,6 @@
     private final Provider<WorkspaceSkeleton> wsProvider;
     private final Event0 onSessionExpired;
     private final Provider<StateManager> stateManagerProvider;
-    private final Event0 onNotDefaultContent;
 
     public KuneErrorHandler(final Session session, final I18nTranslationService i18n,
             final Provider<WorkspaceSkeleton> wsProvider, final Provider<StateManager> stateManagerProvider) {
@@ -76,7 +74,6 @@
         this.wsProvider = wsProvider;
         this.stateManagerProvider = stateManagerProvider;
         this.onSessionExpired = Events.create("onSessionExpired");
-        onNotDefaultContent = new Event0("onNotDefaultContent");
     }
 
     public void doSessionExpired() {
@@ -89,10 +86,6 @@
         return wsProvider.get();
     }
 
-    public void onNotDefaultContent(final Listener0 listener) {
-        onNotDefaultContent.add(listener);
-    }
-
     public void onSessionExpired(final Listener0 listener) {
         onSessionExpired.add(listener);
     }
@@ -107,8 +100,6 @@
         } catch (final SessionExpiredException e) {
             logException(e);
             doSessionExpired();
-        } catch (final NoDefaultContentException e) {
-            onNotDefaultContent.fire();
         } catch (final UserMustBeLoggedException e) {
             logException(e);
             if (session.isLogged()) {

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-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -322,7 +322,7 @@
             @Override
             public ToolSelector create() {
                 final ToolSelectorPresenter presenter = new ToolSelectorPresenter($(StateManager.class),
-                        $(WsThemePresenter.class), $(KuneErrorHandler.class));
+                        $(WsThemePresenter.class));
                 return presenter;
             }
         });
@@ -412,9 +412,9 @@
                         contextNavigatorToolbar);
 
                 final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class),
-                        $(Session.class), $(KuneErrorHandler.class), $$(ContentServiceAsync.class), i18n,
-                        $(EntityTitle.class), $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar,
-                        $(ContextActionRegistry.class), $$(FileDownloadUtils.class), true);
+                        $(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class),
+                        $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar, $(ContextActionRegistry.class),
+                        $$(FileDownloadUtils.class), true);
                 final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n,
                         $(WorkspaceSkeleton.class), $(ActionManager.class));
                 presenter.init(panel);

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -24,7 +24,6 @@
 import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
 import org.ourproject.kune.platf.client.actions.UserActionRegistry;
 import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
-import org.ourproject.kune.platf.client.app.HistoryWrapper;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
@@ -266,7 +265,7 @@
             @Override
             public WsThemePresenter create() {
                 final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $$(GroupServiceAsync.class),
-                        $(StateManager.class), $(KuneErrorHandler.class));
+                        $(StateManager.class));
                 final WsThemePanel panel = new WsThemePanel($(WorkspaceSkeleton.class), presenter,
                         $(I18nUITranslationService.class));
                 presenter.init(panel);
@@ -290,7 +289,7 @@
             @Override
             public EntitySubTitle create() {
                 final EntitySubTitlePresenter presenter = new EntitySubTitlePresenter(
-                        $(I18nUITranslationService.class), $(StateManager.class), false, $(KuneErrorHandler.class));
+                        $(I18nUITranslationService.class), $(StateManager.class), false);
                 final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, $(WorkspaceSkeleton.class));
                 presenter.init(panel);
                 return presenter;
@@ -300,8 +299,7 @@
         register(ApplicationComponentGroup.class, new Factory<EntityLicensePresenter>(EntityLicensePresenter.class) {
             @Override
             public EntityLicensePresenter create() {
-                final EntityLicensePresenter presenter = new EntityLicensePresenter($(StateManager.class),
-                        $(KuneErrorHandler.class));
+                final EntityLicensePresenter presenter = new EntityLicensePresenter($(StateManager.class));
                 final EntityLicensePanel panel = new EntityLicensePanel(presenter, $(I18nUITranslationService.class),
                         $(WorkspaceSkeleton.class));
                 presenter.init(panel);
@@ -399,9 +397,7 @@
         register(ApplicationComponentGroup.class, new Factory<NoHomePage>(NoHomePage.class) {
             @Override
             public NoHomePage create() {
-                final NoHomePagePresenter presenter = new NoHomePagePresenter($(Session.class), $(StateManager.class),
-                        $(KuneErrorHandler.class), $(EntityLogo.class), $$(GroupServiceAsync.class),
-                        $$(EntityLogo.class), $$(SocialNetworkServiceAsync.class), $(HistoryWrapper.class));
+                final NoHomePagePresenter presenter = new NoHomePagePresenter($(StateManager.class), $$(EntityLogo.class));
                 final NoHomePagePanel panel = new NoHomePagePanel(presenter, $(WorkspaceSkeleton.class),
                         $(I18nTranslationService.class));
                 presenter.init(panel);

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProvider.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProvider.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProvider.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,15 +39,15 @@
 
 package org.ourproject.kune.platf.client.state;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public interface ContentProvider {
 
-    void getContent(String user, StateToken newState, AsyncCallback<StateDTO> callback);
+    void cache(StateToken encodeState, StateAbstractDTO content);
 
-    void cache(StateToken encodeState, StateDTO content);
+    void getContent(String user, StateToken newState, AsyncCallback<StateAbstractDTO> callback);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -41,7 +41,7 @@
 
 import java.util.HashMap;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.workspace.client.site.Site;
@@ -51,20 +51,20 @@
 public class ContentProviderDefault implements ContentProvider {
 
     private final ContentServiceAsync server;
-    private final HashMap<StateToken, StateDTO> cache;
+    private final HashMap<StateToken, StateAbstractDTO> cache;
 
     public ContentProviderDefault(final ContentServiceAsync server) {
         this.server = server;
-        this.cache = new HashMap<StateToken, StateDTO>();
+        this.cache = new HashMap<StateToken, StateAbstractDTO>();
     }
 
-    public void cache(final StateToken encodeState, final StateDTO content) {
+    public void cache(final StateToken encodeState, final StateAbstractDTO content) {
         cache.put(encodeState, content);
     }
 
-    public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
+    public void getContent(final String user, final StateToken newState, final AsyncCallback<StateAbstractDTO> callback) {
         Site.showProgressLoading();
-        final StateDTO catched = getCached(newState);
+        final StateAbstractDTO catched = getCached(newState);
         if (catched != null) {
             callback.onSuccess(catched);
         } else {
@@ -72,7 +72,7 @@
         }
     }
 
-    private StateDTO getCached(final StateToken newState) {
+    private StateAbstractDTO getCached(final StateToken newState) {
         return cache.remove(newState);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -45,7 +45,9 @@
 import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
 import org.ourproject.kune.platf.client.dto.LicenseDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
@@ -62,13 +64,17 @@
 
     void check(AsyncCallbackSimple<?> callback);
 
+    StateContainerDTO getContainerState();
+
+    StateContentDTO getContentState();
+
     List<I18nCountryDTO> getCountries();
 
     Object[][] getCountriesArray();
 
     I18nLanguageDTO getCurrentLanguage();
 
-    StateDTO getCurrentState();
+    StateAbstractDTO getCurrentState();
 
     StateToken getCurrentStateToken();
 
@@ -96,7 +102,7 @@
 
     void setCurrentLanguage(final I18nLanguageDTO currentLanguage);
 
-    void setCurrentState(final StateDTO currentState);
+    void setCurrentState(final StateAbstractDTO currentState);
 
     void setCurrentUserInfo(UserInfoDTO currentUserInfo);
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,7 +46,9 @@
 import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
 import org.ourproject.kune.platf.client.dto.LicenseDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
@@ -67,7 +69,7 @@
     private Object[][] languagesArray;
     private Object[][] countriesArray;
     private Object[][] timezonesArray;
-    private StateDTO currentState;
+    private StateAbstractDTO currentState;
     private I18nLanguageDTO currentLanguage;
     private final Event<InitDataDTO> onInitDataReceived;
     private final Event<UserInfoDTO> onUserSignIn;
@@ -88,6 +90,14 @@
         userServiceProvider.get().onlyCheckSession(getUserHash(), callback);
     }
 
+    public StateContainerDTO getContainerState() {
+        return (StateContainerDTO) currentState;
+    }
+
+    public StateContentDTO getContentState() {
+        return (StateContentDTO) currentState;
+    }
+
     public List<I18nCountryDTO> getCountries() {
         return initData.getCountries();
     }
@@ -103,7 +113,7 @@
         return currentLanguage;
     }
 
-    public StateDTO getCurrentState() {
+    public StateAbstractDTO getCurrentState() {
         return currentState;
     }
 
@@ -165,7 +175,7 @@
         this.currentLanguage = currentLanguage;
     }
 
-    public void setCurrentState(final StateDTO currentState) {
+    public void setCurrentState(final StateAbstractDTO currentState) {
         this.currentState = currentState;
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -41,7 +41,7 @@
 
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.calclab.suco.client.listener.Listener;
@@ -58,9 +58,9 @@
 
     void onGroupChanged(Listener2<GroupDTO, GroupDTO> listener);
 
-    void onSocialNetworkChanged(Listener<StateDTO> listener);
+    void onSocialNetworkChanged(Listener<StateAbstractDTO> listener);
 
-    void onStateChanged(Listener<StateDTO> listener);
+    void onStateChanged(Listener<StateAbstractDTO> listener);
 
     void onToolChanged(Listener2<String, String> listener);
 
@@ -70,7 +70,7 @@
 
     void restorePreviousState();
 
-    void setRetrievedState(StateDTO state);
+    void setRetrievedState(StateAbstractDTO state);
 
     void setSocialNetwork(SocialNetworkResultDTO socialNet);
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,7 +46,8 @@
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -63,12 +64,12 @@
 
 public class StateManagerDefault implements StateManager {
     private final ContentProvider contentProvider;
-    private StateDTO oldState;
+    private StateAbstractDTO oldState;
     private final Session session;
     private final HistoryWrapper history;
     private final HashMap<String, Listener<StateToken>> siteTokens;
-    private final Event<StateDTO> onStateChanged;
-    private final Event<StateDTO> onSocialNetworkChanged;
+    private final Event<StateAbstractDTO> onStateChanged;
+    private final Event<StateAbstractDTO> onSocialNetworkChanged;
     private final Event2<String, String> onToolChanged;
     private final Event2<GroupDTO, GroupDTO> onGroupChanged;
 
@@ -78,10 +79,10 @@
         this.session = session;
         this.history = history;
         this.oldState = null;
-        this.onStateChanged = Events.create(StateDTO.class, "onStateChanged");
+        this.onStateChanged = Events.create(StateAbstractDTO.class, "onStateChanged");
         this.onGroupChanged = Events.create(GroupDTO.class, GroupDTO.class, "onGroupChanged");
         this.onToolChanged = Events.create(String.class, String.class, "onToolChanged");
-        this.onSocialNetworkChanged = Events.create(StateDTO.class, "onSocialNetworkChanged");
+        this.onSocialNetworkChanged = Events.create(StateAbstractDTO.class, "onSocialNetworkChanged");
         session.onUserSignIn(new Listener<UserInfoDTO>() {
             public void onEvent(final UserInfoDTO parameter) {
                 if (oldState != null) {
@@ -134,11 +135,11 @@
         }
     }
 
-    public void onSocialNetworkChanged(final Listener<StateDTO> listener) {
+    public void onSocialNetworkChanged(final Listener<StateAbstractDTO> listener) {
         onSocialNetworkChanged.add(listener);
     }
 
-    public void onStateChanged(final Listener<StateDTO> listener) {
+    public void onStateChanged(final Listener<StateAbstractDTO> listener) {
         onStateChanged.add(listener);
     }
 
@@ -163,19 +164,19 @@
         if (oldState == null) {
             onHistoryChanged(new StateToken());
         } else {
-            final StateDTO newState = oldState;
+            final StateAbstractDTO newState = oldState;
             oldState = session.getCurrentState();
             setState(newState);
         }
     }
 
-    public void setRetrievedState(final StateDTO newState) {
+    public void setRetrievedState(final StateAbstractDTO newState) {
         contentProvider.cache(newState.getStateToken(), newState);
         setState(newState);
     }
 
     public void setSocialNetwork(final SocialNetworkResultDTO socialNet) {
-        StateDTO state;
+        StateAbstractDTO state;
         if (session != null && (state = session.getCurrentState()) != null) {
             // After a SN operation, usually returns a SocialNetworkResultDTO
             // with new SN data and we refresh the state
@@ -190,28 +191,35 @@
         }
     }
 
-    private void checkGroupAndToolChange(final StateDTO oldState, final StateDTO newState) {
+    private void checkGroupAndToolChange(final StateAbstractDTO oldState, final StateAbstractDTO newState) {
         final GroupDTO oldGroup = oldState != null ? oldState.getGroup() : null;
         final GroupDTO newGroup = newState.getGroup();
-        final String oldToolName = oldState != null ? oldState.getToolName() : null;
-        final String newToolName = newState.getToolName();
         if (oldState == null || !oldGroup.equals(newGroup)) {
             onGroupChanged.fire(oldGroup, newGroup);
         }
+        // TODO field with oldToolName
+        String oldToolName = null;
+        String newToolName = null;
+        if (oldState instanceof StateContainerDTO) {
+            oldToolName = oldState != null ? ((StateContainerDTO) oldState).getToolName() : null;
+        }
+        if (newState instanceof StateContainerDTO) {
+            newToolName = ((StateContainerDTO) newState).getToolName();
+        }
         if (oldState == null || oldToolName == null || !oldToolName.equals(newToolName)) {
             onToolChanged.fire(oldToolName, newToolName);
         }
     }
 
     private void onHistoryChanged(final StateToken newState) {
-        contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateDTO>() {
-            public void onSuccess(final StateDTO newState) {
+        contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateAbstractDTO>() {
+            public void onSuccess(final StateAbstractDTO newState) {
                 setState(newState);
             }
         });
     }
 
-    private void setState(final StateDTO newState) {
+    private void setState(final StateAbstractDTO newState) {
         session.setCurrentState(newState);
         onStateChanged.fire(newState);
         Site.hideProgress();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -23,24 +23,21 @@
 import java.util.List;
 
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
 import com.calclab.suco.client.listener.Listener2;
 
 public class ToolSelectorPresenter implements ToolSelector {
 
     private final HashMap<String, ToolSelectorItem> tools;
 
-    public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter,
-            final KuneErrorHandler errorHandler) {
+    public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
         tools = new HashMap<String, ToolSelectorItem>();
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(StateDTO state) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
                 for (String tool : tools.keySet()) {
                     List<String> enabledTools = state.getEnabledTools();
                     if (enabledTools != null && enabledTools.contains(tool)) {
@@ -61,12 +58,6 @@
                 onToolChanged(oldTool, newTool);
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                setToolsVisible(false);
-            }
-        });
-
     }
 
     public void addTool(final ToolSelectorItem item) {
@@ -91,13 +82,8 @@
         if (oldTool != null) {
             tools.get(oldTool).setSelected(false);
         }
-        tools.get(newTool).setSelected(true);
-    }
-
-    private void setToolsVisible(boolean visible) {
-        for (String tool : tools.keySet()) {
-            tools.get(tool).setVisible(visible);
+        if (newTool != null) {
+            tools.get(newTool).setSelected(true);
         }
     }
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -38,7 +38,8 @@
  */
 package org.ourproject.kune.platf.client.ui.rate;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -66,9 +67,13 @@
         this.session = session;
         this.contentServiceProvider = contentServiceProvider;
         this.stateManager = stateManager;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContentDTO) {
+                    setState((StateContentDTO) state);
+                } else {
+                    view.setVisible(false);
+                }
             }
         });
     }
@@ -103,7 +108,7 @@
         final Double newValue = starClicked + 1d == currentRate ? currentRate - 0.5d : starClicked + 1d;
         setRatePanel(newValue);
         Site.showProgressProcessing();
-        final StateDTO currentState = session.getCurrentState();
+        final StateAbstractDTO currentState = session.getCurrentState();
         contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getStateToken(), newValue,
                 new AsyncCallbackSimple<Object>() {
                     public void onSuccess(final Object result) {
@@ -152,7 +157,7 @@
         }
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateContentDTO state) {
         if (state.isRateable()) {
             if (session.isLogged()) {
                 setRate(state.getCurrentUserRate());
@@ -160,8 +165,6 @@
             } else {
                 view.setVisible(false);
             }
-        } else {
-            view.setVisible(false);
         }
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -19,7 +19,8 @@
  */
 package org.ourproject.kune.platf.client.ui.rate;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 
 import com.calclab.suco.client.listener.Listener;
@@ -29,9 +30,13 @@
     private RateView view;
 
     public RatePresenter(final StateManager stateManager) {
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContentDTO) {
+                    setState((StateContentDTO) state);
+                } else {
+                    view.setVisible(false);
+                }
             }
         });
     }
@@ -44,14 +49,11 @@
         view.setVisible(visible);
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateContentDTO state) {
         if (state.isRateable()) {
             view.setVisible(true);
             view.setRate(state.getRate());
             view.setByUsers(state.getRateByUsers());
-        } else {
-            view.setVisible(false);
         }
-
     }
 }

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,165 +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/>.
- *
- */
-/*
- *
- * 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.access;
-
-import org.ourproject.kune.platf.server.domain.AccessLists;
-import org.ourproject.kune.platf.server.domain.Container;
-import org.ourproject.kune.platf.server.domain.Content;
-import org.ourproject.kune.platf.server.domain.SocialNetwork;
-
-public class Access {
-    private Content content;
-    private Container container;
-    private AccessLists contentAccessLists;
-    private AccessLists containerAccessLists;
-    private AccessLists groupAccessLists;
-    private AccessRights contentRights;
-    private AccessRights containerRights;
-    private AccessRights groupRights;
-
-    public Access(final Content descriptor, final Container container) {
-        setContent(descriptor);
-        setContainer(container);
-    }
-
-    public Container getContainer() {
-        return container;
-    }
-
-    public AccessLists getContainerAccessLists() {
-        return containerAccessLists;
-    }
-
-    public AccessRights getContainerRights() {
-        return containerRights;
-    }
-
-    public Content getContent() {
-        return content;
-    }
-
-    public AccessLists getContentAccessLists() {
-        return contentAccessLists;
-    }
-
-    public AccessRights getContentRights() {
-        return contentRights;
-    }
-
-    public AccessLists getGroupAccessLists() {
-        return groupAccessLists;
-    }
-
-    public AccessRights getGroupRights() {
-        return groupRights;
-    }
-
-    public boolean hasContainerRights() {
-        return containerRights != null;
-    }
-
-    public boolean hasContentRights() {
-        return contentRights != null;
-    }
-
-    public boolean hasGroupRights() {
-        return groupRights != null;
-    }
-
-    public void setContainer(final Container container) {
-        this.container = container;
-        containerAccessLists = container != null ? getContainerAccessLists(container) : null;
-        groupAccessLists = containerAccessLists;
-    }
-
-    public void setContainerRights(final AccessRights accessRights) {
-        this.containerRights = accessRights;
-        if (equalsAccessLists()) {
-            this.contentRights = accessRights;
-        }
-    }
-
-    public void setContent(final Content descriptor) {
-        this.content = descriptor;
-        contentAccessLists = descriptor != null ? getContentAccessList(descriptor) : null;
-    }
-
-    public void setContentRights(final AccessRights accessRights) {
-        this.contentRights = accessRights;
-        if (equalsAccessLists()) {
-            this.containerRights = accessRights;
-        }
-    }
-
-    public void setContentWidthFolderRights(final Content content) {
-        setContent(content);
-        this.contentRights = containerRights;
-    }
-
-    public void setGroupRights(final AccessRights accessRights) {
-        this.groupRights = accessRights;
-    }
-
-    private boolean equalsAccessLists() {
-        if (contentAccessLists == containerAccessLists) {
-            return true;
-        } else if (contentAccessLists != null) {
-            return contentAccessLists.equals(containerAccessLists);
-        } else {
-            return containerAccessLists.equals(contentAccessLists);
-        }
-    }
-
-    private AccessLists getContentAccessList(final Content descriptor) {
-        AccessLists accessLists;
-        if (descriptor.hasAccessList()) {
-            accessLists = descriptor.getAccessLists();
-        } else {
-            final SocialNetwork socialNetwork = descriptor.getContainer().getOwner().getSocialNetwork();
-            accessLists = socialNetwork.getAccessLists();
-        }
-        return accessLists;
-    }
-
-    private AccessLists getContainerAccessLists(final Container container) {
-        return container.getOwner().getSocialNetwork().getAccessLists();
-    }
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,11 +39,9 @@
 
 package org.ourproject.kune.platf.server.access;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
-import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.User;
 
 public interface AccessService {
@@ -52,6 +50,4 @@
 
     Content accessToContent(Long contentId, User user, AccessRol accessRol) throws DefaultException;
 
-    Access getAccess(User user, StateToken token, Group defaultGroup, AccessRol accessRol) throws DefaultException;
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,16 +39,10 @@
 
 package org.ourproject.kune.platf.server.access;
 
-import javax.persistence.NoResultException;
-
-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.client.errors.DefaultException;
-import org.ourproject.kune.platf.client.errors.NoDefaultContentException;
 import org.ourproject.kune.platf.server.domain.Container;
 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 com.google.inject.Inject;
@@ -59,87 +53,33 @@
 
     private final FinderService finder;
     private final AccessRightsService accessRightsService;
-    private final Group groupFinder;
 
     @Inject
-    public AccessServiceDefault(final FinderService finder, final AccessRightsService accessRightsService,
-            final Group groupFinder) {
+    public AccessServiceDefault(final FinderService finder, final AccessRightsService accessRightsService) {
         this.finder = finder;
         this.accessRightsService = accessRightsService;
-        this.groupFinder = groupFinder;
     }
 
     public Container accessToContainer(final Long folderId, final User user, final AccessRol accessRol)
             throws DefaultException {
-        final Container folder = finder.getFolder(folderId);
-        final Access access = new Access(null, folder);
-        addFolderRights(access, user);
-        addGroupRights(access, user);
-        return check(access, access.getContainerRights(), accessRol).getContainer();
+        final Container container = finder.getFolder(folderId);
+        check(accessRightsService.get(user, container.getAccessLists()), accessRol);
+        return container;
     }
 
     public Content accessToContent(final Long contentId, final User user, final AccessRol accessRol)
             throws DefaultException {
-        final Content descriptor = finder.getContent(contentId);
-        final Access access = new Access(descriptor, null);
-        addContentRights(access, user);
-        return check(access, access.getContentRights(), accessRol).getContent();
+        final Content content = finder.getContent(contentId);
+        check(accessRightsService.get(user, content.getAccessLists()), accessRol);
+        return content;
     }
 
-    public Access getAccess(final User user, final StateToken token, final Group defaultGroup, final AccessRol accessRol)
-            throws DefaultException {
-        checkGroupExistence(token);
-        final Content descriptor = finder.getContent(token, defaultGroup);
-        if (Content.NO_CONTENT.equals(descriptor)) {
-            throw new NoDefaultContentException();
-        }
-        final Access access = new Access(descriptor, descriptor.getContainer());
-        addContentRights(access, user);
-        addFolderRights(access, user);
-        addGroupRights(access, user);
-        if (!isValid(accessRol, access.getContentRights()) || !isValid(accessRol, access.getContainerRights())) {
-            throw new AccessViolationException();
-        }
-        return access;
-    }
-
-    private void addContentRights(final Access access, final User user) {
-        if (!access.hasContentRights()) {
-            access.setContentRights(accessRightsService.get(user, access.getContentAccessLists()));
-        }
-    }
-
-    private void addFolderRights(final Access access, final User user) {
-        if (!access.hasContainerRights()) {
-            access.setContainerRights(accessRightsService.get(user, access.getContainerAccessLists()));
-        }
-    }
-
-    private void addGroupRights(final Access access, final User user) {
-        if (!access.hasGroupRights()) {
-            access.setGroupRights(accessRightsService.get(user, access.getGroupAccessLists()));
-        }
-    }
-
-    private Access check(final Access access, final AccessRights rights, final AccessRol accessRol)
-            throws AccessViolationException {
+    private void check(final AccessRights rights, final AccessRol accessRol) throws AccessViolationException {
         if (!isValid(accessRol, rights)) {
             throw new AccessViolationException();
         }
-        return access;
     }
 
-    private void checkGroupExistence(final StateToken token) throws ContentNotFoundException {
-        if (token.hasGroup()) {
-            try {
-                final String tokenGroup = token.getGroup();
-                groupFinder.findByShortName(tokenGroup);
-            } catch (final NoResultException e) {
-                throw new ContentNotFoundException();
-            }
-        }
-    }
-
     private boolean isValid(final AccessRol accessRol, final AccessRights rights) {
         switch (accessRol) {
         case Viewer:

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/FinderServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/FinderServiceDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/FinderServiceDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -46,6 +46,7 @@
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.client.errors.GroupNotFoundException;
+import org.ourproject.kune.platf.client.errors.NoDefaultContentException;
 import org.ourproject.kune.platf.client.errors.ToolNotFoundException;
 import org.ourproject.kune.platf.server.content.CommentManager;
 import org.ourproject.kune.platf.server.content.ContainerManager;
@@ -115,7 +116,7 @@
         if (token.hasAll()) {
             return findByContentReference(group, token.getTool(), folderId, contentId);
         } else if (token.hasGroupToolAndFolder()) {
-            return findByFolderReference(group, token.getTool(), folderId);
+            return findByFolderReference(group, folderId);
         } else if (token.hasGroupAndTool()) {
             return findByRootOnGroup(group, token.getTool());
         } else if (token.hasGroup()) {
@@ -165,9 +166,13 @@
         return descriptor;
     }
 
-    private Content findByFolderReference(final String groupName, final String toolName, final Long folderId) {
+    private Content findByFolderReference(final String groupName, final Long folderId) {
         final Container container = containerManager.find(folderId);
-        return generateFolderFakeContent(container);
+        if (container == null) {
+            throw new ContentNotFoundException();
+        } else {
+            return generateFolderFakeContent(container);
+        }
     }
 
     private Content findByRootOnGroup(final String groupName, final String toolName) throws DefaultException {
@@ -185,7 +190,11 @@
 
     private Content findDefaultContentOfGroup(final Group group) {
         final Content defaultContent = group.getDefaultContent();
-        return defaultContent == null ? Content.NO_CONTENT : defaultContent;
+        if (defaultContent == null) {
+            throw new NoDefaultContentException();
+        } else {
+            return defaultContent;
+        }
     }
 
     private Content findDefaultContentOfGroup(final String groupName) throws GroupNotFoundException {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -41,7 +41,6 @@
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 
 import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
@@ -99,18 +98,18 @@
     }
 
     public Content createContent(final String title, final String body, final User author, final Container container) {
-        final Content descriptor = new Content();
-        descriptor.addAuthor(author);
-        descriptor.setLanguage(author.getLanguage());
+        final Content newContent = new Content();
+        newContent.addAuthor(author);
+        newContent.setLanguage(author.getLanguage());
         // FIXME: remove this when UI take publishing into account
-        descriptor.setPublishedOn(new Date());
-        container.addContent(descriptor);
-        descriptor.setContainer(container);
-        final Revision revision = new Revision(descriptor);
+        newContent.setPublishedOn(new Date());
+        container.addContent(newContent);
+        newContent.setContainer(container);
+        final Revision revision = new Revision(newContent);
         revision.setTitle(title);
         revision.setBody(body);
-        descriptor.addRevision(revision);
-        return persist(descriptor);
+        newContent.addRevision(revision);
+        return persist(newContent);
     }
 
     public void delContent(final User user, final Long contentId) throws DefaultException {
@@ -216,8 +215,7 @@
         final Content content = finder.getContent(contentId);
         final ArrayList<String> tagsStripped = KuneStringUtils.splitTags(tags);
         final ArrayList<Tag> tagList = new ArrayList<Tag>();
-        for (final Iterator<String> i = tagsStripped.iterator(); i.hasNext();) {
-            final String tagString = i.next();
+        for (String tagString : tagsStripped) {
             Tag tag;
             try {
                 tag = tagManager.findByTagName(tagString);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -138,6 +138,12 @@
         return absolutePath;
     }
 
+    @Transient
+    public AccessLists getAccessLists() {
+        // TODO like in Content, do store specific accesslist
+        return getOwner().getAccessLists();
+    }
+
     public List<ContainerTranslation> getAliases() {
         return containerTranslations;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -181,8 +181,9 @@
         }
     }
 
+    @Transient
     public AccessLists getAccessLists() {
-        return accessLists;
+        return hasAccessList() ? accessLists : getContainer().getAccessLists();
     }
 
     public List<User> getAuthors() {

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-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -65,6 +65,7 @@
 import org.hibernate.validator.Length;
 import org.hibernate.validator.Pattern;
 import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.google.inject.name.Named;
 import com.wideplay.warp.persist.dao.Finder;
@@ -189,6 +190,11 @@
         return null;
     }
 
+    @Transient
+    public AccessLists getAccessLists() {
+        return getSocialNetwork().getAccessLists();
+    }
+
     public AdmissionType getAdmissionType() {
         return admissionType;
     }
@@ -246,6 +252,11 @@
         return socialNetwork;
     }
 
+    @Transient
+    public StateToken getStateToken() {
+        return new StateToken(shortName);
+    }
+
     public ToolConfiguration getToolConfiguration(final String name) {
         return toolsConfig.get(name);
     }
@@ -328,5 +339,4 @@
     public String toString() {
         return "Group[" + shortName + "]";
     }
-
 }
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -51,22 +51,25 @@
 import org.ourproject.kune.platf.client.dto.CommentDTO;
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.StateNoContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.errors.AccessViolationException;
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.client.errors.GroupNotFoundException;
+import org.ourproject.kune.platf.client.errors.NoDefaultContentException;
 import org.ourproject.kune.platf.client.errors.ToolNotFoundException;
 import org.ourproject.kune.platf.client.rpc.ContentService;
 import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.Access;
 import org.ourproject.kune.platf.server.access.AccessRightsService;
 import org.ourproject.kune.platf.server.access.AccessRol;
 import org.ourproject.kune.platf.server.access.AccessService;
+import org.ourproject.kune.platf.server.access.FinderService;
 import org.ourproject.kune.platf.server.auth.ActionLevel;
 import org.ourproject.kune.platf.server.auth.Authenticated;
 import org.ourproject.kune.platf.server.auth.Authorizated;
@@ -83,11 +86,10 @@
 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 org.ourproject.kune.platf.server.manager.SocialNetworkManager;
 import org.ourproject.kune.platf.server.manager.TagManager;
-import org.ourproject.kune.platf.server.manager.UserManager;
 import org.ourproject.kune.platf.server.mapper.Mapper;
-import org.ourproject.kune.platf.server.state.State;
+import org.ourproject.kune.platf.server.state.StateContainer;
+import org.ourproject.kune.platf.server.state.StateContent;
 import org.ourproject.kune.platf.server.state.StateService;
 
 import com.google.inject.Inject;
@@ -108,30 +110,28 @@
     private final ContentManager contentManager;
     private final ContainerManager containerManager;
     private final TagManager tagManager;
-    private final SocialNetworkManager socialNetworkManager;
     private final CommentManager commentManager;
     private final AccessRightsService rightsService;
-    private final UserManager userManager;
+    private final FinderService finderService;
 
     @Inject
-    public ContentRPC(final Provider<UserSession> userSessionProvider, final AccessService accessService,
-            final AccessRightsService rightsService, final StateService stateService,
-            final CreationService creationService, final UserManager userManager, final GroupManager groupManager,
+    public ContentRPC(FinderService finderService, final Provider<UserSession> userSessionProvider,
+            final AccessService accessService, final AccessRightsService rightsService,
+            final StateService stateService, final CreationService creationService, final GroupManager groupManager,
             final XmppManager xmppManager, final ContentManager contentManager,
-            final ContainerManager containerManager, final TagManager tagManager,
-            final SocialNetworkManager socialNetworkManager, final CommentManager commentManager, final Mapper mapper) {
+            final ContainerManager containerManager, final TagManager tagManager, final CommentManager commentManager,
+            final Mapper mapper) {
+        this.finderService = finderService;
         this.userSessionProvider = userSessionProvider;
         this.accessService = accessService;
         this.rightsService = rightsService;
         this.stateService = stateService;
         this.creationService = creationService;
-        this.userManager = userManager;
         this.groupManager = groupManager;
         this.xmppManager = xmppManager;
         this.contentManager = contentManager;
         this.containerManager = containerManager;
         this.tagManager = tagManager;
-        this.socialNetworkManager = socialNetworkManager;
         this.commentManager = commentManager;
         this.mapper = mapper;
     }
@@ -174,56 +174,51 @@
     @Authenticated
     @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addContent(final String userHash, final StateToken parentToken, final String title)
+    public StateContentDTO addContent(final String userHash, final StateToken parentToken, final String title)
             throws DefaultException {
         final Group group = groupManager.findByShortName(parentToken.getGroup());
         final UserSession userSession = getUserSession();
         final User user = userSession.getUser();
-        final boolean userIsLoggedIn = userSession.isUserLoggedIn();
         final Container container = accessService.accessToContainer(ContentUtils.parseId(parentToken.getFolder()),
                 user, AccessRol.Editor);
         final Content addedContent = creationService.createContent(title, "", user, container);
-        final Access access = accessService.getAccess(user, addedContent.getStateToken(), group, AccessRol.Editor);
-        final State state = stateService.create(access);
-        completeState(user, userIsLoggedIn, group, state);
-        return mapState(state, user, group);
+        final StateContent state = stateService.create(user, addedContent);
+        return mapStateSiblings(state, user, group);
     }
 
     @Authenticated
     @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addFolder(final String userHash, final StateToken parentToken, final String title,
+    public StateContainerDTO addFolder(final String userHash, final StateToken parentToken, final String title,
             final String contentTypeId) throws DefaultException {
         final Group group = groupManager.findByShortName(parentToken.getGroup());
         final UserSession userSession = getUserSession();
         final User user = userSession.getUser();
-        final boolean userIsLoggedIn = userSession.isUserLoggedIn();
-        final State state = createFolder(parentToken.getGroup(), ContentUtils.parseId(parentToken.getFolder()), title,
-                contentTypeId);
-        completeState(user, userIsLoggedIn, group, state);
-        return mapState(state, user, group);
+        final Container container = createFolder(parentToken.getGroup(), ContentUtils.parseId(parentToken.getFolder()),
+                title, contentTypeId);
+        StateContainer state = stateService.create(user, container);
+        return mapStateSiblings(state, user, group);
     }
 
     @Authenticated
     @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addRoom(final String userHash, final StateToken parentToken, final String roomName)
+    public StateContainerDTO addRoom(final String userHash, final StateToken parentToken, final String roomName)
             throws DefaultException {
         final String groupShortName = parentToken.getGroup();
         final Group group = groupManager.findByShortName(groupShortName);
         final UserSession userSession = getUserSession();
         final User user = userSession.getUser();
-        final boolean userIsLoggedIn = userSession.isUserLoggedIn();
         final String userShortName = user.getShortName();
         final ChatConnection connection = xmppManager.login(userShortName, userSession.getUser().getPassword(),
                 userHash);
         xmppManager.createRoom(connection, roomName, userShortName + userHash);
         xmppManager.disconnect(connection);
         try {
-            final State state = createFolder(groupShortName, ContentUtils.parseId(parentToken.getFolder()), roomName,
-                    ChatServerTool.TYPE_ROOM);
-            completeState(user, userIsLoggedIn, group, state);
-            return mapState(state, user, group);
+            final Container container = createFolder(groupShortName, ContentUtils.parseId(parentToken.getFolder()),
+                    roomName, ChatServerTool.TYPE_ROOM);
+            StateContainer state = stateService.create(user, container);
+            return mapStateSiblings(state, user, group);
         } catch (final ContentNotFoundException e) {
             xmppManager.destroyRoom(connection, roomName);
             throw new ContentNotFoundException();
@@ -251,31 +246,41 @@
     // contents for instance)
     @Authenticated(mandatory = false)
     @Transactional(type = TransactionType.READ_ONLY)
-    public StateDTO getContent(final String userHash, final StateToken token) throws DefaultException {
+    public StateAbstractDTO getContent(final String userHash, final StateToken token) throws DefaultException {
         Group defaultGroup;
         final UserSession userSession = getUserSession();
         final User user = userSession.getUser();
         final boolean userIsLoggedIn = userSession.isUserLoggedIn();
         if (userIsLoggedIn) {
             defaultGroup = groupManager.getGroupOfUserWithId(user.getId());
-            if (groupManager.findEnabledTools(defaultGroup.getId()).size() == 0) {
-                defaultGroup = groupManager.getDefaultGroup();
-            }
+            // if (groupManager.findEnabledTools(defaultGroup.getId()).size() ==
+            // 0) {
+            // defaultGroup = groupManager.getDefaultGroup();
+            // }
         } else {
             defaultGroup = groupManager.getDefaultGroup();
         }
-        Access access;
         try {
-            access = accessService.getAccess(user, token, defaultGroup, AccessRol.Viewer);
+            final Content content = finderService.getContent(token, defaultGroup);
+            Long id = content.getId();
+            if (id != null) {
+                // Content
+                accessService.accessToContent(id, user, AccessRol.Viewer);
+                return mapStateSiblings(stateService.create(user, content), user, content.getContainer().getOwner());
+            } else {
+                // Container
+                final Container container = content.getContainer();
+                accessService.accessToContainer(container.getId(), user, AccessRol.Viewer);
+                // this getContainer....
+                return mapStateSiblings(stateService.create(user, container), user, container.getOwner());
+            }
         } catch (final NoResultException e) {
             throw new ContentNotFoundException();
         } catch (final ToolNotFoundException e) {
             throw new ContentNotFoundException();
+        } catch (final NoDefaultContentException e) {
+            return mapper.map(stateService.createNoHome(user, token.getGroup()), StateNoContentDTO.class);
         }
-        final State state = stateService.create(access);
-        final Group group = state.getGroup();
-        completeState(user, userIsLoggedIn, group, state);
-        return mapState(state, user, group);
     }
 
     @Authenticated(mandatory = false)
@@ -434,38 +439,14 @@
         return mapper.map(comment, CommentDTO.class);
     }
 
-    private void completeState(final User user, final boolean userIsLoggedIn, final Group group, final State state) {
-        if (state.isRateable()) {
-            final Long contentId = ContentUtils.parseId(state.getDocumentId());
-            final Content content = contentManager.find(contentId);
-            if (userIsLoggedIn) {
-                state.setCurrentUserRate(contentManager.getRateContent(user, content));
-            }
-            state.setRate(contentManager.getRateAvg(content));
-            state.setRateByUsers(contentManager.getRateByUsers(content));
-        }
-        state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
-        state.setGroupTags(tagManager.getSummaryByGroup(group));
-        state.setGroupMembers(socialNetworkManager.get(user, group));
-        state.setParticipation(socialNetworkManager.findParticipation(user, group));
-        if (group.getGroupType().equals(GroupType.PERSONAL)) {
-            state.setUserBuddies(userManager.getUserBuddies(group.getShortName()));
-        }
-    }
-
-    private State createFolder(final String groupShortName, final Long parentFolderId, final String title,
+    private Container createFolder(final String groupShortName, final Long parentFolderId, final String title,
             final String typeId) throws DefaultException {
         final UserSession userSession = getUserSession();
         final User user = userSession.getUser();
         final Group group = groupManager.findByShortName(groupShortName);
-
-        accessService.accessToContainer(parentFolderId, user, AccessRol.Editor);
-
         final Container container = creationService.createFolder(group, parentFolderId, title, user.getLanguage(),
                 typeId);
-        final Access access = accessService.getAccess(user, container.getStateToken(), group, AccessRol.Editor);
-        final State state = stateService.create(access);
-        return state;
+        return container;
     }
 
     private List<TagResultDTO> getSummaryTags(final Group group) {
@@ -483,8 +464,8 @@
         siblingDTO.setRights(mapper.map(rightsService.get(user, lists), AccessRightsDTO.class));
     }
 
-    private StateDTO mapState(final State state, final User user, final Group group) {
-        final StateDTO stateDTO = mapper.map(state, StateDTO.class);
+    private StateContainerDTO mapStateSiblings(final StateContainer state, final User user, final Group group) {
+        final StateContainerDTO stateDTO = mapper.map(state, StateContainerDTO.class);
         final AccessLists groupAccessList = group.getSocialNetwork().getAccessLists();
         for (final ContentSimpleDTO siblingDTO : stateDTO.getRootContainer().getContents()) {
             mapContentRightsInstate(user, groupAccessList, siblingDTO);
@@ -495,6 +476,18 @@
         return stateDTO;
     }
 
+    private StateContentDTO mapStateSiblings(final StateContent state, final User user, final Group group) {
+        final StateContentDTO stateDTO = mapper.map(state, StateContentDTO.class);
+        final AccessLists groupAccessList = group.getSocialNetwork().getAccessLists();
+        for (final ContentSimpleDTO siblingDTO : stateDTO.getRootContainer().getContents()) {
+            mapContentRightsInstate(user, groupAccessList, siblingDTO);
+        }
+        for (final ContentSimpleDTO siblingDTO : stateDTO.getContainer().getContents()) {
+            mapContentRightsInstate(user, groupAccessList, siblingDTO);
+        }
+        return stateDTO;
+    }
+
     private String renameContent(final String documentId, final String newName) throws ContentNotFoundException,
             DefaultException {
         final Long contentId = ContentUtils.parseId(documentId);

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,223 +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/>.
- *
- */
-/*
- *
- * 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.state;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.server.access.AccessRights;
-import org.ourproject.kune.platf.server.domain.BasicMimeType;
-import org.ourproject.kune.platf.server.domain.Container;
-import org.ourproject.kune.platf.server.domain.ContentStatus;
-import org.ourproject.kune.platf.server.domain.License;
-import org.ourproject.kune.platf.server.domain.TagResult;
-import org.ourproject.kune.platf.server.domain.User;
-
-public class State extends StateContent {
-    private String documentId;
-    private String content;
-    private Container container;
-    private Container rootContainer;
-    private AccessRights contentRights;
-    private AccessRights containerRights;
-    private ContentStatus status;
-    private boolean isRateable;
-    private Double rate;
-    private Integer rateByUsers;
-    private Double currentUserRate;
-    private BasicMimeType mimeType;
-    private License license;
-    private List<User> authors;
-    private Date publishedOn;
-    private String tags;
-    private List<TagResult> groupTags;
-
-    public State() {
-    }
-
-    public List<User> getAuthors() {
-        return authors;
-    }
-
-    public Container getContainer() {
-        return container;
-    }
-
-    public AccessRights getContainerRights() {
-        return containerRights;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public AccessRights getContentRights() {
-        return contentRights;
-    }
-
-    public Double getCurrentUserRate() {
-        return currentUserRate;
-    }
-
-    public String getDocumentId() {
-        return documentId;
-    }
-
-    public List<TagResult> getGroupTags() {
-        return groupTags;
-    }
-
-    public License getLicense() {
-        return license;
-    }
-
-    public BasicMimeType getMimeType() {
-        return mimeType;
-    }
-
-    public Date getPublishedOn() {
-        return publishedOn;
-    }
-
-    public Double getRate() {
-        return rate;
-    }
-
-    public Integer getRateByUsers() {
-        return rateByUsers;
-    }
-
-    public Container getRootContainer() {
-        return rootContainer;
-    }
-
-    public ContentStatus getStatus() {
-        return status;
-    }
-
-    public String getTags() {
-        return tags;
-    }
-
-    public boolean isRateable() {
-        return isRateable;
-    }
-
-    public void setAuthors(final List<User> authors) {
-        this.authors = authors;
-    }
-
-    public void setContainer(final Container container) {
-        this.container = container;
-    }
-
-    public void setContainerRights(final AccessRights containerRights) {
-        this.containerRights = containerRights;
-    }
-
-    public void setContent(final String content) {
-        this.content = content;
-    }
-
-    public void setContentRights(final AccessRights accessRights) {
-        this.contentRights = accessRights;
-    }
-
-    public void setCurrentUserRate(final Double currentUserRate) {
-        this.currentUserRate = currentUserRate;
-    }
-
-    public void setDocumentId(final String docRef) {
-        this.documentId = docRef;
-    }
-
-    public void setGroupTags(final List<TagResult> groupTags) {
-        this.groupTags = groupTags;
-    }
-
-    public void setIsRateable(final boolean isRateable) {
-        this.isRateable = isRateable;
-    }
-
-    public void setLicense(final License license) {
-        this.license = license;
-    }
-
-    public void setMimeType(final BasicMimeType mimeType) {
-        this.mimeType = mimeType;
-    }
-
-    public void setPublishedOn(final Date publishedOn) {
-        this.publishedOn = publishedOn;
-    }
-
-    public void setRate(final Double rate) {
-        if (rate != null) {
-            this.rate = rate;
-        } else {
-            this.rate = 0d;
-        }
-    }
-
-    public void setRateByUsers(final Long rateByUsers) {
-        if (rateByUsers != null) {
-            this.rateByUsers = rateByUsers.intValue();
-        } else {
-            this.rateByUsers = 0;
-        }
-    }
-
-    public void setRootContainer(final Container rootContainer) {
-        this.rootContainer = rootContainer;
-    }
-
-    public void setStatus(final ContentStatus status) {
-        this.status = status;
-    }
-
-    public void setTags(final String tags) {
-        this.tags = tags;
-    }
-
-    @Override
-    public String toString() {
-        return "State[" + getStateToken() + "/" + getTypeId() + "]";
-    }
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateAbstract.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -23,7 +23,6 @@
 
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.server.access.AccessRights;
-import org.ourproject.kune.platf.server.domain.AccessLists;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.SocialNetwork;
 import org.ourproject.kune.platf.server.sn.ParticipationData;
@@ -31,7 +30,6 @@
 
 public abstract class StateAbstract {
 
-    private AccessLists accessLists;
     private List<String> enabledTools;
     private Group group;
     private SocialNetwork groupMembers;
@@ -41,8 +39,7 @@
     private StateToken stateToken;
     private String title;
 
-    public AccessLists getAccessLists() {
-        return accessLists;
+    public StateAbstract() {
     }
 
     public List<String> getEnabledTools() {
@@ -77,35 +74,31 @@
         return userBuddies;
     }
 
-    public void setAccessLists(final AccessLists accessLists) {
-        this.accessLists = accessLists;
-    }
-
     public void setEnabledTools(List<String> enabledTools) {
         this.enabledTools = enabledTools;
     }
 
-    public void setGroup(final Group group) {
+    public void setGroup(Group group) {
         this.group = group;
     }
 
-    public void setGroupMembers(final SocialNetwork groupMembers) {
+    public void setGroupMembers(SocialNetwork groupMembers) {
         this.groupMembers = groupMembers;
     }
 
-    public void setGroupRights(final AccessRights groupRights) {
+    public void setGroupRights(AccessRights groupRights) {
         this.groupRights = groupRights;
     }
 
-    public void setParticipation(final ParticipationData participation) {
+    public void setParticipation(ParticipationData participation) {
         this.participation = participation;
     }
 
-    public void setStateToken(final StateToken stateToken) {
+    public void setStateToken(StateToken stateToken) {
         this.stateToken = stateToken;
     }
 
-    public void setTitle(final String title) {
+    public void setTitle(String title) {
         this.title = title;
     }
 
@@ -113,4 +106,9 @@
         this.userBuddies = userBuddies;
     }
 
+    @Override
+    public String toString() {
+        return "State[" + getStateToken() + "]";
+    }
+
 }

Added: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -0,0 +1,103 @@
+package org.ourproject.kune.platf.server.state;
+
+import java.util.List;
+
+import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.domain.AccessLists;
+import org.ourproject.kune.platf.server.domain.Container;
+import org.ourproject.kune.platf.server.domain.I18nLanguage;
+import org.ourproject.kune.platf.server.domain.License;
+import org.ourproject.kune.platf.server.domain.TagResult;
+
+public class StateContainer extends StateAbstract {
+
+    private I18nLanguage language;
+    private String typeId;
+    private String toolName;
+    private Container container;
+    private Container rootContainer;
+    private AccessRights containerRights;
+    private License license;
+    private List<TagResult> groupTags;
+    private AccessLists accessLists;
+
+    public StateContainer() {
+    }
+
+    public Container getContainer() {
+        return container;
+    }
+
+    public AccessRights getContainerRights() {
+        return containerRights;
+    }
+
+    public List<TagResult> getGroupTags() {
+        return groupTags;
+    }
+
+    public I18nLanguage getLanguage() {
+        return language;
+    }
+
+    public License getLicense() {
+        return license;
+    }
+
+    public Container getRootContainer() {
+        return rootContainer;
+    }
+
+    public String getToolName() {
+        return toolName;
+    }
+
+    public String getTypeId() {
+        return typeId;
+    }
+
+    public void setContainer(Container container) {
+        this.container = container;
+    }
+
+    public void setContainerRights(AccessRights containerRights) {
+        this.containerRights = containerRights;
+    }
+
+    public void setGroupTags(List<TagResult> groupTags) {
+        this.groupTags = groupTags;
+    }
+
+    public void setLanguage(I18nLanguage language) {
+        this.language = language;
+    }
+
+    public void setLicense(License license) {
+        this.license = license;
+    }
+
+    public void setRootContainer(Container rootContainer) {
+        this.rootContainer = rootContainer;
+    }
+
+    public void setToolName(String toolName) {
+        this.toolName = toolName;
+    }
+
+    public void setTypeId(String typeId) {
+        this.typeId = typeId;
+    }
+
+    @Override
+    public String toString() {
+        return "State[" + getStateToken() + "/" + getTypeId() + "]";
+    }
+
+    public AccessLists getAccessLists() {
+        return accessLists;
+    }
+
+    public void setAccessLists(AccessLists accessLists) {
+        this.accessLists = accessLists;
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContent.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContent.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -19,36 +19,140 @@
  */
 package org.ourproject.kune.platf.server.state;
 
-import org.ourproject.kune.platf.server.domain.I18nLanguage;
+import java.util.Date;
+import java.util.List;
 
-public abstract class StateContent extends StateAbstract {
+import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.domain.BasicMimeType;
+import org.ourproject.kune.platf.server.domain.ContentStatus;
+import org.ourproject.kune.platf.server.domain.User;
 
-    private I18nLanguage language;
-    private String typeId;
-    private String toolName;
+public class StateContent extends StateContainer {
 
-    public I18nLanguage getLanguage() {
-        return language;
+    private String documentId;
+    private int version;
+    private String content;
+    private AccessRights contentRights;
+    private ContentStatus status;
+    private boolean isRateable;
+    private Double rate;
+    private Integer rateByUsers;
+    private Double currentUserRate;
+    private BasicMimeType mimeType;
+    private Date publishedOn;
+    private String tags;
+    private List<User> authors;
+
+    public StateContent() {
     }
 
-    public String getToolName() {
-        return toolName;
+    public List<User> getAuthors() {
+        return authors;
     }
 
-    public String getTypeId() {
-        return typeId;
+    public String getContent() {
+        return content;
     }
 
-    public void setLanguage(final I18nLanguage language) {
-        this.language = language;
+    public AccessRights getContentRights() {
+        return contentRights;
     }
 
-    public void setToolName(final String toolName) {
-        this.toolName = toolName;
+    public Double getCurrentUserRate() {
+        return currentUserRate;
     }
 
-    public void setTypeId(final String typeId) {
-        this.typeId = typeId;
+    public String getDocumentId() {
+        return documentId;
     }
 
+    public BasicMimeType getMimeType() {
+        return mimeType;
+    }
+
+    public Date getPublishedOn() {
+        return publishedOn;
+    }
+
+    public Double getRate() {
+        return rate;
+    }
+
+    public Integer getRateByUsers() {
+        return rateByUsers;
+    }
+
+    public ContentStatus getStatus() {
+        return status;
+    }
+
+    public String getTags() {
+        return tags;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public boolean isRateable() {
+        return isRateable;
+    }
+
+    public void setAuthors(List<User> authors) {
+        this.authors = authors;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public void setContentRights(AccessRights contentRights) {
+        this.contentRights = contentRights;
+    }
+
+    public void setCurrentUserRate(Double currentUserRate) {
+        this.currentUserRate = currentUserRate;
+    }
+
+    public void setDocumentId(String documentId) {
+        this.documentId = documentId;
+    }
+
+    public void setMimeType(BasicMimeType mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    public void setPublishedOn(Date publishedOn) {
+        this.publishedOn = publishedOn;
+    }
+
+    public void setRate(Double rate) {
+        this.rate = rate;
+    }
+
+    public void setRateable(boolean isRateable) {
+        this.isRateable = isRateable;
+    }
+
+    public void setRateByUsers(Integer rateByUsers) {
+        this.rateByUsers = rateByUsers;
+    }
+
+    public void setStatus(ContentStatus status) {
+        this.status = status;
+    }
+
+    public void setTags(String tags) {
+        this.tags = tags;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    @Override
+    public String toString() {
+        return "State[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "") + "]";
+    }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateNoContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateNoContent.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateNoContent.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -19,9 +19,9 @@
  */
 package org.ourproject.kune.platf.server.state;
 
+
 /**
  * Used for contents not found or users without homepage
  */
 public class StateNoContent extends StateAbstract {
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateService.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateService.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,8 +39,15 @@
 
 package org.ourproject.kune.platf.server.state;
 
-import org.ourproject.kune.platf.server.access.Access;
+import org.ourproject.kune.platf.server.domain.Container;
+import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.User;
 
 public interface StateService {
-    State create(Access access);
+
+    StateContainer create(User userLogged, Container container);
+
+    StateContent create(User userLogged, Content content);
+
+    StateNoContent createNoHome(User user, String groupShortName);
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,68 +39,130 @@
 
 package org.ourproject.kune.platf.server.state;
 
-import org.ourproject.kune.platf.server.access.Access;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.server.access.AccessRightsService;
+import org.ourproject.kune.platf.server.content.ContentManager;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.License;
 import org.ourproject.kune.platf.server.domain.Revision;
+import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.manager.GroupManager;
+import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
+import org.ourproject.kune.platf.server.manager.TagManager;
+import org.ourproject.kune.platf.server.manager.UserManager;
 
+import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
 @Singleton
 public class StateServiceDefault implements StateService {
 
-    public State create(final Access access) {
-        final Content content = access.getContent();
-        final Container container = access.getContainer();
-        final State state = new State();
+    private final AccessRightsService rightsService;
+    private final UserManager userManager;
+    private final SocialNetworkManager socialNetworkManager;
+    private final GroupManager groupManager;
+    private final TagManager tagManager;
+    private final ContentManager contentManager;
+    private final I18nTranslationService i18n;
 
-        final Long documentId = content.getId();
-        if (documentId != null) {
-            state.setTypeId(content.getTypeId());
-            state.setMimeType(content.getMimeType());
-            state.setDocumentId(documentId.toString());
-            state.setIsRateable(true);
-            state.setLanguage(content.getLanguage());
-            state.setPublishedOn(content.getPublishedOn());
-            state.setAuthors(content.getAuthors());
-            state.setTags(content.getTagsAsString());
-            state.setStatus(content.getStatus());
-            state.setStateToken(content.getStateToken());
-        } else {
-            state.setTypeId(container.getTypeId());
-            state.setDocumentId(null);
-            state.setIsRateable(false);
-            state.setLanguage(container.getLanguage());
-            state.setStateToken(container.getStateToken());
-        }
-        if (!container.isRoot()) {
-            state.setRootContainer(container.getAbsolutePath().get(0));
-        } else {
-            state.setRootContainer(container);
-        }
-        final Revision revision = content.getLastRevision();
-        final char[] text = revision.getBody();
+    @Inject
+    public StateServiceDefault(UserManager userManager, GroupManager groupManager,
+            SocialNetworkManager socialNetworkManager, ContentManager contentManager, TagManager tagManager,
+            AccessRightsService rightsService, I18nTranslationService i18n) {
+        this.userManager = userManager;
+        this.groupManager = groupManager;
+        this.socialNetworkManager = socialNetworkManager;
+        this.contentManager = contentManager;
+        this.tagManager = tagManager;
+        this.rightsService = rightsService;
+        this.i18n = i18n;
+    }
+
+    public StateContainer create(User userLogged, Container container) {
+        final StateContainer state = new StateContainer();
+        state.setTitle(container.getName());
+        state.setTypeId(container.getTypeId());
+        state.setLanguage(container.getLanguage());
+        state.setStateToken(container.getStateToken());
+        state.setRootContainer(calculateRootContainer(container));
+        state.setLicense(container.getOwner().getDefaultLicense());
+        state.setAccessLists(container.getAccessLists());
+        Group group = container.getOwner();
+        setCommon(state, userLogged, group, container);
+        return state;
+    }
+
+    public StateContent create(User userLogged, Content content) {
+        StateContent state = new StateContent();
+        state.setTypeId(content.getTypeId());
+        state.setMimeType(content.getMimeType());
+        state.setDocumentId(content.getId().toString());
+        state.setRateable(true);
+        state.setLanguage(content.getLanguage());
+        state.setPublishedOn(content.getPublishedOn());
+        state.setAuthors(content.getAuthors());
+        state.setTags(content.getTagsAsString());
+        state.setStatus(content.getStatus());
+        state.setStateToken(content.getStateToken());
+        Revision revision = content.getLastRevision();
+        state.setTitle(revision.getTitle());
+        state.setVersion(content.getVersion());
+        char[] text = revision.getBody();
         state.setContent(text == null ? null : new String(text));
-        if (documentId != null) {
-            state.setTitle(revision.getTitle());
-        } else {
-            state.setTitle(container.getName());
+        Container container = content.getContainer();
+        state.setRootContainer(calculateRootContainer(container));
+        License license = content.getLicense();
+        Group group = container.getOwner();
+        state.setLicense(license == null ? group.getDefaultLicense() : license);
+        state.setContentRights(rightsService.get(userLogged, content.getAccessLists()));
+        state.setAccessLists(content.getAccessLists());
+        setCommon(state, userLogged, group, container);
+        if (userLogged != User.UNKNOWN_USER) {
+            state.setCurrentUserRate(contentManager.getRateContent(userLogged, content));
         }
+        Double rateAvg = contentManager.getRateAvg(content);
+        state.setRate(rateAvg != null ? rateAvg : 0D);
+        Long rateByUsers = contentManager.getRateByUsers(content);
+        state.setRateByUsers(rateByUsers != null ? rateByUsers.intValue() : 0);
+        return state;
+    }
+
+    public StateNoContent createNoHome(User userLogged, String groupShortName) {
+        Group group = groupManager.findByShortName(groupShortName);
+        assert (group.getGroupType().equals(GroupType.PERSONAL));
+        StateNoContent state = new StateNoContent();
+        state.setGroup(group);
+        state.setGroupRights(rightsService.get(userLogged, group.getAccessLists()));
+        state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
+        setSocialNetwork(state, userLogged, group);
+        state.setStateToken(group.getStateToken());
+        state.setTitle(i18n.t("This user doesn't have a homepage"));
+        return state;
+    }
+
+    private Container calculateRootContainer(Container container) {
+        return container.isRoot() ? container : container.getAbsolutePath().get(0);
+    }
+
+    private void setCommon(StateContainer state, User userLogged, Group group, Container container) {
         state.setToolName(container.getToolName());
-        Group group = container.getOwner();
         state.setGroup(group);
         state.setContainer(container);
-        state.setAccessLists(access.getContentAccessLists());
-        state.setContentRights(access.getContentRights());
-        state.setContainerRights(access.getContainerRights());
-        state.setGroupRights(access.getGroupRights());
-        License contentLicense = content.getLicense();
-        if (contentLicense == null) {
-            contentLicense = group.getDefaultLicense();
+        state.setGroupRights(rightsService.get(userLogged, group.getAccessLists()));
+        state.setContainerRights(rightsService.get(userLogged, container.getAccessLists()));
+        state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
+        state.setGroupTags(tagManager.getSummaryByGroup(group));
+        setSocialNetwork(state, userLogged, group);
+    }
+
+    private void setSocialNetwork(StateAbstract state, User userLogged, Group group) {
+        state.setGroupMembers(socialNetworkManager.get(userLogged, group));
+        state.setParticipation(socialNetworkManager.findParticipation(userLogged, group));
+        if (group.getGroupType().equals(GroupType.PERSONAL)) {
+            state.setUserBuddies(userManager.getUserBuddies(group.getShortName()));
         }
-        state.setLicense(contentLicense);
-        return state;
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -40,11 +40,13 @@
 package org.ourproject.kune.workspace.client.ctxnav;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 public interface ContextNavigator {
 
+    void clear();
+
     void editItem(StateToken stateToken);
 
     View getView();
@@ -59,6 +61,6 @@
 
     void setItemText(StateToken stateToken, String name);
 
-    void setState(StateDTO state, boolean selectItem);
+    void setState(StateContainerDTO state, boolean selectItem);
 
 }

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	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -55,12 +55,13 @@
 import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-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.ui.KuneUiUtils;
@@ -91,17 +92,15 @@
     private final ActionToolbar<StateToken> toolbar;
     private final Provider<FileDownloadUtils> downloadUtilsProvider;
     private final boolean useGenericImageIcon;
-    private final KuneErrorHandler errorHandler;
 
     public ContextNavigatorPresenter(final StateManager stateManager, final Session session,
-            final KuneErrorHandler errorHandler, final Provider<ContentServiceAsync> contentServiceProvider,
-            final I18nUITranslationService i18n, final EntityTitle entityTitle,
-            final ContentIconsRegistry contentIconsRegistry, final DragDropContentRegistry dragDropContentRegistry,
-            final ActionToolbar<StateToken> toolbar, final ActionRegistry<StateToken> actionRegistry,
-            Provider<FileDownloadUtils> downloadUtilsProvider, boolean useGenericImageIcon) {
+            final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n,
+            final EntityTitle entityTitle, final ContentIconsRegistry contentIconsRegistry,
+            final DragDropContentRegistry dragDropContentRegistry, final ActionToolbar<StateToken> toolbar,
+            final ActionRegistry<StateToken> actionRegistry, Provider<FileDownloadUtils> downloadUtilsProvider,
+            boolean useGenericImageIcon) {
         this.stateManager = stateManager;
         this.session = session;
-        this.errorHandler = errorHandler;
         this.contentServiceProvider = contentServiceProvider;
         this.i18n = i18n;
         this.entityTitle = entityTitle;
@@ -115,14 +114,16 @@
         editOnNextStateChange = false;
     }
 
+    public void clear() {
+        toolbar.clear();
+        view.clear();
+        actionsByItem.clear();
+    }
+
     public void editItem(final StateToken stateToken) {
         view.editItem(genId(stateToken));
     }
 
-    public StateToken getCurrentStateToken() {
-        return session.getCurrentState().getStateToken();
-    }
-
     public View getView() {
         return view;
     }
@@ -143,11 +144,6 @@
                 clear();
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                clear();
-            }
-        });
     }
 
     public boolean isSelected(final StateToken stateToken) {
@@ -188,11 +184,14 @@
     }
 
     public void refresh(final StateToken stateToken) {
-        contentServiceProvider.get().getContent(session.getUserHash(), stateToken, new AsyncCallbackSimple<StateDTO>() {
-            public void onSuccess(final StateDTO result) {
-                setState(result, false);
-            }
-        });
+        contentServiceProvider.get().getContent(session.getUserHash(), stateToken,
+                new AsyncCallbackSimple<StateAbstractDTO>() {
+                    public void onSuccess(final StateAbstractDTO state) {
+                        if (state instanceof StateContainerDTO) {
+                            setState((StateContainerDTO) state, false);
+                        }
+                    }
+                });
     }
 
     public void selectItem(final StateToken stateToken) {
@@ -209,14 +208,24 @@
         view.setItemText(genId(stateToken), name);
     }
 
-    public void setState(final StateDTO state, final boolean select) {
+    public void setState(final StateContainerDTO state, final boolean select) {
+        setStateContainer(state, select);
+    }
+
+    public void setStateContainer(final StateContainerDTO state, final boolean select) {
+        // TODO: separate in two methods for stateConent and stateContainer
+
+        final StateToken stateToken = state.getStateToken();
+        boolean isContent = (state instanceof StateContentDTO);
+        StateContentDTO stateContent = null;
+
         final ContainerDTO container = state.getContainer();
-        final StateToken stateToken = state.getStateToken();
         final AccessRightsDTO containerRights = state.getContainerRights();
         AccessRightsDTO rights;
 
-        if (stateToken.hasAll()) {
-            rights = state.getContentRights();
+        if (isContent) {
+            stateContent = (StateContentDTO) state;
+            rights = stateContent.getContentRights();
         } else {
             rights = containerRights;
         }
@@ -235,10 +244,11 @@
 
         // Process our current content/container
         final ActionItemCollection<StateToken> actionItems = new ActionItemCollection<StateToken>();
-        if (state.hasDocument()) {
-            rights = state.getContentRights();
+        if (isContent) {
+            rights = stateContent.getContentRights();
             final ActionItemCollection<StateToken> contentActions = addItem(state.getTitle(), state.getTypeId(),
-                    state.getMimeType(), state.getStatus(), stateToken, container.getStateToken(), rights, false);
+                    stateContent.getMimeType(), stateContent.getStatus(), stateToken, container.getStateToken(),
+                    rights, false);
             final ActionItemCollection<StateToken> containerActions = actionRegistry.getCurrentActions(
                     container.getStateToken(), container.getTypeId(), session.isLogged(), containerRights, true);
             actionItems.addAll(containerActions);
@@ -270,12 +280,6 @@
         toolbar.attach();
     }
 
-    protected void clear() {
-        toolbar.clear();
-        view.clear();
-        actionsByItem.clear();
-    }
-
     private ActionItemCollection<StateToken> addItem(final String title, final String contentTypeId,
             final BasicMimeTypeDTO mimeType, final ContentStatusDTO status, final StateToken stateToken,
             final StateToken parentStateToken, final AccessRightsDTO rights, final boolean isNodeSelected) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -21,7 +21,7 @@
 
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
@@ -52,8 +52,8 @@
                 setGroupLogo(newGroup);
             }
         });
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
                 final boolean isAdmin = state.getGroupRights().isAdministrable();
                 if (state.getGroup().hasLogo()) {
                     view.setChangeYourLogoText();
@@ -86,7 +86,7 @@
     public void reloadGroupLogo(StateToken groupToken) {
         groupServiceProvider.get().getGroup(session.getUserHash(), groupToken, new AsyncCallbackSimple<GroupDTO>() {
             public void onSuccess(GroupDTO group) {
-                StateDTO currentState = session.getCurrentState();
+                StateAbstractDTO currentState = session.getCurrentState();
                 if (currentState.getGroup().getShortName().equals(group.getShortName())) {
                     // only if we are in the
                     // same group

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -40,29 +40,27 @@
 
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.LicenseDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 
 import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
 
 public class EntityLicensePresenter {
 
     private EntityLicenseView view;
     private LicenseDTO license;
 
-    public EntityLicensePresenter(final StateManager stateManager, KuneErrorHandler errorHandler) {
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setLicense(state);
+    public EntityLicensePresenter(final StateManager stateManager) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    setLicense((StateContainerDTO) state);
+                } else {
+                    view.detach();
+                }
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                view.detach();
-            }
-        });
     }
 
     public View getView() {
@@ -77,7 +75,7 @@
         view.openWindow(license.getUrl());
     }
 
-    private void setLicense(final StateDTO state) {
+    private void setLicense(final StateContainerDTO state) {
         view.attach();
         this.license = state.getLicense();
         view.showLicense(state.getGroup().getLongName(), license);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePanel.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePanel.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -43,9 +43,7 @@
         EntityWorkspace ew = ws.getEntityWorkspace();
         ew.setContent(noHomepageCtnLabel);
         ew.setContext(noHomepageCtxLabel);
-        ew.getContentTopBar().removeAll();
         ew.getContextTopBar().removeAll();
-        ew.getContentBottomBar().removeAll();
         ew.getContextBottomBar().removeAll();
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -20,53 +20,25 @@
 package org.ourproject.kune.workspace.client.nohomepage;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
-import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
-import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateNoContentDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.entitylogo.EntityLogo;
 
 import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener0;
+import com.calclab.suco.client.listener.Listener;
 
 public class NoHomePagePresenter implements NoHomePage {
 
     private NoHomePageView view;
 
-    public NoHomePagePresenter(final Session session, final StateManager stateManager, KuneErrorHandler errorHandler,
-            EntityLogo entityLogo, final Provider<GroupServiceAsync> groupServiceProvider,
-            final Provider<EntityLogo> entityLogoProvider, final Provider<SocialNetworkServiceAsync> snServiceProvider,
-            final HistoryWrapper history) {
-
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                view.clearWs();
-                StateToken groupToken = new StateToken(history.getToken());
-                groupServiceProvider.get().getGroup(session.getUserHash(), groupToken,
-                        new AsyncCallbackSimple<GroupDTO>() {
-                            public void onSuccess(GroupDTO group) {
-                                StateDTO currentState = new StateDTO();
-                                currentState.setStateToken(group.getStateToken());
-                                session.setCurrentState(currentState);
-                                session.getCurrentState().setGroup(group);
-                                entityLogoProvider.get().refreshGroupLogo();
-                                snServiceProvider.get().getSocialNetwork(session.getUserHash(),
-                                        session.getCurrentStateToken(),
-                                        new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-                                            public void onSuccess(SocialNetworkResultDTO result) {
-                                                session.getCurrentState().setGroupRights(result.getGroupRights());
-                                                stateManager.setSocialNetwork(result);
-                                            }
-                                        });
-                            }
-                        });
+    public NoHomePagePresenter(final StateManager stateManager, final Provider<EntityLogo> entityLogoProvider) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
+                if (state instanceof StateNoContentDTO) {
+                    view.clearWs();
+                    entityLogoProvider.get().refreshGroupLogo();
+                }
             }
         });
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -21,7 +21,8 @@
 
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.GroupListDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.state.StateManager;
 
@@ -32,9 +33,13 @@
     private SitePublicSpaceLinkView view;
 
     public SitePublicSpaceLinkPresenter(final StateManager stateManager) {
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    setState((StateContainerDTO) state);
+                } else {
+                    view.setVisible(false);
+                }
             }
         });
     }
@@ -51,7 +56,7 @@
         view.setVisible(visible);
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateContainerDTO state) {
         final StateToken token = state.getStateToken();
         if (state.getAccessLists().getViewers().getMode().equals(GroupListDTO.EVERYONE)) {
             final String publicUrl = token.getPublicUrl();
@@ -60,6 +65,7 @@
         } else {
             view.setContentPublic(false);
         }
+        view.setVisible(true);
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -31,7 +31,7 @@
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.GroupType;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
 import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -57,13 +57,13 @@
         this.actionRegistry = actionRegistry;
         this.i18n = i18n;
         this.chatClientToolProvider = chatClientToolProvider;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(StateDTO state) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
                 setState(state);
             }
         });
-        stateManager.onSocialNetworkChanged(new Listener<StateDTO>() {
-            public void onEvent(StateDTO state) {
+        stateManager.onSocialNetworkChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
                 setState(state);
             }
         });
@@ -78,7 +78,7 @@
         this.view = view;
     }
 
-    protected void setState(StateDTO state) {
+    protected void setState(StateAbstractDTO state) {
         if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
             view.clear();
             UserBuddiesDataDTO userBuddies = state.getUserBuddies();

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-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -28,7 +28,7 @@
 import org.ourproject.kune.platf.client.dto.LinkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
 import org.ourproject.kune.platf.client.services.ImageDescriptor;
@@ -68,8 +68,8 @@
         this.stateManager = stateManager;
         this.session = session;
         this.snServiceProvider = snServiceProvider;
-        final Listener<StateDTO> setStateListener = new Listener<StateDTO>() {
-            public void onEvent(StateDTO state) {
+        final Listener<StateAbstractDTO> setStateListener = new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
                 setState(state);
             }
         };
@@ -173,7 +173,7 @@
         view.setVisible(true);
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateAbstractDTO state) {
         if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
             view.setVisible(false);
         } else {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -43,7 +43,7 @@
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
 import org.ourproject.kune.platf.client.services.ImageUtils;
 import org.ourproject.kune.platf.client.state.Session;
@@ -76,8 +76,8 @@
         collabOnlyCategory = new GridGroup(i18n.t("collaborator in:"), " ", i18n.t("Collaborate in these groups"),
                 false);
         super.addGroupOperation(gotoGroupMenuItem, false);
-        final Listener<StateDTO> setStateListener = new Listener<StateDTO>() {
-            public void onEvent(StateDTO state) {
+        final Listener<StateAbstractDTO> setStateListener = new Listener<StateAbstractDTO>() {
+            public void onEvent(StateAbstractDTO state) {
                 setState(state);
             }
         };
@@ -99,7 +99,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    private void setState(final StateDTO state) {
+    private void setState(final StateAbstractDTO state) {
         final ParticipationDataDTO participation = state.getParticipation();
         final AccessRightsDTO rights = state.getGroupRights();
         view.clear();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -39,7 +39,7 @@
 package org.ourproject.kune.workspace.client.summary;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.themes.WsTheme;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -52,8 +52,8 @@
     private GroupSummaryView view;
 
     public GroupSummaryPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
                 setState(state);
             }
         });
@@ -72,7 +72,7 @@
         this.view = view;
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateAbstractDTO state) {
         view.setComment("Summary about this group (in development)");
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -42,7 +42,8 @@
 import java.util.List;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
@@ -65,9 +66,13 @@
             final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
         this.session = session;
         this.searcherProvider = searcherProvider;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    setState((StateContainerDTO) state);
+                } else {
+                    view.setVisible(false);
+                }
             }
         });
         wsThemePresenter.onThemeChanged(new Listener2<WsTheme, WsTheme>() {
@@ -95,8 +100,8 @@
         view.setTags(groupTags);
     }
 
-    void setState(final StateDTO state) {
-        if (state.getTags() != null && state.getTags().length() > 0) {
+    void setState(final StateContainerDTO state) {
+        if (state.getGroupTags() != null && state.getGroupTags().size() > 0) {
             view.setVisible(true);
             view.setTags(state.getGroupTags());
         } else {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -20,10 +20,9 @@
 package org.ourproject.kune.workspace.client.themes;
 
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
-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.workspace.client.site.Site;
@@ -32,7 +31,6 @@
 import com.calclab.suco.client.ioc.Provider;
 import com.calclab.suco.client.listener.Event2;
 import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
 import com.calclab.suco.client.listener.Listener2;
 
 public class WsThemePresenter {
@@ -45,7 +43,7 @@
     private WsTheme defTheme;
 
     public WsThemePresenter(final Session session, final Provider<GroupServiceAsync> groupServiceProvider,
-            final StateManager stateManager, final KuneErrorHandler errorHandler) {
+            final StateManager stateManager) {
         this.session = session;
         this.groupServiceProvider = groupServiceProvider;
         this.onThemeChanged = Events.create(WsTheme.class, WsTheme.class, "onThemeChanged");
@@ -56,16 +54,11 @@
                 setTheme(defTheme);
             }
         });
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
                 setState(state);
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                setTheme(defTheme);
-            }
-        });
     }
 
     public void init(final WsThemeView view) {
@@ -91,7 +84,7 @@
         defTheme = new WsTheme(initData.getWsThemes()[0]);
     }
 
-    private void setState(final StateDTO state) {
+    private void setState(final StateAbstractDTO state) {
         setTheme(new WsTheme(state.getGroup().getWorkspaceTheme()));
         if (state.getGroupRights().isAdministrable()) {
             view.setVisible(true);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -40,13 +40,13 @@
 package org.ourproject.kune.workspace.client.title;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
 import org.ourproject.kune.platf.client.state.StateManager;
 
 import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
 
 public class EntitySubTitlePresenter implements EntitySubTitle {
 
@@ -55,20 +55,18 @@
     private final boolean showLanguage;
 
     public EntitySubTitlePresenter(final I18nTranslationService i18n, final StateManager stateManager,
-            boolean showLanguage, KuneErrorHandler errorHandler) {
+            boolean showLanguage) {
         this.i18n = i18n;
         this.showLanguage = showLanguage;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    setState((StateContainerDTO) state);
+                } else if (state instanceof StateContentDTO) {
+                    setState((StateContentDTO) state);
+                }
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                view.setContentSubTitleLeftVisible(false);
-                view.setContentSubTitleRightVisible(false);
-            }
-        });
     }
 
     public View getView() {
@@ -85,14 +83,7 @@
         }
     }
 
-    private void setState(final StateDTO state) {
-        if (state.hasDocument()) {
-            view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors",
-                    state.getAuthors().get(0).getName()));
-            view.setContentSubTitleLeftVisible(true);
-        } else {
-            view.setContentSubTitleLeftVisible(false);
-        }
+    private void setLanguage(final StateContainerDTO state) {
         if (state.getLanguage() != null && showLanguage) {
             final String langName = state.getLanguage().getEnglishName();
             setContentLanguage(langName);
@@ -102,4 +93,16 @@
         }
     }
 
+    private void setState(final StateContainerDTO state) {
+        view.setContentSubTitleLeftVisible(false);
+        setLanguage(state);
+    }
+
+    private void setState(final StateContentDTO state) {
+        view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors",
+                state.getAuthors().get(0).getName()));
+        view.setContentSubTitleLeftVisible(true);
+        setLanguage(state);
+    }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -107,6 +107,10 @@
         titleLabel.setEditable(editable);
     }
 
+    public void setContentTitleVisible(final boolean visible) {
+        titleLabel.setVisible(visible);
+    }
+
     public void setDateVisible(final boolean visible) {
         dateLabel.setVisible(visible);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -43,7 +43,9 @@
 
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -55,7 +57,6 @@
 
 import com.calclab.suco.client.ioc.Provider;
 import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
@@ -79,19 +80,19 @@
         this.contentServiceProvider = contentServiceProvider;
         this.contextNavigatorProvider = contextNavigatorProvider;
         this.iconsRegistry = iconsRegistry;
-        stateManager.onStateChanged(new Listener<StateDTO>() {
-            public void onEvent(final StateDTO state) {
-                setState(state);
+        stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
+            public void onEvent(final StateAbstractDTO state) {
+                if (state instanceof StateContainerDTO) {
+                    setState((StateContainerDTO) state);
+                } else if (state instanceof StateContentDTO) {
+                    setState((StateContentDTO) state);
+                } else {
+                    view.setContentIconVisible(false);
+                    view.setContentTitleVisible(false);
+                    view.setDateVisible(false);
+                }
             }
         });
-        errorHandler.onNotDefaultContent(new Listener0() {
-            public void onEvent() {
-                view.setDateVisible(false);
-                view.setContentIconVisible(false);
-                view.setContentTitleEditable(false);
-                view.setContentTitle("");
-            }
-        });
     }
 
     public View getView() {
@@ -112,11 +113,13 @@
      */
     public void setContentTitle(final String title) {
         view.setContentTitle(title);
+        view.setContentTitleVisible(true);
     }
 
     public void setContentTitle(final String title, final boolean editable) {
         setContentTitle(title);
         view.setContentTitleEditable(editable);
+        view.setContentTitleVisible(true);
     }
 
     protected void onTitleRename(final String newName) {
@@ -146,22 +149,7 @@
         view.setDateVisible(visible);
     }
 
-    private void setState(final StateDTO state) {
-        if (state.hasDocument()) {
-            setContentTitle(state.getTitle(), state.getContentRights().isEditable());
-            setContentDateVisible(true);
-            setContentDate(state.getPublishedOn());
-        } else {
-            if (state.getContainer().getParentFolderId() == null) {
-                // We translate root folder names (documents, chat room,
-                // etcetera)
-                setContentTitle(i18n.t(state.getTitle()), false);
-            } else {
-                setContentTitle(state.getTitle(), state.getContentRights().isEditable());
-            }
-            setContentDateVisible(false);
-        }
-        final String contentTypeIcon = iconsRegistry.getContentTypeIcon(state.getTypeId(), state.getMimeType());
+    private void setIcon(final String contentTypeIcon) {
         if (contentTypeIcon.length() > 0) {
             view.setContentIcon(contentTypeIcon);
             view.setContentIconVisible(true);
@@ -170,4 +158,27 @@
         }
     }
 
+    private void setState(final StateContainerDTO state) {
+        if (state.getContainer().getParentFolderId() == null) {
+            // We translate root folder names (documents, chat room,
+            // etcetera)
+            setContentTitle(i18n.t(state.getTitle()), false);
+        } else {
+            setContentTitle(state.getTitle(), state.getContainerRights().isEditable());
+        }
+        setContentDateVisible(false);
+        final String contentTypeIcon = iconsRegistry.getContentTypeIcon(state.getTypeId(), null);
+        setIcon(contentTypeIcon);
+        view.setContentTitleVisible(true);
+    }
+
+    private void setState(final StateContentDTO state) {
+        setContentTitle(state.getTitle(), state.getContentRights().isEditable());
+        setContentDateVisible(true);
+        setContentDate(state.getPublishedOn());
+        final String contentTypeIcon = iconsRegistry.getContentTypeIcon(state.getTypeId(), state.getMimeType());
+        setIcon(contentTypeIcon);
+        view.setContentTitleVisible(true);
+    }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -55,6 +55,8 @@
 
     void setContentTitleEditable(boolean editable);
 
+    void setContentTitleVisible(boolean visible);
+
     void setDateVisible(boolean visible);
 
 }

Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/main/resources/dozerBeanMapping.xml	2008-10-24 01:37:05 UTC (rev 923)
@@ -127,8 +127,8 @@
   </mapping>
 
   <mapping>
-    <class-a>org.ourproject.kune.platf.client.dto.StateDTO</class-a>
-    <class-b>org.ourproject.kune.platf.server.state.State</class-b>
+    <class-a>org.ourproject.kune.platf.client.dto.StateContentDTO</class-a>
+    <class-b>org.ourproject.kune.platf.server.state.StateContent</class-b>
     <field>
       <a>authors</a>
       <b>authors</b>
@@ -139,7 +139,12 @@
         org.ourproject.kune.platf.server.domain.User
       </b-hint>
     </field>
-    <field>
+  </mapping>
+
+   <mapping>
+    <class-a>org.ourproject.kune.platf.client.dto.StateContainerDTO</class-a>
+    <class-b>org.ourproject.kune.platf.server.state.StateContainer</class-b>
+     <field>
       <a>groupTags</a>
       <b>groupTags</b>
       <a-hint>
@@ -152,6 +157,11 @@
   </mapping>
 
   <mapping>
+    <class-a>org.ourproject.kune.platf.client.dto.StateAbstractDTO</class-a>
+    <class-b>org.ourproject.kune.platf.server.state.StateAbstract</class-b>
+  </mapping>
+
+  <mapping>
     <class-a>
       org.ourproject.kune.platf.client.dto.StateToken
     </class-a>

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -5,7 +5,7 @@
 import org.mockito.Mockito;
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.workspace.client.site.SiteToken;
 
@@ -50,7 +50,7 @@
     public void getDefGroup() {
         stateManager.onHistoryChanged("site.docs");
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
-                (StateToken) Mockito.anyObject(), (AsyncCallback<StateDTO>) Mockito.anyObject());
+                (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
     @Before
@@ -71,7 +71,7 @@
         Mockito.stub(history.getToken()).toReturn("");
         stateManager.reload();
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
-                (StateToken) Mockito.anyObject(), (AsyncCallback<StateDTO>) Mockito.anyObject());
+                (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
     @SuppressWarnings("unchecked")
@@ -83,7 +83,7 @@
         stateManager.onHistoryChanged(token);
         Mockito.verify(listener, Mockito.times(1)).onEvent(Mockito.anyObject());
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
-                (StateToken) Mockito.anyObject(), (AsyncCallback<StateDTO>) Mockito.anyObject());
+                (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -3,7 +3,6 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
@@ -50,8 +49,7 @@
     public void begin() {
         final StateManager stateManager = Mockito.mock(StateManager.class);
         final WsThemePresenter themePresenter = Mockito.mock(WsThemePresenter.class);
-        KuneErrorHandler errorHandler = Mockito.mock(KuneErrorHandler.class);
-        toolSelector = new ToolSelectorPresenter(stateManager, themePresenter, errorHandler);
+        toolSelector = new ToolSelectorPresenter(stateManager, themePresenter);
         toolSelectorItem1 = Mockito.mock(ToolSelectorItem.class);
         toolSelectorItem2 = Mockito.mock(ToolSelectorItem.class);
     }
@@ -86,6 +84,17 @@
         Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(true);
     }
 
+    @Test
+    public void setStateWithNoToolNameMustUnSelectTheOlder() {
+        setToolNames();
+        toolSelector.addTool(toolSelectorItem1);
+        toolSelector.addTool(toolSelectorItem2);
+        toolSelector.onToolChanged(TOOL1_NAME, null);
+        Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false);
+        Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false);
+        Mockito.verify(toolSelectorItem2, Mockito.never()).setSelected(true);
+    }
+
     public void setToolNames() {
         Mockito.stub(toolSelectorItem1.getShortName()).toReturn(TOOL1_NAME);
         Mockito.stub(toolSelectorItem2.getShortName()).toReturn(TOOL2_NAME);

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -5,7 +5,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.ourproject.kune.platf.client.dto.CommentDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
@@ -13,7 +13,7 @@
 public class ContentCommentServiceTest extends ContentServiceIntegrationTest {
 
     String groupName;
-    private StateDTO defaultContent;
+    private StateContainerDTO defaultContent;
 
     @Test
     public void commentDefaultContent() throws Exception {

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -12,7 +12,8 @@
 import org.ourproject.kune.platf.client.dto.ContainerDTO;
 import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
@@ -21,7 +22,7 @@
 public class ContentServiceAddTest extends ContentServiceIntegrationTest {
 
     String groupName;
-    private StateDTO defaultContent;
+    private StateContentDTO defaultContent;
 
     @Before
     public void init() throws Exception {
@@ -45,7 +46,7 @@
         final AccessRightsDTO groupRights = defaultContent.getGroupRights();
 
         final String title = "New Content Title";
-        final StateDTO added = contentService.addContent(session.getHash(),
+        final StateContentDTO added = contentService.addContent(session.getHash(),
                 defaultContent.getContainer().getStateToken(), title);
         assertNotNull(added);
         final List<ContentSimpleDTO> contents = added.getContainer().getContents();
@@ -59,7 +60,7 @@
         assertNotNull(added.getAccessLists());
 
         final StateToken newState = added.getStateToken();
-        final StateDTO sameAgain = contentService.getContent(session.getHash(), newState);
+        final StateContentDTO sameAgain = (StateContentDTO) contentService.getContent(session.getHash(), newState);
         assertNotNull(sameAgain);
         assertEquals(2, sameAgain.getContainer().getContents().size());
 
@@ -71,8 +72,8 @@
         defaultContent = getDefaultContent();
         final ContainerDTO parent = defaultContent.getContainer();
         final String title = "folder name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
-                DocumentClientTool.TYPE_FOLDER);
+        final StateContainerDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(),
+                title, DocumentClientTool.TYPE_FOLDER);
         assertNotNull(newState);
         assertNotNull(newState.getGroupMembers());
         assertNotNull(newState.getParticipation());
@@ -95,7 +96,8 @@
         defaultContent = getDefaultContent();
         final ContainerDTO parent = defaultContent.getContainer();
         final String roomName = "testroom";
-        final StateDTO newState = contentService.addRoom(session.getHash(), parent.getStateToken(), roomName);
+        final StateContainerDTO newState = contentService.addRoom(session.getHash(), parent.getStateToken(),
+                roomName);
         assertNotNull(newState);
     }
 
@@ -105,12 +107,12 @@
         defaultContent = getDefaultContent();
         final ContainerDTO parent = defaultContent.getContainer();
         final String title = "folder name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
-                DocumentClientTool.TYPE_FOLDER);
+        final StateContainerDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(),
+                title, DocumentClientTool.TYPE_FOLDER);
         assertNotNull(newState);
 
-        final StateDTO newState2 = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
-                DocumentClientTool.TYPE_FOLDER);
+        final StateContainerDTO newState2 = contentService.addFolder(session.getHash(), parent.getStateToken(),
+                title, DocumentClientTool.TYPE_FOLDER);
         assertNotNull(newState2);
 
         final ContainerDTO parentAgain = getDefaultContent().getContainer();

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -6,7 +6,10 @@
 
 import org.junit.Before;
 import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.StateNoContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
@@ -14,12 +17,20 @@
 public class ContentServiceGetTest extends ContentServiceIntegrationTest {
 
     @Test
+    public void contentOfUserWithNoHomePage() throws Exception {
+        final String userHash = doLogin();
+        final StateAbstractDTO response = contentService.getContent(userHash, new StateToken());
+        assertTrue(response instanceof StateNoContentDTO);
+    }
+
+    @Test
     public void contentWithLoggedUserIsEditable() throws Exception {
         final String userHash = doLogin();
-        final StateDTO response = contentService.getContent(userHash, new StateToken());
+        final StateContentDTO response = (StateContentDTO) contentService.getContent(userHash,
+                getDefaultContent().getStateToken());
         assertNotNull(response.getContentRights());
         assertTrue(response.getContentRights().isEditable());
-        // assertTrue(response.getAccessLists().getAdmin().size() == 1);
+        assertTrue(response.getAccessLists().getAdmins().getList().size() == 1);
     }
 
     @Before
@@ -29,7 +40,7 @@
 
     @Test
     public void defaultCountentShouldExist() throws Exception {
-        final StateDTO content = contentService.getContent(null, new StateToken());
+        final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
         assertNotNull(content);
         assertNotNull(content.getGroup());
         assertNotNull(content.getContainer());
@@ -42,7 +53,7 @@
 
     @Test
     public void noContentNotLogged() throws Exception {
-        final StateDTO response = contentService.getContent(null, new StateToken());
+        final StateContentDTO response = (StateContentDTO) contentService.getContent(null, new StateToken());
         assertNotNull(response);
     }
 
@@ -63,7 +74,7 @@
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent4() throws Exception {
-        final StateDTO stateDTO = getDefaultContent();
+        final StateContainerDTO stateDTO = getDefaultContent();
         contentService.getContent(null, stateDTO.getStateToken().clone().setDocument("dadaas"));
     }
 
@@ -74,7 +85,7 @@
 
     @Test
     public void notLoggedUserShouldNotEditDefaultDoc() throws Exception {
-        final StateDTO content = contentService.getContent(null, new StateToken());
+        final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
         assertFalse(content.getContentRights().isAdministrable());
         assertFalse(content.getContentRights().isEditable());
         assertTrue(content.getContentRights().isVisible());
@@ -85,7 +96,8 @@
 
     @Test
     public void unknownContent() throws Exception {
-        final StateDTO content = contentService.getContent(null, new StateToken("site.docs"));
+        final StateContainerDTO content = (StateContainerDTO) contentService.getContent(null, new StateToken(
+                "site.docs"));
         assertNotNull(content);
         assertNotNull(content.getGroup());
         assertNotNull(content.getContainer());

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,6 +1,6 @@
 package org.ourproject.kune.platf.integration.content;
 
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentService;
 import org.ourproject.kune.platf.integration.IntegrationTest;
@@ -11,9 +11,9 @@
     @Inject
     protected ContentService contentService;
 
-    protected StateDTO getDefaultContent() throws Exception {
+    protected StateContentDTO getDefaultContent() throws Exception {
         final StateToken stateToken = new StateToken(getDefSiteGroupName());
-        final StateDTO content = contentService.getContent(session.getHash(), stateToken);
+        final StateContentDTO content = (StateContentDTO) contentService.getContent(session.getHash(), stateToken);
         return content;
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -4,13 +4,13 @@
 
 import org.junit.Before;
 import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
 import org.ourproject.kune.platf.server.TestDomainHelper;
 
 public class ContentServiceSaveTest extends ContentServiceIntegrationTest {
 
-    private StateDTO defaultContent;
+    private StateContentDTO defaultContent;
 
     @Before
     public void init() throws Exception {
@@ -25,10 +25,12 @@
         final String text = "Lorem ipsum dolor sit amet";
         final int version = defaultContent.getVersion();
         final int currentVersion = contentService.save(getHash(), defaultContent.getStateToken(), text);
-        assertEquals(version + 2, currentVersion);
-        final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
+        assertEquals(version + 1, currentVersion);
+        final StateContentDTO again = (StateContentDTO) contentService.getContent(getHash(),
+                defaultContent.getStateToken());
         assertEquals(text, again.getContent());
-        assertEquals(0, (int) again.getRateByUsers());
+        assertEquals(version + 1, again.getVersion());
+        assertEquals(0, again.getRateByUsers().intValue());
         assertEquals(new Double(0), again.getRate());
     }
 
@@ -38,8 +40,10 @@
         ;
         final int version = defaultContent.getVersion();
         final int currentVersion = contentService.save(getHash(), defaultContent.getStateToken(), text);
-        assertEquals(version + 2, currentVersion);
-        final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
+        assertEquals(version + 1, currentVersion);
+        final StateContentDTO again = (StateContentDTO) contentService.getContent(getHash(),
+                defaultContent.getStateToken());
+        assertEquals(version + 1, again.getVersion());
         assertEquals(text, again.getContent());
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -12,7 +12,8 @@
 import org.ourproject.kune.docs.client.DocumentClientTool;
 import org.ourproject.kune.platf.client.dto.ContainerDTO;
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
@@ -21,7 +22,7 @@
 
 public class ContentServiceVariousTest extends ContentServiceIntegrationTest {
 
-    private StateDTO defaultContent;
+    private StateContentDTO defaultContent;
     private String groupShortName;
 
     @Test
@@ -44,7 +45,8 @@
     @Test
     public void contentRateAndRetrieve() throws Exception {
         contentService.rateContent(getHash(), defaultContent.getStateToken(), 4.5);
-        final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
+        final StateContentDTO again = (StateContentDTO) contentService.getContent(getHash(),
+                defaultContent.getStateToken());
         assertEquals(true, again.isRateable());
         assertEquals(new Double(4.5), again.getCurrentUserRate());
         assertEquals(new Double(4.5), again.getRate());
@@ -54,7 +56,8 @@
     @Test
     public void contentSetLanguage() throws Exception {
         contentService.setLanguage(getHash(), defaultContent.getStateToken(), "es");
-        final StateDTO contentRetrieved = contentService.getContent(getHash(), defaultContent.getStateToken());
+        final StateContentDTO contentRetrieved = (StateContentDTO) contentService.getContent(getHash(),
+                defaultContent.getStateToken());
         assertEquals("es", contentRetrieved.getLanguage().getCode());
     }
 
@@ -62,7 +65,8 @@
     // FIXME: when State refactor do this test (with noLogin and without)
     public void defAdminDontShowAsParticipation() throws Exception {
         doLogin();
-        final StateDTO content = contentService.getContent(getHash(), new StateToken(getSiteAdminShortName()));
+        final StateContentDTO content = (StateContentDTO) contentService.getContent(getHash(), new StateToken(
+                getSiteAdminShortName()));
         assertEquals(0, content.getParticipation().getGroupsIsCollab().size());
         assertEquals(1, content.getParticipation().getGroupsIsAdmin().size());
     }
@@ -74,8 +78,8 @@
 
         final String oldTitle = "some title";
         String newTitle = "folder new name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), defaultContent.getStateToken(), oldTitle,
-                DocumentClientTool.TYPE_FOLDER);
+        final StateContainerDTO newState = contentService.addFolder(session.getHash(),
+                defaultContent.getStateToken(), oldTitle, DocumentClientTool.TYPE_FOLDER);
 
         final ContainerDTO newFolder = newState.getContainer();
 
@@ -89,7 +93,8 @@
 
         final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
                 newFolder.getId().toString(), null);
-        StateDTO folderAgain = contentService.getContent(getHash(), newFolderToken);
+        StateContainerDTO folderAgain = (StateContainerDTO) contentService.getContent(getHash(),
+                newFolderToken);
 
         assertEquals(newTitle, folderAgain.getContainer().getName());
 
@@ -97,7 +102,7 @@
 
         result = contentService.renameContainer(getHash(), newFolderToken, newTitle);
 
-        folderAgain = contentService.getContent(getHash(), newFolderToken);
+        folderAgain = (StateContainerDTO) contentService.getContent(getHash(), newFolderToken);
 
         assertEquals(newTitle, folderAgain.getContainer().getName());
     }
@@ -171,8 +176,8 @@
         doLogin();
         defaultContent = getDefaultContent();
 
-        final StateDTO added = contentService.addContent(session.getHash(), defaultContent.getStateToken(),
-                "New Content Title");
+        final StateContainerDTO added = contentService.addContent(session.getHash(),
+                defaultContent.getStateToken(), "New Content Title");
         assertNotNull(added);
 
         final ContentSimpleDTO newDefContent = contentService.setAsDefaultContent(session.getHash(),
@@ -190,8 +195,8 @@
 
         final String oldTitle = "some title";
         String newTitle = "folder new name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), folder.getStateToken(), oldTitle,
-                DocumentClientTool.TYPE_FOLDER);
+        final StateContainerDTO newState = contentService.addFolder(session.getHash(), folder.getStateToken(),
+                oldTitle, DocumentClientTool.TYPE_FOLDER);
 
         final ContainerDTO newFolder = newState.getContainer();
 
@@ -203,7 +208,8 @@
 
         assertEquals(newTitle, result);
 
-        final StateDTO folderAgain = contentService.getContent(getHash(), newState.getStateToken());
+        final StateContainerDTO folderAgain = (StateContainerDTO) contentService.getContent(getHash(),
+                newState.getStateToken());
 
         assertEquals(newTitle, folderAgain.getContainer().getName());
     }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -9,7 +9,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.errors.SessionExpiredException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
@@ -32,7 +32,7 @@
     @Test
     public void testCreateLogo() throws Exception {
         manager.createUploadedFile(super.getDefaultContent().getStateToken(), "image/png", new File(TEST_FILE));
-        StateDTO defaultContent = super.getDefaultContent();
+        StateContainerDTO defaultContent = super.getDefaultContent();
         assertTrue(defaultContent.getGroup().hasLogo());
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -18,7 +18,7 @@
 import org.ourproject.kune.platf.client.dto.GroupListDTO;
 import org.ourproject.kune.platf.client.dto.LicenseDTO;
 import org.ourproject.kune.platf.client.dto.LinkDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.server.TestDomainHelper;
 import org.ourproject.kune.platf.server.TestHelper;
@@ -34,7 +34,7 @@
 import org.ourproject.kune.platf.server.domain.Revision;
 import org.ourproject.kune.platf.server.domain.User;
 import org.ourproject.kune.platf.server.manager.GroupManager;
-import org.ourproject.kune.platf.server.state.State;
+import org.ourproject.kune.platf.server.state.StateContent;
 
 import com.google.inject.Inject;
 
@@ -123,17 +123,17 @@
 
     @Test
     public void testContentMapping() {
-        final State c = new State();
+        final StateContent c = new StateContent();
         c.setContentRights(new AccessRights(true, true, true));
         final Group groupAdmins = TestDomainHelper.createGroup(1);
         final Group groupEdit = TestDomainHelper.createGroup(2);
         final Group groupView = TestDomainHelper.createGroup(3);
         c.setAccessLists(TestDomainHelper.createAccessLists(groupAdmins, groupEdit, groupView));
         c.setRate(10.2D);
-        c.setRateByUsers(3L);
+        c.setRateByUsers(3);
         c.setCurrentUserRate(null);
 
-        final StateDTO dto = mapper.map(c, StateDTO.class);
+        final StateContentDTO dto = mapper.map(c, StateContentDTO.class);
         assertEquals(c.getContentRights().isAdministrable(), dto.getContentRights().isAdministrable());
 
         assertValidAccessListsMapping(c.getAccessLists().getAdmins(), dto.getAccessLists().getAdmins());
@@ -234,9 +234,9 @@
         final StateToken stateToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "2");
         final StateToken stateTokenMapped = mapper.map(stateToken, StateToken.class);
         assertEquals(stateToken, stateTokenMapped);
-        final State state = new State();
+        final StateContent state = new StateContent();
         state.setStateToken(stateToken);
-        final StateDTO stateDTO = mapper.map(state, StateDTO.class);
+        final StateContentDTO stateDTO = mapper.map(state, StateContentDTO.class);
         assertEquals(stateToken, stateDTO.getStateToken());
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java	2008-10-22 12:53:33 UTC (rev 922)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java	2008-10-24 01:37:05 UTC (rev 923)
@@ -1,9 +1,12 @@
 package org.ourproject.kune.workspace.client.tags;
 
+import java.util.ArrayList;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.TagResultDTO;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.search.SiteSearcher;
@@ -32,15 +35,26 @@
 
     @Test
     public void noTagsViewNotVisible() {
-        final StateDTO state = new StateDTO();
+        final StateContainerDTO state = new StateContainerDTO();
         tagsSummaryPresenter.setState(state);
         Mockito.verify(view).setVisible(false);
     }
 
     @Test
+    public void withTagsViewFalse() {
+        final StateContainerDTO state = new StateContainerDTO();
+        ArrayList<TagResultDTO> list = new ArrayList<TagResultDTO>();
+        state.setGroupTags(list);
+        tagsSummaryPresenter.setState(state);
+        Mockito.verify(view).setVisible(false);
+    }
+
+    @Test
     public void withTagsViewVisible() {
-        final StateDTO state = new StateDTO();
-        state.setTags("test test1");
+        final StateContainerDTO state = new StateContainerDTO();
+        ArrayList<TagResultDTO> list = new ArrayList<TagResultDTO>();
+        list.add(new TagResultDTO("abc", 1L));
+        state.setGroupTags(list);
         tagsSummaryPresenter.setState(state);
         Mockito.verify(view).setVisible(true);
     }




More information about the kune-commits mailing list