[kune-commits] r1586 - in trunk/src: main/java/cc/kune/barters/server main/java/cc/kune/blogs/server main/java/cc/kune/chat/server main/java/cc/kune/core/client/sn main/java/cc/kune/core/client/sn/actions/conditions main/java/cc/kune/core/public main/java/cc/kune/core/server main/java/cc/kune/core/server/content main/java/cc/kune/core/server/manager/file main/java/cc/kune/docs/server main/java/cc/kune/events/server main/java/cc/kune/gallery/server main/java/cc/kune/gspace/client/viewers main/java/cc/kune/lists/server main/java/cc/kune/tasks/server main/java/cc/kune/wiki/server test/java/cc/kune/blogs/server test/java/cc/kune/core/server test/java/cc/kune/core/server/manager test/java/cc/kune/docs/server test/java/cc/kune/lists/server test/java/cc/kune/wiki/server

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Sat Nov 5 23:01:53 CET 2011


Author: vjrj_
Date: 2011-11-05 23:01:51 +0100 (Sat, 05 Nov 2011)
New Revision: 1586

Modified:
   trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
   trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
   trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java
   trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/CreationService.java
   trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
   trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
   trunk/src/main/java/cc/kune/events/server/EventsServerTool.java
   trunk/src/main/java/cc/kune/gallery/server/GalleryServerTool.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
   trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
   trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java
   trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
   trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java
   trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java
   trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java
   trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
   trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java
   trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java
Log:
Some refactorization in Tools content creation and some fix with wikipages (now edited by anyone registered user)

Modified: trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -32,6 +32,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.server.tool.ServerWaveTool;
@@ -54,10 +55,11 @@
 
   @Inject
   public BarterServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_BARTER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
         Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager,
-        containerManager, configurationManager, i18n, ServerToolTarget.forUsers);
+        containerManager, creationService, configurationManager, i18n, ServerToolTarget.forUsers);
     gadgetUrl = UrlUtils.of(BARTER_GADGET);
   }
 
@@ -70,11 +72,10 @@
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
     final Container rootFolder = createRoot(group);
     setContainerAcl(rootFolder);
-    final Content content = createInitialContent(user, group, rootFolder, i18n.t("Barter sample"),
+    createInitialContent(user, group, rootFolder, i18n.t("Barter sample"),
         i18n.t("This is only a barter sample. You can invite other participants to this barter, "
             + "but also publish to the general public allowing you to share services, goods, etc."),
-        TYPE_BARTER, gadgetUrl);
-    contentManager.save(content);
+        TYPE_BARTER);
     return group;
   }
 
@@ -96,6 +97,6 @@
     bartersAcl.getAdmins().add(container.getOwner());
     bartersAcl.getEditors().setMode(GroupListMode.NORMAL);
     bartersAcl.getViewers().setMode(GroupListMode.EVERYONE);
-    containerManager.setAccessList(container, bartersAcl);
+    setAccessList(container, bartersAcl);
   }
 }

Modified: trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -31,11 +31,11 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.domain.Container;
-import cc.kune.domain.Content;
 import cc.kune.domain.Group;
 import cc.kune.domain.I18nLanguage;
 import cc.kune.domain.User;
@@ -46,10 +46,11 @@
 
   @Inject
   public BlogServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_POST, TYPE_UPLOADEDFILE),
         Arrays.asList(TYPE_BLOG), Arrays.asList(TYPE_BLOG), Arrays.asList(TYPE_ROOT), contentManager,
-        containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+        containerManager, creationService, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
   @Override
@@ -57,12 +58,11 @@
     final Container rootFolder = createRoot(group);
 
     final I18nLanguage language = user.getLanguage();
-    final Container blog = containerManager.createFolder(group, rootFolder, i18n.t("Blog sample"),
-        language, TYPE_BLOG);
+    final Container blog = creationService.createFolder(group, rootFolder.getId(),
+        i18n.t("Blog sample"), language, TYPE_BLOG);
 
-    final Content content = createInitialContent(user, group, blog, i18n.t("A post sample"),
+    createInitialContent(user, group, blog, i18n.t("A post sample"),
         i18n.t("This is only a post sample. You can edit it, rename the post and this blog"), TYPE_POST);
-    contentManager.save(content);
     return group;
   }
 }

Modified: trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/chat/server/ChatServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -30,6 +30,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -46,10 +47,12 @@
   @Inject
   public ChatServerTool(final ToolConfigurationManager configurationManager,
       final ContentManager contentManager, final ContainerManager containerManager,
-      final ChatManagerDefault chatManager, final I18nTranslationService i18n) {
+      final ChatManagerDefault chatManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Collections.<String> emptyList(),
         Collections.<String> emptyList(), Arrays.asList(TYPE_ROOM), Arrays.asList(TYPE_ROOT),
-        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forGroups);
+        contentManager, containerManager, creationService, configurationManager, i18n,
+        ServerToolTarget.forGroups);
     this.chatManager = chatManager;
   }
 

Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -67,9 +67,9 @@
     bottomActionsToolbar.setStyleName("k-sn-bottomPanel-actions");
     armor.getEntityToolsNorth().add(widget);
     deck.showWidget(2);
-    noBuddies = new Label("This user has no buddies yet");
+    noBuddies = new Label(i18n.t("This user has no buddies yet"));
     noBuddies.addStyleName("kune-Margin-Medium-l");
-    noPublic = new Label(CoreMessages.BUDDIES_NOT_PUBLIC);
+    noPublic = new Label(i18n.t(CoreMessages.BUDDIES_NOT_PUBLIC));
     noPublic.addStyleName("kune-Margin-Medium-l");
   }
 

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -32,26 +32,26 @@
 @Singleton
 public class IsCurrentStateEditableCondition implements GuiAddCondition {
 
-    private final Session session;
+  private final Session session;
 
-    @Inject
-    public IsCurrentStateEditableCondition(final Session session) {
-        this.session = session;
+  @Inject
+  public IsCurrentStateEditableCondition(final Session session) {
+    this.session = session;
+  }
+
+  @Override
+  public boolean mustBeAdded(final GuiActionDescrip descr) {
+    final StateAbstractDTO currentState = session.getCurrentState();
+    if (currentState == null) {
+      return false;
+    } else {
+      if (currentState instanceof StateContentDTO) {
+        return ((StateContentDTO) currentState).getContentRights().isEditable();
+      } else {
+        // session.getContainerState() instanceof StateContentDTO)
+        return ((StateContainerDTO) currentState).getGroupRights().isEditable();
+      }
     }
 
-    @Override
-    public boolean mustBeAdded(final GuiActionDescrip descr) {
-        final StateAbstractDTO currentState = session.getCurrentState();
-        if (currentState == null) {
-            return false;
-        } else {
-            if (currentState instanceof StateContentDTO) {
-                return ((StateContentDTO) currentState).getGroupRights().isEditable();
-            } else {
-                // session.getContainerState() instanceof StateContentDTO)
-                return ((StateContainerDTO) currentState).getGroupRights().isEditable();
-            }
-        }
-
-    }
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-05 22:01:51 UTC (rev 1586)
@@ -701,7 +701,7 @@
 }
 
 .k-publicspace-panel {
-  margin: 5px;
+  padding: 5px;
   display: table-row;
 }
 

Modified: trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/AbstractServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -1,6 +1,5 @@
 package cc.kune.core.server;
 
-import java.net.URL;
 import java.util.Date;
 import java.util.List;
 
@@ -8,12 +7,14 @@
 import cc.kune.core.client.errors.ContentNotPermittedException;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerTool;
 import cc.kune.core.server.tool.ServerToolRegistry;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.domain.ContentStatus;
 import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.AccessLists;
 import cc.kune.domain.Container;
 import cc.kune.domain.Content;
 import cc.kune.domain.Group;
@@ -25,8 +26,9 @@
 public abstract class AbstractServerTool implements ServerTool {
 
   protected final ToolConfigurationManager configurationManager;
-  protected final ContainerManager containerManager;
-  protected final ContentManager contentManager;
+  private final ContainerManager containerManager;
+  private final ContentManager contentManager;
+  protected final CreationService creationService;
   protected final I18nTranslationService i18n;
   private final String name;
   private final String rootName;
@@ -41,8 +43,8 @@
       final List<String> validContents, final List<String> validContentParents,
       final List<String> validContainers, final List<String> validContainerParents,
       final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
-      final ServerToolTarget target) {
+      final CreationService creationService, final ToolConfigurationManager configurationManager,
+      final I18nTranslationService i18n, final ServerToolTarget target) {
     this.name = name;
     this.rootName = rootName;
     this.typeRoot = typeRoot;
@@ -52,6 +54,7 @@
     this.validContainerParents = validContainerParents;
     this.contentManager = contentManager;
     this.containerManager = containerManager;
+    this.creationService = creationService;
     this.configurationManager = configurationManager;
     this.i18n = i18n;
     this.target = target;
@@ -77,22 +80,16 @@
 
   protected Content createInitialContent(final User user, final Group group, final Container rootFolder,
       final String title, final String body, final String contentType) {
-    final Content content = contentManager.createContent(title, body, user, rootFolder, contentType);
+    final Content content = creationService.createContent(title, body, user, rootFolder, contentType);
     setContentValues(content, contentType, user);
+    contentManager.save(content);
     return content;
   }
 
-  protected Content createInitialContent(final User user, final Group group, final Container rootFolder,
-      final String title, final String body, final String contentType, final URL gadgetUrl) {
-    final Content content = contentManager.createContent(title, body, user, rootFolder, contentType,
-        gadgetUrl);
-    setContentValues(content, contentType, user);
-    return content;
-  }
-
   protected Container createRoot(final Group group) {
     final ToolConfiguration config = new ToolConfiguration();
-    final Container rootFolder = containerManager.createRootFolder(group, name, rootName, typeRoot);
+
+    final Container rootFolder = creationService.createRootFolder(group, name, rootName, typeRoot);
     setContainerAcl(rootFolder);
     config.setRoot(rootFolder);
     group.setToolConfig(name, config);
@@ -129,6 +126,10 @@
     registry.register(this);
   }
 
+  protected void setAccessList(final Container container, final AccessLists acl) {
+    containerManager.setAccessList(container, acl);
+  }
+
   protected void setContainerAcl(final Container container) {
   }
 

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -19,7 +19,6 @@
  */
 package cc.kune.core.server.content;
 
-import java.net.URL;
 import java.util.Date;
 
 import cc.kune.core.client.errors.DefaultException;
@@ -49,11 +48,6 @@
 
   void addParticipant(User user, Long contentId, String participant);
 
-  Content createContent(String title, String body, User author, Container container, String typeId);
-
-  Content createContent(String title, String body, User author, Container container, String typeId,
-      URL gadgetUrl);
-
   boolean findIfExistsTitle(Container container, String title);
 
   Double getRateAvg(Content content);

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -112,14 +112,12 @@
     }
   }
 
-  @Override
-  public Content createContent(final String title, final String body, final User author,
+  protected Content createContent(final String title, final String body, final User author,
       final Container container, final String typeId) {
     return createContent(title, body, author, container, typeId, KuneWaveService.WITHOUT_GADGET);
   }
 
-  @Override
-  public Content createContent(final String title, final String body, final User author,
+  protected Content createContent(final String title, final String body, final User author,
       final Container container, final String typeId, final URL gadgetUrl) {
     FilenameUtils.checkBasicFilename(title);
     final String newtitle = findInexistentTitle(container, title);

Modified: trunk/src/main/java/cc/kune/core/server/content/CreationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationService.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationService.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -35,6 +35,8 @@
   Content createGadget(User user, Container container, String gadgetname, String typeId, String title,
       String body);
 
+  Container createRootFolder(Group group, String name, String rootName, String typeRoot);
+
   Content saveContent(User editor, Content descriptor, String content);
 
 }

Modified: trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -44,7 +44,7 @@
 public class CreationServiceDefault implements CreationService {
   private final XMLKuneClientActions actions;
   private final ContainerManager containerManager;
-  private final ContentManager contentManager;
+  private final ContentManagerDefault contentManager;
   private final Log LOG = LogFactory.getLog(CreationServiceDefault.class);
   private final ServerToolRegistry tools;
 
@@ -53,7 +53,7 @@
       final ContentManager contentManager, final ServerToolRegistry toolRegistry,
       final XMLActionReader xmlActionReader) {
     this.containerManager = containerManager;
-    this.contentManager = contentManager;
+    this.contentManager = (ContentManagerDefault) contentManager;
     this.tools = toolRegistry;
     this.actions = xmlActionReader.getActions();
   }
@@ -104,6 +104,13 @@
   }
 
   @Override
+  public Container createRootFolder(final Group group, final String name, final String rootName,
+      final String typeRoot) {
+    // FIXME Check that does not exist yet
+    return containerManager.createRootFolder(group, name, rootName, typeRoot);
+  }
+
+  @Override
   public Content saveContent(final User editor, final Content content, final String body) {
     return contentManager.save(editor, content, body);
   }

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -30,8 +30,8 @@
 import cc.kune.core.server.auth.ActionLevel;
 import cc.kune.core.server.auth.Authenticated;
 import cc.kune.core.server.auth.Authorizated;
-import cc.kune.core.server.content.ContentManager;
 import cc.kune.core.server.content.ContentUtils;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.FileManager;
 import cc.kune.core.server.properties.KuneProperties;
 import cc.kune.core.server.utils.StringW;
@@ -54,7 +54,7 @@
   @Inject
   AccessService accessService;
   @Inject
-  ContentManager contentManager;
+  CreationService creationService;
   @Inject
   FileManager fileManager;
   @Inject
@@ -133,7 +133,7 @@
       final User user = userSession.getUser();
       final Container container = accessService.accessToContainer(
           ContentUtils.parseId(stateToken.getFolder()), user, AccessRol.Editor);
-      final Content content = contentManager.createContent(
+      final Content content = creationService.createContent(
           FileUtils.getFileNameWithoutExtension(file.getName(), extension), preview, user, container,
           typeId);
       content.setMimeType(basicMimeType);

Modified: trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -31,6 +31,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -47,10 +48,11 @@
   @Inject
   public DocumentServerTool(final ContentManager contentManager,
       final ContainerManager containerManager, final ToolConfigurationManager configurationManager,
-      final I18nTranslationService i18n) {
+      final I18nTranslationService i18n, final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_DOCUMENT, TYPE_UPLOADEDFILE), Arrays.asList(
         TYPE_ROOT, TYPE_FOLDER), Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
-        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+        contentManager, containerManager, creationService, configurationManager, i18n,
+        ServerToolTarget.forBoth);
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/events/server/EventsServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/events/server/EventsServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/events/server/EventsServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -32,6 +32,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.server.tool.ServerWaveTool;
@@ -54,10 +55,11 @@
 
   @Inject
   public EventsServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_MEETING), Arrays.asList(TYPE_ROOT),
         Collections.<String> emptyList(), Arrays.asList(TYPE_ROOT), contentManager, containerManager,
-        configurationManager, i18n, ServerToolTarget.forGroups);
+        creationService, configurationManager, i18n, ServerToolTarget.forGroups);
     gadgetUrl = UrlUtils.of(MEETING_GADGET);
   }
 
@@ -70,11 +72,11 @@
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
     final Container rootFolder = createRoot(group);
 
-    final Content content = createInitialContent(user, group, rootFolder, i18n.t("Meeting sample"),
+    createInitialContent(user, group, rootFolder, i18n.t("Meeting sample"),
         i18n.t("This is only a meet sample. You can invite other participants to this meeting, "
             + "but also publish to the general public allowing you to to help in the organization, "
-            + "call and speed-up of events."), TYPE_MEETING, gadgetUrl);
-    contentManager.save(content);
+            + "call and speed-up of events."), TYPE_MEETING);
+
     return group;
   }
 
@@ -96,6 +98,6 @@
     meetsAcl.getAdmins().add(container.getOwner());
     meetsAcl.getEditors().setMode(GroupListMode.NORMAL);
     meetsAcl.getViewers().setMode(GroupListMode.EVERYONE);
-    containerManager.setAccessList(container, meetsAcl);
+    setAccessList(container, meetsAcl);
   }
 }

Modified: trunk/src/main/java/cc/kune/gallery/server/GalleryServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/gallery/server/GalleryServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/gallery/server/GalleryServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -30,6 +30,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -43,17 +44,18 @@
 
   @Inject
   public GalleryServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_UPLOADEDFILE), Arrays.asList(TYPE_ROOT,
         TYPE_ALBUM), Arrays.asList(TYPE_ALBUM), Arrays.asList(TYPE_ROOT, TYPE_ALBUM), contentManager,
-        containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+        containerManager, creationService, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
   @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
     final Container rootFolder = createRoot(group);
 
-    containerManager.createFolder(group, rootFolder, i18n.t("Album sample"), user.getLanguage(),
+    creationService.createFolder(group, rootFolder.getId(), i18n.t("Album sample"), user.getLanguage(),
         TYPE_ALBUM);
     return group;
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -24,6 +24,7 @@
 import cc.kune.common.client.actions.BeforeActionListener;
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
 import cc.kune.common.client.errors.UIException;
+import cc.kune.common.client.log.Log;
 import cc.kune.common.client.ui.EditEvent;
 import cc.kune.common.client.ui.EditEvent.EditHandler;
 import cc.kune.common.client.ui.HasEditHandler;
@@ -171,6 +172,7 @@
     getView().clear();
     final StateContentDTO stateContent = (StateContentDTO) state;
     final AccessRights rights = stateContent.getContentRights();
+    Log.info("Content rights: " + rights);
     if (session.isLogged() && rights.isEditable()) {
       if (stateContent.isParticipant()) {
         // is already participant, show wave editor

Modified: trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -35,6 +35,7 @@
 import cc.kune.core.server.UserSessionManager;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.domain.ContentStatus;
@@ -56,10 +57,11 @@
   @Inject
   public ListsServerTool(final ContentManager contentManager, final ContainerManager containerManager,
       final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
-      final UserSessionManager userSessionManager, final KuneWaveService waveManager) {
+      final UserSessionManager userSessionManager, final KuneWaveService waveManager,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_POST), Arrays.asList(TYPE_LIST),
         Arrays.asList(TYPE_LIST), Arrays.asList(TYPE_ROOT), contentManager, containerManager,
-        configurationManager, i18n, ServerToolTarget.forGroups);
+        creationService, configurationManager, i18n, ServerToolTarget.forGroups);
     this.userSessionManager = userSessionManager;
     this.waveManager = waveManager;
   }

Modified: trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/tasks/server/TaskServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -31,6 +31,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.domain.ContentStatus;
@@ -47,24 +48,24 @@
 
   @Inject
   public TaskServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_TASK), Arrays.asList(TYPE_FOLDER, TYPE_ROOT),
         Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager,
-        containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+        containerManager, creationService, configurationManager, i18n, ServerToolTarget.forBoth);
   }
 
   private Container createFolder(final Group group, final Container rootFolder,
       final I18nLanguage language, final String title) {
-    final Container shortTerm = containerManager.createFolder(group, rootFolder, i18n.t(title),
+    final Container shortTerm = creationService.createFolder(group, rootFolder.getId(), i18n.t(title),
         language, TYPE_FOLDER);
     return shortTerm;
   }
 
   private void createTask(final User user, final Group group, final Container shortTerm,
       final String text) {
-    final Content content = createInitialContent(user, group, shortTerm, i18n.t(text),
+    createInitialContent(user, group, shortTerm, i18n.t(text),
         i18n.t("This is only a task sample. You can edit it, rename it"), TYPE_TASK);
-    contentManager.save(content);
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -32,6 +32,7 @@
 import cc.kune.core.server.AbstractServerTool;
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.ToolConfigurationManager;
 import cc.kune.core.server.tool.ServerToolTarget;
 import cc.kune.core.shared.domain.ContentStatus;
@@ -49,18 +50,21 @@
 
   @Inject
   public WikiServerTool(final ContentManager contentManager, final ContainerManager containerManager,
-      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+      final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+      final CreationService creationService) {
     super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE), Arrays.asList(
         TYPE_ROOT, TYPE_FOLDER), Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER),
-        contentManager, containerManager, configurationManager, i18n, ServerToolTarget.forBoth);
+        contentManager, containerManager, creationService, configurationManager, i18n,
+        ServerToolTarget.forBoth);
   }
 
   @Override
   public Group initGroup(final User user, final Group group, final Object... otherVars) {
     final Container rootFolder = createRoot(group);
 
-    final Content content = super.createInitialContent(user, group, rootFolder, i18n.t("Wiki page sample"), i18n.t("This is only a wiki page sample. You can edit or rename it, but also any other user."), TYPE_WIKIPAGE);
-    contentManager.save(content);
+    super.createInitialContent(user, group, rootFolder, i18n.t("Wiki page sample"),
+        i18n.t("This is only a wiki page sample. You can edit or rename it, but also any other user."),
+        TYPE_WIKIPAGE);
     return group;
   }
 
@@ -82,6 +86,6 @@
     wikiAcl.getAdmins().add(container.getOwner());
     wikiAcl.getEditors().setMode(GroupListMode.EVERYONE);
     wikiAcl.getViewers().setMode(GroupListMode.EVERYONE);
-    containerManager.setAccessList(container, wikiAcl);
+    setAccessList(container, wikiAcl);
   }
 }

Modified: trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -36,7 +36,7 @@
 
   @Before
   public void before() {
-    serverTool = new BlogServerTool(null, null, null, null);
+    serverTool = new BlogServerTool(null, null, null, null, null);
   }
 
   @Test

Modified: trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -29,6 +29,7 @@
 
 import cc.kune.core.server.content.ContainerManager;
 import cc.kune.core.server.content.ContentManager;
+import cc.kune.core.server.content.CreationService;
 import cc.kune.core.server.manager.GroupManager;
 import cc.kune.core.server.manager.I18nCountryManager;
 import cc.kune.core.server.manager.I18nLanguageManager;
@@ -60,6 +61,8 @@
   protected ContentManager contentManager;
   @Inject
   protected I18nCountryManager countryManager;
+  @Inject
+  protected CreationService creationService;
   protected License defLicense;
   protected I18nLanguage english;
   protected I18nCountry gb;

Modified: trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -42,14 +42,14 @@
 
   private Content createContent() {
     assertNotNull(container);
-    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
+    final Content cnt = creationService.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
     persist(cnt);
     containerManager.persist(container);
     return cnt;
   }
 
   private void createContentWithMimeAndCheck(final String mimetype) {
-    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
+    final Content cnt = creationService.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
     cnt.setMimeType(new BasicMimeType(mimetype));
     persist(cnt);
     final Content newCnt = contentManager.find(cnt.getId());
@@ -96,7 +96,7 @@
   @Test(expected = NameInUseException.class)
   public void testBasicMoveWithExistingNameShouldFail() {
     final Content content = createContent();
-    final Content sameNameCnt = contentManager.createContent(TITLE, BODY, user, otherContainer,
+    final Content sameNameCnt = creationService.createContent(TITLE, BODY, user, otherContainer,
         TYPE_UPLOADEDFILE);
     persist(sameNameCnt);
     contentManager.moveContent(content, otherContainer);
@@ -140,7 +140,7 @@
    */
   @Test
   public void testUTF8Persist() {
-    final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container, TYPE_DOCUMENT);
+    final Content cnt = creationService.createContent("汉语/漢語", "汉语/漢語", user, container, TYPE_DOCUMENT);
     final Content newCnt = contentManager.find(cnt.getId());
     assertEquals("汉语/漢語", newCnt.getTitle());
   }

Modified: trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -33,7 +33,7 @@
 
   @Before
   public void before() {
-    serverTool = new DocumentServerTool(null, null, null, null);
+    serverTool = new DocumentServerTool(null, null, null, null, null);
   }
 
   @Test

Modified: trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -35,7 +35,7 @@
 
   @Before
   public void before() {
-    serverTool = new ListsServerTool(null, null, null, null, null, null);
+    serverTool = new ListsServerTool(null, null, null, null, null, null, null);
   }
 
   @Test

Modified: trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java	2011-11-05 19:34:12 UTC (rev 1585)
+++ trunk/src/test/java/cc/kune/wiki/server/WikiServerToolTest.java	2011-11-05 22:01:51 UTC (rev 1586)
@@ -33,7 +33,7 @@
 
   @Before
   public void before() {
-    serverTool = new WikiServerTool(null, null, null, null);
+    serverTool = new WikiServerTool(null, null, null, null, null);
   }
 
   @Test




More information about the kune-commits mailing list