[kune-commits] r1322 - in trunk: . .codepro src/main/java/cc/kune src/main/java/cc/kune/blogs src/main/java/cc/kune/blogs/client src/main/java/cc/kune/blogs/client/actions src/main/java/cc/kune/blogs/server src/main/java/cc/kune/blogs/shared src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/chat/client/resources src/main/java/cc/kune/common/client/utils src/main/java/cc/kune/core src/main/java/cc/kune/core/client/cnt src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/client/sn/actions/registry src/main/java/cc/kune/core/client/state src/main/java/cc/kune/core/client/ui/utils src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/init src/main/java/cc/kune/core/server/manager src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/core/server/state src/main/java/cc/kune/core/server/tool src/main/java/cc/kune/core/shared src/main/java/cc/kune/docs src/main/java/cc/kune/docs/client src/main/java/cc/kune/docs/client/actions src/main/java/cc/kune/docs/server src/main/java/cc/kune/docs/shared src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/wave/client src/main/java/cc/kune/wave/server src/main/java/org/ourproject/kune/chat/server src/main/java/org/ourproject/kune/gallery/server src/main/java/org/ourproject/kune/wiki/server src/main/java/org/ourproject/kune/workspace/client/ctxnav src/main/resources/db src/test/java/cc/kune/blogs/server src/test/java/cc/kune/core/server src/test/java/cc/kune/core/server/integration src/test/java/cc/kune/core/server/integration/content src/test/java/cc/kune/core/server/manager src/test/java/cc/kune/docs src/test/java/cc/kune/docs/server src/test/java/cc/kune/wave/server src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed Apr 27 17:32:02 CEST 2011
Author: vjrj_
Date: 2011-04-27 17:32:01 +0200 (Wed, 27 Apr 2011)
New Revision: 1322
Added:
trunk/.codepro/
trunk/.codepro/deadCodeEntryPoints.xml
trunk/src/main/java/cc/kune/blogs/shared/
trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java
trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml
trunk/src/main/java/cc/kune/core/shared/ToolConstants.java
trunk/src/main/java/cc/kune/docs/shared/
trunk/src/main/java/cc/kune/docs/shared/DocsConstants.java
Removed:
trunk/src/main/java/cc/kune/core/Core.gwt.xml
Modified:
trunk/.project
trunk/src/main/java/cc/kune/Kune.gwt.xml
trunk/src/main/java/cc/kune/blogs/KuneBlogs.gwt.xml
trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
trunk/src/main/java/cc/kune/blogs/client/actions/NewBlogBtn.java
trunk/src/main/java/cc/kune/blogs/client/actions/NewPostBtn.java
trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
trunk/src/main/java/cc/kune/chat/client/resources/ChatResources.java
trunk/src/main/java/cc/kune/common/client/utils/Pair.java
trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java
trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java
trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java
trunk/src/main/java/cc/kune/core/client/ui/utils/ContentPosition.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/init/DatabaseInitializer.java
trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
trunk/src/main/java/cc/kune/core/server/tool/ServerTool.java
trunk/src/main/java/cc/kune/docs/KuneDocs.gwt.xml
trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java
trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java
trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
trunk/src/main/java/cc/kune/gspace/client/actions/ActionGroups.java
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java
trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java
trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
trunk/src/main/resources/db/liquibase_changelog.xml
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/integration/DatabaseInitializerTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java
trunk/src/test/java/cc/kune/docs/DocumentToolTest.java
trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
Log:
More blogs/docs and WIAB integration work
Added: trunk/.codepro/deadCodeEntryPoints.xml
===================================================================
--- trunk/.codepro/deadCodeEntryPoints.xml (rev 0)
+++ trunk/.codepro/deadCodeEntryPoints.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated by Code Pro -->
+<entry-points
+ version="1">
+ <explicit-entry-points>
+ <explicit-entry-point
+ handle="=kune/src\/main\/java<cc.kune.client{KuneEntryPoint.java[KuneEntryPoint~onModuleLoad"/>
+ </explicit-entry-points>
+ <include-main
+ enabled="true"/>
+ <include-tests
+ enabled="false"/>
+ <include-xml
+ enabled="true"/>
+</entry-points>
\ No newline at end of file
Property changes on: trunk/.codepro/deadCodeEntryPoints.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/.project
===================================================================
--- trunk/.project 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/.project 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,38 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>kune</name>
- <comment>kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
- <projects/>
- <buildSpec>
- <buildCommand>
- <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
- </buildCommand>
- <buildCommand>
- <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- </buildCommand>
- <buildCommand>
- <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
- </buildCommand>
- <buildCommand>
- <name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
- <nature>org.eclipse.ajdt.ui.ajnature</nature>
- <nature>com.google.gwt.eclipse.core.gwtNature</nature>
- <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
- <nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
+ <name>kune</name>
+ <comment>kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.ajdt.ui.ajnature</nature>
+ <nature>com.google.gwt.eclipse.core.gwtNature</nature>
+ <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+ <nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/src/main/java/cc/kune/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -3,7 +3,7 @@
<module rename-to="ws">
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.gwt.logging.Logging' />
- <inherits name="cc.kune.core.Core" />
+ <inherits name="cc.kune.core.KuneCore" />
<inherits name="cc.kune.wave.KuneWave" />
<inherits name="cc.kune.chat.KuneChat" />
<inherits name="cc.kune.docs.KuneDocs" />
Modified: trunk/src/main/java/cc/kune/blogs/KuneBlogs.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/blogs/KuneBlogs.gwt.xml 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/KuneBlogs.gwt.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,5 +1,6 @@
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
<module>
- <inherits name="cc.kune.core.Core" />
- <source path="client" />
+ <inherits name="cc.kune.core.KuneCore" />
+ <source path="client" />
+ <source path="shared" />
</module>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,11 @@
*/
package cc.kune.blogs.client;
+import static cc.kune.blogs.shared.BlogsConstants.NAME;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.resources.nav.NavResources;
@@ -29,11 +34,6 @@
public class BlogsClientTool extends FoldableAbstractClientTool {
- public static final String NAME = "blogs";
- public static final String TYPE_BLOG = NAME + "." + "blog";
- public static final String TYPE_POST = NAME + "." + "post";
- public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
private final NavResources navResources;
@Inject
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,10 +19,10 @@
\*/
package cc.kune.blogs.client.actions;
-import static org.ourproject.kune.blogs.client.BlogClientTool.TYPE_BLOG;
-import static org.ourproject.kune.blogs.client.BlogClientTool.TYPE_POST;
-import static org.ourproject.kune.blogs.client.BlogClientTool.TYPE_ROOT;
-import static org.ourproject.kune.blogs.client.BlogClientTool.TYPE_UPLOADEDFILE;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.resources.CoreResources;
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/NewBlogBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/NewBlogBtn.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/NewBlogBtn.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,6 +1,6 @@
package cc.kune.blogs.client.actions;
-import cc.kune.blogs.client.BlogsClientTool;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.NewContainerBtn;
@@ -12,7 +12,7 @@
@Inject
public NewBlogBtn(final I18nTranslationService i18n, final NewContainerAction action, final NavResources res) {
super(i18n, action, res, i18n.t("New blog"), i18n.t("Create a new blog"), i18n.t("New blog"),
- BlogsClientTool.TYPE_BLOG);
+ BlogsConstants.TYPE_BLOG);
}
}
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/NewPostBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/NewPostBtn.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/NewPostBtn.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,6 +1,6 @@
package cc.kune.blogs.client.actions;
-import cc.kune.blogs.client.BlogsClientTool;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -14,7 +14,7 @@
public NewPostBtn(final I18nTranslationService i18n, final NewContentAction action, final NavResources res,
final GlobalShortcutRegister shorcutReg) {
super(i18n, action, res, shorcutReg, i18n.t("New post"), i18n.t("Create a new blog post"), i18n.t("New post"),
- BlogsClientTool.TYPE_POST);
+ BlogsConstants.TYPE_POST);
}
}
Modified: trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,7 +19,11 @@
*/
package cc.kune.blogs.server;
-
+import static cc.kune.blogs.shared.BlogsConstants.NAME;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
import cc.kune.core.client.errors.ContainerNotPermittedException;
import cc.kune.core.client.errors.ContentNotPermittedException;
import cc.kune.core.server.content.ContainerManager;
@@ -40,17 +44,12 @@
import com.google.inject.Inject;
public class BlogServerTool implements ServerTool {
- public static final String NAME = "blogs";
- public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_BLOG = NAME + "." + "blog";
- public static final String TYPE_POST = NAME + "." + "post";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
public static final String ROOT_NAME = "blogs";
- private final ContentManager contentManager;
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
+ private final ContentManager contentManager;
private final I18nTranslationService i18n;
@Inject
@@ -62,85 +61,94 @@
this.i18n = translationService;
}
- public void checkTypesBeforeContainerCreation(String parentTypeId, String typeId) {
+ void checkContainerTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_BLOG)) {
+ // ok valid container
+ if ((typeId.equals(TYPE_BLOG) && parentTypeId.equals(TYPE_ROOT))) {
+ // ok
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
+ void checkContentTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_POST)) {
+ // ok valid content
+ if ((typeId.equals(TYPE_UPLOADEDFILE) && parentTypeId.equals(TYPE_BLOG))
+ || (typeId.equals(TYPE_POST) && parentTypeId.equals(TYPE_BLOG))) {
+ // ok
+ } else {
+ throw new ContentNotPermittedException();
+ }
+
+ } else {
+ throw new ContentNotPermittedException();
+ }
+ }
+
+ @Override
+ public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
checkContainerTypeId(parentTypeId, typeId);
}
- public void checkTypesBeforeContentCreation(String parentTypeId, String typeId) {
+ @Override
+ public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
checkContentTypeId(parentTypeId, typeId);
}
+ @Override
public String getName() {
return NAME;
}
+ @Override
public String getRootName() {
return ROOT_NAME;
}
+ @Override
public ServerToolTarget getTarget() {
return ServerToolTarget.forBoth;
}
- public Group initGroup(final User user, final Group group) {
+ @Override
+ public Group initGroup(final User user, final Group group, final Object... otherVars) {
final ToolConfiguration config = new ToolConfiguration();
final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
config.setRoot(rootFolder);
group.setToolConfig(NAME, config);
configurationManager.persist(config);
- I18nLanguage language = user.getLanguage();
+ final I18nLanguage language = user.getLanguage();
final Container blog = containerManager.createFolder(group, rootFolder, i18n.t("Blog sample"), language,
TYPE_BLOG);
- final Content content = contentManager.createContent(i18n.t("A post sample"), "", user, blog,
- BlogServerTool.TYPE_POST);
+ final Content content = contentManager.createContent(i18n.t("A post sample"),
+ i18n.t("This is only a post sample. You can edit it, rename the post and this blog"), user, blog,
+ TYPE_POST);
content.addAuthor(user);
content.setLanguage(language);
content.setTypeId(TYPE_POST);
content.setStatus(ContentStatus.publishedOnline);
- contentManager.save(user, content,
- i18n.t("This is only a post sample. You can edit it, rename the post and this blog"));
+ contentManager.save(user, content);
return group;
}
+ @Override
public void onCreateContainer(final Container container, final Container parent) {
}
+ @Override
public void onCreateContent(final Content content, final Container parent) {
}
+ @Override
@Inject
public void register(final ServerToolRegistry registry) {
registry.register(this);
}
-
- void checkContainerTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_BLOG)) {
- // ok valid container
- if ((typeId.equals(TYPE_BLOG) && parentTypeId.equals(TYPE_ROOT))) {
- // ok
- } else {
- throw new ContainerNotPermittedException();
- }
- } else {
- throw new ContainerNotPermittedException();
- }
- }
-
- void checkContentTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_POST)) {
- // ok valid content
- if ((typeId.equals(TYPE_UPLOADEDFILE) && parentTypeId.equals(TYPE_BLOG))
- || (typeId.equals(TYPE_POST) && parentTypeId.equals(TYPE_BLOG))) {
- // ok
- } else {
- throw new ContentNotPermittedException();
- }
-
- } else {
- throw new ContentNotPermittedException();
- }
- }
}
Added: trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java (rev 0)
+++ trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -0,0 +1,15 @@
+package cc.kune.blogs.shared;
+
+import cc.kune.core.shared.ToolConstants;
+
+public final class BlogsConstants {
+
+ public static final String NAME = "blogs";
+ public static final String TYPE_BLOG = NAME + "." + "blog";
+ public static final String TYPE_POST = NAME + "." + "post";
+ public static final String TYPE_ROOT = NAME + "." + "root";
+ public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
+
+ private BlogsConstants() {
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/blogs/shared/BlogsConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -54,7 +54,7 @@
putValue(Action.NAME, i18n.t("Group's public room"));
putValue(Action.SHORT_DESCRIPTION, i18n.t("Enter to this group public chat room"));
putValue(Action.SMALL_ICON, res.groupChat());
- setInviteMembers(false);
+ setInviteMembersImpl(false);
}
@Override
@@ -103,6 +103,10 @@
}
public void setInviteMembers(final boolean inviteMembers) {
+ setInviteMembersImpl(inviteMembers);
+ }
+
+ private void setInviteMembersImpl(final boolean inviteMembers) {
this.inviteMembers = inviteMembers;
}
Modified: trunk/src/main/java/cc/kune/chat/client/resources/ChatResources.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/resources/ChatResources.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/chat/client/resources/ChatResources.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -87,7 +87,7 @@
ImageResource unavailable();
@Source("user_add.png")
- ImageResource user_add();
+ ImageResource userAdd();
@Source("xa.png")
ImageResource xa();
Modified: trunk/src/main/java/cc/kune/common/client/utils/Pair.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/Pair.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/common/client/utils/Pair.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,7 +19,7 @@
* @param <L>
* @param <R>
*/
-public class Pair<L, R> {
+public final class Pair<L, R> {
public static <L, R> Pair<L, R> create(final L l, final R r) {
return new Pair<L, R>(l, r);
}
Deleted: trunk/src/main/java/cc/kune/core/Core.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/Core.gwt.xml 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/Core.gwt.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
-<module rename-to="ws">
- <!-- source / public / etc ==================================== -->
- <!-- excluding test sources for this module workaround for open issue 4454
- see http://code.google.com/p/google-web-toolkit/issues/detail?id=4454 -->
- <source path='client'
- excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java" />
- <source path="shared" />
- <public path="public" />
- <!-- Dependencies ============================================= -->
- <inherits name="com.google.gwt.user.User" />
- <inherits name="cc.kune.gspace.GSpace" />
- <inherits name="cc.kune.msgs.KuneMsgs" />
- <inherits name="cc.kune.common.KuneCommon" />
- <inherits name="com.extjs.gxt.ui.GXT" />
-<!-- <inherits name="com.jhickman.web.gwt.gxtuibinder.GxtUiBinder" />-->
- <inherits name="com.calclab.suco.Suco" />
- <inherits name='com.gwtplatform.mvp.Mvp' />
- <!-- Styles =================================================== -->
- <!-- <inherits name="com.google.gwt.user.theme.standard.Standard" /> -->
-</module>
\ No newline at end of file
Copied: trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml (from rev 1320, trunk/src/main/java/cc/kune/core/Core.gwt.xml)
===================================================================
--- trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml (rev 0)
+++ trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
+<module rename-to="ws">
+ <!-- source / public / etc ==================================== -->
+ <!-- excluding test sources for this module workaround for open issue 4454
+ see http://code.google.com/p/google-web-toolkit/issues/detail?id=4454 -->
+ <source path='client'
+ excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java" />
+ <source path="shared" />
+ <public path="public" />
+ <!-- Dependencies ============================================= -->
+ <inherits name="com.google.gwt.user.User" />
+ <inherits name="cc.kune.gspace.GSpace" />
+ <inherits name="cc.kune.msgs.KuneMsgs" />
+ <inherits name="cc.kune.common.KuneCommon" />
+ <inherits name="com.extjs.gxt.ui.GXT" />
+<!-- <inherits name="com.jhickman.web.gwt.gxtuibinder.GxtUiBinder" />-->
+ <inherits name="com.calclab.suco.Suco" />
+ <inherits name='com.gwtplatform.mvp.Mvp' />
+ <!-- Styles =================================================== -->
+ <!-- <inherits name="com.google.gwt.user.theme.standard.Standard" /> -->
+</module>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -89,7 +89,8 @@
}
@Override
- public void setEditableWaveContent(final WaveRef waveRef, final boolean isNewWave) {
+ public void setEditableWaveContent(final WaveRef waveRef, final boolean isNewWave) { // NOPMD by vjrj on 27/04/11 8:40
+ // FIXME
}
// public void setWave(final String waveId, final Listener0 onLoaded) {
Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -31,13 +31,12 @@
interface AbstractSNPanelUiBinder extends UiBinder<Widget, AbstractSNPanel> {
}
- private static final String CATEG_HEIGHT = "80px";
-
+ private final static int AVATARLABELMAXSIZE = 4;
+ private final static int AVATARSIZE = 22;
+ private final static String CATEG_HEIGHT = "80px";
private static AbstractSNPanelUiBinder uiBinder = GWT.create(AbstractSNPanelUiBinder.class);
- protected final ActionSimplePanel actions;
- int AVATARLABELMAXSIZE = 4;
- int AVATARSIZE = 22;
+ protected final ActionSimplePanel actions;
ActionFlowPanel bottomActionsToolbar;
@UiField
FlowPanel bottomPanel;
Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -17,7 +17,7 @@
@Inject
public GroupSNPanel(final I18nTranslationService i18n, final GuiProvider guiProvider, final GSpaceArmor armor) {
super(i18n, guiProvider, armor);
- setVisible(false);
+ setVisibleImpl(false);
mainTitle.setText(i18n.t("Group members"));
Tooltip.to(mainTitle, i18n.t("People and groups collaborating in this group"));
firstCategoryLabel.setText(i18n.t("Admins"));
@@ -83,6 +83,10 @@
@Override
public void setVisible(final boolean visible) {
+ setVisibleImpl(visible);
+ }
+
+ private void setVisibleImpl(final boolean visible) {
mainPanel.setVisible(visible);
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -18,7 +18,7 @@
@Inject
public UserSNPanel(final I18nTranslationService i18n, final GuiProvider guiProvider, final GSpaceArmor armor) {
super(i18n, guiProvider, armor);
- setVisible(false);
+ setVisibleImpl(false);
mainTitle.setText(i18n.t("His/her network:"));
mainTitle.setTitle(i18n.t("This user buddies and groups where participes"));
firstCategoryLabel.setText(i18n.t("Buddies"));
@@ -76,6 +76,10 @@
@Override
public void setVisible(final boolean visible) {
+ setVisibleImpl(visible);
+ }
+
+ private void setVisibleImpl(final boolean visible) {
mainPanel.setVisible(visible);
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -4,4 +4,8 @@
@SuppressWarnings("serial")
public abstract class AbstractSNActionsRegistry extends GuiActionDescCollection {
+
+ public AbstractSNActionsRegistry() {
+ super();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -8,4 +8,8 @@
@SuppressWarnings("serial")
public abstract class AbstractSNMembersActionsRegistry extends ArrayList<Provider<MenuItemDescriptor>> {
+
+ public AbstractSNMembersActionsRegistry() {
+ super();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/state/ContentCacheDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -42,7 +42,8 @@
this.server = server;
this.eventBus = eventBus;
this.cacheMap = new HashMap<StateToken, StateAbstractDTO>();
- useCache = true;
+ // Don't use while we don't check changes in the server
+ useCache = false;
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/ui/utils/ContentPosition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/utils/ContentPosition.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/client/ui/utils/ContentPosition.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -35,11 +35,11 @@
public static final String RIGHT = "right";
private static I18nTranslationService i18n;
private static Object[][] positionObjs;
- public static final String[][] positions = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
+ public static final String[][] POSITIONS = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
public synchronized static Object[][] getPositions() {
if (positionObjs == null) {
- final String[][] values = positions;
+ final String[][] values = POSITIONS;
positionObjs = new Object[values.length][1];
int i = 0;
for (final String[] position : values) {
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -21,7 +21,6 @@
import java.util.Date;
-
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.server.manager.Manager;
import cc.kune.core.server.manager.impl.SearchResult;
@@ -62,6 +61,8 @@
Content renameContent(User user, Long contentId, String newName) throws DefaultException;
+ Content save(User user, Content content);
+
Content save(User editor, Content content, String body);
SearchResult<Content> search(String search);
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -28,7 +28,10 @@
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.client.errors.NameInUseException;
@@ -42,6 +45,7 @@
import cc.kune.core.server.utils.FilenameUtils;
import cc.kune.core.shared.domain.ContentStatus;
import cc.kune.core.shared.domain.RateResult;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.I18nLanguage;
@@ -52,6 +56,8 @@
import cc.kune.domain.finders.ContentFinder;
import cc.kune.domain.finders.I18nLanguageFinder;
import cc.kune.domain.finders.UserFinder;
+import cc.kune.wave.server.KuneWaveManager;
+import cc.kune.wave.server.ParticipantUtils;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -63,14 +69,17 @@
private final ContainerFinder containerFinder;
private final ContentFinder contentFinder;
private final FinderService finder;
+ private final KuneWaveManager kuneWaveManager;
private final I18nLanguageFinder languageFinder;
+ private final ParticipantUtils participantUtils;
private final TagUserContentManager tagManager;
private final UserFinder userFinder;
@Inject
public ContentManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
final Provider<EntityManager> provider, final FinderService finder, final UserFinder userFinder,
- final I18nLanguageFinder languageFinder, final TagUserContentManager tagManager) {
+ final I18nLanguageFinder languageFinder, final TagUserContentManager tagManager,
+ final KuneWaveManager kuneWaveManager, final ParticipantUtils participantUtils) {
super(provider, Content.class);
this.contentFinder = contentFinder;
this.containerFinder = containerFinder;
@@ -78,6 +87,8 @@
this.userFinder = userFinder;
this.languageFinder = languageFinder;
this.tagManager = tagManager;
+ this.kuneWaveManager = kuneWaveManager;
+ this.participantUtils = participantUtils;
}
@Override
@@ -93,6 +104,7 @@
@Override
public Content createContent(final String title, final String body, final User author, final Container container,
final String typeId) {
+ String contentBody;
FilenameUtils.checkBasicFilename(title);
final String newtitle = findInexistentTitle(container, title);
final Content newContent = new Content();
@@ -103,7 +115,14 @@
newContent.setContainer(container);
final Revision revision = new Revision(newContent);
revision.setTitle(newtitle);
- revision.setBody(body);
+ // Duplicate in StateServiceDefault
+ if ((typeId.equals(DocsConstants.TYPE_DOCUMENT)) || (typeId.equals(BlogsConstants.TYPE_POST))) {
+ final WaveRef waveRef = kuneWaveManager.createWave(title, body, participantUtils.of(author.getShortName()));
+ contentBody = JavaWaverefEncoder.encodeToUriPathSegment(waveRef);
+ } else {
+ contentBody = body;
+ }
+ revision.setBody(contentBody);
newContent.addRevision(revision);
return persist(newContent);
}
@@ -187,6 +206,11 @@
}
@Override
+ public Content save(final User editor, final Content content) {
+ return persist(content);
+ }
+
+ @Override
public Content save(final User editor, final Content content, final String body) {
final Revision revision = new Revision(content);
revision.setEditor(editor);
Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -5,8 +5,6 @@
import javax.persistence.NoResultException;
import org.waveprotocol.box.server.authentication.PasswordDigest;
-import org.waveprotocol.wave.model.waveref.WaveRef;
-import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
import cc.kune.core.client.errors.UserMustBeLoggedException;
import cc.kune.core.server.content.ContentManager;
@@ -83,17 +81,15 @@
final License defaultLicense = licenseManager.findByShortName(defaultLicenseId);
final Group siteGroup = new Group(siteShortName, siteName, defaultLicense, GroupType.PROJECT);
- groupManager.createGroup(siteGroup, user);
+ groupManager.createGroup(siteGroup, user, ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName));
+ final Content defaultContent = siteGroup.getDefaultContent();
+ contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
+ contentManager.save(user, defaultContent);
+
userManager.reIndex();
groupManager.reIndex();
- final Content defaultContent = siteGroup.getDefaultContent();
- final WaveRef waveId = kuneWaveManager.createWave(
- ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName), user.getShortName());
- contentManager.save(user, defaultContent, JavaWaverefEncoder.encodeToUriPathSegment(waveId));
-
- contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
}
private void createLicenses() {
Modified: trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -21,7 +21,6 @@
import java.util.List;
-
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.EmailAddressInUseException;
import cc.kune.core.client.errors.GroupNameInUseException;
@@ -39,7 +38,8 @@
void clearGroupBackImage(Group group);
- Group createGroup(Group group, User user) throws GroupNameInUseException, UserMustBeLoggedException;
+ Group createGroup(Group group, User user, String publicDescrip) throws GroupNameInUseException,
+ UserMustBeLoggedException;
Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,6 +1,6 @@
package cc.kune.core.server.manager.impl;
-public class ContentConstants {
+public final class ContentConstants {
public static final String INITIAL_CONTENT = "<span style=\"font-weight: bold;\">Welcome to [%s]</span><br/>"
+ " <br/>" + " This site is powered by <a target=\"_blank\""
@@ -167,6 +167,8 @@
+ " the ones others shared with you. You can use the search box to"
+ " search through all your waves, using specific keywords.<br/>";
+ public static final String WELCOME_WAVE_CONTENT_TITLE = "Welcome to [%s]";
+
private ContentConstants() {
}
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -46,6 +46,7 @@
import cc.kune.core.shared.domain.AdmissionType;
import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.dto.GroupType;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.AccessLists;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -65,6 +66,7 @@
public class GroupManagerDefault extends DefaultManager<Group, Long> implements GroupManager {
private final GroupFinder finder;
+ private final I18nTranslationService i18n;
private final KuneProperties kuneProperties;
private final LicenseFinder licenseFinder;
private final LicenseManager licenseManager;
@@ -77,7 +79,7 @@
public GroupManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder,
final UserFinder userFinder, final KuneProperties kuneProperties, final DatabaseProperties properties,
final ServerToolRegistry registry, final LicenseManager licenseManager, final LicenseFinder licenseFinder,
- final ServerToolRegistry serverToolRegistry) {
+ final ServerToolRegistry serverToolRegistry, final I18nTranslationService i18n) {
super(provider, Group.class);
this.finder = finder;
this.userFinder = userFinder;
@@ -87,6 +89,7 @@
this.licenseManager = licenseManager;
this.licenseFinder = licenseFinder;
this.serverToolRegistry = serverToolRegistry;
+ this.i18n = i18n;
}
@Override
@@ -110,8 +113,8 @@
}
@Override
- public Group createGroup(final Group group, final User user) throws GroupNameInUseException,
- UserMustBeLoggedException {
+ public Group createGroup(final Group group, final User user, final String publicDescrip)
+ throws GroupNameInUseException, UserMustBeLoggedException {
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
if (User.isKnownUser(user)) {
if (group.getGroupType().equals(GroupType.COMMUNITY)) {
@@ -128,7 +131,8 @@
group.setDefaultLicense(license);
group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
initSocialNetwork(group, user.getUserGroup());
- initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys());
+ final String title = i18n.t("About [%s]", group.getLongName());
+ initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys(), title, publicDescrip);
return group;
} else {
throw new UserMustBeLoggedException();
@@ -160,9 +164,12 @@
userGroup.setDefaultContent(null);
user.setUserGroup(userGroup);
initSocialNetwork(userGroup, userGroup);
+
+ final String title = i18n.t("[%s] Bio", user.getName());
+ final String body = "<h1>" + title + "</h1>" + i18n.t("This user has not written its biography yet");
try {
initGroup(user, userGroup, wantPersonalHomepage ? serverToolRegistry.getToolsForUserKeys()
- : ServerToolRegistry.emptyToolList);
+ : ServerToolRegistry.emptyToolList, title, body);
super.persist(user, User.class);
} catch (final PersistenceException e) {
if (e.getCause() instanceof ConstraintViolationException) {
@@ -204,8 +211,8 @@
return findByShortName(shortName);
}
- private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable)
- throws GroupNameInUseException {
+ private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable,
+ final Object... vars) throws GroupNameInUseException {
try {
persist(group);
} catch (final IllegalStateException e) {
@@ -218,7 +225,7 @@
}
for (final ServerTool tool : registry.all()) {
if (toolsToEnable.contains(tool.getName())) {
- tool.initGroup(user, group);
+ tool.initGroup(user, group, vars);
}
}
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -137,8 +137,11 @@
final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(),
passwdDigest.getSalt(), language, country, tz);
kuneWaveManager.createWave(
+ ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]",
+ databaseProperties.getDefaultSiteName()),
ContentConstants.WELCOME_WAVE_CONTENT.replaceAll("\\[%s\\]",
- databaseProperties.getDefaultSiteName()), databaseProperties.getAdminShortName(), shortName);
+ databaseProperties.getDefaultSiteName()),
+ participantUtils.of(databaseProperties.getAdminShortName()), participantUtils.of(shortName));
return user;
} catch (final RuntimeException e) {
try {
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -23,9 +23,6 @@
import javax.persistence.NoResultException;
-import org.waveprotocol.wave.model.waveref.WaveRef;
-import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
-
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.ContentNotFoundException;
import cc.kune.core.client.errors.DefaultException;
@@ -70,7 +67,6 @@
import cc.kune.domain.Content;
import cc.kune.domain.Group;
import cc.kune.domain.User;
-import cc.kune.wave.server.KuneWaveManager;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -86,7 +82,6 @@
private final CreationService creationService;
private final FinderService finderService;
private final GroupManager groupManager;
- private final KuneWaveManager kuneWaveManager;
private final Mapper mapper;
private final AccessRightsService rightsService;
private final StateService stateService;
@@ -100,7 +95,7 @@
final StateService stateService, final CreationService creationService, final GroupManager groupManager,
final XmppManager xmppManager, final ContentManager contentManager,
final ContainerManager containerManager, final TagUserContentManager tagManager,
- final CommentManager commentManager, final Mapper mapper, final KuneWaveManager kuneWaveManager) {
+ final CommentManager commentManager, final Mapper mapper) {
this.finderService = finderService;
this.userSessionProvider = userSessionProvider;
this.accessService = accessService;
@@ -114,7 +109,6 @@
this.tagManager = tagManager;
this.commentManager = commentManager;
this.mapper = mapper;
- this.kuneWaveManager = kuneWaveManager;
}
@Override
@@ -158,9 +152,7 @@
@Transactional
public StateContentDTO addContent(final String userHash, final StateToken parentToken, final String title,
final String typeId) throws DefaultException {
- final String body = "";
- final WaveRef waveRef = kuneWaveManager.createWave(body, getCurrentUser().getShortName());
- return createContent(parentToken, title, typeId, JavaWaverefEncoder.encodeToUriPathSegment(waveRef));
+ return createContent(parentToken, title, typeId);
}
@Override
@@ -207,11 +199,11 @@
return null;
}
- private StateContentDTO createContent(final StateToken parentToken, final String title, final String typeId,
- final String body) {
+ private StateContentDTO createContent(final StateToken parentToken, final String title, final String typeId) {
final User user = getCurrentUser();
final Container container = accessService.accessToContainer(ContentUtils.parseId(parentToken.getFolder()),
user, AccessRol.Editor);
+ final String body = "";
final Content addedContent = creationService.createContent(title, body, user, container, typeId);
return getState(user, addedContent);
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,9 +19,6 @@
*/
package cc.kune.core.server.rpc;
-import org.waveprotocol.wave.model.waveref.WaveRef;
-import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
-
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.GroupService;
import cc.kune.core.server.UserSession;
@@ -108,10 +105,9 @@
final String tags, final String[] enabledTools) throws DefaultException {
final User user = getUserLogged();
final Group group = mapper.map(groupDTO, Group.class);
- final Group newGroup = groupManager.createGroup(group, user);
- final WaveRef waveId = kuneWaveManager.createWave("<h1>" + i18n.t("About [%s]", groupDTO.getLongName())
- + "</h1>" + publicDesc, user.getShortName());
- contentManager.save(user, newGroup.getDefaultContent(), JavaWaverefEncoder.encodeToUriPathSegment(waveId));
+ final Group newGroup = groupManager.createGroup(group, user, publicDesc);
+ // This is necessary?
+ contentManager.save(user, newGroup.getDefaultContent());
// contentManager.setTags(user, defContentId, tags);
return newGroup.getDefaultContent().getStateToken();
};
Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -25,8 +25,6 @@
import org.json.JSONObject;
import org.waveprotocol.box.server.CoreSettings;
import org.waveprotocol.box.server.authentication.SessionManager;
-import org.waveprotocol.wave.model.waveref.WaveRef;
-import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
@@ -53,7 +51,6 @@
import cc.kune.domain.Group;
import cc.kune.domain.User;
import cc.kune.wave.server.CustomWaveClientServlet;
-import cc.kune.wave.server.KuneWaveManager;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -67,7 +64,6 @@
private final ContentManager contentManager;
private final GroupManager groupManager;
private final I18nTranslationService i18n;
- private final KuneWaveManager kuneWaveManager;
private final Mapper mapper;
private final Provider<SessionService> sessionServiceProvider;
private final UserInfoService userInfoService;
@@ -83,8 +79,7 @@
@Named(CoreSettings.USE_SOCKETIO) final Boolean useSocketIO, final GroupManager groupManager,
final UserInfoService userInfoService, final Mapper mapper, final SessionManager waveSessionManager,
final CustomWaveClientServlet waveClientServlet, final I18nTranslationService i18n,
- final KuneWaveManager kuneWaveManager, final ContentManager contentManager) {
-
+ final ContentManager contentManager) {
this.sessionServiceProvider = sessionServiceProvider;
this.userSessionProvider = userSessionProvider;
this.userManager = userManager;
@@ -95,7 +90,6 @@
this.waveSessionManager = waveSessionManager;
this.waveClientServlet = waveClientServlet;
this.i18n = i18n;
- this.kuneWaveManager = kuneWaveManager;
this.contentManager = contentManager;
}
@@ -106,9 +100,9 @@
userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
userDTO.getTimezone().getId());
final Group userGroup = groupManager.createUserGroup(user, wantPersonalHomepage);
- final WaveRef waveId = kuneWaveManager.createWave("<h1>" + i18n.t("[%s] Bio", userDTO.getName()) + "</h1>"
- + i18n.t("This user has not written its biography yet"), user.getShortName());
- contentManager.save(user, userGroup.getDefaultContent(), JavaWaverefEncoder.encodeToUriPathSegment(waveId));
+ // Is this necessary? try to remove (used when we were setting the def
+ // content
+ contentManager.save(user, userGroup.getDefaultContent());
}
@Override
Modified: trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,9 @@
*/
package cc.kune.core.server.state;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+
import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
@@ -29,7 +32,6 @@
import cc.kune.core.server.manager.SocialNetworkManager;
import cc.kune.core.server.manager.TagUserContentManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.docs.server.DocumentServerTool;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -103,10 +105,11 @@
state.setVersion(content.getVersion());
final char[] text = revision.getBody();
final String textBody = text == null ? null : new String(text);
- if (typeId.equals(DocumentServerTool.TYPE_WAVE)) {
+ if (typeId.equals(TYPE_DOCUMENT) || (typeId.equals(TYPE_POST))) {
state.setWaveRef(textBody);
try {
- state.setContent(kuneWaveManager.fetchWavelet(JavaWaverefEncoder.decodeWaveRefFromPath(textBody)).getRootBlip().getContent());
+ state.setContent(kuneWaveManager.fetchWavelet(JavaWaverefEncoder.decodeWaveRefFromPath(textBody),
+ content.getAuthors().get(0).getShortName()).getRootBlip().getContent());
} catch (final InvalidWaveRefException e) {
throw new DefaultException("Error retriving Wave");
}
Modified: trunk/src/main/java/cc/kune/core/server/tool/ServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/core/server/tool/ServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,7 +19,6 @@
*/
package cc.kune.core.server.tool;
-
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -33,10 +32,6 @@
*/
public interface ServerTool {
- /* Same constant in client */
- public static final String UPLOADEDFILE_SUFFIX = "uploaded";
- public static final String WAVE_SUFFIX = "wave";
-
void checkTypesBeforeContainerCreation(String parentTypeId, String typeId);
void checkTypesBeforeContentCreation(String parentTypeId, String typeId);
@@ -47,7 +42,7 @@
ServerToolTarget getTarget();
- Group initGroup(User user, Group group);
+ Group initGroup(User user, Group group, Object... vars);
void onCreateContainer(Container container, Container parent);
Added: trunk/src/main/java/cc/kune/core/shared/ToolConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/ToolConstants.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/shared/ToolConstants.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -0,0 +1,13 @@
+package cc.kune.core.shared;
+
+public final class ToolConstants {
+
+ public static final String UPLOADEDFILE_SUFFIX = "uploaded";
+ @Deprecated
+ public static final String WAVE_SUFFIX = "wave";
+
+ private ToolConstants() {
+
+ }
+
+}
Property changes on: trunk/src/main/java/cc/kune/core/shared/ToolConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/docs/KuneDocs.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/docs/KuneDocs.gwt.xml 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/KuneDocs.gwt.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,5 +1,6 @@
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd">
<module>
- <inherits name="cc.kune.core.Core" />
- <source path="client" />
+ <inherits name="cc.kune.core.KuneCore" />
+ <source path="client" />
+ <source path="shared" />
</module>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,11 @@
*/
package cc.kune.docs.client;
+import static cc.kune.docs.shared.DocsConstants.NAME;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.resources.nav.NavResources;
@@ -28,12 +33,7 @@
import com.google.inject.Inject;
public class DocsClientTool extends FoldableAbstractClientTool {
- public static final String NAME = "docs";
- public static final String TYPE_DOCUMENT = NAME + "." + "doc";
- public static final String TYPE_FOLDER = NAME + "." + "folder";
- public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
- public static final String TYPE_WAVE = NAME + "." + FoldableAbstractClientTool.WAVE_SUFFIX;
+
private final NavResources navResources;
@Inject
@@ -63,7 +63,6 @@
private void registerIcons() {
registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
registerContentTypeIcon(TYPE_DOCUMENT, navResources.page());
- registerContentTypeIcon(TYPE_WAVE, navResources.page());
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
}
Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,11 +19,10 @@
\*/
package cc.kune.docs.client.actions;
-import static cc.kune.docs.client.DocsClientTool.TYPE_DOCUMENT;
-import static cc.kune.docs.client.DocsClientTool.TYPE_FOLDER;
-import static cc.kune.docs.client.DocsClientTool.TYPE_ROOT;
-import static cc.kune.docs.client.DocsClientTool.TYPE_UPLOADEDFILE;
-import static cc.kune.docs.client.DocsClientTool.TYPE_WAVE;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.resources.CoreResources;
@@ -40,7 +39,7 @@
final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
final String[] containersNoRoot = { TYPE_FOLDER };
- final String[] contents = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE, TYPE_WAVE };
+ final String[] contents = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
@Inject
Modified: trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -3,7 +3,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.docs.client.DocsClientTool;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.actions.NewContentBtn;
import com.google.inject.Inject;
@@ -15,7 +15,7 @@
final GlobalShortcutRegister shorcutReg) {
super(i18n, action, res, shorcutReg, i18n.t("New document"), i18n.t("Create a New Document here. "
+ "This document will be a new 'Page' in the public web if you publish it"), i18n.t("New document"),
- DocsClientTool.TYPE_WAVE);
+ DocsConstants.TYPE_DOCUMENT);
}
}
Modified: trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -2,7 +2,7 @@
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.docs.client.DocsClientTool;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.actions.NewContainerBtn;
import com.google.inject.Inject;
@@ -13,7 +13,7 @@
public NewFolderBtn(final I18nTranslationService i18n, final NewContainerAction action, final NavResources res) {
super(i18n, action, res, i18n.t("New folder"),
i18n.t("Create a new folder here. A folder will be a 'section' in the public web"),
- i18n.t("New folder"), DocsClientTool.TYPE_FOLDER);
+ i18n.t("New folder"), DocsConstants.TYPE_FOLDER);
}
}
Modified: trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,13 @@
*/
package cc.kune.docs.server;
+import static cc.kune.docs.shared.DocsConstants.NAME;
+import static cc.kune.docs.shared.DocsConstants.ROOT_NAME;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
+
import java.util.Date;
import cc.kune.core.client.errors.ContainerNotPermittedException;
@@ -31,6 +38,7 @@
import cc.kune.core.server.tool.ServerToolTarget;
import cc.kune.core.shared.domain.ContentStatus;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -40,14 +48,6 @@
import com.google.inject.Inject;
public class DocumentServerTool implements ServerTool {
- public static final String NAME = "docs";
- public static final String ROOT_NAME = "documents";
- public static final String TYPE_DOCUMENT = NAME + "." + "doc";
- public static final String TYPE_FOLDER = NAME + "." + "folder";
- public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
- public static final String TYPE_WAVE = NAME + "." + ServerTool.WAVE_SUFFIX;
-
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
private final ContentManager contentManager;
@@ -76,10 +76,9 @@
}
void checkContentTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_WAVE)) {
+ if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE)) {
// ok valid content
if ((typeId.equals(TYPE_DOCUMENT) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))
- || (typeId.equals(TYPE_WAVE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))
|| (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
// ok
} else {
@@ -117,18 +116,18 @@
}
@Override
- public Group initGroup(final User user, final Group group) {
+ public Group initGroup(final User user, final Group group, final Object... otherVars) {
final ToolConfiguration config = new ToolConfiguration();
final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
config.setRoot(rootFolder);
group.setToolConfig(NAME, config);
configurationManager.persist(config);
- final String longName = group.getLongName();
- final Content content = contentManager.createContent(i18n.t("About [%s]", longName), "", user, rootFolder,
- DocumentServerTool.TYPE_WAVE);
+ final String title = (String) otherVars[0];
+ final String body = (String) otherVars[1];
+ final Content content = contentManager.createContent(title, body, user, rootFolder, DocsConstants.TYPE_DOCUMENT);
content.addAuthor(user);
content.setLanguage(user.getLanguage());
- content.setTypeId(TYPE_WAVE);
+ content.setTypeId(TYPE_DOCUMENT);
content.setStatus(ContentStatus.publishedOnline);
content.setPublishedOn(new Date());
group.setDefaultContent(content);
Added: trunk/src/main/java/cc/kune/docs/shared/DocsConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/shared/DocsConstants.java (rev 0)
+++ trunk/src/main/java/cc/kune/docs/shared/DocsConstants.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -0,0 +1,20 @@
+package cc.kune.docs.shared;
+
+import cc.kune.core.shared.ToolConstants;
+
+public final class DocsConstants {
+
+ public static final String NAME = "docs";
+ public static final String ROOT_NAME = "documents";
+ public static final String TYPE_DOCUMENT = NAME + "." + "doc";
+ public static final String TYPE_FOLDER = NAME + "." + "folder";
+ public static final String TYPE_ROOT = NAME + "." + "root";
+ public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
+
+ // @Deprecated
+ // public static final String TYPE_WAVE = NAME + "." +
+ // ToolConstants.WAVE_SUFFIX;
+
+ private DocsConstants() {
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/docs/shared/DocsConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ActionGroups.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ActionGroups.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ActionGroups.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -4,10 +4,10 @@
* A group of actions that must be grouped and showed in some perspective (on
* edit, etc)
*/
-public class ActionGroups {
- public static String EDIT = "edit";
- public static String MENUITEM = "menu-item";
- public static String VIEW = "view";
+public final class ActionGroups {
+ public final static String EDIT = "edit";
+ public final static String MENUITEM = "menu-item";
+ public final static String VIEW = "view";
private ActionGroups() {
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -2,16 +2,16 @@
import javax.annotation.Nonnull;
-import cc.kune.blogs.client.BlogsClientTool;
import cc.kune.blogs.client.actions.BlogsClientActions;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.core.shared.dto.HasContent;
import cc.kune.core.shared.dto.StateContentDTO;
-import cc.kune.docs.client.DocsClientTool;
import cc.kune.docs.client.actions.DocsClientActions;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.actions.ActionGroups;
import cc.kune.gspace.client.tool.ContentViewer;
import cc.kune.gspace.client.tool.ContentViewerSelector;
@@ -55,8 +55,8 @@
super(eventBus, view, proxy);
this.session = session;
this.actionsRegistry = actionsRegistry;
- viewerSelector.register(this, true, DocsClientTool.TYPE_WAVE);
- viewerSelector.register(this, true, BlogsClientTool.TYPE_POST);
+ viewerSelector.register(this, true, DocsConstants.TYPE_DOCUMENT);
+ viewerSelector.register(this, true, BlogsConstants.TYPE_POST);
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -23,12 +23,11 @@
public class FolderViewerAsFlowPanel extends AbstractFolderViewerPanel {
interface FolderViewerAsFlowPanelUiBinder extends UiBinder<Widget, FolderViewerAsFlowPanel> {
}
+ private static final int ICONLABELMAXSIZE = 20;
+ private static final int ICONSIZE = 100;
private static FolderViewerAsFlowPanelUiBinder uiBinder = GWT.create(FolderViewerAsFlowPanelUiBinder.class);
-
@UiField
FlowPanel flow;
- int ICONLABELMAXSIZE = 20;
- int ICONSIZE = 100;
@Inject
public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n) {
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -2,7 +2,7 @@
import javax.annotation.Nonnull;
-import cc.kune.blogs.client.BlogsClientTool;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
@@ -21,7 +21,7 @@
import cc.kune.core.shared.dto.HasContent;
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.docs.client.DocsClientTool;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.actions.ActionGroups;
import cc.kune.gspace.client.tool.ContentViewer;
import cc.kune.gspace.client.tool.ContentViewerSelector;
@@ -87,8 +87,8 @@
this.downloadUtilsProvider = downloadUtilsProvider;
this.capabilitiesRegistry = capabilitiesRegistry;
iconsRegistry = capabilitiesRegistry.getIconsRegistry();
- viewerSelector.register(this, true, DocsClientTool.TYPE_ROOT, DocsClientTool.TYPE_FOLDER);
- viewerSelector.register(this, true, BlogsClientTool.TYPE_ROOT, BlogsClientTool.TYPE_BLOG);
+ viewerSelector.register(this, true, DocsConstants.TYPE_ROOT, DocsConstants.TYPE_FOLDER);
+ viewerSelector.register(this, true, BlogsConstants.TYPE_ROOT, BlogsConstants.TYPE_BLOG);
useGenericImageIcon = false;
}
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -63,6 +63,7 @@
import org.waveprotocol.wave.model.waveref.WaveRef;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.sitebar.spaces.Space;
import cc.kune.core.client.sitebar.spaces.SpaceConfEvent;
import cc.kune.core.client.state.SiteTokens;
@@ -96,7 +97,7 @@
private static final Binder BINDER = GWT.create(Binder.class);
- static Log LOG = Log.get(WebClient.class);
+ static final Log LOG = Log.get(WebClient.class);
// Use of GWT logging is only intended for sending exception reports to the
// server, nothing else in the client should use java.util.logging.
// Please also see WebClientDemo.gwt.xml.
@@ -157,7 +158,7 @@
public void onCreateRequest(WaveCreationEvent event) {
LOG.info("WaveCreationEvent received");
if (channel == null) {
- throw new RuntimeException("Spaghetti attack. Create occured before login");
+ throw new DefaultException("Spaghetti attack. Create occured before login");
}
openWave(WaveRef.of(idGenerator.newWaveId()), true);
Modified: trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -95,7 +95,7 @@
* Try to create a user with the provided username and password. On error,
* returns a string containing an error message. On success, returns null.
*/
- public String tryCreateUser(String username, final PasswordDigest passwordDigest) {
+ public String tryCreateUser(String username, final PasswordDigest passwordDigest) { // NOPMD by vjrj on 27/04/11 8:36
final String message = null;
ParticipantId id = null;
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -1,13 +1,16 @@
package cc.kune.wave.server;
+import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.WaveRef;
import com.google.wave.api.Wavelet;
public interface KuneWaveManager {
- WaveRef createWave(String message, String... participants);
+ WaveRef createWave(String message, ParticipantId participants);
- Wavelet fetchWavelet(WaveRef waveRef);
+ WaveRef createWave(String title, String message, ParticipantId... participantsArray);
+ Wavelet fetchWavelet(WaveRef waveRef, String author);
+
}
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -5,6 +5,8 @@
import java.util.Map;
import java.util.Set;
+import javax.annotation.Nonnull;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.waveprotocol.box.server.CoreSettings;
@@ -40,6 +42,8 @@
public class KuneWaveManagerDefault implements KuneWaveManager {
public static final Log LOG = LogFactory.getLog(KuneWaveManagerDefault.class);
+ private static final String NO_TITLE = "";
+
private final ConversationUtil conversationUtil;
private final EventDataConverterManager converterManager;
private final String domain;
@@ -61,14 +65,20 @@
}
@Override
- public WaveRef createWave(final String message, final String... participantArray) {
+ public WaveRef createWave(final String message, final ParticipantId participant) {
+ return createWave(NO_TITLE, message, participant);
+ }
+
+ @Override
+ public WaveRef createWave(@Nonnull final String title, final String message,
+ @Nonnull final ParticipantId... participantsArray) {
String newWaveId = null;
String newWaveletId = null;
final Set<String> participants = new HashSet<String>();
- for (final String participant : participantArray) {
- participants.add(participantUtils.of(participant).toString());
+ for (final ParticipantId participant : participantsArray) {
+ participants.add(participant.toString());
}
- final ParticipantId user = participantUtils.of(participantArray[0]);
+ final ParticipantId user = participantsArray[0];
final OperationQueue opQueue = new OperationQueue();
final Wavelet newWavelet = opQueue.createWavelet(domain, participants);
final Blip rootBlip = newWavelet.getRootBlip();
@@ -118,14 +128,14 @@
}
@Override
- public Wavelet fetchWavelet(final WaveRef waveName) {
+ public Wavelet fetchWavelet(final WaveRef waveName, final String author) {
Wavelet wavelet = null;
final OperationQueue opQueue = new OperationQueue();
opQueue.fetchWavelet(waveName.getWaveId(), waveName.getWaveletId());
final OperationContextImpl context = new OperationContextImpl(waveletProvider,
converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
final OperationRequest request = opQueue.getPendingOperations().get(0);
- OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.getSuperAdmin());
+ OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(author));
final String reqId = request.getId();
final JsonRpcResponse response = context.getResponse(reqId);
if (response != null) {
Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -21,7 +21,7 @@
public ParticipantUtils(@Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain,
final DatabaseProperties databaseProperties) throws InvalidParticipantAddress {
this.domain = domain;
- superAdmin = of(databaseProperties.getAdminShortName());
+ superAdmin = ofImpl(databaseProperties.getAdminShortName());
}
public ParticipantId getSuperAdmin() {
@@ -29,6 +29,10 @@
}
public ParticipantId of(final String username) {
+ return ofImpl(username);
+ }
+
+ private ParticipantId ofImpl(final String username) {
try {
if (username.contains(ParticipantId.DOMAIN_PREFIX)) {
return ParticipantId.of(username);
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -36,11 +36,11 @@
import com.google.inject.Inject;
public class ChatServerTool implements ServerTool {
+ public static final String NAME = "chats";
+ public static final String ROOT_NAME = "chat rooms";
+ public static final String TYPE_CHAT = ChatClientTool.TYPE_CHAT;
+ public static final String TYPE_ROOM = ChatClientTool.TYPE_ROOM;
public static final String TYPE_ROOT = ChatClientTool.TYPE_ROOT;
- public static final String TYPE_ROOM = ChatClientTool.TYPE_ROOM;
- public static final String TYPE_CHAT = ChatClientTool.TYPE_CHAT;
- public static final String ROOT_NAME = "chat rooms";
- public static final String NAME = "chats";
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
@@ -50,10 +50,23 @@
this.containerManager = containerManager;
}
+ private void checkContainerTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_ROOM)) {
+ if (!parentTypeId.equals(TYPE_ROOT)) {
+ throw new ContainerNotPermittedException();
+ }
+ // ok valid container
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
+ @Override
public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
checkContainerTypeId(parentTypeId, typeId);
}
+ @Override
public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
if (!parentTypeId.equals(TYPE_ROOM)) {
throw new ContainerNotPermittedException();
@@ -61,19 +74,23 @@
// in the future chat history checks
}
+ @Override
public String getName() {
return NAME;
}
+ @Override
public String getRootName() {
return ROOT_NAME;
}
+ @Override
public ServerToolTarget getTarget() {
return ServerToolTarget.forGroups;
}
- public Group initGroup(final User user, final Group group) {
+ @Override
+ public Group initGroup(final User user, final Group group, final Object... otherVars) {
final ToolConfiguration config = new ToolConfiguration();
final Container container = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
config.setRoot(container);
@@ -82,26 +99,18 @@
return group;
}
+ @Override
public void onCreateContainer(final Container container, final Container parent) {
}
+ @Override
public void onCreateContent(final Content content, final Container parent) {
}
+ @Override
@Inject
public void register(final ServerToolRegistry registry) {
registry.register(this);
}
- private void checkContainerTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_ROOM)) {
- if (!parentTypeId.equals(TYPE_ROOT)) {
- throw new ContainerNotPermittedException();
- }
- // ok valid container
- } else {
- throw new ContainerNotPermittedException();
- }
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,7 +19,6 @@
*/
package org.ourproject.kune.gallery.server;
-
import cc.kune.core.client.errors.ContainerNotPermittedException;
import cc.kune.core.client.errors.ContentNotPermittedException;
import cc.kune.core.server.content.ContainerManager;
@@ -27,6 +26,7 @@
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.ToolConstants;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
@@ -38,11 +38,11 @@
public class GalleryServerTool implements ServerTool {
public static final String NAME = "gallery";
+ public static final String ROOT_NAME = "gallery";
+ public static final String TYPE_ALBUM = NAME + "." + "album";
public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_ALBUM = NAME + "." + "album";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
- public static final String ROOT_NAME = "gallery";
+ public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
@@ -56,27 +56,59 @@
this.i18n = translationService;
}
- public void checkTypesBeforeContainerCreation(String parentTypeId, String typeId) {
+ void checkContainerTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_ALBUM)) {
+ // ok valid container
+ if ((typeId.equals(TYPE_ALBUM) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM)))) {
+ // ok
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
+ void checkContentTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_UPLOADEDFILE)) {
+ // ok valid content
+ if (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM))) {
+ // ok
+ } else {
+ throw new ContentNotPermittedException();
+ }
+ } else {
+ throw new ContentNotPermittedException();
+ }
+ }
+
+ @Override
+ public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
checkContainerTypeId(parentTypeId, typeId);
}
- public void checkTypesBeforeContentCreation(String parentTypeId, String typeId) {
+ @Override
+ public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
checkContentTypeId(parentTypeId, typeId);
}
+ @Override
public String getName() {
return NAME;
}
+ @Override
public String getRootName() {
return ROOT_NAME;
}
+ @Override
public ServerToolTarget getTarget() {
return ServerToolTarget.forBoth;
}
- public Group initGroup(final User user, final Group group) {
+ @Override
+ public Group initGroup(final User user, final Group group, final Object... otherVars) {
final ToolConfiguration config = new ToolConfiguration();
final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
config.setRoot(rootFolder);
@@ -87,40 +119,17 @@
return group;
}
+ @Override
public void onCreateContainer(final Container container, final Container parent) {
}
+ @Override
public void onCreateContent(final Content content, final Container parent) {
}
+ @Override
@Inject
public void register(final ServerToolRegistry registry) {
registry.register(this);
}
-
- void checkContainerTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_ALBUM)) {
- // ok valid container
- if ((typeId.equals(TYPE_ALBUM) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM)))) {
- // ok
- } else {
- throw new ContainerNotPermittedException();
- }
- } else {
- throw new ContainerNotPermittedException();
- }
- }
-
- void checkContentTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_UPLOADEDFILE)) {
- // ok valid content
- if (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM))) {
- // ok
- } else {
- throw new ContentNotPermittedException();
- }
- } else {
- throw new ContentNotPermittedException();
- }
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -21,7 +21,6 @@
import java.util.Date;
-
import cc.kune.core.client.errors.ContainerNotPermittedException;
import cc.kune.core.client.errors.ContentNotPermittedException;
import cc.kune.core.server.content.ContainerManager;
@@ -30,6 +29,7 @@
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.ToolConstants;
import cc.kune.core.shared.domain.ContentStatus;
import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -44,16 +44,16 @@
public class WikiServerTool implements ServerTool {
public static final String NAME = "wiki";
+ public static final String ROOT_NAME = "wiki";
+ public static final String TYPE_FOLDER = NAME + "." + "folder";
public static final String TYPE_ROOT = NAME + "." + "root";
- public static final String TYPE_FOLDER = NAME + "." + "folder";
+ public static final String TYPE_UPLOADEDFILE = NAME + "." + ToolConstants.UPLOADEDFILE_SUFFIX;
+
public static final String TYPE_WIKIPAGE = NAME + "." + "wikipage";
- public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
- public static final String ROOT_NAME = "wiki";
-
- private final ContentManager contentManager;
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
+ private final ContentManager contentManager;
private final I18nTranslationService i18n;
@Inject
@@ -65,27 +65,61 @@
this.i18n = translationService;
}
- public void checkTypesBeforeContainerCreation(String parentTypeId, String typeId) {
+ void checkContainerTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_FOLDER)) {
+ // ok valid container
+ if ((typeId.equals(TYPE_FOLDER) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
+ // ok
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
+ void checkContentTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_WIKIPAGE) || typeId.equals(TYPE_UPLOADEDFILE)) {
+ // ok valid content
+ final boolean parentIsFolderOrRoot = parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER);
+ if ((typeId.equals(TYPE_UPLOADEDFILE) && parentIsFolderOrRoot)
+ || (typeId.equals(TYPE_WIKIPAGE) && parentIsFolderOrRoot)) {
+ // ok
+ } else {
+ throw new ContentNotPermittedException();
+ }
+ } else {
+ throw new ContentNotPermittedException();
+ }
+ }
+
+ @Override
+ public void checkTypesBeforeContainerCreation(final String parentTypeId, final String typeId) {
checkContainerTypeId(parentTypeId, typeId);
}
- public void checkTypesBeforeContentCreation(String parentTypeId, String typeId) {
+ @Override
+ public void checkTypesBeforeContentCreation(final String parentTypeId, final String typeId) {
checkContentTypeId(parentTypeId, typeId);
}
+ @Override
public String getName() {
return NAME;
}
+ @Override
public String getRootName() {
return ROOT_NAME;
}
+ @Override
public ServerToolTarget getTarget() {
return ServerToolTarget.forBoth;
}
- public Group initGroup(final User user, final Group group) {
+ @Override
+ public Group initGroup(final User user, final Group group, final Object... otherVars) {
final ToolConfiguration config = new ToolConfiguration();
final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
setContainerWikiAcl(rootFolder);
@@ -103,50 +137,25 @@
return group;
}
+ @Override
public void onCreateContainer(final Container container, final Container parent) {
setContainerWikiAcl(container);
}
+ @Override
public void onCreateContent(final Content content, final Container parent) {
content.setStatus(ContentStatus.publishedOnline);
content.setPublishedOn(new Date());
}
+ @Override
@Inject
public void register(final ServerToolRegistry registry) {
registry.register(this);
}
- void checkContainerTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_FOLDER)) {
- // ok valid container
- if ((typeId.equals(TYPE_FOLDER) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
- // ok
- } else {
- throw new ContainerNotPermittedException();
- }
- } else {
- throw new ContainerNotPermittedException();
- }
- }
-
- void checkContentTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_WIKIPAGE) || typeId.equals(TYPE_UPLOADEDFILE)) {
- // ok valid content
- boolean parentIsFolderOrRoot = parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER);
- if ((typeId.equals(TYPE_UPLOADEDFILE) && parentIsFolderOrRoot)
- || (typeId.equals(TYPE_WIKIPAGE) && parentIsFolderOrRoot)) {
- // ok
- } else {
- throw new ContentNotPermittedException();
- }
- } else {
- throw new ContentNotPermittedException();
- }
- }
-
private void setContainerWikiAcl(final Container container) {
- AccessLists wikiAcl = new AccessLists();
+ final AccessLists wikiAcl = new AccessLists();
wikiAcl.getAdmins().setMode(GroupListMode.NORMAL);
wikiAcl.getAdmins().add(container.getOwner());
wikiAcl.getEditors().setMode(GroupListMode.EVERYONE);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,7 +19,7 @@
*/
package org.ourproject.kune.workspace.client.ctxnav;
-import static cc.kune.docs.client.DocsClientTool.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
import java.util.HashMap;
Modified: trunk/src/main/resources/db/liquibase_changelog.xml
===================================================================
--- trunk/src/main/resources/db/liquibase_changelog.xml 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/main/resources/db/liquibase_changelog.xml 2011-04-27 15:32:01 UTC (rev 1322)
@@ -125,5 +125,10 @@
encoding="utf8" stripComments="1" />
<rollback>DELETE FROM `ext_media_descriptors` WHERE id BETWEEN 1 AND 6;</rollback>
</changeSet>
-
+ <changeSet id="19" author="vjrj">
+ <comment>Wave id migration</comment>
+ <sqlFile path="src/main/resources/db/update-0015-waveid.sql"
+ encoding="utf8" stripComments="1" />
+ <rollback>SELECT * FROM globalize_countries;</rollback>
+ </changeSet>
</databaseChangeLog>
Modified: trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/blogs/server/BlogServerToolTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,15 +19,14 @@
*/
package cc.kune.blogs.server;
-import static cc.kune.blogs.server.BlogServerTool.TYPE_BLOG;
-import static cc.kune.blogs.server.BlogServerTool.TYPE_POST;
-import static cc.kune.blogs.server.BlogServerTool.TYPE_ROOT;
-import static cc.kune.blogs.server.BlogServerTool.TYPE_UPLOADEDFILE;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_BLOG;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_POST;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT;
+import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE;
import org.junit.Before;
import org.junit.Test;
-import cc.kune.blogs.server.BlogServerTool;
import cc.kune.core.client.errors.ContainerNotPermittedException;
import cc.kune.core.client.errors.ContentNotPermittedException;
Modified: trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,7 @@
*/
package cc.kune.core.server;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
import static org.junit.Assert.assertEquals;
import java.util.TimeZone;
@@ -33,7 +34,6 @@
import cc.kune.core.server.manager.I18nLanguageManager;
import cc.kune.core.server.manager.LicenseManager;
import cc.kune.core.server.manager.UserManager;
-import cc.kune.docs.server.DocumentServerTool;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.I18nCountry;
@@ -116,7 +116,7 @@
content.setLanguage(english);
contentManager.persist(content);
container = new Container();
- container.setTypeId(DocumentServerTool.TYPE_FOLDER);
+ container.setTypeId(TYPE_FOLDER);
containerManager.persist(container);
}
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.server.integration;
+import static cc.kune.docs.shared.DocsConstants.NAME;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -36,7 +38,6 @@
import cc.kune.core.server.manager.I18nLanguageManager;
import cc.kune.core.server.manager.I18nTranslationManager;
import cc.kune.core.server.manager.LicenseManager;
-import cc.kune.docs.server.DocumentServerTool;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -80,7 +81,7 @@
@Test
public void testDefaultDocumentContent() {
final Content content = defaultGroup.getDefaultContent();
- assertEquals(DocumentServerTool.TYPE_WAVE, content.getTypeId());
+ assertEquals(TYPE_DOCUMENT, content.getTypeId());
final Container rootDocFolder = content.getContainer();
assertEquals(true, rootDocFolder.isRoot());
}
@@ -95,7 +96,7 @@
@Test
public void testToolConfiguration() {
assertNotNull(defaultGroup);
- final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(DocumentServerTool.NAME);
+ final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(NAME);
assertNotNull(docToolConfig);
assertTrue(docToolConfig.isEnabled());
final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatServerTool.NAME);
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,7 @@
*/
package cc.kune.core.server.integration.content;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -38,8 +39,7 @@
import cc.kune.core.shared.dto.ContentSimpleDTO;
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.core.shared.dto.StateContentDTO;
-import cc.kune.docs.client.DocsClientTool;
-import cc.kune.docs.server.DocumentServerTool;
+import cc.kune.docs.shared.DocsConstants;
public class ContentServiceAddTest extends ContentServiceIntegrationTest {
@@ -54,7 +54,7 @@
public void noLoggedInShouldThrowIllegalAccess() throws ContentNotFoundException, Exception {
defaultContent = getSiteDefaultContent();
contentService.addContent(session.getHash(), defaultContent.getContainer().getStateToken(), "a name",
- DocumentServerTool.TYPE_DOCUMENT);
+ TYPE_DOCUMENT);
}
@Test
@@ -68,7 +68,7 @@
final String title = "New Content Title";
final StateContentDTO added = contentService.addContent(session.getHash(),
- defaultContent.getContainer().getStateToken(), title, DocumentServerTool.TYPE_DOCUMENT);
+ defaultContent.getContainer().getStateToken(), title, TYPE_DOCUMENT);
assertNotNull(added);
final List<ContentSimpleDTO> contents = added.getContainer().getContents();
assertEquals(title, added.getTitle());
@@ -93,7 +93,7 @@
final ContainerDTO parent = defaultContent.getContainer();
final String title = "folder name";
final StateContainerDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
- DocsClientTool.TYPE_FOLDER);
+ DocsConstants.TYPE_FOLDER);
assertNotNull(newState);
assertNotNull(newState.getGroupMembers());
assertNotNull(newState.getParticipation());
@@ -127,11 +127,11 @@
final ContainerDTO parent = defaultContent.getContainer();
final String title = "folder name";
final StateContainerDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
- DocsClientTool.TYPE_FOLDER);
+ DocsConstants.TYPE_FOLDER);
assertNotNull(newState);
final StateContainerDTO newState2 = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
- DocsClientTool.TYPE_FOLDER);
+ DocsConstants.TYPE_FOLDER);
assertNotNull(newState2);
final ContainerDTO parentAgain = getSiteDefaultContent().getContainer();
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,7 @@
*/
package cc.kune.core.server.integration.content;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -41,8 +42,7 @@
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.core.shared.dto.StateContentDTO;
import cc.kune.core.shared.dto.UserSimpleDTO;
-import cc.kune.docs.client.DocsClientTool;
-import cc.kune.docs.server.DocumentServerTool;
+import cc.kune.docs.shared.DocsConstants;
public class ContentServiceVariousTest extends ContentServiceIntegrationTest {
@@ -66,6 +66,24 @@
assertEquals(1, authors4.size());
}
+ private void checkResult(final TagCloudResult cloudResult) {
+ assertNotNull(cloudResult.getTagCountList());
+ final List<TagCount> summaryTags = cloudResult.getTagCountList();
+ assertEquals(3, summaryTags.size());
+
+ TagCount tagResult = summaryTags.get(0);
+ assertEquals("afoo2", tagResult.getName());
+ assertEquals(1, (long) tagResult.getCount());
+
+ tagResult = summaryTags.get(1);
+ assertEquals("bfoo", tagResult.getName());
+ assertEquals(1, (long) tagResult.getCount());
+
+ tagResult = summaryTags.get(2);
+ assertEquals("cfoa", tagResult.getName());
+ assertEquals(1, (long) tagResult.getCount());
+ }
+
@Test
public void contentRateAndRetrieve() throws Exception {
contentService.rateContent(getHash(), defaultContent.getStateToken(), 4.5);
@@ -102,7 +120,7 @@
final String oldTitle = "some title";
String newTitle = "folder new name";
final StateContainerDTO newState = contentService.addFolder(session.getHash(), defaultContent.getStateToken(),
- oldTitle, DocsClientTool.TYPE_FOLDER);
+ oldTitle, DocsConstants.TYPE_FOLDER);
final ContainerDTO newFolder = newState.getContainer();
@@ -188,7 +206,7 @@
defaultContent = getSiteDefaultContent();
final StateContainerDTO added = contentService.addContent(session.getHash(), defaultContent.getStateToken(),
- "New Content Title", DocumentServerTool.TYPE_DOCUMENT);
+ "New Content Title", TYPE_DOCUMENT);
assertNotNull(added);
final ContentSimpleDTO newDefContent = contentService.setAsDefaultContent(session.getHash(),
@@ -207,7 +225,7 @@
final String oldTitle = "some title";
String newTitle = "folder new name";
final StateContainerDTO newState = contentService.addFolder(session.getHash(), folder.getStateToken(),
- oldTitle, DocsClientTool.TYPE_FOLDER);
+ oldTitle, DocsConstants.TYPE_FOLDER);
final ContainerDTO newFolder = newState.getContainer();
@@ -225,22 +243,4 @@
assertEquals(newTitle, folderAgain.getContainer().getName());
}
- private void checkResult(final TagCloudResult cloudResult) {
- assertNotNull(cloudResult.getTagCountList());
- final List<TagCount> summaryTags = cloudResult.getTagCountList();
- assertEquals(3, summaryTags.size());
-
- TagCount tagResult = summaryTags.get(0);
- assertEquals("afoo2", tagResult.getName());
- assertEquals(1, (long) tagResult.getCount());
-
- tagResult = summaryTags.get(1);
- assertEquals("bfoo", tagResult.getName());
- assertEquals(1, (long) tagResult.getCount());
-
- tagResult = summaryTags.get(2);
- assertEquals("cfoa", tagResult.getName());
- assertEquals(1, (long) tagResult.getCount());
- }
-
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.server.manager;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
import static org.junit.Assert.assertEquals;
import org.junit.Ignore;
@@ -26,7 +28,6 @@
import cc.kune.core.server.PersistencePreLoadedDataTest;
import cc.kune.core.server.manager.impl.SearchResult;
-import cc.kune.docs.server.DocumentServerTool;
import cc.kune.domain.BasicMimeType;
import cc.kune.domain.Content;
@@ -37,14 +38,12 @@
private static final String TITLE = "title";
private void createContent() {
- final Content cnt = contentManager.createContent(TITLE, BODY, user, container,
- DocumentServerTool.TYPE_UPLOADEDFILE);
+ final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
persist(cnt);
}
private void createContentWithMimeAndCheck(final String mimetype) {
- final Content cnt = contentManager.createContent(TITLE, BODY, user, container,
- DocumentServerTool.TYPE_UPLOADEDFILE);
+ final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
cnt.setMimeType(new BasicMimeType(mimetype));
persist(cnt);
final Content newCnt = contentManager.find(cnt.getId());
@@ -113,8 +112,7 @@
*/
@Test
public void testUTF8Persist() {
- final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container,
- DocumentServerTool.TYPE_DOCUMENT);
+ final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container, TYPE_DOCUMENT);
final Content newCnt = contentManager.find(cnt.getId());
assertEquals("汉语/漢語", newCnt.getTitle());
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -42,10 +42,12 @@
public class GroupManagerTest extends PersistencePreLoadedDataTest {
+ private static final String PUBLIC_DESCRIP = "Some public descrip";
+
@Test
public void createdGroupShoudHaveValidSocialNetwork() throws Exception {
final Group group = new Group("short", "longName", defLicense, GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ groupManager.createGroup(group, user, PUBLIC_DESCRIP);
final SocialNetwork socialNetwork = group.getSocialNetwork();
final AccessLists lists = socialNetwork.getAccessLists();
assertTrue(lists.getAdmins().includes(user.getUserGroup()));
@@ -58,7 +60,7 @@
public void createGroup() throws Exception {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ groupManager.createGroup(group, user, PUBLIC_DESCRIP);
final Group otherGroup = groupManager.findByShortName("ysei");
assertEquals(group.getLongName(), otherGroup.getLongName());
@@ -70,7 +72,7 @@
public void createGroupAndSearch() throws Exception, ParseException {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ groupManager.createGroup(group, user, PUBLIC_DESCRIP);
groupManager.reIndex();
final SearchResult<Group> result = groupManager.search("ysei");
assertEquals(1, result.getSize());
@@ -82,12 +84,12 @@
public void createGroupWithExistingLongName() throws Exception {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ groupManager.createGroup(group, user, PUBLIC_DESCRIP);
final Group group2 = new Group("ysei2", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
group2.setDefaultLicense(defLicense);
- groupManager.createGroup(group2, user);
+ groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
rollbackTransaction();
}
@@ -96,11 +98,11 @@
public void createGroupWithExistingShortName() throws Exception {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ groupManager.createGroup(group, user, PUBLIC_DESCRIP);
final Group group2 = new Group("ysei", "Yellow Submarine Environmental Initiative 2", defLicense,
GroupType.PROJECT);
- groupManager.createGroup(group2, user);
+ groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
rollbackTransaction();
}
@@ -108,7 +110,7 @@
private void createTestGroup(final int number) throws Exception {
final Group g = new Group("ysei" + number, "Yellow Submarine Environmental Initiative " + number, defLicense,
GroupType.PROJECT);
- groupManager.createGroup(g, user);
+ groupManager.createGroup(g, user, PUBLIC_DESCRIP);
}
@Test(expected = EmailAddressInUseException.class)
Modified: trunk/src/test/java/cc/kune/docs/DocumentToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/docs/DocumentToolTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/docs/DocumentToolTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,20 +19,23 @@
*/
package cc.kune.docs;
+import static cc.kune.docs.shared.DocsConstants.NAME;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import cc.kune.docs.client.DocsClientTool;
-import cc.kune.docs.server.DocumentServerTool;
+import cc.kune.docs.shared.DocsConstants;
public class DocumentToolTest {
@Test
public void clientAndServerSync() {
- assertEquals(DocumentServerTool.NAME, DocsClientTool.NAME);
- assertEquals(DocumentServerTool.TYPE_ROOT, DocsClientTool.TYPE_ROOT);
- assertEquals(DocumentServerTool.TYPE_FOLDER, DocsClientTool.TYPE_FOLDER);
- assertEquals(DocumentServerTool.TYPE_DOCUMENT, DocsClientTool.TYPE_DOCUMENT);
+ assertEquals(NAME, DocsConstants.NAME);
+ assertEquals(TYPE_ROOT, DocsConstants.TYPE_ROOT);
+ assertEquals(TYPE_FOLDER, DocsConstants.TYPE_FOLDER);
+ assertEquals(TYPE_DOCUMENT, DocsConstants.TYPE_DOCUMENT);
}
}
Modified: trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,10 +19,10 @@
*/
package cc.kune.docs.server;
-import static cc.kune.docs.server.DocumentServerTool.TYPE_DOCUMENT;
-import static cc.kune.docs.server.DocumentServerTool.TYPE_FOLDER;
-import static cc.kune.docs.server.DocumentServerTool.TYPE_ROOT;
-import static cc.kune.docs.server.DocumentServerTool.TYPE_UPLOADEDFILE;
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
+import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -19,8 +19,11 @@
public class KuneWaveManagerDefaultTest extends IntegrationTest {
private static final String MESSAGE = "testing";
+ private static final String TITLE = "title";
@Inject
KuneWaveManagerDefault manager;
+ @Inject
+ ParticipantUtils participantUtils;
@Before
public void before() {
@@ -31,10 +34,20 @@
@Test
public void createWave() throws DefaultException, IOException {
doLogin();
- final WaveRef waveletName = manager.createWave(MESSAGE, getSiteAdminShortName());
+ final WaveRef waveletName = manager.createWave(MESSAGE, participantUtils.of(getSiteAdminShortName()));
assertNotNull(waveletName);
- final Wavelet fetchWavelet = manager.fetchWavelet(waveletName);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
assertNotNull(fetchWavelet);
assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
}
+
+ @Test
+ public void createWaveWithTitle() throws DefaultException, IOException {
+ doLogin();
+ final WaveRef waveletName = manager.createWave(TITLE, MESSAGE, participantUtils.of(getSiteAdminShortName()));
+ assertNotNull(waveletName);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java 2011-04-26 19:57:21 UTC (rev 1321)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java 2011-04-27 15:32:01 UTC (rev 1322)
@@ -30,14 +30,14 @@
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.docs.client.DocsClientTool;
+import cc.kune.docs.shared.DocsConstants;
public class FileUploaderPresenterTest {
private static final String SOMEUSER_HASH = "someuserHash";
private FileUploaderPresenter presenter;
+ private Session session;
private FileUploaderView view;
- private Session session;
@Before
public void before() {
@@ -53,7 +53,7 @@
Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1.1"));
assertTrue(presenter.checkFolderChange());
Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
}
@Test
@@ -61,7 +61,7 @@
Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
assertTrue(presenter.checkFolderChange());
Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
}
@Test
@@ -72,9 +72,9 @@
Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.2"));
assertTrue(presenter.checkFolderChange());
Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.2",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
}
@Test
@@ -85,9 +85,9 @@
Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.2"));
assertFalse(presenter.checkFolderChange());
Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
Mockito.verify(view, Mockito.never()).setUploadParams(SOMEUSER_HASH, "group.docs.2",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
}
@Test
@@ -97,6 +97,6 @@
Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
assertTrue(presenter.checkFolderChange());
Mockito.verify(view, Mockito.times(2)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
- DocsClientTool.TYPE_UPLOADEDFILE);
+ DocsConstants.TYPE_UPLOADEDFILE);
}
}
More information about the kune-commits
mailing list