[kune-commits] r1251 - in branches/wave-jetty-embed-guice: . src/main/java/cc/kune/core/client/errors src/main/java/cc/kune/core/client/sitebar src/main/java/cc/kune/core/client/state src/main/java/cc/kune/domain src/main/java/cc/kune/domain/finders src/main/java/cc/kune/wave/server src/main/java/org/ourproject/kune/app/server src/main/java/org/ourproject/kune/platf/client/actions/ui src/main/java/org/ourproject/kune/platf/client/shortcuts src/main/java/org/ourproject/kune/platf/client/ui/rte/basic src/main/java/org/ourproject/kune/platf/server src/main/java/org/ourproject/kune/platf/server/content src/main/java/org/ourproject/kune/platf/server/init src/main/java/org/ourproject/kune/platf/server/manager src/main/java/org/ourproject/kune/platf/server/manager/file src/main/java/org/ourproject/kune/platf/server/manager/impl src/main/java/org/ourproject/kune/platf/server/rpc src/main/java/org/ourproject/kune/rack src/main/java/org/ourproject/kune/rack/filters/rest src/main/java/org/ourproject/kune/workspace/client/hello src/main/resources/META-INF src/main/webapp/WEB-INF src/test/java/cc/kune src/test/java/cc/kune/domain src/test/java/cc/kune/domain/finders src/test/java/org/ourproject/kune/platf/integration src/test/java/org/ourproject/kune/platf/integration/content src/test/java/org/ourproject/kune/platf/integration/kuneservice src/test/java/org/ourproject/kune/platf/integration/socialnet src/test/java/org/ourproject/kune/platf/server src/test/java/org/ourproject/kune/platf/server/auth src/test/java/org/ourproject/kune/platf/server/finders src/test/java/org/ourproject/kune/platf/server/manager src/test/java/org/ourproject/kune/platf/server/manager/impl src/test/java/org/ourproject/kune/workspace/client/tool
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun Feb 13 12:00:55 CET 2011
Author: vjrj_
Date: 2011-02-13 12:00:54 +0100 (Sun, 13 Feb 2011)
New Revision: 1251
Added:
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContainerFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContentFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ExtMediaDescripFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/GroupFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nCountryFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nLanguageFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nTranslationFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/LicenseFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/RateFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagUserContentFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/UserFinder.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/JettyModule.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/FinderRegistry.java
branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/
branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/finders/
branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/finders/TagUserContentFinderTest.java
Modified:
branches/wave-jetty-embed-guice/.classpath
branches/wave-jetty-embed-guice/pom.xml
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/errors/SessionExpiredEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/GroupChangedEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/SocialNetworkChangedEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/StateChangedEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/ToolChangedEvent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Container.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Content.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/ExtMediaDescrip.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Group.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nCountry.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nLanguage.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nTranslation.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/License.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Rate.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Tag.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/TagUserContent.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/User.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/CustomServerRpcProvider.java
branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/WaveMain.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/OldGuiActionDescrip.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/LicenseManager.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/TagUserContentManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nCountryManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nLanguageManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/RateManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/TagManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/I18nRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/filters/rest/TransactionalServiceExecutor.java
branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
branches/wave-jetty-embed-guice/src/main/resources/META-INF/persistence.xml
branches/wave-jetty-embed-guice/src/main/webapp/WEB-INF/web.xml
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkMembersTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestConstants.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestHelper.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/GroupFinderTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/LicenseFinderTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/UserFinderTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/LicenseManagerTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagManagerTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagUserContentTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/impl/AbstractSocialNetworkManagerTest.java
branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java
Log:
wiab and kune in the same port
Modified: branches/wave-jetty-embed-guice/.classpath
===================================================================
--- branches/wave-jetty-embed-guice/.classpath 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/.classpath 2011-02-13 11:00:54 UTC (rev 1251)
@@ -33,10 +33,10 @@
<classpathentry kind="var" path="M2_REPO/freemarker/freemarker/2.3.8/freemarker-2.3.8.jar"/>
<classpathentry kind="var" path="M2_REPO/com/googlecode/gwt/inject/gin/r137/gin-r137.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava-gwt/r07/guava-gwt-r07.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/google/code/guice/guice/2.1-SNAPSHOT-r1160/guice-2.1-SNAPSHOT-r1160.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/google/inject/guice/2.0/guice-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/google/inject/guice/3.0-rc2/guice-3.0-rc2.jar" sourcepath="M2_REPO/com/google/inject/guice/3.0-rc2/guice-3.0-rc2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-assisted-inject/2.0/guice-assisted-inject-2.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/google/code/guice/guice-servlet/2.0.1/guice-servlet-2.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-persist/3.0-rc2/guice-persist-3.0-rc2.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-persist/3.0-rc2/guice-persist-3.0-rc2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-servlet/3.0-rc2/guice-servlet-3.0-rc2.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-servlet/3.0-rc2/guice-servlet-3.0-rc2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/jhickman/web/gwt/gwt-customuibinder/0.1/gwt-customuibinder-0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/adamtacy/gwt-fx/r464/gwt-fx-r464.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-gin/1.0-r137/gwt-gin-1.0-r137.jar"/>
@@ -105,7 +105,6 @@
<classpathentry kind="var" path="M2_REPO/org/jivesoftware/smackx/debugger/smackx-debugger/3.0.4/smackx-debugger-3.0.4.jar"/>
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar" sourcepath="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/wideplay/warp-persist/2.0-SNAPSHOT/warp-persist-2.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-custom/0.3.6/waveinabox-server-custom-0.3.6.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
Modified: branches/wave-jetty-embed-guice/pom.xml
===================================================================
--- branches/wave-jetty-embed-guice/pom.xml 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/pom.xml 2011-02-13 11:00:54 UTC (rev 1251)
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cc.kune</groupId>
<artifactId>kune</artifactId>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<version>0.0.7</version>
<name>kune</name>
<description> kune free/open/libre collaboration platform </description>
@@ -187,6 +187,10 @@
<url>http://google-web-toolkit.googlecode.com/svn/2.1.0/gwt/maven/</url>
<name>Google Web Toolkit Plugin Repository</name>
</pluginRepository>
+ <pluginRepository>
+ <id>onejar-maven-plugin.googlecode.com</id>
+ <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
+ </pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
@@ -202,9 +206,10 @@
</dependency>
<!-- guice -->
<dependency>
- <groupId>com.google.code.guice</groupId>
+ <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
- <version>2.1-SNAPSHOT-r1160</version>
+ <!-- <version>2.1-SNAPSHOT-r1160</version> -->
+ <version>3.0-rc2</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwt.inject</groupId>
@@ -212,45 +217,50 @@
<version>r137</version>
</dependency>
<dependency>
- <groupId>com.google.code.guice</groupId>
+ <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
- <version>2.0.1</version>
+ <version>3.0-rc2</version>
</dependency>
<dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-persist</artifactId>
+ <version>3.0-rc2</version>
+ </dependency>
+ <dependency>
<groupId>com.extjs</groupId>
<artifactId>gxt</artifactId>
<version>2.2.1</version>
- <scope>compile</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.cobogw.gwt</groupId>
<artifactId>cobogw</artifactId>
<version>1.3.1</version>
</dependency>
-<dependency>
- <groupId>com.gwtplatform</groupId>
- <artifactId>gwtp-all</artifactId>
- <version>0.5</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
-</dependency>
<dependency>
+ <groupId>com.gwtplatform</groupId>
+ <artifactId>gwtp-all</artifactId>
+ <version>0.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.adamtacy</groupId>
<artifactId>gwt-fx</artifactId>
<version>r464</version>
@@ -395,27 +405,21 @@
<version>3.2.3.GA</version>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-c3p0</artifactId>
- <version>3.3.1.GA</version>
- </dependency>
- <!-- <dependency>
- <groupId>c3p0</groupId>
- <artifactId>c3p0</artifactId>
- <version>0.9.1.2</version>
- </dependency> -->
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+ <!-- <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId>
+ <version>0.9.1.2</version> </dependency> -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<!-- wave use 2.5 -->
<version>2.5</version>
</dependency>
+ <!-- <dependency> <groupId>com.wideplay</groupId> <artifactId>warp-persist</artifactId>
+ <version>2.0-SNAPSHOT</version> </dependency> -->
<dependency>
- <groupId>com.wideplay</groupId>
- <artifactId>warp-persist</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
@@ -775,11 +779,23 @@
<!-- =roo -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-5</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
+ <dependencySets>
+ <dependencySet>
+ <scope>runtime</scope>
+ <unpackOptions>
+ <excludes>
+ <exclude>**/gxt/**</exclude>
+ <exclude>**/extjs/**</exclude>
+ <exclude>**extjs**</exclude>
+ <exclude>**gxt**</exclude>
+ </excludes>
+ </unpackOptions>
+ </dependencySet>
+ </dependencySets>
</configuration>
</plugin>
<plugin>
@@ -916,6 +932,24 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <mainClass>cc.kune.wave.server.WaveMain</mainClass>
+ <!-- <classpathPrefix>~/.m2/repository/</classpathPrefix> -->
+ <!-- <classpathLayoutType>repository</classpathLayoutType> -->
+ <!-- NOTE: Deprecated in version 2.4. Use 'classpathLayoutType'
+ instead. -->
+ <classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
+ <!-- <packageName>cc.kune.wave.server</packageName> -->
+ </manifest>
+ <manifestEntries>
+ <mode>development</mode>
+ <url>${pom.url}</url>
+ </manifestEntries>
+ </archive>
+ </configuration>
<executions>
<!-- <execution> -->
<!-- <id>core</id> -->
@@ -950,21 +984,53 @@
<!-- </includes> -->
<!-- </configuration> -->
<!-- </execution> -->
+ <!-- <execution> -->
+ <!-- <id>helloworldmodule</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>jar</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <classifier>helloworldmodule</classifier> -->
+ <!-- <includes> -->
+ <!-- <include>**/HelloWorld*</include> -->
+ <!-- </includes> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.dstovall</groupId>
+ <artifactId>onejar-maven-plugin</artifactId>
+ <version>1.4.4</version>
+ <executions>
<execution>
- <id>helloworldmodule</id>
- <phase>package</phase>
+ <configuration>
+ <!-- Optional -->
+ <!-- <onejarVersion>0.97</onejarVersion> -->
+ <!-- Optional, use only if you need to include native libraries
+ (dll's) -->
+<!-- <binlibs>-->
+<!-- <fileSet>-->
+<!-- <directory>${project.build.directory}/${project.build.finalName}</directory>-->
+<!-- <includes>-->
+<!-- <include>**</include>-->
+<!-- </includes>-->
+<!-- </fileSet>-->
+<!-- </binlibs>-->
+ <!-- Optional, default is false -->
+ <attachToBuild>true</attachToBuild>
+ <!-- Optional, default is "onejar" -->
+ <classifier>onejar</classifier>
+ </configuration>
<goals>
- <goal>jar</goal>
+ <goal>one-jar</goal>
</goals>
- <configuration>
- <classifier>helloworldmodule</classifier>
- <includes>
- <include>**/HelloWorld*</include>
- </includes>
- </configuration>
</execution>
</executions>
</plugin>
+
+
<!-- <plugin> -->
<!-- <groupId>org.codehaus.mojo</groupId> -->
<!-- <artifactId>selenium-maven-plugin</artifactId> -->
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/errors/SessionExpiredEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/errors/SessionExpiredEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/errors/SessionExpiredEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,7 +22,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class SessionExpiredEvent extends GwtEvent<SessionExpiredEvent.SessionExpiredHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -71,9 +71,10 @@
this.siteOptions = siteOptions;
this.gotoGroupAction = gotoGroupAction;
createActions();
- if (session.isLogged()) {
- onUserSignIn(session.getCurrentUserInfo()); // NOPMD by vjrj on 11/02/11 3:37
- }
+ // if (session.isLogged()) {
+ // onUserSignIn(session.getCurrentUserInfo()); // NOPMD by vjrj on
+ // 11/02/11 3:37
+ // }
session.onUserSignIn(new UserSignInHandler() {
@Override
public void onUserSignIn(final UserSignInEvent event) {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -3,7 +3,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class AccessRightsChangedEvent extends GwtEvent<AccessRightsChangedEvent.AccessRightsChangedHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/GroupChangedEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/GroupChangedEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/GroupChangedEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,7 +22,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class GroupChangedEvent extends GwtEvent<GroupChangedEvent.GroupChangedHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/SocialNetworkChangedEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/SocialNetworkChangedEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/SocialNetworkChangedEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,7 +22,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class SocialNetworkChangedEvent extends GwtEvent<SocialNetworkChangedEvent.SocialNetworkChangedHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/StateChangedEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/StateChangedEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/StateChangedEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,7 +22,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class StateChangedEvent extends GwtEvent<StateChangedEvent.StateChangedHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/ToolChangedEvent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/ToolChangedEvent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/core/client/state/ToolChangedEvent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,7 +22,6 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
-
import com.google.gwt.event.shared.HasHandlers;
public class ToolChangedEvent extends GwtEvent<ToolChangedEvent.ToolChangedHandler> {
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Container.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Container.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Container.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -53,29 +53,46 @@
import cc.kune.domain.utils.HasId;
import cc.kune.domain.utils.HasStateToken;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Indexed
@Table(name = "containers")
public class Container implements HasId, HasStateToken {
+ @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private List<Container> absolutePath;
+
+ @OneToOne(cascade = CascadeType.ALL)
+ private AccessLists accessLists;
+
+ @OrderBy("createdOn DESC")
+ @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private Set<Container> childs;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ private List<ContainerTranslation> containerTranslations;
+
+ @ContainedIn
+ @OrderBy("createdOn DESC")
+ @OneToMany(mappedBy = "container", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private Set<Content> contents;
+
+ @Basic(optional = false)
+ private Long createdOn;
+
+ @Basic(optional = true)
+ private Date deletedOn;
+
@Id
@GeneratedValue
@DocumentId
Long id;
+ @ManyToOne
+ private I18nLanguage language;
+
@Column
@Field(index = Index.TOKENIZED, store = Store.NO)
private String name;
- private String toolName;
-
- private String typeId;
-
- @ManyToOne
- private I18nLanguage language;
-
@IndexedEmbedded(depth = 1, prefix = "owner_")
@OneToOne
private Group owner;
@@ -87,30 +104,10 @@
@JoinColumn
private Container parent;
- @OrderBy("createdOn DESC")
- @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- private Set<Container> childs;
+ private String toolName;
- @ContainedIn
- @OrderBy("createdOn DESC")
- @OneToMany(mappedBy = "container", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- private Set<Content> contents;
+ private String typeId;
- @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
- private List<Container> absolutePath;
-
- @OneToMany(cascade = CascadeType.ALL)
- private List<ContainerTranslation> containerTranslations;
-
- @OneToOne(cascade = CascadeType.ALL)
- private AccessLists accessLists;
-
- @Basic(optional = false)
- private Long createdOn;
-
- @Basic(optional = true)
- private Date deletedOn;
-
public Container() {
this(null, null, null);
}
@@ -137,11 +134,6 @@
contents.add(descriptor);
}
- @Finder(query = "SELECT COUNT(*) FROM Container c WHERE c.parent = :container AND c.name LIKE :title")
- public Long findIfExistsTitle(@Named("container") final Container container, @Named("title") final String title) {
- return null;
- }
-
public List<Container> getAbsolutePath() {
return absolutePath;
}
@@ -175,6 +167,7 @@
return deletedOn;
}
+ @Override
public Long getId() {
return id;
}
@@ -199,6 +192,7 @@
return parent != null ? parent.getId() : null;
}
+ @Override
@Transient
public StateToken getStateToken() {
return new StateToken(getOwner().getShortName(), getToolName(), getId());
@@ -264,6 +258,7 @@
this.deletedOn = deletedOn;
}
+ @Override
public void setId(final Long id) {
this.id = id;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Content.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Content.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Content.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -56,23 +56,17 @@
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.domain.utils.HasStateToken;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-import com.wideplay.warp.persist.dao.FirstResult;
-import com.wideplay.warp.persist.dao.MaxResults;
-
@Entity
@Table(name = "contents")
@Indexed
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Content implements HasStateToken {
- private static final String GROUP = "group";
- private static final String MIMETYPE = "mimetype";
+ public static final String GROUP = "group";
+ public static final String MIMETYPE = "mimetype";
public static final Content NO_CONTENT = new Content();
+ public static final String TITLE = "title";
- private static final String TITLE = "title";
-
@OneToOne(cascade = CascadeType.ALL)
private AccessLists accessLists;
@@ -170,36 +164,6 @@
}
}
- @Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> find2Mime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
- @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2,
- @FirstResult final int offset, @MaxResults final int limit) {
- return null;
- }
-
- @Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null")
- public int find2MimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
- @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2) {
- return 0;
- }
-
- @Finder(query = "select count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title LIKE :title")
- public Long findIfExistsTitle(@Named("container") final Container container, @Named(TITLE) final String title) {
- return null;
- }
-
- @Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> findMime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
- @Named(MIMETYPE) final String mimetype, @FirstResult final int offset, @MaxResults final int limit) {
- return null;
- }
-
- @Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null")
- public int findMimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
- @Named(MIMETYPE) final String mimetype) {
- return 0;
- }
-
@Transient
public AccessLists getAccessLists() {
return hasAccessList() ? accessLists : getContainer().getAccessLists();
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/ExtMediaDescrip.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/ExtMediaDescrip.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/ExtMediaDescrip.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -31,28 +29,26 @@
import cc.kune.domain.utils.HasId;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Table(name = "ext_media_descriptors")
public class ExtMediaDescrip implements HasId {
+ @Column(nullable = false)
+ private String detectRegex;
+ @Column(nullable = false)
+ @Length(max = 1000)
+ private String embedTemplate;
+ private int height;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
+ private String idRegex;
+ @Column(nullable = false)
private String name;
@Column(nullable = false)
private String siteurl;
- @Column(nullable = false)
- private String detectRegex;
- @Column(nullable = false)
- private String idRegex;
- @Column(nullable = false)
- @Length(max = 1000)
- private String embedTemplate;
private int width;
- private int height;
public ExtMediaDescrip() {
this(null, null, null, null, null, 0, 0);
@@ -69,11 +65,6 @@
height = defHeight;
}
- @Finder(query = "from ExtMediaDescrip")
- public List<ExtMediaDescrip> getAll() {
- return null;
- }
-
public String getDetectRegex() {
return detectRegex;
}
@@ -86,6 +77,7 @@
return height;
}
+ @Override
public Long getId() {
return id;
}
@@ -118,6 +110,7 @@
this.height = height;
}
+ @Override
public void setId(final Long id) {
this.id = id;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Group.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Group.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Group.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,7 +20,6 @@
package cc.kune.domain;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import javax.persistence.Basic;
@@ -51,9 +50,6 @@
import cc.kune.core.shared.dto.GroupType;
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Indexed
@Table(name = "groups")
@@ -159,26 +155,6 @@
return toolsConfig.get(toolName) != null;
}
- @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.admins.list adm WHERE adm.id = :groupid)")
- public List<Group> findAdminInGroups(@Named("groupid") final Long groupId) {
- return null;
- }
-
- @Finder(query = "FROM Group g WHERE g.shortName = :shortName")
- public Group findByShortName(@Named("shortName") final String shortName) {
- return null;
- }
-
- @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.editors.list AS ed WHERE ed.id = :groupid)")
- public List<Group> findCollabInGroups(@Named("groupid") final Long groupId) {
- return null;
- }
-
- @Finder(query = "SELECT t.root.toolName FROM ToolConfiguration t WHERE t.enabled=true AND t.root.owner.id = :groupid")
- public List<String> findEnabledTools(@Named("groupid") final Long groupId) {
- return null;
- }
-
@Transient
public AccessLists getAccessLists() {
return getSocialNetwork().getAccessLists();
@@ -188,11 +164,6 @@
return admissionType;
}
- @Finder(query = "FROM Group")
- public List<Group> getAll() {
- return null;
- }
-
public Long getCreatedOn() {
return createdOn;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nCountry.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nCountry.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nCountry.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -31,9 +29,6 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
/**
* GlobalizeCountries generated by hbm2java from original rails globalize schema
*
@@ -46,39 +41,39 @@
@Table(name = "globalize_countries")
public class I18nCountry implements HasId {
- @Id
- // Is not a @GeneratedValue similar to I18nLanguage (we have already ids)
- @DocumentId
- @Column(name = "id", unique = true, nullable = false)
- private Long id;
-
@Column(name = "code", length = 2)
private String code;
- @Column(name = "english_name")
- private String englishName;
+ @Column(name = "currency_code", length = 3)
+ private String currencyCode;
- @Column(name = "date_format")
- private String dateFormat;
+ @Column(name = "currency_decimal_sep", length = 2)
+ private String currencyDecimalSep;
@Column(name = "currency_format")
private String currencyFormat;
- @Column(name = "currency_code", length = 3)
- private String currencyCode;
+ @Column(name = "date_format")
+ private String dateFormat;
- @Column(name = "thousands_sep", length = 2)
- private String thousandsSep;
-
@Column(name = "decimal_sep", length = 2)
private String decimalSep;
- @Column(name = "currency_decimal_sep", length = 2)
- private String currencyDecimalSep;
+ @Column(name = "english_name")
+ private String englishName;
+ @Id
+ // Is not a @GeneratedValue similar to I18nLanguage (we have already ids)
+ @DocumentId
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
@Column(name = "number_grouping_scheme")
private String numberGroupingScheme;
+ @Column(name = "thousands_sep", length = 2)
+ private String thousandsSep;
+
public I18nCountry() {
this(null, null, null, null, null, null, null, null, null, null);
}
@@ -98,16 +93,6 @@
this.numberGroupingScheme = numberGroupingScheme;
}
- @Finder(query = "FROM I18nCountry WHERE code = :country")
- public I18nCountry findByCode(@Named("country") final String country) {
- return null;
- }
-
- @Finder(query = "FROM I18nCountry ORDER BY english_name")
- public List<I18nCountry> getAll() {
- return null;
- }
-
public String getCode() {
return this.code;
}
@@ -136,6 +121,7 @@
return this.englishName;
}
+ @Override
public Long getId() {
return this.id;
}
@@ -176,6 +162,7 @@
this.englishName = englishName;
}
+ @Override
public void setId(final Long id) {
this.id = id;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nLanguage.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nLanguage.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nLanguage.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -36,9 +34,6 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
/**
* GlobalizeLanguages generated by hbm2java from original rails globalize schema
*
@@ -149,16 +144,6 @@
this.dateFormat = dateFormat;
}
- @Finder(query = "FROM I18nLanguage l WHERE code = :language")
- public I18nLanguage findByCode(@Named("language") final String language) {
- return null;
- }
-
- @Finder(query = "FROM I18nLanguage ORDER BY englishName")
- public List<I18nLanguage> getAll() {
- return null;
- }
-
public String getCode() {
return code;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nTranslation.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nTranslation.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/I18nTranslation.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -28,8 +26,6 @@
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.hibernate.search.annotations.DocumentId;
@@ -37,11 +33,6 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-import com.wideplay.warp.persist.dao.FirstResult;
-import com.wideplay.warp.persist.dao.MaxResults;
-
/**
* GlobalizeTranslations generated by hbm2java from original rails globalize
* schema
@@ -49,43 +40,26 @@
@Entity
@Indexed
@Table(name = "globalize_translations")
- at NamedQueries( {
- @NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
- @NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
- @NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
- @NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
public class I18nTranslation implements HasId {
public static final String DEF_NAMESPACE = "kune_core";
public static final Integer DEF_PLUR_INDEX = 1;
public static final String DEFAULT_LANG = "en";
+
public static final String UNTRANSLATED_VALUE = null;
- private static final String TRANSLATED_QUERY = "translated";
- private static final String UNTRANSLATED_QUERY = "untranslated";
- private static final String TRANSLATED_COUNT_QUERY = "translatedcount";
- private static final String UNTRANSLATED_COUNT_QUERY = "untranslatedcount";
+ @Column(name = "facet")
+ private String facet;
+
@Id
@GeneratedValue
@DocumentId
@Column(name = "id", unique = true, nullable = false)
private Long id;
- @Column(name = "gtype")
- private String type;
-
- @Column(name = "tr_key")
- private String trKey;
-
- @Column(name = "table_name")
- private String tableName;
-
@Column(name = "item_id")
private Integer itemId;
- @Column(name = "facet")
- private String facet;
-
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "language_id")
private I18nLanguage language;
@@ -93,161 +67,129 @@
@Column(name = "pluralization_index")
private Integer pluralizationIndex;
+ @Column(name = "table_name")
+ private String tableName;
+
@Column(name = "text")
private String text;
+ @Column(name = "tr_key")
+ private String trKey;
+
+ @Column(name = "gtype")
+ private String type;
+
public I18nTranslation() {
- this(null, null, null, null, null, null, null, null);
+ this(null, null, null, null, null, null, null, null);
}
public I18nTranslation(final String trKey, final I18nLanguage language, final String text) {
- this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
+ this("", null, DEF_PLUR_INDEX, "", text, trKey, DEF_NAMESPACE, language);
}
public I18nTranslation(final String facet, final Integer itemId, final Integer pluralizationIndex,
- final String tableName, final String text, final String trKey, final String type,
- final I18nLanguage language) {
- this.type = type;
- this.trKey = trKey;
- this.tableName = tableName;
- this.itemId = itemId;
- this.facet = facet;
- this.language = language;
- this.pluralizationIndex = pluralizationIndex;
- this.text = text;
+ final String tableName, final String text, final String trKey, final String type,
+ final I18nLanguage language) {
+ this.type = type;
+ this.trKey = trKey;
+ this.tableName = tableName;
+ this.itemId = itemId;
+ this.facet = facet;
+ this.language = language;
+ this.pluralizationIndex = pluralizationIndex;
+ this.text = text;
}
public I18nTranslation cloneForNewLanguage() {
- final I18nTranslation clone = new I18nTranslation();
- clone.type = type;
- clone.trKey = trKey;
- clone.tableName = tableName;
- clone.itemId = itemId;
- clone.facet = facet;
- clone.language = null;
- clone.pluralizationIndex = pluralizationIndex;
- clone.text = null;
- return clone;
+ final I18nTranslation clone = new I18nTranslation();
+ clone.type = type;
+ clone.trKey = trKey;
+ clone.tableName = tableName;
+ clone.itemId = itemId;
+ clone.facet = facet;
+ clone.language = null;
+ clone.pluralizationIndex = pluralizationIndex;
+ clone.text = null;
+ return clone;
}
- @Finder(query = "SELECT gt FROM I18nTranslation gt JOIN gt.language gl WHERE gl.code = :language")
- public List<I18nTranslation> findByLanguage(@Named("language") final String language) {
- return null;
- }
-
public String getFacet() {
- return this.facet;
+ return this.facet;
}
+ @Override
public Long getId() {
- return this.id;
+ return this.id;
}
public Integer getItemId() {
- return this.itemId;
+ return this.itemId;
}
public I18nLanguage getLanguage() {
- return language;
+ return language;
}
- @Finder(query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :deflanguage AND gt.trKey NOT IN (SELECT gt.trKey FROM I18nTranslation gt WHERE gt.language = :language)")
- public List<I18nTranslation> getNonExistentFromDefault(@Named("deflanguage") final I18nLanguage deflanguage,
- @Named("language") final I18nLanguage language) {
- return null;
- }
-
public Integer getPluralizationIndex() {
- return this.pluralizationIndex;
+ return this.pluralizationIndex;
}
public String getTableName() {
- return this.tableName;
+ return this.tableName;
}
public String getText() {
- return this.text;
+ return this.text;
}
- @Finder(namedQuery = TRANSLATED_QUERY)
- public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language) {
- return null;
- }
-
- @Finder(namedQuery = TRANSLATED_QUERY)
- public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language,
- @FirstResult final int first, @MaxResults final int max) {
- return null;
- }
-
- @Finder(namedQuery = TRANSLATED_COUNT_QUERY)
- public Long getTranslatedLexiconCount(@Named("language") final I18nLanguage language) {
- return null;
- }
-
public String getTrKey() {
- return this.trKey;
+ return this.trKey;
}
public String getType() {
- return this.type;
+ return this.type;
}
- @Finder(namedQuery = UNTRANSLATED_QUERY)
- public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language) {
- return null;
- }
-
- @Finder(namedQuery = UNTRANSLATED_QUERY)
- public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language,
- @FirstResult final int first, @MaxResults final int max) {
- return null;
- }
-
- @Finder(namedQuery = UNTRANSLATED_COUNT_QUERY)
- public Long getUnstranslatedLexiconCount(@Named("language") final I18nLanguage language) {
- return null;
- }
-
public void setFacet(final String facet) {
- this.facet = facet;
+ this.facet = facet;
}
+ @Override
public void setId(final Long id) {
- this.id = id;
+ this.id = id;
}
public void setItemId(final Integer itemId) {
- this.itemId = itemId;
+ this.itemId = itemId;
}
public void setLanguage(final I18nLanguage language) {
- this.language = language;
+ this.language = language;
}
public void setPluralizationIndex(final Integer pluralizationIndex) {
- this.pluralizationIndex = pluralizationIndex;
+ this.pluralizationIndex = pluralizationIndex;
}
public void setTableName(final String tableName) {
- this.tableName = tableName;
+ this.tableName = tableName;
}
public void setText(final String text) {
- this.text = text;
+ this.text = text;
}
public void setTrKey(final String trKey) {
- this.trKey = trKey;
+ this.trKey = trKey;
}
public void setType(final String type) {
- this.type = type;
+ this.type = type;
}
@Override
public String toString() {
- return "I18nTranslation[" + trKey + " (" + language + ") " + text + "]";
+ return "I18nTranslation[" + trKey + " (" + language + ") " + text + "]";
}
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/License.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/License.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/License.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -29,32 +27,29 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Table(name = "licenses")
public class License implements HasId {
+ private String description;
+
@Id
@GeneratedValue
private Long id;
- @Column(unique = true)
- private String shortName;
-
- @Column(unique = true)
- private String longName;
-
- private String description;
-
@Column(nullable = false)
- private String url;
+ private String imageUrl;
+
private boolean isCC;
+
private boolean isCopyleft;
private boolean isDeprecated;
+ @Column(unique = true)
+ private String longName;
private String rdf;
+ @Column(unique = true)
+ private String shortName;
@Column(nullable = false)
- private String imageUrl;
+ private String url;
public License() {
this(null, null, null, null, false, false, false, null, null);
@@ -74,62 +69,35 @@
this.imageUrl = imageUrl;
}
- public Long getId() {
- return id;
- }
-
- public void setId(final Long id) {
- this.id = id;
- }
-
- public String getShortName() {
- return shortName;
- }
-
- public void setShortName(final String shortName) {
- this.shortName = shortName;
- }
-
- public String getLongName() {
- return longName;
- }
-
- public void setLongName(final String longName) {
- this.longName = longName;
- }
-
public String getDescription() {
return description;
}
- public void setDescription(final String description) {
- this.description = description;
+ @Override
+ public Long getId() {
+ return id;
}
public String getImageUrl() {
return imageUrl;
}
- public void setImageUrl(final String imageUrl) {
- this.imageUrl = imageUrl;
+ public String getLongName() {
+ return longName;
}
public String getRdf() {
return rdf;
}
- public void setRdf(final String rdf) {
- this.rdf = rdf;
+ public String getShortName() {
+ return shortName;
}
public String getUrl() {
return url;
}
- public void setUrl(final String url) {
- this.url = url;
- }
-
public boolean isCC() {
return isCC;
}
@@ -154,23 +122,32 @@
this.isDeprecated = isDeprecated;
}
- @Finder(query = "from License l where l.shortName = :shortName")
- public License findByShortName(@Named("shortName") final String shortName) {
- return null;
+ public void setDescription(final String description) {
+ this.description = description;
}
- @Finder(query = "from License")
- public List<License> getAll() {
- return null;
+ @Override
+ public void setId(final Long id) {
+ this.id = id;
}
- @Finder(query = "from License where isCC = true")
- public List<License> getCC() {
- return null;
+ public void setImageUrl(final String imageUrl) {
+ this.imageUrl = imageUrl;
}
- @Finder(query = "from License where isCC = false")
- public List<License> getNotCC() {
- return null;
+ public void setLongName(final String longName) {
+ this.longName = longName;
}
+
+ public void setRdf(final String rdf) {
+ this.rdf = rdf;
+ }
+
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
+
+ public void setUrl(final String url) {
+ this.url = url;
+ }
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Rate.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Rate.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Rate.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -29,28 +29,25 @@
import org.hibernate.validator.Range;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Table(name = "rates", uniqueConstraints = { @UniqueConstraint(columnNames = { "content_id", "rater_id" }) })
public class Rate {
+ @ManyToOne
+ Content content;
+
+ @Basic(optional = false)
+ private final Long createdOn;
+
@Id
@GeneratedValue
Long id;
@ManyToOne
- Content content;
-
- @ManyToOne
User rater;
@Range(min = 0, max = 5)
Double value;
- @Basic(optional = false)
- private final Long createdOn;
-
public Rate() {
this(null, null, null);
}
@@ -62,21 +59,6 @@
this.createdOn = System.currentTimeMillis();
}
- @Finder(query = "SELECT AVG(r.value) FROM Rate r WHERE r.content = :content")
- public Double calculateRate(@Named("content") final Content content) {
- return null;
- }
-
- @Finder(query = "SELECT count(*) FROM Rate r WHERE r.content = :content")
- public Long calculateRateNumberOfUsers(@Named("content") final Content content) {
- return null;
- }
-
- @Finder(query = "SELECT r FROM Rate r WHERE r.rater = :user AND r.content = :content")
- public Rate find(@Named("user") final User user, @Named("content") final Content content) {
- return null;
- }
-
public Content getContent() {
return content;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Tag.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Tag.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/Tag.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -34,14 +34,14 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Indexed
@Table(name = "tags")
public class Tag implements HasId {
+ @Basic(optional = false)
+ private final Long createdOn;
+
@Id
@GeneratedValue
@DocumentId
@@ -51,9 +51,6 @@
@Column(unique = true)
private String name;
- @Basic(optional = false)
- private final Long createdOn;
-
public Tag() {
this(null);
}
@@ -63,15 +60,11 @@
this.createdOn = System.currentTimeMillis();
}
- @Finder(query = "FROM Tag g WHERE g.name = :name")
- public Tag findByTagName(@Named("name") final String tag) {
- return null;
- }
-
public Long getCreatedOn() {
return createdOn;
}
+ @Override
public Long getId() {
return id;
}
@@ -80,6 +73,7 @@
return name;
}
+ @Override
public void setId(final Long id) {
this.id = id;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/TagUserContent.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/TagUserContent.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/TagUserContent.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,16 +19,12 @@
*/
package cc.kune.domain;
-import java.util.List;
-
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.hibernate.search.annotations.DocumentId;
@@ -38,24 +34,10 @@
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
-//See:
-//http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_langref_resulttype
- at NamedQueries({
- @NamedQuery(name = "tagsgrouped", query = "SELECT NEW cc.kune.core.shared.domain.TagCount(t.name, COUNT(tuc.content.id)) "
- + "FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group "
- + "GROUP BY t.name ORDER BY t.name"),
- @NamedQuery(name = "tagsmaxgrouped", query = "SELECT Count(tuc.content.id) FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group GROUP BY t.name ORDER BY count(*) DESC LIMIT 0,1"),
- @NamedQuery(name = "tagsmingrouped", query = "SELECT Count(tuc.content.id) FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group GROUP BY t.name ORDER BY count(*) ASC LIMIT 0,1") })
@Entity
@Indexed
@Table(name = "tag_user_content")
public class TagUserContent implements HasId {
- public static final String TAGSGROUPED = "tagsgrouped";
- public static final String TAGSMAXGROUPED = "tagsmaxgrouped";
- public static final String TAGSMINGROUPED = "tagsmingrouped";
@IndexedEmbedded
@NotNull
@@ -91,16 +73,6 @@
this.createdOn = System.currentTimeMillis();
}
- @Finder(query = "FROM TagUserContent t WHERE t.user = :user AND t.content = :content")
- public List<TagUserContent> find(@Named("user") final User user, @Named("content") final Content content) {
- return null;
- }
-
- @Finder(query = "SELECT t.tag FROM TagUserContent t WHERE t.user = :user AND t.content = :content")
- public List<Tag> findTags(@Named("user") final User user, @Named("content") final Content content) {
- return null;
- }
-
public Content getContent() {
return content;
}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/User.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/User.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/User.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,7 +19,6 @@
*/
package cc.kune.domain;
-import java.util.List;
import java.util.TimeZone;
import javax.persistence.Basic;
@@ -48,9 +47,6 @@
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.domain.utils.HasId;
-import com.google.inject.name.Named;
-import com.wideplay.warp.persist.dao.Finder;
-
@Entity
@Indexed
@Table(name = "kusers")
@@ -163,25 +159,10 @@
// this.properties = properties;
}
- @Finder(query = "from User")
- public List<User> getAll() {
- return null;
- }
-
public UserBuddiesVisibility getBuddiesVisibility() {
return buddiesVisibility;
}
- @Finder(query = "from User where email = :email")
- public User getByEmail(@Named("email") final String email) {
- return null;
- }
-
- @Finder(query = "from User where shortName = :shortName")
- public User getByShortName(@Named("shortName") final String shortName) {
- return null;
- }
-
public I18nCountry getCountry() {
return country;
}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContainerFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContainerFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContainerFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import cc.kune.domain.Container;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface ContainerFinder {
+ @Finder(query = "SELECT COUNT(*) FROM Container c WHERE c.parent = :container AND c.name LIKE :title")
+ public Long findIfExistsTitle(@Named("container") final Container container, @Named("title") final String title);
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContentFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContentFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ContentFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import static cc.kune.domain.Content.GROUP;
+import static cc.kune.domain.Content.MIMETYPE;
+import static cc.kune.domain.Content.TITLE;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.Container;
+import cc.kune.domain.Content;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+import com.google.inject.persist.finder.FirstResult;
+import com.google.inject.persist.finder.MaxResults;
+
+public interface ContentFinder {
+ @Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC", returnAs = ArrayList.class)
+ public List<Content> find2Mime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2,
+ @FirstResult final int offset, @MaxResults final int limit);
+
+ @Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null")
+ public int find2MimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2);
+
+ @Finder(query = "SELECT count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title LIKE :title")
+ public Long findIfExistsTitle(@Named("container") final Container container, @Named(TITLE) final String title);
+
+ @Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC", returnAs = ArrayList.class)
+ public List<Content> findMime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @FirstResult final int offset, @MaxResults final int limit);
+
+ @Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null")
+ public int findMimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype);
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ExtMediaDescripFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ExtMediaDescripFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/ExtMediaDescripFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,33 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.ExtMediaDescrip;
+
+import com.google.inject.persist.finder.Finder;
+
+public interface ExtMediaDescripFinder {
+
+ @Finder(query = "from ExtMediaDescrip", returnAs = ArrayList.class)
+ public List<ExtMediaDescrip> getAll();
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/GroupFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/GroupFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/GroupFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,27 @@
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.Group;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface GroupFinder {
+
+ @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.admins.list adm WHERE adm.id = :groupid)", returnAs = ArrayList.class)
+ public List<Group> findAdminInGroups(@Named("groupid") final Long groupId);
+
+ @Finder(query = "FROM Group g WHERE g.shortName = :shortName")
+ public Group findByShortName(@Named("shortName") final String shortName);
+
+ @Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id FROM g.socialNetwork.accessLists.editors.list AS ed WHERE ed.id = :groupid)", returnAs = ArrayList.class)
+ public List<Group> findCollabInGroups(@Named("groupid") final Long groupId);
+
+ @Finder(query = "SELECT t.root.toolName FROM ToolConfiguration t WHERE t.enabled=true AND t.root.owner.id = :groupid", returnAs = ArrayList.class)
+ public List<String> findEnabledTools(@Named("groupid") final Long groupId);
+
+ @Finder(query = "FROM Group", returnAs = ArrayList.class)
+ public List<Group> getAll();
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nCountryFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nCountryFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nCountryFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.I18nCountry;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface I18nCountryFinder {
+
+ @Finder(query = "FROM I18nCountry WHERE code = :country")
+ public I18nCountry findByCode(@Named("country") final String country);
+
+ @Finder(query = "FROM I18nCountry ORDER BY english_name", returnAs = ArrayList.class)
+ public List<I18nCountry> getAll();
+
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nLanguageFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nLanguageFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nLanguageFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.I18nLanguage;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface I18nLanguageFinder {
+
+ @Finder(query = "FROM I18nLanguage l WHERE code = :language")
+ public I18nLanguage findByCode(@Named("language") final String language);
+
+ @Finder(query = "FROM I18nLanguage ORDER BY englishName", returnAs = ArrayList.class)
+ public List<I18nLanguage> getAll();
+
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nTranslationFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nTranslationFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/I18nTranslationFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+
+import cc.kune.domain.I18nLanguage;
+import cc.kune.domain.I18nTranslation;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+import com.google.inject.persist.finder.FirstResult;
+import com.google.inject.persist.finder.MaxResults;
+
+ at NamedQueries({
+ @NamedQuery(name = "untranslated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+ @NamedQuery(name = "translated", query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :language and text!=null"),
+ @NamedQuery(name = "untranslatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text=null"),
+ @NamedQuery(name = "translatedcount", query = "SELECT COUNT(gt.id) FROM I18nTranslation gt WHERE gt.language = :language and text!=null") })
+public interface I18nTranslationFinder {
+ String TRANSLATED_COUNT_QUERY = "translatedcount";
+ String TRANSLATED_QUERY = "translated";
+ String UNTRANSLATED_COUNT_QUERY = "untranslatedcount";
+ String UNTRANSLATED_QUERY = "untranslated";
+
+ @Finder(query = "SELECT gt FROM I18nTranslation gt JOIN gt.language gl WHERE gl.code = :language", returnAs = ArrayList.class)
+ public List<I18nTranslation> findByLanguage(@Named("language") final String language);
+
+ @Finder(query = "SELECT gt FROM I18nTranslation gt WHERE gt.language = :deflanguage AND gt.trKey NOT IN (SELECT gt.trKey FROM I18nTranslation gt WHERE gt.language = :language)", returnAs = ArrayList.class)
+ public List<I18nTranslation> getNonExistentFromDefault(@Named("deflanguage") final I18nLanguage deflanguage,
+ @Named("language") final I18nLanguage language);
+
+ @Finder(namedQuery = TRANSLATED_QUERY, returnAs = ArrayList.class)
+ public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language);
+
+ @Finder(namedQuery = TRANSLATED_QUERY, returnAs = ArrayList.class)
+ public List<I18nTranslation> getTranslatedLexicon(@Named("language") final I18nLanguage language,
+ @FirstResult final int first, @MaxResults final int max);
+
+ @Finder(namedQuery = TRANSLATED_COUNT_QUERY)
+ public Long getTranslatedLexiconCount(@Named("language") final I18nLanguage language);
+
+ @Finder(namedQuery = UNTRANSLATED_QUERY, returnAs = ArrayList.class)
+ public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language);
+
+ @Finder(namedQuery = UNTRANSLATED_QUERY, returnAs = ArrayList.class)
+ public List<I18nTranslation> getUnstranslatedLexicon(@Named("language") final I18nLanguage language,
+ @FirstResult final int first, @MaxResults final int max);
+
+ @Finder(namedQuery = UNTRANSLATED_COUNT_QUERY)
+ public Long getUnstranslatedLexiconCount(@Named("language") final I18nLanguage language);
+
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/LicenseFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/LicenseFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/LicenseFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.License;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface LicenseFinder {
+
+ @Finder(query = "from License l where l.shortName = :shortName")
+ public License findByShortName(@Named("shortName") final String shortName);
+
+ @Finder(query = "from License", returnAs = ArrayList.class)
+ public List<License> getAll();
+
+ @Finder(query = "from License where isCC = true", returnAs = ArrayList.class)
+ public List<License> getCC();
+
+ @Finder(query = "from License where isCC = false", returnAs = ArrayList.class)
+ public List<License> getNotCC();
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/RateFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/RateFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/RateFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import cc.kune.domain.Content;
+import cc.kune.domain.Rate;
+import cc.kune.domain.User;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface RateFinder {
+
+ @Finder(query = "SELECT AVG(r.value) FROM Rate r WHERE r.content = :content")
+ public Double calculateRate(@Named("content") final Content content);
+
+ @Finder(query = "SELECT count(*) FROM Rate r WHERE r.content = :content")
+ public Long calculateRateNumberOfUsers(@Named("content") final Content content);
+
+ @Finder(query = "SELECT r FROM Rate r WHERE r.rater = :user AND r.content = :content")
+ public Rate find(@Named("user") final User user, @Named("content") final Content content);
+
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import cc.kune.domain.Tag;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface TagFinder {
+
+ @Finder(query = "FROM Tag g WHERE g.name = :name")
+ public Tag findByTagName(@Named("name") final String tag);
+
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagUserContentFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagUserContentFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/TagUserContentFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,53 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.core.shared.domain.TagCount;
+import cc.kune.domain.Content;
+import cc.kune.domain.Group;
+import cc.kune.domain.Tag;
+import cc.kune.domain.TagUserContent;
+import cc.kune.domain.User;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface TagUserContentFinder {
+
+ @Finder(query = "FROM TagUserContent t WHERE t.user = :user AND t.content = :content", returnAs = ArrayList.class)
+ public List<TagUserContent> find(@Named("user") final User user, @Named("content") final Content content);
+
+ @Finder(query = "SELECT t.tag FROM TagUserContent t WHERE t.user = :user AND t.content = :content", returnAs = ArrayList.class)
+ public List<Tag> findTags(@Named("user") final User user, @Named("content") final Content content);
+
+ @Finder(query = "SELECT Count(tuc.content.id) FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group GROUP BY t.name ORDER BY count(*) ASC LIMIT 0,1")
+ public int getMaxGrouped(@Named("group") final Group group);
+
+ @Finder(query = "SELECT Count(tuc.content.id) FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group GROUP BY t.name ORDER BY count(*) DESC LIMIT 0,1")
+ public int getMinGrouped(@Named("group") final Group group);
+
+ @Finder(query = "SELECT NEW cc.kune.core.shared.domain.TagCount(t.name, COUNT(tuc.content.id)) "
+ + "FROM TagUserContent tuc JOIN tuc.tag t WHERE tuc.content.container.owner = :group "
+ + "GROUP BY t.name ORDER BY t.name", returnAs = ArrayList.class)
+ public List<TagCount> getTagsGroups(@Named("group") final Group group);
+}
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/UserFinder.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/UserFinder.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/domain/finders/UserFinder.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.domain.User;
+
+import com.google.inject.name.Named;
+import com.google.inject.persist.finder.Finder;
+
+public interface UserFinder {
+
+ @Finder(query = "from User", returnAs = ArrayList.class)
+ public List<User> getAll();
+
+ @Finder(query = "from User where email = :email")
+ public User getByEmail(@Named("email") final String email);
+
+ @Finder(query = "from User where shortName = :shortName")
+ public User getByShortName(@Named("shortName") final String shortName);
+
+}
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/CustomServerRpcProvider.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/CustomServerRpcProvider.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/CustomServerRpcProvider.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -23,6 +23,7 @@
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
+import org.jruby.rack.RackFilter;
import org.ourproject.kune.rack.RackServletFilter;
import org.waveprotocol.box.common.comms.WaveClientRpc.ProtocolAuthenticate;
import org.waveprotocol.box.common.comms.WaveClientRpc.ProtocolAuthenticationResult;
@@ -50,7 +51,6 @@
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.name.Named;
-import com.google.inject.servlet.GuiceFilter;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Descriptors.MethodDescriptor;
@@ -59,6 +59,8 @@
import com.google.protobuf.Service;
import com.google.protobuf.UnknownFieldSet;
+import de.spieleck.servlets.ProxyServlet;
+
/**
* ServerRpcProvider can provide instances of type Service over an incoming
* network socket and service incoming RPCs to these services and their methods.
@@ -417,12 +419,69 @@
httpServer.addConnector(connector);
}
+ // final WebAppContext context = new WebAppContext();
final ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
if (jettySessionManager != null) {
context.getSessionHandler().setSessionManager(jettySessionManager);
}
context.setResourceBase(resourceBase);
context.setContextPath(baseUrl);
+
+ // context.setWar(baseUrl);
+
+ final ServletHolder httpbindHolder = new ServletHolder(ProxyServlet.class);
+ httpbindHolder.setInitParameter("remotePath", "/http-bind/");
+ httpbindHolder.setInitParameter("remotePort", "5280");
+ context.addServlet(httpbindHolder, "/http-bind/");
+
+ final FilterHolder rubyRack = new FilterHolder(org.jruby.rack.rails.RailsServletContextListener.class);
+ rubyRack.setFilter(new RackFilter());
+ rubyRack.setInitParameter("jruby.standalone", "true");
+ rubyRack.setInitParameter("rails.root", "/WEB-INF/publicspace/");
+ rubyRack.setInitParameter("files.prefix", "/WEB-INF/publicspace/public");
+ rubyRack.setInitParameter("rails.env", "production");
+ rubyRack.setInitParameter("jruby.max.runtimes", "1");
+ rubyRack.setInitParameter("public.root", "/public/");
+ context.addFilter(rubyRack, "/public/*", 0);
+
+ // <context-param>
+ // <param-name>jruby.standalone</param-name>
+ // <param-value>true</param-value>
+ // </context-param>
+ // <context-param>
+ // <param-name>rails.root</param-name>
+ // <param-value>/WEB-INF/publicspace/
+ // </param-value>
+ // </context-param>
+ // <context-param>
+ // <param-name>files.prefix</param-name>
+ // <param-value>/WEB-INF/publicspace/public
+ // </param-value>
+ // </context-param>
+ // <context-param>
+ // <param-name>rails.env</param-name>
+ // <param-value>production</param-value>
+ // </context-param>
+ // <context-param>
+ // <param-name>jruby.max.runtimes</param-name>
+ // <param-value>1</param-value>
+ // </context-param>
+ // <context-param>
+ // <param-name>public.root</param-name>
+ // <param-value>/public/</param-value>
+ // </context-param>
+ // <filter>
+ // <filter-name>RackFilter</filter-name>
+ // <filter-class>org.jruby.rack.RackFilter</filter-class>
+ // </filter>
+ // <filter-mapping>
+ // <filter-name>RackFilter</filter-name>
+ // <url-pattern>/public/*</url-pattern>
+ // </filter-mapping>
+ // <listener>
+ // <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
+ // </listener>
+
context.addEventListener(new GuiceServletContextListener() {
@Override
protected Injector getInjector() {
@@ -430,12 +489,13 @@
}
});
context.setAttribute(RackServletFilter.INJECTOR_PARENT_ATTRIBUTE, injector);
- context.addFilter(GuiceFilter.class, "/*", 0);
final FilterHolder filterHolder = new FilterHolder(RackServletFilter.class);
filterHolder.setInitParameter("org.ourproject.kune.rack.RackModule",
"org.ourproject.kune.app.server.KuneRackModule");
- context.addFilter(filterHolder, "/ws*", 0);
+ context.addFilter(filterHolder, "/ws/*", 0);
+ // context.addFilter(GuiceFilter.class, "/*", 0);
+
// Servlet where the websocket connection is served from.
final ServletHolder wsholder = new ServletHolder(new WaveWebSocketServlet());
context.addServlet(wsholder, "/socket");
@@ -477,11 +537,16 @@
final ServletHolder defaultServlet = new ServletHolder(new DefaultServlet());
context.addServlet(defaultServlet, "/static/*");
context.addServlet(defaultServlet, "/webclient/*");
+ context.addServlet(defaultServlet, "/ws/*");
for (final Pair<String, ServletHolder> servlet : servletRegistry) {
context.addServlet(servlet.getSecond(), servlet.getFirst());
}
+ // final ContextHandlerCollection contexts = new
+ // ContextHandlerCollection();
+ // contexts.setHandlers(new Handler[] { context, webContext });
+
httpServer.setHandler(context);
try {
Added: branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/JettyModule.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/JettyModule.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/JettyModule.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,3 @@
+package cc.kune.wave.server;
+
+
Modified: branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/WaveMain.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/WaveMain.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/cc/kune/wave/server/WaveMain.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -42,8 +42,6 @@
import org.waveprotocol.box.server.rpc.AuthenticationServlet;
import org.waveprotocol.box.server.rpc.FetchServlet;
import org.waveprotocol.box.server.rpc.SignOutServlet;
-import org.waveprotocol.box.server.rpc.UserRegistrationServlet;
-import org.waveprotocol.box.server.rpc.WaveClientServlet;
import org.waveprotocol.box.server.waveserver.WaveBus;
import org.waveprotocol.box.server.waveserver.WaveServerException;
import org.waveprotocol.box.server.waveserver.WaveletProvider;
@@ -128,7 +126,7 @@
server.addServlet(SessionManager.SIGN_IN_URL, injector.getInstance(AuthenticationServlet.class));
server.addServlet("/auth/signout", injector.getInstance(SignOutServlet.class));
- server.addServlet("/auth/register", injector.getInstance(UserRegistrationServlet.class));
+ server.addServlet("/auth/register", injector.getInstance(CustomUserRegistrationServlet.class));
server.addServlet("/fetch/*", injector.getInstance(FetchServlet.class));
@@ -147,7 +145,7 @@
final ServletHolder proxyServletHolder = server.addServlet("/gadgets/*", proxyServlet);
proxyServletHolder.setInitParameter("HostHeader", gadgetServerHostname);
- server.addServlet("/", injector.getInstance(WaveClientServlet.class));
+ server.addServlet("/", injector.getInstance(CustomWaveClientServlet.class));
}
public static void main(final String... args) {
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,6 +27,7 @@
import org.ourproject.kune.gallery.server.GalleryServerModule;
import org.ourproject.kune.platf.server.LoggerMethodInterceptor;
import org.ourproject.kune.platf.server.PlatformServerModule;
+import org.ourproject.kune.platf.server.init.FinderRegistry;
import org.ourproject.kune.platf.server.manager.file.EntityLogoDownloadManager;
import org.ourproject.kune.platf.server.manager.file.EntityLogoUploadManager;
import org.ourproject.kune.platf.server.manager.file.FileDownloadManager;
@@ -57,10 +58,10 @@
import com.google.inject.Module;
import com.google.inject.Scope;
import com.google.inject.matcher.Matchers;
+import com.google.inject.persist.jpa.JpaPersistModule;
import com.google.inject.servlet.GuiceFilter;
import com.google.inject.servlet.ServletModule;
import com.google.inject.servlet.SessionScoped;
-import com.wideplay.warp.jpa.JpaUnit;
public class KuneRackModule implements RackModule {
public static final Log LOG = LogFactory.getLog(KuneRackModule.class);
@@ -75,8 +76,8 @@
configModule = new AbstractModule() {
@Override
public void configure() {
+ install(FinderRegistry.init(new JpaPersistModule(jpaUnit)));
bindInterceptor(Matchers.any(), new NotInObject(), new LoggerMethodInterceptor());
- bindConstant().annotatedWith(JpaUnit.class).to(jpaUnit);
bindConstant().annotatedWith(PropertiesFileName.class).to(propertiesFileName);
if (sessionScope != null) {
bindScope(SessionScoped.class, sessionScope);
@@ -100,7 +101,7 @@
builder.exclude("/templates/.*");
/* Wave with context '/' */
- // builder.exclude("/*");
+ builder.exclude("/");
builder.exclude("/attachment/.*");
builder.exclude("/auth/signin");
builder.exclude("/auth/signout");
@@ -114,6 +115,7 @@
builder.exclude("/gadgets");
builder.exclude("/gadgets/.*");
builder.exclude("/socket.io/*");
+ builder.exclude("/socket.io/.*]");
builder.exclude("/socket");
builder.exclude("/static/.*");
builder.exclude("/webclient/.*");
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,8 +20,8 @@
package org.ourproject.kune.platf.client.actions.ui;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.OldAbstractAction;
-import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,10 +19,10 @@
*/
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,8 @@
*/
package org.ourproject.kune.platf.client.actions.ui;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.OldAbstractAction;
-import org.ourproject.kune.platf.client.actions.ActionEvent;
public abstract class AbstractSeparatorDescriptor extends OldGuiActionDescrip {
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,9 +19,9 @@
*/
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import com.google.gwt.resources.client.ImageResource;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,8 +19,8 @@
*/
package org.ourproject.kune.platf.client.actions.ui;
+import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.OldAbstractAction;
-import org.ourproject.kune.platf.client.actions.Action;
import com.google.gwt.resources.client.ImageResource;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/OldGuiActionDescrip.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/OldGuiActionDescrip.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/actions/ui/OldGuiActionDescrip.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,10 +20,10 @@
package org.ourproject.kune.platf.client.actions.ui;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.ChangebleObject;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
/**
* The Class AbstractUIActionDescriptor.
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,11 +19,11 @@
*/
package org.ourproject.kune.platf.client.shortcuts;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.ChangebleObject;
import org.ourproject.kune.platf.client.actions.InputMap;
import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Shortcut;
import com.allen_sauer.gwt.log.client.Log;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,12 +20,12 @@
package org.ourproject.kune.platf.client.ui.rte.basic;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
import org.ourproject.kune.platf.client.actions.OldAbstractAction;
-import org.ourproject.kune.platf.client.actions.KeyStroke;
-import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
import org.ourproject.kune.platf.client.actions.ui.GuiAddCondition;
import org.ourproject.kune.platf.client.actions.ui.IsActionExtensible;
import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
import com.calclab.suco.client.events.Listener0;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -23,13 +23,13 @@
import org.cobogw.gwt.user.client.CSS;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.InputMap;
import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.ui.ComplexToolbar;
+import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
-import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -28,22 +28,22 @@
import java.util.Map;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.AbstractExtendedAction;
import org.ourproject.kune.platf.client.actions.ActionEvent;
import org.ourproject.kune.platf.client.actions.InputMap;
import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Shortcut;
import org.ourproject.kune.platf.client.actions.ui.AbstractActionExtensiblePresenter;
import org.ourproject.kune.platf.client.actions.ui.ButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ui.GuiActionDescCollection;
-import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
import org.ourproject.kune.platf.client.actions.ui.GuiAddCondition;
import org.ourproject.kune.platf.client.actions.ui.MenuCheckItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuRadioItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuSeparatorDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
+import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.PushButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ui.ToolbarSeparatorDescriptor;
import org.ourproject.kune.platf.client.actions.ui.ToolbarSeparatorDescriptor.Type;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -23,20 +23,20 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.PersistenceService;
+import com.google.inject.persist.PersistService;
@Singleton
public class KunePersistenceService {
@Inject
DatabaseInitializer databaseInitializer;
@Inject
- PersistenceService persistenceService;
+ PersistService persistenceService;
public void start() {
try {
persistenceService.start();
databaseInitializer.initConditional();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new ServerException("Error starting persistence service", e);
}
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -99,23 +99,9 @@
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.Comment;
-import cc.kune.domain.Container;
-import cc.kune.domain.Content;
-import cc.kune.domain.ExtMediaDescrip;
-import cc.kune.domain.Group;
-import cc.kune.domain.I18nCountry;
-import cc.kune.domain.I18nLanguage;
-import cc.kune.domain.I18nTranslation;
-import cc.kune.domain.License;
-import cc.kune.domain.Rate;
import cc.kune.domain.SocialNetwork;
-import cc.kune.domain.Tag;
-import cc.kune.domain.TagUserContent;
-import cc.kune.domain.User;
import com.google.inject.matcher.Matchers;
-import com.wideplay.warp.persist.PersistenceService;
-import com.wideplay.warp.persist.UnitOfWork;
public class PlatformServerModule extends AbstractExtendedModule {
private void bindFinders() {
@@ -124,20 +110,8 @@
// created in an ancestor injector whenever possible (...)
// (This fails with finders, then we make explicit bindings)
- bind(User.class);
- bind(Group.class);
- bind(Content.class);
- bind(Container.class);
- bind(License.class);
bind(SocialNetwork.class);
- bind(Rate.class);
- bind(I18nCountry.class);
- bind(I18nLanguage.class);
- bind(I18nTranslation.class);
- bind(Tag.class);
- bind(TagUserContent.class);
bind(Comment.class);
- bind(ExtMediaDescrip.class);
}
private void bindManagers() {
@@ -182,7 +156,7 @@
@Override
protected void configure() {
- install(PersistenceService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());
+ // install(PersistService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());
bind(KunePersistenceService.class);
bindFinders();
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -38,9 +38,10 @@
import cc.kune.core.client.errors.NameInUseException;
import cc.kune.domain.AccessLists;
import cc.kune.domain.Container;
-import cc.kune.domain.Content;
import cc.kune.domain.Group;
import cc.kune.domain.I18nLanguage;
+import cc.kune.domain.finders.ContainerFinder;
+import cc.kune.domain.finders.ContentFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -49,25 +50,26 @@
@Singleton
public class ContainerManagerDefault extends DefaultManager<Container, Long> implements ContainerManager {
- private final Container containerFinder;
- private final Content contentFinder;
+ private final ContainerFinder containerFinder;
+ private final ContentFinder contentFinder;
@Inject
- public ContainerManagerDefault(final Content contentFinder, final Container containerFinder,
+ public ContainerManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
final Provider<EntityManager> provider) {
super(provider, Container.class);
this.contentFinder = contentFinder;
this.containerFinder = containerFinder;
}
+ @Override
public Container createFolder(final Group group, final Container parent, final String name,
final I18nLanguage language, final String typeId) {
FilenameUtils.checkBasicFilename(name);
- String newtitle = findInexistentName(parent, name);
+ final String newtitle = findInexistentName(parent, name);
final List<Container> parentAbsolutePath = parent.getAbsolutePath();
final List<Container> childAbsolutePath = new ArrayList<Container>();
- for (Container parentRef : parentAbsolutePath) {
+ for (final Container parentRef : parentAbsolutePath) {
childAbsolutePath.add(parentRef);
}
// FIXME: use
@@ -82,6 +84,7 @@
return child;
}
+ @Override
public Container createRootFolder(final Group group, final String toolName, final String name, final String type) {
final Container container = new Container(name, group, toolName);
container.setTypeId(type);
@@ -92,15 +95,26 @@
}
/** Duplicate code in ContentMD **/
+ @Override
public boolean findIfExistsTitle(final Container container, final String title) {
return (contentFinder.findIfExistsTitle(container, title) > 0)
|| (containerFinder.findIfExistsTitle(container, title) > 0);
}
+ /** Duplicate code in ContentMD **/
+ private String findInexistentName(final Container container, final String title) {
+ String initialTitle = String.valueOf(title);
+ while (findIfExistsTitle(container, initialTitle)) {
+ initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
+ }
+ return initialTitle;
+ }
+
+ @Override
public Container renameFolder(final Group group, final Container container, final String newName)
throws DefaultException {
FilenameUtils.checkBasicFilename(newName);
- String newNameWithoutNT = FilenameUtils.chomp(newName);
+ final String newNameWithoutNT = FilenameUtils.chomp(newName);
if (container.isRoot()) {
throw new DefaultException("Root folder cannot be renamed");
}
@@ -112,10 +126,12 @@
return container;
}
+ @Override
public SearchResult<Container> search(final String search) {
return this.search(search, null, null);
}
+ @Override
public SearchResult<Container> search(final String search, final Integer firstResult, final Integer maxResults) {
final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "name" }, new StandardAnalyzer());
Query query;
@@ -127,18 +143,10 @@
return super.search(query, firstResult, maxResults);
}
+ @Override
public void setAccessList(final Container container, final AccessLists accessList) {
container.setAccessLists(accessList);
persist(container);
}
- /** Duplicate code in ContentMD **/
- private String findInexistentName(final Container container, final String title) {
- String initialTitle = String.valueOf(title);
- while (findIfExistsTitle(container, initialTitle)) {
- initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
- }
- return initialTitle;
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -48,6 +48,10 @@
import cc.kune.domain.Rate;
import cc.kune.domain.Revision;
import cc.kune.domain.User;
+import cc.kune.domain.finders.ContainerFinder;
+import cc.kune.domain.finders.ContentFinder;
+import cc.kune.domain.finders.I18nLanguageFinder;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -56,17 +60,17 @@
@Singleton
public class ContentManagerDefault extends DefaultManager<Content, Long> implements ContentManager {
+ private final ContainerFinder containerFinder;
+ private final ContentFinder contentFinder;
private final FinderService finder;
- private final User userFinder;
- private final I18nLanguage languageFinder;
- private final Content contentFinder;
- private final Container containerFinder;
+ private final I18nLanguageFinder languageFinder;
private final TagUserContentManager tagManager;
+ private final UserFinder userFinder;
@Inject
- public ContentManagerDefault(final Content contentFinder, final Container containerFinder,
- final Provider<EntityManager> provider, final FinderService finder, final User userFinder,
- final I18nLanguage languageFinder, final TagUserContentManager tagManager) {
+ public ContentManagerDefault(final ContentFinder contentFinder, final ContainerFinder containerFinder,
+ final Provider<EntityManager> provider, final FinderService finder, final UserFinder userFinder,
+ final I18nLanguageFinder languageFinder, final TagUserContentManager tagManager) {
super(provider, Content.class);
this.contentFinder = contentFinder;
this.containerFinder = containerFinder;
@@ -76,6 +80,7 @@
this.tagManager = tagManager;
}
+ @Override
public void addAuthor(final User user, final Long contentId, final String authorShortName) throws DefaultException {
final Content content = finder.getContent(contentId);
final User author = userFinder.getByShortName(authorShortName);
@@ -85,10 +90,11 @@
content.addAuthor(author);
}
+ @Override
public Content createContent(final String title, final String body, final User author, final Container container,
final String typeId) {
FilenameUtils.checkBasicFilename(title);
- String newtitle = findInexistentTitle(container, title);
+ final String newtitle = findInexistentTitle(container, title);
final Content newContent = new Content();
newContent.addAuthor(author);
newContent.setLanguage(author.getLanguage());
@@ -102,19 +108,36 @@
return persist(newContent);
}
+ private MultiFieldQueryParser createMultiFieldParser() {
+ final MultiFieldQueryParser parser = new MultiFieldQueryParser(DEF_GLOBAL_SEARCH_FIELDS, new StandardAnalyzer());
+ return parser;
+ }
+
+ @Override
public boolean findIfExistsTitle(final Container container, final String title) {
return (contentFinder.findIfExistsTitle(container, title) > 0)
|| (containerFinder.findIfExistsTitle(container, title) > 0);
}
+ private String findInexistentTitle(final Container container, final String title) {
+ String initialTitle = String.valueOf(title);
+ while (findIfExistsTitle(container, initialTitle)) {
+ initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
+ }
+ return initialTitle;
+ }
+
+ @Override
public Double getRateAvg(final Content content) {
return finder.getRateAvg(content);
}
+ @Override
public Long getRateByUsers(final Content content) {
return finder.getRateByUsers(content);
}
+ @Override
public Double getRateContent(final User rater, final Content content) {
final Rate rate = finder.getRate(rater, content);
if (rate != null) {
@@ -124,6 +147,7 @@
}
}
+ @Override
public RateResult rateContent(final User rater, final Long contentId, final Double value) throws DefaultException {
final Content content = finder.getContent(contentId);
final Rate oldRate = finder.getRate(rater, content);
@@ -134,11 +158,12 @@
oldRate.setValue(value);
super.persist(oldRate, Rate.class);
}
- Double rateAvg = getRateAvg(content);
- Long rateByUsers = getRateByUsers(content);
+ final Double rateAvg = getRateAvg(content);
+ final Long rateByUsers = getRateByUsers(content);
return new RateResult(rateAvg != null ? rateAvg : 0D, rateByUsers != null ? rateByUsers.intValue() : 0, value);
}
+ @Override
public void removeAuthor(final User user, final Long contentId, final String authorShortName)
throws DefaultException {
final Content content = finder.getContent(contentId);
@@ -149,8 +174,9 @@
content.removeAuthor(author);
}
+ @Override
public Content renameContent(final User user, final Long contentId, final String newTitle) throws DefaultException {
- String newTitleWithoutNL = FilenameUtils.chomp(newTitle);
+ final String newTitleWithoutNL = FilenameUtils.chomp(newTitle);
FilenameUtils.checkBasicFilename(newTitleWithoutNL);
final Content content = finder.getContent(contentId);
if (findIfExistsTitle(content.getContainer(), newTitleWithoutNL)) {
@@ -160,6 +186,7 @@
return content;
}
+ @Override
public Content save(final User editor, final Content content, final String body) {
final Revision revision = new Revision(content);
revision.setEditor(editor);
@@ -169,10 +196,12 @@
return persist(content);
}
+ @Override
public SearchResult<Content> search(final String search) {
return this.search(search, null, null);
}
+ @Override
public SearchResult<Content> search(final String search, final Integer firstResult, final Integer maxResults) {
final MultiFieldQueryParser parser = createMultiFieldParser();
Query query;
@@ -184,22 +213,25 @@
return super.search(query, firstResult, maxResults);
}
+ @Override
public SearchResult<Content> searchMime(final String search, final Integer firstResult, final Integer maxResults,
final String groupShortName, final String mimetype) {
- List<Content> list = contentFinder.findMime(groupShortName, "%" + search + "%", mimetype, firstResult,
+ final List<Content> list = contentFinder.findMime(groupShortName, "%" + search + "%", mimetype, firstResult,
maxResults);
- int count = contentFinder.findMimeCount(groupShortName, "%" + search + "%", mimetype);
+ final int count = contentFinder.findMimeCount(groupShortName, "%" + search + "%", mimetype);
return new SearchResult<Content>(count, list);
}
+ @Override
public SearchResult<?> searchMime(final String search, final Integer firstResult, final Integer maxResults,
final String groupShortName, final String mimetype, final String mimetype2) {
- List<Content> list = contentFinder.find2Mime(groupShortName, "%" + search + "%", mimetype, mimetype2,
+ final List<Content> list = contentFinder.find2Mime(groupShortName, "%" + search + "%", mimetype, mimetype2,
firstResult, maxResults);
- int count = contentFinder.find2MimeCount(groupShortName, "%" + search + "%", mimetype, mimetype2);
+ final int count = contentFinder.find2MimeCount(groupShortName, "%" + search + "%", mimetype, mimetype2);
return new SearchResult<Content>(count, list);
}
+ @Override
public I18nLanguage setLanguage(final User user, final Long contentId, final String languageCode)
throws DefaultException {
final Content content = finder.getContent(contentId);
@@ -211,11 +243,13 @@
return language;
}
+ @Override
public void setPublishedOn(final User user, final Long contentId, final Date publishedOn) throws DefaultException {
final Content content = finder.getContent(contentId);
content.setPublishedOn(publishedOn);
}
+ @Override
public Content setStatus(final Long contentId, final ContentStatus status) {
final Content content = finder.getContent(contentId);
content.setStatus(status);
@@ -234,21 +268,9 @@
return content;
}
+ @Override
public void setTags(final User user, final Long contentId, final String tags) throws DefaultException {
final Content content = finder.getContent(contentId);
tagManager.setTags(user, content, tags);
}
-
- private MultiFieldQueryParser createMultiFieldParser() {
- final MultiFieldQueryParser parser = new MultiFieldQueryParser(DEF_GLOBAL_SEARCH_FIELDS, new StandardAnalyzer());
- return parser;
- }
-
- private String findInexistentTitle(final Container container, final String title) {
- String initialTitle = String.valueOf(title);
- while (findIfExistsTitle(container, initialTitle)) {
- initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
- }
- return initialTitle;
- }
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -26,8 +26,7 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class DatabaseInitializer {
private final ContentManager contentManager;
@@ -205,7 +204,7 @@
}
}
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void initDatabase() throws Exception {
createOthers();
createLicenses();
Added: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/FinderRegistry.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/FinderRegistry.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/init/FinderRegistry.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,37 @@
+package org.ourproject.kune.platf.server.init;
+
+import cc.kune.domain.finders.ContainerFinder;
+import cc.kune.domain.finders.ContentFinder;
+import cc.kune.domain.finders.ExtMediaDescripFinder;
+import cc.kune.domain.finders.GroupFinder;
+import cc.kune.domain.finders.I18nCountryFinder;
+import cc.kune.domain.finders.I18nLanguageFinder;
+import cc.kune.domain.finders.I18nTranslationFinder;
+import cc.kune.domain.finders.LicenseFinder;
+import cc.kune.domain.finders.RateFinder;
+import cc.kune.domain.finders.TagFinder;
+import cc.kune.domain.finders.TagUserContentFinder;
+import cc.kune.domain.finders.UserFinder;
+
+import com.google.inject.Module;
+import com.google.inject.persist.jpa.JpaPersistModule;
+
+public class FinderRegistry {
+
+ public static Module init(final JpaPersistModule jpaPersistModule) {
+ jpaPersistModule.addFinder(ContainerFinder.class);
+ jpaPersistModule.addFinder(ContentFinder.class);
+ jpaPersistModule.addFinder(ExtMediaDescripFinder.class);
+ jpaPersistModule.addFinder(GroupFinder.class);
+ jpaPersistModule.addFinder(I18nCountryFinder.class);
+ jpaPersistModule.addFinder(I18nLanguageFinder.class);
+ jpaPersistModule.addFinder(I18nTranslationFinder.class);
+ jpaPersistModule.addFinder(LicenseFinder.class);
+ jpaPersistModule.addFinder(RateFinder.class);
+ jpaPersistModule.addFinder(TagFinder.class);
+ jpaPersistModule.addFinder(TagUserContentFinder.class);
+ jpaPersistModule.addFinder(UserFinder.class);
+ return jpaPersistModule;
+ }
+
+}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/LicenseManager.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/LicenseManager.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/LicenseManager.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -22,6 +22,7 @@
import java.util.List;
import cc.kune.domain.License;
+import cc.kune.domain.finders.LicenseFinder;
public interface LicenseManager {
@@ -37,6 +38,6 @@
License persist(final License license);
- void setLicenseFinder(final License licenseFinder);
+ void setLicenseFinder(final LicenseFinder licenseFinder);
}
\ No newline at end of file
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/TagUserContentManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/TagUserContentManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/TagUserContentManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -24,7 +24,6 @@
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
-import javax.persistence.Query;
import org.ourproject.kune.platf.server.manager.impl.DefaultManager;
@@ -36,6 +35,7 @@
import cc.kune.domain.Tag;
import cc.kune.domain.TagUserContent;
import cc.kune.domain.User;
+import cc.kune.domain.finders.TagUserContentFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -43,27 +43,45 @@
@Singleton
public class TagUserContentManagerDefault extends DefaultManager<TagUserContent, Long> implements TagUserContentManager {
+ private final TagUserContentFinder finder;
private final Provider<EntityManager> provider;
private final TagManager tagManager;
- private final TagUserContent finder;
@Inject
public TagUserContentManagerDefault(final Provider<EntityManager> provider, final TagManager tagManager,
- final TagUserContent finder) {
+ final TagUserContentFinder finder) {
super(provider, TagUserContent.class);
this.provider = provider;
this.tagManager = tagManager;
this.finder = finder;
}
+ @Override
public List<Tag> find(final User user, final Content content) {
return finder.findTags(user, content);
}
+ private int getMaxCount(final Group group) {
+ // return finder.getMaxGrouped(group);
+ return 0;
+ }
+
+ private int getMinCount(final Group group) {
+ // return finder.getMinGrouped(group);
+ return 0;
+ }
+
+ private List<TagCount> getSummaryByGroup(final Group group) {
+ return new ArrayList<TagCount>();
+ // return finder.getTagsGroups(group);
+ }
+
+ @Override
public TagCloudResult getTagCloudResultByGroup(final Group group) {
return new TagCloudResult(getSummaryByGroup(group), getMaxCount(group), getMinCount(group));
}
+ @Override
public String getTagsAsString(final User user, final Content content) {
String tagConcatenated = "";
if (user.getId() != null) {
@@ -76,12 +94,14 @@
return tagConcatenated.replaceFirst(" ", "");
}
+ @Override
public void remove(final User user, final Content content) {
for (final TagUserContent item : finder.find(user, content)) {
provider.get().remove(item);
}
}
+ @Override
public void setTags(final User user, final Content content, final String tags) {
final ArrayList<String> tagsStripped = TextUtils.splitTags(tags);
final ArrayList<Tag> tagList = new ArrayList<Tag>();
@@ -104,26 +124,4 @@
persist(tagUserContent);
}
}
-
- private int getMaxCount(final Group group) {
- final Query q = provider.get().createNamedQuery(TagUserContent.TAGSMAXGROUPED);
- q.setParameter("group", group);
- final List resultList = q.getResultList();
- return (resultList.size() == 0 ? 0 : ((Long) resultList.get(0)).intValue());
- }
-
- @SuppressWarnings("rawtypes")
- private int getMinCount(final Group group) {
- final Query q = provider.get().createNamedQuery(TagUserContent.TAGSMINGROUPED);
- q.setParameter("group", group);
- final List resultList = q.getResultList();
- return (resultList.size() == 0 ? 0 : ((Long) resultList.get(0)).intValue());
- }
-
- private List<TagCount> getSummaryByGroup(final Group group) {
- final Query q = provider.get().createNamedQuery(TagUserContent.TAGSGROUPED);
- q.setParameter("group", group);
- final List<TagCount> results = q.getResultList();
- return results;
- }
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -42,8 +42,7 @@
import cc.kune.domain.Group;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class EntityLogoUploadManager extends FileUploadManagerAbstract {
@@ -95,7 +94,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
final FileItem file, final String typeId) throws Exception {
final String mimeTypeS = file.getContentType();
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -47,24 +47,23 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
+import com.google.inject.persist.Transactional;
import com.google.inject.servlet.RequestScoped;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
@RequestScoped
public class FileUploadManager extends FileJsonUploadManagerAbstract {
private static final long serialVersionUID = -7209922761735338754L;
@Inject
- UserSession userSession;
+ AccessService accessService;
@Inject
ContentManager contentManager;
@Inject
- AccessService accessService;
- @Inject
FileManager fileManager;
@Inject
I18nTranslationService i18n;
+ @Inject
+ UserSession userSession;
@Override
protected void beforePostStart() {
@@ -104,7 +103,7 @@
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
Content createUploadedFileWrapped(final String userHash, final StateToken stateToken, final String fileName,
final FileItem fileUploadItem, final String typeId) throws Exception {
final String relDir = FileUtils.toDir(stateToken);
@@ -137,8 +136,8 @@
final User user = userSession.getUser();
final Container container = accessService.accessToContainer(ContentUtils.parseId(stateToken.getFolder()),
user, AccessRol.Editor);
- final Content content = contentManager.createContent(FileUtils.getFileNameWithoutExtension(file.getName(),
- extension), preview, user, container, typeId);
+ final Content content = contentManager.createContent(
+ FileUtils.getFileNameWithoutExtension(file.getName(), extension), preview, user, container, typeId);
content.setMimeType(basicMimeType);
content.setFilename(file.getName());
return content;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.server.manager.ExtMediaDescripManager;
import cc.kune.domain.ExtMediaDescrip;
+import cc.kune.domain.finders.ExtMediaDescripFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -35,14 +36,16 @@
public class ExtMediaDescripManagerDefault extends DefaultManager<ExtMediaDescrip, Long> implements
ExtMediaDescripManager {
- private final ExtMediaDescrip extMediaFinder;
+ private final ExtMediaDescripFinder extMediaFinder;
@Inject
- public ExtMediaDescripManagerDefault(final Provider<EntityManager> provider, final ExtMediaDescrip extMediaFinder) {
+ public ExtMediaDescripManagerDefault(final Provider<EntityManager> provider,
+ final ExtMediaDescripFinder extMediaFinder) {
super(provider, ExtMediaDescrip.class);
this.extMediaFinder = extMediaFinder;
}
+ @Override
public List<ExtMediaDescrip> getAll() {
return extMediaFinder.getAll();
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -53,6 +53,9 @@
import cc.kune.domain.SocialNetwork;
import cc.kune.domain.ToolConfiguration;
import cc.kune.domain.User;
+import cc.kune.domain.finders.GroupFinder;
+import cc.kune.domain.finders.LicenseFinder;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -61,19 +64,19 @@
@Singleton
public class GroupManagerDefault extends DefaultManager<Group, Long> implements GroupManager {
- private final Group finder;
+ private final GroupFinder finder;
private final KuneProperties kuneProperties;
- private final License licenseFinder;
+ private final LicenseFinder licenseFinder;
private final LicenseManager licenseManager;
private final DatabaseProperties properties;
private final ServerToolRegistry registry;
private final ServerToolRegistry serverToolRegistry;
- private final User userFinder;
+ private final UserFinder userFinder;
@Inject
- public GroupManagerDefault(final Provider<EntityManager> provider, final Group finder, final User userFinder,
- final KuneProperties kuneProperties, final DatabaseProperties properties,
- final ServerToolRegistry registry, final LicenseManager licenseManager, final License licenseFinder,
+ 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) {
super(provider, Group.class);
this.finder = finder;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nCountryManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nCountryManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nCountryManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.server.manager.I18nCountryManager;
import cc.kune.domain.I18nCountry;
+import cc.kune.domain.finders.I18nCountryFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -34,19 +35,21 @@
@Singleton
public class I18nCountryManagerDefault extends DefaultManager<I18nCountry, Long> implements I18nCountryManager {
- private final I18nCountry finder;
+ private final I18nCountryFinder finder;
@Inject
- public I18nCountryManagerDefault(final Provider<EntityManager> provider, final I18nCountry finder) {
+ public I18nCountryManagerDefault(final Provider<EntityManager> provider, final I18nCountryFinder finder) {
super(provider, I18nCountry.class);
this.finder = finder;
}
+ @Override
+ public I18nCountry findByCode(final String country) {
+ return finder.findByCode(country);
+ }
+
+ @Override
public List<I18nCountry> getAll() {
return finder.getAll();
}
-
- public I18nCountry findByCode(final String country) {
- return finder.findByCode(country);
- }
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nLanguageManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nLanguageManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nLanguageManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.server.manager.I18nLanguageManager;
import cc.kune.domain.I18nLanguage;
+import cc.kune.domain.finders.I18nLanguageFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -34,18 +35,20 @@
@Singleton
public class I18nLanguageManagerDefault extends DefaultManager<I18nLanguage, Long> implements I18nLanguageManager {
- private final I18nLanguage finder;
+ private final I18nLanguageFinder finder;
@Inject
- public I18nLanguageManagerDefault(final Provider<EntityManager> provider, final I18nLanguage finder) {
+ public I18nLanguageManagerDefault(final Provider<EntityManager> provider, final I18nLanguageFinder finder) {
super(provider, I18nLanguage.class);
this.finder = finder;
}
+ @Override
public I18nLanguage findByCode(final String language) {
return finder.findByCode(language);
}
+ @Override
public List<I18nLanguage> getAll() {
return finder.getAll();
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -32,6 +32,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.domain.I18nLanguage;
import cc.kune.domain.I18nTranslation;
+import cc.kune.domain.finders.I18nTranslationFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -41,12 +42,12 @@
public class I18nTranslationManagerDefault extends DefaultManager<I18nTranslation, Long> implements
I18nTranslationManager {
- private final I18nTranslation finder;
+ private final I18nTranslationFinder finder;
private final ConcurrentHashMap<String, HashMap<String, String>> langCache;
private final I18nLanguageManager languageManager;
@Inject
- public I18nTranslationManagerDefault(final Provider<EntityManager> provider, final I18nTranslation finder,
+ public I18nTranslationManagerDefault(final Provider<EntityManager> provider, final I18nTranslationFinder finder,
final I18nLanguageManager languageManager) {
super(provider, I18nTranslation.class);
this.finder = finder;
@@ -54,6 +55,7 @@
langCache = new ConcurrentHashMap<String, HashMap<String, String>>();
}
+ @Override
public HashMap<String, String> getLexicon(final String language) {
HashMap<String, String> map = langCache.get(language);
if (map == null) {
@@ -62,11 +64,27 @@
return map;
}
+ @SuppressWarnings("unchecked")
+ private HashMap<String, String> getLexiconFromDb(final String language) {
+ HashMap<String, String> map = new HashMap<String, String>();
+ final List<I18nTranslation> set = finder.findByLanguage(language);
+ if (!language.equals(I18nTranslation.DEFAULT_LANG)) {
+ map = (HashMap<String, String>) getLexicon(I18nTranslation.DEFAULT_LANG).clone();
+ }
+ for (final I18nTranslation trans : set) {
+ map.put(trans.getTrKey(), trans.getText());
+ }
+ langCache.put(language, map);
+ return map;
+ }
+
+ @Override
public List<I18nTranslation> getTranslatedLexicon(final String languageCode) {
final I18nLanguage language = languageManager.findByCode(languageCode);
return finder.getTranslatedLexicon(language);
}
+ @Override
public SearchResult<I18nTranslation> getTranslatedLexicon(final String languageCode, final Integer firstResult,
final Integer maxResults) {
final I18nLanguage language = languageManager.findByCode(languageCode);
@@ -75,6 +93,7 @@
return new SearchResult<I18nTranslation>(count.intValue(), list);
}
+ @Override
public String getTranslation(final String language, final String text) {
final HashMap<String, String> lexicon = getLexicon(language);
final String escapedText = TextUtils.escapeHtmlLight(text);
@@ -95,23 +114,27 @@
}
}
+ @Override
public String getTranslation(final String language, final String text, final Integer arg) {
String translation = getTranslation(language, text);
translation = translation.replaceFirst("\\[%d\\]", arg.toString());
return translation;
}
+ @Override
public String getTranslation(final String language, final String text, final String arg) {
String translation = getTranslation(language, text);
translation = translation.replaceFirst("\\[%s\\]", arg);
return translation;
}
+ @Override
public List<I18nTranslation> getUntranslatedLexicon(final String languageCode) {
final I18nLanguage language = initUnstranlated(languageCode);
return finder.getUnstranslatedLexicon(language);
}
+ @Override
public SearchResult<I18nTranslation> getUntranslatedLexicon(final String languageCode, final Integer firstResult,
final Integer maxResults) {
final I18nLanguage language = initUnstranlated(languageCode);
@@ -120,6 +143,24 @@
return new SearchResult<I18nTranslation>(count.intValue(), list);
}
+ private I18nLanguage initUnstranlated(final String languageCode) {
+ final I18nLanguage defLanguage = languageManager.findByCode(I18nTranslation.DEFAULT_LANG);
+ I18nLanguage language;
+ if (languageCode.equals(I18nTranslation.DEFAULT_LANG)) {
+ language = defLanguage;
+ } else {
+ language = languageManager.findByCode(languageCode);
+ final List<I18nTranslation> list = finder.getNonExistentFromDefault(defLanguage, language);
+ for (final I18nTranslation defTrans : list) {
+ final I18nTranslation newTrans = defTrans.cloneForNewLanguage();
+ newTrans.setLanguage(language);
+ persist(newTrans);
+ }
+ }
+ return language;
+ }
+
+ @Override
public String setTranslation(final String id, final String translation) throws DefaultException {
final I18nTranslation trans = super.find(Long.valueOf(id));
if (trans != null) {
@@ -132,6 +173,7 @@
}
}
+ @Override
public void setTranslation(final String languageId, final String text, final String translation) {
final I18nLanguage language = languageManager.findByCode(languageId);
final I18nTranslation newTranslation = new I18nTranslation(text, language, translation);
@@ -143,35 +185,4 @@
}
}
- @SuppressWarnings("unchecked")
- private HashMap<String, String> getLexiconFromDb(final String language) {
- HashMap<String, String> map = new HashMap<String, String>();
- final List<I18nTranslation> set = finder.findByLanguage(language);
- if (!language.equals(I18nTranslation.DEFAULT_LANG)) {
- map = (HashMap<String, String>) getLexicon(I18nTranslation.DEFAULT_LANG).clone();
- }
- for (I18nTranslation trans : set) {
- map.put(trans.getTrKey(), trans.getText());
- }
- langCache.put(language, map);
- return map;
- }
-
- private I18nLanguage initUnstranlated(final String languageCode) {
- final I18nLanguage defLanguage = languageManager.findByCode(I18nTranslation.DEFAULT_LANG);
- I18nLanguage language;
- if (languageCode.equals(I18nTranslation.DEFAULT_LANG)) {
- language = defLanguage;
- } else {
- language = languageManager.findByCode(languageCode);
- final List<I18nTranslation> list = finder.getNonExistentFromDefault(defLanguage, language);
- for (I18nTranslation defTrans : list) {
- final I18nTranslation newTrans = defTrans.cloneForNewLanguage();
- newTrans.setLanguage(language);
- persist(newTrans);
- }
- }
- return language;
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,6 +27,7 @@
import org.ourproject.kune.platf.server.properties.DatabaseProperties;
import cc.kune.domain.License;
+import cc.kune.domain.finders.LicenseFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -34,34 +35,39 @@
@Singleton
public class LicenseManagerDefault extends DefaultManager<License, Long> implements LicenseManager {
- private License licenseFinder;
+ private LicenseFinder licenseFinder;
private final DatabaseProperties properties;
@Inject
public LicenseManagerDefault(final Provider<EntityManager> provider, final DatabaseProperties properties,
- final License licenseFinder) {
+ final LicenseFinder licenseFinder) {
super(provider, License.class);
this.properties = properties;
this.licenseFinder = licenseFinder;
}
+ @Override
public License findByShortName(final String shortName) {
return licenseFinder.findByShortName(shortName);
}
+ @Override
public List<License> getAll() {
return licenseFinder.getAll();
}
+ @Override
public List<License> getCC() {
return licenseFinder.getCC();
}
+ @Override
public License getDefLicense() {
final String licenseDefId = properties.getDefaultLicense();
return licenseFinder.findByShortName(licenseDefId);
}
+ @Override
public List<License> getNotCC() {
return licenseFinder.getNotCC();
}
@@ -71,8 +77,9 @@
return super.persist(license);
}
+ @Override
@Inject
- public void setLicenseFinder(final License licenseFinder) {
+ public void setLicenseFinder(final LicenseFinder licenseFinder) {
this.licenseFinder = licenseFinder;
}
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/RateManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/RateManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/RateManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,6 +27,7 @@
import cc.kune.domain.Content;
import cc.kune.domain.Rate;
import cc.kune.domain.User;
+import cc.kune.domain.finders.RateFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -35,26 +36,29 @@
@Singleton
public class RateManagerDefault extends DefaultManager<Rate, Long> implements RateManager {
- private final Rate finder;
+ private final RateFinder finder;
@Inject
- public RateManagerDefault(final Provider<EntityManager> provider, final Rate finder) {
+ public RateManagerDefault(final Provider<EntityManager> provider, final RateFinder finder) {
super(provider, Rate.class);
this.finder = finder;
}
+ @Override
public Rate find(final User user, final Content content) {
try {
return finder.find(user, content);
- } catch (NoResultException e) {
+ } catch (final NoResultException e) {
return null;
}
}
+ @Override
public Double getRateAvg(final Content content) {
return finder.calculateRate(content);
}
+ @Override
public Long getRateByUsers(final Content content) {
return finder.calculateRateNumberOfUsers(content);
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -44,6 +44,7 @@
import cc.kune.domain.Group;
import cc.kune.domain.SocialNetwork;
import cc.kune.domain.User;
+import cc.kune.domain.finders.GroupFinder;
import cc.kune.domain.utils.ParticipationData;
import cc.kune.domain.utils.SocialNetworkData;
import cc.kune.domain.utils.UserBuddiesData;
@@ -55,12 +56,12 @@
@Singleton
public class SocialNetworkManagerDefault extends DefaultManager<SocialNetwork, Long> implements SocialNetworkManager {
- private final Group finder;
private final AccessRightsService accessRightsService;
+ private final GroupFinder finder;
private final UserManager userManager;
@Inject
- public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final Group finder,
+ public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder,
final AccessRightsService accessRightsService, final UserManager userManager) {
super(provider, SocialNetwork.class);
this.finder = finder;
@@ -68,6 +69,7 @@
this.userManager = userManager;
}
+ @Override
public void acceptJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
AccessViolationException {
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -81,6 +83,12 @@
}
}
+ void addAdmin(final User newAdmin, final Group group) {
+ final SocialNetwork sn = group.getSocialNetwork();
+ sn.addAdmin(newAdmin.getUserGroup());
+ }
+
+ @Override
public void addGroupToAdmins(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
checkGroupAddingToSelf(group, inGroup);
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -92,6 +100,7 @@
}
}
+ @Override
public void addGroupToCollabs(final User userLogged, final Group group, final Group inGroup)
throws DefaultException {
checkGroupAddingToSelf(group, inGroup);
@@ -104,6 +113,7 @@
}
}
+ @Override
public void addGroupToViewers(final User userLogged, final Group group, final Group inGroup)
throws DefaultException {
checkGroupAddingToSelf(group, inGroup);
@@ -116,6 +126,25 @@
}
}
+ private void checkGroupAddingToSelf(final Group group, final Group inGroup) throws DefaultException {
+ if (group.equals(inGroup)) {
+ throwGroupMemberException(group);
+ }
+ }
+
+ private void checkGroupIsNotAlreadyAMember(final Group group, final SocialNetwork sn) throws DefaultException {
+ if (sn.isAdmin(group) || sn.isCollab(group) || sn.isViewer(group) && notEveryOneCanView(sn)) {
+ throwGroupMemberException(group);
+ }
+ }
+
+ private void checkUserLoggedIsAdmin(final User userLogged, final SocialNetwork sn) throws AccessViolationException {
+ if (!accessRightsService.get(userLogged, sn.getAccessLists()).isAdministrable()) {
+ throw new AccessViolationException();
+ }
+ }
+
+ @Override
public void deleteMember(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
AccessViolationException {
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -124,6 +153,7 @@
unJoinGroup(group, inGroup);
}
+ @Override
public void denyJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
final SocialNetwork sn = inGroup.getSocialNetwork();
checkUserLoggedIsAdmin(userLogged, sn);
@@ -135,6 +165,7 @@
}
}
+ @Override
public ParticipationData findParticipation(final User userLogged, final Group group)
throws AccessViolationException {
get(userLogged, group); // check access
@@ -149,6 +180,7 @@
return new ParticipationData(adminInGroups, collabInGroups);
}
+ @Override
public SocialNetwork get(final User petitioner, final Group group) throws AccessViolationException {
final SocialNetwork sn = group.getSocialNetwork();
if (!sn.getAccessLists().getViewers().includes(petitioner.getUserGroup())) {
@@ -157,18 +189,19 @@
return sn;
}
+ @Override
public SocialNetworkData getSocialNetworkData(final User userLogged, final Group group) {
- SocialNetworkData socialNetData = new SocialNetworkData();
+ final SocialNetworkData socialNetData = new SocialNetworkData();
socialNetData.setGroupMembers(get(userLogged, group));
- AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
+ final AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
socialNetData.setGroupRights(groupRights);
socialNetData.setUserParticipation(findParticipation(userLogged, group));
socialNetData.setGroupMembers(get(userLogged, group));
if (group.isPersonal()) {
- UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
- User userGroup = userManager.findByShortname(group.getShortName());
+ final UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
+ final User userGroup = userManager.findByShortname(group.getShortName());
socialNetData.setUserBuddies(userBuddies);
- UserBuddiesVisibility buddiesVisibility = userGroup.getBuddiesVisibility();
+ final UserBuddiesVisibility buddiesVisibility = userGroup.getBuddiesVisibility();
socialNetData.setIsBuddiesVisible(true);
switch (buddiesVisibility) {
case anyone:
@@ -180,8 +213,8 @@
}
break;
case yourbuddies:
- boolean notMe = !userLogged.equals(userGroup);
- boolean notABuddie = !userBuddies.contains(userLogged.getShortName());
+ final boolean notMe = !userLogged.equals(userGroup);
+ final boolean notABuddie = !userBuddies.contains(userLogged.getShortName());
if (notMe && notABuddie) {
socialNetData.setIsBuddiesVisible(false);
socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
@@ -190,7 +223,7 @@
}
socialNetData.setUserBuddiesVisibility(buddiesVisibility);
} else {
- SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
+ final SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
socialNetData.setIsMembersVisible(true);
switch (visibility) {
case anyone:
@@ -214,6 +247,23 @@
return socialNetData;
}
+ private boolean isClosed(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Closed);
+ }
+
+ private boolean isModerated(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Moderated);
+ }
+
+ private boolean isOpen(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Open);
+ }
+
+ private boolean notEveryOneCanView(final SocialNetwork sn) {
+ return !sn.getAccessLists().getViewers().getMode().equals(GroupListMode.EVERYONE);
+ }
+
+ @Override
public SocialNetworkRequestResult requestToJoin(final User userLogged, final Group inGroup)
throws DefaultException, UserMustBeLoggedException {
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -246,6 +296,7 @@
}
}
+ @Override
public void setAdminAsCollab(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
final SocialNetwork sn = inGroup.getSocialNetwork();
checkUserLoggedIsAdmin(userLogged, sn);
@@ -260,6 +311,7 @@
}
}
+ @Override
public void setCollabAsAdmin(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
final SocialNetwork sn = inGroup.getSocialNetwork();
checkUserLoggedIsAdmin(userLogged, sn);
@@ -271,6 +323,15 @@
}
}
+ private void throwGroupMemberException(final Group group) throws DefaultException {
+ if (group.isPersonal()) {
+ throw new AlreadyUserMemberException();
+ } else {
+ throw new AlreadyGroupMemberException();
+ }
+ }
+
+ @Override
public void unJoinGroup(final Group groupToUnJoin, final Group inGroup) throws DefaultException {
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -291,51 +352,4 @@
}
}
- void addAdmin(final User newAdmin, final Group group) {
- final SocialNetwork sn = group.getSocialNetwork();
- sn.addAdmin(newAdmin.getUserGroup());
- }
-
- private void checkGroupAddingToSelf(final Group group, final Group inGroup) throws DefaultException {
- if (group.equals(inGroup)) {
- throwGroupMemberException(group);
- }
- }
-
- private void checkGroupIsNotAlreadyAMember(final Group group, final SocialNetwork sn) throws DefaultException {
- if (sn.isAdmin(group) || sn.isCollab(group) || sn.isViewer(group) && notEveryOneCanView(sn)) {
- throwGroupMemberException(group);
- }
- }
-
- private void checkUserLoggedIsAdmin(final User userLogged, final SocialNetwork sn) throws AccessViolationException {
- if (!accessRightsService.get(userLogged, sn.getAccessLists()).isAdministrable()) {
- throw new AccessViolationException();
- }
- }
-
- private boolean isClosed(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Closed);
- }
-
- private boolean isModerated(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Moderated);
- }
-
- private boolean isOpen(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Open);
- }
-
- private boolean notEveryOneCanView(final SocialNetwork sn) {
- return !sn.getAccessLists().getViewers().getMode().equals(GroupListMode.EVERYONE);
- }
-
- private void throwGroupMemberException(final Group group) throws DefaultException {
- if (group.isPersonal()) {
- throw new AlreadyUserMemberException();
- } else {
- throw new AlreadyGroupMemberException();
- }
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/TagManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/TagManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/TagManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -24,6 +24,7 @@
import org.ourproject.kune.platf.server.manager.TagManager;
import cc.kune.domain.Tag;
+import cc.kune.domain.finders.TagFinder;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -32,14 +33,15 @@
@Singleton
public class TagManagerDefault extends DefaultManager<Tag, Long> implements TagManager {
- private final Tag tagFinder;
+ private final TagFinder tagFinder;
@Inject
- public TagManagerDefault(final Provider<EntityManager> provider, final Tag tagFinder) {
+ public TagManagerDefault(final Provider<EntityManager> provider, final TagFinder tagFinder) {
super(provider, Tag.class);
this.tagFinder = tagFinder;
}
+ @Override
public Tag findByTagName(final String tag) {
return tagFinder.findByTagName(tag);
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -46,6 +46,7 @@
import cc.kune.domain.I18nCountry;
import cc.kune.domain.I18nLanguage;
import cc.kune.domain.User;
+import cc.kune.domain.finders.UserFinder;
import cc.kune.domain.utils.UserBuddiesData;
import cc.kune.wave.server.CustomUserRegistrationServlet;
@@ -56,7 +57,7 @@
@Singleton
public class UserManagerDefault extends DefaultManager<User, Long> implements UserManager {
private final I18nCountryManager countryManager;
- private final User finder;
+ private final UserFinder finder;
private final I18nTranslationService i18n;
private final I18nLanguageManager languageManager;
private final ChatProperties properties;
@@ -65,7 +66,7 @@
private final XmppManager xmppManager;
@Inject
- public UserManagerDefault(final Provider<EntityManager> provider, final User finder,
+ public UserManagerDefault(final Provider<EntityManager> provider, final UserFinder finder,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
final XmppManager xmppManager, final ChatProperties properties, final I18nTranslationService i18n,
final CustomUserRegistrationServlet waveUserRegister) {
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -72,8 +72,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class ContentRPC implements ContentService, RPC {
@@ -116,7 +115,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void addAuthor(final String userHash, final StateToken token, final String authorShortName)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -127,7 +126,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public CommentDTO addComment(final String userHash, final StateToken token, final Long parentCommentId,
final String commentText) throws DefaultException {
final User author = getCurrentUser();
@@ -139,7 +138,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public CommentDTO addComment(final String userHash, final StateToken token, final String commentText)
throws DefaultException {
final User author = getCurrentUser();
@@ -151,7 +150,7 @@
@Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateContentDTO addContent(final String userHash, final StateToken parentToken, final String title,
final String typeId) throws DefaultException {
final String body = "";
@@ -161,7 +160,7 @@
@Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateContainerDTO addFolder(final String userHash, final StateToken parentToken, final String title,
final String contentTypeId) throws DefaultException {
final User user = getCurrentUser();
@@ -173,7 +172,7 @@
@Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateContainerDTO addRoom(final String userHash, final StateToken parentToken, final String roomName)
throws DefaultException {
// final String groupShortName = parentToken.getGroup();
@@ -205,7 +204,7 @@
@Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateContentDTO addWave(final String userHash, final StateToken parentToken, final String typeId,
final String waveId) throws DefaultException {
return createContent(parentToken, "Wave embeded test", typeId, waveId);
@@ -232,7 +231,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateContentDTO delContent(final String userHash, final StateToken token) throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
return getState(getCurrentUser(), contentManager.setStatus(contentId, ContentStatus.inTheDustbin));
@@ -240,7 +239,7 @@
@Override
@Authenticated(mandatory = false)
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public StateAbstractDTO getContent(final String userHash, final StateToken token) throws DefaultException {
Group defaultGroup;
final User user = getCurrentUser();
@@ -302,7 +301,7 @@
@Override
@Authenticated(mandatory = false)
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public TagCloudResult getSummaryTags(final String userHash, final StateToken groupToken) {
final Group group = groupManager.findByShortName(groupToken.getGroup());
return getSummaryTags(group);
@@ -350,7 +349,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public CommentDTO markCommentAsAbuse(final String userHash, final StateToken token, final Long commentId)
throws DefaultException {
final User informer = getCurrentUser();
@@ -362,7 +361,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public RateResult rateContent(final String userHash, final StateToken token, final Double value)
throws DefaultException {
final User rater = getCurrentUser();
@@ -378,7 +377,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void removeAuthor(final String userHash, final StateToken token, final String authorShortName)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -389,7 +388,7 @@
@Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateAbstractDTO renameContainer(final String userHash, final StateToken token, final String newName)
throws DefaultException {
renameFolder(token.getGroup(), ContentUtils.parseId(token.getFolder()), newName);
@@ -399,7 +398,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateAbstractDTO renameContent(final String userHash, final StateToken token, final String newName)
throws DefaultException {
final User user = getCurrentUser();
@@ -430,7 +429,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void save(final String userHash, final StateToken token, final String textContent) throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -442,7 +441,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public ContentSimpleDTO setAsDefaultContent(final String userHash, final StateToken token) {
final Content content = contentManager.find(ContentUtils.parseId(token.getDocument()));
groupManager.setDefaultContent(token.getGroup(), content);
@@ -452,7 +451,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public I18nLanguageDTO setLanguage(final String userHash, final StateToken token, final String languageCode)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -463,7 +462,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void setPublishedOn(final String userHash, final StateToken token, final Date publishedOn)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -474,7 +473,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateAbstractDTO setStatus(final String userHash, final StateToken token, final ContentStatus status) {
if (status.equals(ContentStatus.publishedOnline) || status.equals(ContentStatus.rejected)
|| status.equals(ContentStatus.inTheDustbin)) {
@@ -488,7 +487,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public StateAbstractDTO setStatusAsAdmin(final String userHash, final StateToken token, final ContentStatus status) {
final Content content = contentManager.setStatus(ContentUtils.parseId(token.getDocument()),
ContentStatus.valueOf(status.toString()));
@@ -498,7 +497,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public TagCloudResult setTags(final String userHash, final StateToken token, final String tags)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
@@ -511,7 +510,7 @@
@Override
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public CommentDTO voteComment(final String userHash, final StateToken token, final Long commentId,
final boolean votePositive) throws DefaultException {
final User voter = getCurrentUser();
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -43,15 +43,14 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class GroupRPC implements RPC, GroupService {
+ private final ContentManager contentManager;
+ private final GroupManager groupManager;
private final Mapper mapper;
- private final GroupManager groupManager;
private final Provider<UserSession> userSessionProvider;
- private final ContentManager contentManager;
@Inject
public GroupRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
@@ -62,18 +61,20 @@
this.mapper = mapper;
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license) {
final User user = getUserLogged();
final Group group = groupManager.findByShortName(groupToken.getGroup());
groupManager.changeDefLicense(user, group, license.getShortName());
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void changeGroupWsTheme(final String userHash, final StateToken groupToken, final String theme)
throws DefaultException {
final User user = getUserLogged();
@@ -81,17 +82,19 @@
groupManager.changeWsTheme(user, group, theme);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public GroupDTO clearGroupBackImage(final String userHash, final StateToken token) {
final Group group = groupManager.findByShortName(token.getGroup());
groupManager.clearGroupBackImage(group);
return mapper.map(group, GroupDTO.class);
}
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
+ @Transactional(rollbackOn = DefaultException.class)
public StateToken createNewGroup(final String userHash, final GroupDTO groupDTO, final String publicDesc,
final String tags, final String[] enabledTools) throws DefaultException {
final User user = getUserLogged();
@@ -103,6 +106,7 @@
return newGroup.getDefaultContent().getStateToken();
};
+ @Override
@Authenticated(mandatory = false)
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
public GroupDTO getGroup(final String userHash, final StateToken groupToken) {
@@ -110,9 +114,20 @@
return mapper.map(group, GroupDTO.class);
}
+ private User getUserLogged() {
+ final UserSession userSession = getUserSession();
+ final User user = userSession.getUser();
+ return user;
+ }
+
+ private UserSession getUserSession() {
+ return userSessionProvider.get();
+ }
+
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public GroupDTO setGroupBackImage(final String userHash, final StateToken token) {
final Group group = groupManager.findByShortName(token.getGroup());
final Content content = contentManager.find(ContentUtils.parseId(token.getDocument()));
@@ -120,40 +135,33 @@
return mapper.map(group, GroupDTO.class);
}
+ @Override
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void setGroupNewMembersJoiningPolicy(final String userHash, final StateToken token,
final AdmissionType admissionPolicy) {
final Group group = groupManager.findByShortName(token.getGroup());
group.setAdmissionType(AdmissionType.valueOf(admissionPolicy.toString()));
}
+ @Override
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void setSocialNetworkVisibility(final String userHash, final StateToken token,
final SocialNetworkVisibility visibility) {
final Group group = groupManager.findByShortName(token.getGroup());
group.getSocialNetwork().setVisibility(SocialNetworkVisibility.valueOf(visibility.toString()));
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void setToolEnabled(final String userHash, final StateToken groupToken, final String toolName,
final boolean enabled) {
groupManager.setToolEnabled(getUserLogged(), groupToken.getGroup(), toolName, enabled);
}
- private User getUserLogged() {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
- return user;
- }
-
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/I18nRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/I18nRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/I18nRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -40,16 +40,15 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class I18nRPC implements RPC, I18nService {
private final I18nTranslationManager i18nTranslationManager;
- private final Provider<UserSession> userSessionProvider;
- private final Provider<HttpServletRequest> requestProvider;
private final I18nLanguageManager languageManager;
private final Mapper mapper;
+ private final Provider<HttpServletRequest> requestProvider;
+ private final Provider<UserSession> userSessionProvider;
@Inject
public I18nRPC(final Provider<HttpServletRequest> requestProvider, final Provider<UserSession> userSessionProvider,
@@ -62,7 +61,8 @@
this.mapper = mapper;
}
- @Transactional(type = TransactionType.READ_ONLY)
+ @Override
+ @Transactional
public I18nLanguageDTO getInitialLanguage(final String localeParam) {
String initLanguage;
I18nLanguage lang;
@@ -96,12 +96,14 @@
return mapper.map(lang, I18nLanguageDTO.class);
}
- @Transactional(type = TransactionType.READ_ONLY)
+ @Override
+ @Transactional
public HashMap<String, String> getLexicon(final String language) {
return i18nTranslationManager.getLexicon(language);
}
- @Transactional(type = TransactionType.READ_WRITE)
+ @Override
+ @Transactional
public String getTranslation(final String userHash, final String language, final String text) {
String translation = null;
try {
@@ -111,13 +113,6 @@
return translation;
}
- @Authenticated
- @Transactional(type = TransactionType.READ_WRITE)
- public String setTranslation(final String userHash, final String id, final String translation)
- throws DefaultException {
- return i18nTranslationManager.setTranslation(id, translation);
- }
-
@Authenticated(mandatory = false)
private String getTranslationWrapper(final String language, final String text) {
return i18nTranslationManager.getTranslation(language, text);
@@ -127,4 +122,12 @@
return userSessionProvider.get();
}
+ @Override
+ @Authenticated
+ @Transactional
+ public String setTranslation(final String userHash, final String id, final String translation)
+ throws DefaultException {
+ return i18nTranslationManager.setTranslation(id, translation);
+ }
+
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -41,22 +41,21 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class SiteRPC implements RPC, SiteService {
- private final Mapper mapper;
- private final Provider<UserSession> userSessionProvider;
- private final LicenseManager licenseManager;
- private final UserManager userManager;
private final ChatProperties chatProperties;
- private final UserInfoService userInfoService;
+ private final I18nCountryManager countryManager;
+ private final ExtMediaDescripManager extMediaDescManager;
private final KuneProperties kuneProperties;
private final I18nLanguageManager languageManager;
- private final I18nCountryManager countryManager;
+ private final LicenseManager licenseManager;
+ private final Mapper mapper;
private final ServerToolRegistry serverToolRegistry;
- private final ExtMediaDescripManager extMediaDescManager;
+ private final UserInfoService userInfoService;
+ private final UserManager userManager;
+ private final Provider<UserSession> userSessionProvider;
// TODO: refactor: too many parameters! refactor to Facade Pattern
@Inject
@@ -78,7 +77,8 @@
this.extMediaDescManager = extMediaDescManager;
}
- @Transactional(type = TransactionType.READ_ONLY)
+ @Override
+ @Transactional
public InitDataDTO getInitData(final String userHash) throws DefaultException {
final InitData data = new InitData();
final UserSession userSession = getUserSession();
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -39,16 +39,15 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class SocialNetworkRPC implements SocialNetworkService, RPC {
- private final Provider<UserSession> userSessionProvider;
private final GroupManager groupManager;
+ private final Mapper mapper;
private final SocialNetworkManager socialNetworkManager;
- private final Mapper mapper;
+ private final Provider<UserSession> userSessionProvider;
@Inject
public SocialNetworkRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
@@ -59,9 +58,10 @@
this.mapper = mapper;
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO acceptJoinGroup(final String hash, final StateToken groupToken,
final String groupToAcceptShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -72,9 +72,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO addAdminMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -85,9 +86,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO addCollabMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -98,9 +100,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO addViewerMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -111,9 +114,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO deleteMember(final String hash, final StateToken groupToken,
final String groupToDeleleShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -124,9 +128,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO denyJoinGroup(final String hash, final StateToken groupToken,
final String groupToDenyShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -137,10 +142,15 @@
return generateResponse(userLogged, group);
}
+ private SocialNetworkDataDTO generateResponse(final User userLogged, final Group group) {
+ return mapper.map(socialNetworkManager.getSocialNetworkData(userLogged, group), SocialNetworkDataDTO.class);
+ }
+
+ @Override
@Authenticated(mandatory = false)
// At least you can access as Viewer to the Group
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public SocialNetworkDataDTO getSocialNetwork(final String hash, final StateToken groupToken)
throws DefaultException {
final UserSession userSession = getUserSession();
@@ -149,8 +159,13 @@
return generateResponse(user, group);
}
+ private UserSession getUserSession() {
+ return userSessionProvider.get();
+ }
+
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkRequestResult requestJoinGroup(final String hash, final StateToken groupToken)
throws DefaultException {
final UserSession userSession = getUserSession();
@@ -159,9 +174,10 @@
return socialNetworkManager.requestToJoin(user, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO setAdminAsCollab(final String hash, final StateToken groupToken,
final String groupToSetCollabShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -172,9 +188,10 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
final String groupToSetAdminShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -185,8 +202,9 @@
return generateResponse(userLogged, group);
}
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public SocialNetworkDataDTO unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
final UserSession userSession = getUserSession();
final User userLogged = userSession.getUser();
@@ -195,12 +213,4 @@
return generateResponse(userLogged, group);
}
- private SocialNetworkDataDTO generateResponse(final User userLogged, final Group group) {
- return mapper.map(socialNetworkManager.getSocialNetworkData(userLogged, group), SocialNetworkDataDTO.class);
- }
-
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -48,18 +48,17 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import com.wideplay.warp.persist.TransactionType;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
@Singleton
public class UserRPC implements RPC, UserService {
- private final UserManager userManager;
- private final Provider<UserSession> userSessionProvider;
private final GroupManager groupManager;
private final Mapper mapper;
+ private final Provider<SessionService> sessionServiceProvider;
private final UserInfoService userInfoService;
- private final Provider<SessionService> sessionServiceProvider;
+ private final UserManager userManager;
+ private final Provider<UserSession> userSessionProvider;
@Inject
public UserRPC(final Provider<SessionService> sessionServiceProvider,
@@ -74,7 +73,8 @@
this.mapper = mapper;
}
- @Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
+ @Override
+ @Transactional(rollbackOn = DefaultException.class)
public UserInfoDTO createUser(final UserDTO userDTO, final boolean wantPersonalHomepage) throws DefaultException {
final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(), userDTO.getEmail(),
userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
@@ -83,8 +83,9 @@
return login(userDTO.getShortName(), userDTO.getPassword());
}
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
public String getUserAvatarBaser64(final String userHash, final StateToken userToken) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -100,7 +101,17 @@
}
}
- @Transactional(type = TransactionType.READ_ONLY)
+ private UserSession getUserSession() {
+ return userSessionProvider.get();
+ }
+
+ private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
+ final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
+ return mapper.map(userInfo, UserInfoDTO.class);
+ }
+
+ @Override
+ @Transactional
public UserInfoDTO login(final String nickOrEmail, final String passwd) throws DefaultException {
final SessionService sessionService = sessionServiceProvider.get();
sessionService.getNewSession();
@@ -108,31 +119,45 @@
return loginUser(user);
}
+ private UserInfoDTO loginUser(final User user) throws DefaultException {
+ if (user != null) {
+ // Maybe use terracotta.org for http session clustering
+ getUserSession().login(user, UUID.randomUUID().toString());
+ return loadUserInfo(user);
+ } else {
+ throw new UserAuthException();
+ }
+ }
+
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public void logout(final String userHash) throws DefaultException {
getUserSession().logout();
final SessionService sessionService = sessionServiceProvider.get();
sessionService.getNewSession();
- }
+ };
+ @Override
@Authenticated(mandatory = false)
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public void onlyCheckSession(final String userHash) throws DefaultException {
// Do nothing @Authenticated checks user session
}
+ @Override
@Authenticated
- @Transactional(type = TransactionType.READ_ONLY)
+ @Transactional
public UserInfoDTO reloadUserInfo(final String userHash) throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
return loadUserInfo(user);
}
+ @Override
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- @Transactional(type = TransactionType.READ_WRITE)
+ @Transactional
public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
final UserBuddiesVisibility visibility) {
final UserSession userSession = getUserSession();
@@ -141,25 +166,6 @@
throw new AccessViolationException();
}
user.setBuddiesVisibility(UserBuddiesVisibility.valueOf(visibility.toString()));
- };
-
- private UserSession getUserSession() {
- return userSessionProvider.get();
}
- private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
- final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
- return mapper.map(userInfo, UserInfoDTO.class);
- }
-
- private UserInfoDTO loginUser(final User user) throws DefaultException {
- if (user != null) {
- // Maybe use terracotta.org for http session clustering
- getUserSession().login(user, UUID.randomUUID().toString());
- return loadUserInfo(user);
- } else {
- throw new UserAuthException();
- }
- }
-
}
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -131,7 +131,6 @@
// final Injector waveChildInjector = waveStarter.runMain();
final Injector waveChildInjector = (Injector) filterConfig.getServletContext().getAttribute(
INJECTOR_PARENT_ATTRIBUTE);
- // final Injector waveChildInjector = Guice.createInjector();
final Injector kuneChildInjector = installInjector(filterConfig, rack, waveChildInjector);
startContainerListeners(rack.getListeners(), kuneChildInjector);
docks = rack.getDocks();
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/filters/rest/TransactionalServiceExecutor.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/filters/rest/TransactionalServiceExecutor.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/rack/filters/rest/TransactionalServiceExecutor.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,7 +20,7 @@
package org.ourproject.kune.rack.filters.rest;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class TransactionalServiceExecutor {
private final RESTMethodFinder methodFinder;
Modified: branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
===================================================================
--- branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -20,16 +20,16 @@
package org.ourproject.kune.workspace.client.hello;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.AbstractExtendedAction;
import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.OldAbstractAction;
import org.ourproject.kune.platf.client.actions.Shortcut;
import org.ourproject.kune.platf.client.actions.ui.MenuCheckItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuRadioItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.MenuSeparatorDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ui.PushButtonDescriptor;
import org.ourproject.kune.platf.client.services.AbstractExtendedModule;
import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
Modified: branches/wave-jetty-embed-guice/src/main/resources/META-INF/persistence.xml
===================================================================
--- branches/wave-jetty-embed-guice/src/main/resources/META-INF/persistence.xml 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/resources/META-INF/persistence.xml 2011-02-13 11:00:54 UTC (rev 1251)
@@ -7,6 +7,30 @@
<persistence-unit name="development"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <!-- JPA entities must be registered here -->
+ <!-- src/main/java/cc/kune/domain$ ls -1 *.java | sed 's/.java/<\/class>/g' | sed 's/^/<class>cc.kune.domain./g' -->
+ <class>cc.kune.domain.AccessLists</class>
+ <class>cc.kune.domain.BasicMimeType</class>
+ <class>cc.kune.domain.Comment</class>
+ <class>cc.kune.domain.Container</class>
+ <class>cc.kune.domain.ContainerTranslation</class>
+ <class>cc.kune.domain.Content</class>
+ <class>cc.kune.domain.ContentTranslation</class>
+ <class>cc.kune.domain.CustomProperties</class>
+ <class>cc.kune.domain.ExtMediaDescrip</class>
+ <class>cc.kune.domain.Group</class>
+ <class>cc.kune.domain.GroupList</class>
+ <class>cc.kune.domain.I18nCountry</class>
+ <class>cc.kune.domain.I18nLanguage</class>
+ <class>cc.kune.domain.I18nTranslation</class>
+ <class>cc.kune.domain.License</class>
+ <class>cc.kune.domain.Rate</class>
+ <class>cc.kune.domain.Revision</class>
+ <class>cc.kune.domain.SocialNetwork</class>
+ <class>cc.kune.domain.Tag</class>
+ <class>cc.kune.domain.TagUserContent</class>
+ <class>cc.kune.domain.ToolConfiguration</class>
+ <class>cc.kune.domain.User</class>
<properties>
<property name="hibernate.archive.autodetection" value="class, hbm" />
<property name="hibernate.show_sql" value="false" />
@@ -19,7 +43,7 @@
<property name="hibernate.connection.username" value="kune" />
<property name="hibernate.connection.password" value="db4kune" />
- <!-- http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-production
+ <!-- http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-production
(NO!, une liquibase, for instance) -->
<!-- http://stackoverflow.com/questions/438146/hibernate-question-hbm2ddl-auto-possible-values-and-what-they-do -->
<property name="hibernate.hbm2ddl.auto" value="update" />
@@ -41,6 +65,29 @@
<persistence-unit name="test_db" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <!-- JPA entities must be registered here -->
+ <class>cc.kune.domain.AccessLists</class>
+ <class>cc.kune.domain.BasicMimeType</class>
+ <class>cc.kune.domain.Comment</class>
+ <class>cc.kune.domain.Container</class>
+ <class>cc.kune.domain.ContainerTranslation</class>
+ <class>cc.kune.domain.Content</class>
+ <class>cc.kune.domain.ContentTranslation</class>
+ <class>cc.kune.domain.CustomProperties</class>
+ <class>cc.kune.domain.ExtMediaDescrip</class>
+ <class>cc.kune.domain.Group</class>
+ <class>cc.kune.domain.GroupList</class>
+ <class>cc.kune.domain.I18nCountry</class>
+ <class>cc.kune.domain.I18nLanguage</class>
+ <class>cc.kune.domain.I18nTranslation</class>
+ <class>cc.kune.domain.License</class>
+ <class>cc.kune.domain.Rate</class>
+ <class>cc.kune.domain.Revision</class>
+ <class>cc.kune.domain.SocialNetwork</class>
+ <class>cc.kune.domain.Tag</class>
+ <class>cc.kune.domain.TagUserContent</class>
+ <class>cc.kune.domain.ToolConfiguration</class>
+ <class>cc.kune.domain.User</class>
<properties>
<property name="hibernate.archive.autodetection" value="class, hbm" />
<property name="hibernate.show_sql" value="false" />
@@ -71,6 +118,29 @@
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <!-- JPA entities must be registered here -->
+ <class>cc.kune.domain.AccessLists</class>
+ <class>cc.kune.domain.BasicMimeType</class>
+ <class>cc.kune.domain.Comment</class>
+ <class>cc.kune.domain.Container</class>
+ <class>cc.kune.domain.ContainerTranslation</class>
+ <class>cc.kune.domain.Content</class>
+ <class>cc.kune.domain.ContentTranslation</class>
+ <class>cc.kune.domain.CustomProperties</class>
+ <class>cc.kune.domain.ExtMediaDescrip</class>
+ <class>cc.kune.domain.Group</class>
+ <class>cc.kune.domain.GroupList</class>
+ <class>cc.kune.domain.I18nCountry</class>
+ <class>cc.kune.domain.I18nLanguage</class>
+ <class>cc.kune.domain.I18nTranslation</class>
+ <class>cc.kune.domain.License</class>
+ <class>cc.kune.domain.Rate</class>
+ <class>cc.kune.domain.Revision</class>
+ <class>cc.kune.domain.SocialNetwork</class>
+ <class>cc.kune.domain.Tag</class>
+ <class>cc.kune.domain.TagUserContent</class>
+ <class>cc.kune.domain.ToolConfiguration</class>
+ <class>cc.kune.domain.User</class>
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
@@ -87,4 +157,6 @@
value="/var/lib/kune/lucene/kune_test/indexes" />
</properties>
</persistence-unit>
+
+
</persistence>
Modified: branches/wave-jetty-embed-guice/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/wave-jetty-embed-guice/src/main/webapp/WEB-INF/web.xml 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/main/webapp/WEB-INF/web.xml 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,48 +19,48 @@
<welcome-file>ws.html</welcome-file>
</welcome-file-list>
<!-- Wave proxies ========================================================================================= -->
- <filter>
- <filter-name>JettyContinuationFilter</filter-name>
- <filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>JettyContinuationFilter</filter-name>
- <servlet-name>Wiab</servlet-name>
- <!-- <url-pattern>/*</url-pattern> -->
- </filter-mapping>
- <servlet>
- <servlet-name>Wiab</servlet-name>
- <servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class>
- <init-param>
- <param-name>ProxyTo</param-name>
- <param-value>http://127.0.0.1:9898/</param-value>
- </init-param>
- <init-param>
- <param-name>Prefix</param-name>
- <param-value>/</param-value>
- </init-param>
- </servlet>
- <servlet-mapping>
- <servlet-name>Wiab</servlet-name>
- <url-pattern>/attachment/*</url-pattern>
- <url-pattern>/auth/signin</url-pattern>
- <url-pattern>/auth/signout</url-pattern>
- <url-pattern>/auth/register</url-pattern>
- <url-pattern>/fetch/*</url-pattern>
- <url-pattern>/robot/dataapi</url-pattern>
- <url-pattern>/robot/dataapi/oauth/*</url-pattern>
- <url-pattern>/robot/dataapi/rpc</url-pattern>
- <url-pattern>/robot/register/*</url-pattern>
- <url-pattern>/robot/rpc</url-pattern>
- <url-pattern>/gadgets</url-pattern>
- <url-pattern>/gadgets/*</url-pattern>
- <url-pattern>/socket.io/*</url-pattern>
- <url-pattern>/socket</url-pattern>
- <url-pattern>/static/*</url-pattern>
- <url-pattern>/webclient/*</url-pattern>
- <!-- <url-pattern>/*</url-pattern> -->
- <!-- <load-on-startup>1</load-on-startup> -->
- </servlet-mapping>
+<!-- <filter>-->
+<!-- <filter-name>JettyContinuationFilter</filter-name>-->
+<!-- <filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>-->
+<!-- </filter>-->
+<!-- <filter-mapping>-->
+<!-- <filter-name>JettyContinuationFilter</filter-name>-->
+<!-- <servlet-name>Wiab</servlet-name>-->
+<!-- <url-pattern>/*</url-pattern> -->
+<!-- </filter-mapping>-->
+<!-- <servlet>-->
+<!-- <servlet-name>Wiab</servlet-name>-->
+<!-- <servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class>-->
+<!-- <init-param>-->
+<!-- <param-name>ProxyTo</param-name>-->
+<!-- <param-value>http://127.0.0.1:9898/</param-value>-->
+<!-- </init-param>-->
+<!-- <init-param>-->
+<!-- <param-name>Prefix</param-name>-->
+<!-- <param-value>/</param-value>-->
+<!-- </init-param>-->
+<!-- </servlet>-->
+<!-- <servlet-mapping>-->
+<!-- <servlet-name>Wiab</servlet-name>-->
+<!-- <url-pattern>/attachment/*</url-pattern>-->
+<!-- <url-pattern>/auth/signin</url-pattern>-->
+<!-- <url-pattern>/auth/signout</url-pattern>-->
+<!-- <url-pattern>/auth/register</url-pattern>-->
+<!-- <url-pattern>/fetch/*</url-pattern>-->
+<!-- <url-pattern>/robot/dataapi</url-pattern>-->
+<!-- <url-pattern>/robot/dataapi/oauth/*</url-pattern>-->
+<!-- <url-pattern>/robot/dataapi/rpc</url-pattern>-->
+<!-- <url-pattern>/robot/register/*</url-pattern>-->
+<!-- <url-pattern>/robot/rpc</url-pattern>-->
+<!-- <url-pattern>/gadgets</url-pattern>-->
+<!-- <url-pattern>/gadgets/*</url-pattern>-->
+<!-- <url-pattern>/socket.io/*</url-pattern>-->
+<!-- <url-pattern>/socket</url-pattern>-->
+<!-- <url-pattern>/static/*</url-pattern>-->
+<!-- <url-pattern>/webclient/*</url-pattern>-->
+<!-- <url-pattern>/*</url-pattern> -->
+<!-- <load-on-startup>1</load-on-startup> -->
+<!-- </servlet-mapping>-->
<!-- JRuby servlets ======================================================================================= -->
<!-- Note: this gives problems depending on the version of jetty or tomcat -->
<context-param>
@@ -139,20 +139,20 @@
</url-pattern>
</servlet-mapping>
<!-- Kune normal guice configuration ======================================================================== -->
- <filter>
- <filter-name>rack</filter-name>
- <filter-class>org.ourproject.kune.rack.RackServletFilter</filter-class>
- <init-param>
- <param-name>org.ourproject.kune.rack.RackModule</param-name>
- <param-value>
- org.ourproject.kune.app.server.KuneRackModule
- </param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>rack</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
+<!-- <filter>-->
+<!-- <filter-name>rack</filter-name>-->
+<!-- <filter-class>org.ourproject.kune.rack.RackServletFilter</filter-class>-->
+<!-- <init-param>-->
+<!-- <param-name>org.ourproject.kune.rack.RackModule</param-name>-->
+<!-- <param-value>-->
+<!-- org.ourproject.kune.app.server.KuneRackModule-->
+<!-- </param-value>-->
+<!-- </init-param>-->
+<!-- </filter>-->
+<!-- <filter-mapping>-->
+<!-- <filter-name>rack</filter-name>-->
+<!-- <url-pattern>/*</url-pattern>-->
+<!-- </filter-mapping>-->
<!-- Wave proxies with context /wiab/ ====================================================================== -->
<!-- <servlet> -->
<!-- <servlet-name>WiabSocketIO</servlet-name> -->
Added: branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/finders/TagUserContentFinderTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/finders/TagUserContentFinderTest.java (rev 0)
+++ branches/wave-jetty-embed-guice/src/test/java/cc/kune/domain/finders/TagUserContentFinderTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.domain.finders;
+
+import org.junit.Test;
+import org.ourproject.kune.platf.server.PersistencePreLoadedDataTest;
+
+import com.google.inject.Inject;
+
+public class TagUserContentFinderTest extends PersistencePreLoadedDataTest {
+
+ @Inject
+ TagUserContentFinder tag;
+
+ @Test
+ public void test() {
+ tag.getTagsGroups(groupManager.getSiteDefaultGroup());
+ }
+}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -43,7 +43,7 @@
import cc.kune.domain.ToolConfiguration;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class DatabaseInitializationTest {
@Inject
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,6 +27,7 @@
import org.ourproject.kune.platf.server.KunePersistenceService;
import org.ourproject.kune.platf.server.PlatformServerModule;
import org.ourproject.kune.platf.server.TestConstants;
+import org.ourproject.kune.platf.server.init.FinderRegistry;
import org.ourproject.kune.platf.server.properties.PropertiesFileName;
import org.ourproject.kune.wiki.server.WikiServerModule;
import org.waveprotocol.box.server.CoreSettings;
@@ -38,9 +39,9 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Scopes;
+import com.google.inject.persist.jpa.JpaPersistModule;
import com.google.inject.servlet.RequestScoped;
import com.google.inject.servlet.SessionScoped;
-import com.wideplay.warp.jpa.JpaUnit;
public class IntegrationTestHelper {
@@ -49,19 +50,16 @@
try {
injector = Guice.createInjector(CustomSettingsBinder.bindSettings(TestConstants.WAVE_TEST_PROPFILE,
CoreSettings.class));
- final PersistenceModule persistenceModule = injector.getInstance(PersistenceModule.class);
+ final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class);
- final Injector childInjector = injector.createChildInjector(persistenceModule, new PlatformServerModule(),
- new DocumentServerModule(), new ChatServerModule(), new WikiServerModule(), new AbstractModule() {
+ final Injector childInjector = injector.createChildInjector(wavePersistModule,
+ FinderRegistry.init(new JpaPersistModule(TestConstants.PERSISTENCE_UNIT)),
+ new PlatformServerModule(), new DocumentServerModule(), new ChatServerModule(),
+ new WikiServerModule(), new AbstractModule() {
@Override
protected void configure() {
bindScope(SessionScoped.class, Scopes.SINGLETON);
bindScope(RequestScoped.class, Scopes.SINGLETON);
- // test: use
- // memory
- // test_db: use
- // mysql
- bindConstant().annotatedWith(JpaUnit.class).to(TestConstants.PERSISTENCE_UNIT);
bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -19,7 +19,10 @@
*/
package org.ourproject.kune.platf.integration.content;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.List;
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -34,20 +34,21 @@
import cc.kune.core.shared.dto.GroupType;
import cc.kune.core.shared.dto.LicenseDTO;
import cc.kune.domain.Group;
+import cc.kune.domain.finders.GroupFinder;
import com.google.inject.Inject;
public class GroupServiceTest extends IntegrationTest {
@Inject
+ GroupFinder groupFinder;
+
+ @Inject
GroupService service;
@Inject
UserSession session;
- @Inject
- Group groupFinder;
-
@Test
public void createCommunity() throws Exception {
doLogin();
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkMembersTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkMembersTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkMembersTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -34,7 +34,7 @@
import cc.kune.domain.Group;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class SocialNetworkMembersTest extends IntegrationTest {
@Inject
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -36,11 +36,13 @@
import cc.kune.domain.Container;
import cc.kune.domain.Content;
-import cc.kune.domain.Group;
import cc.kune.domain.I18nCountry;
import cc.kune.domain.I18nLanguage;
import cc.kune.domain.License;
import cc.kune.domain.User;
+import cc.kune.domain.finders.GroupFinder;
+import cc.kune.domain.finders.LicenseFinder;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
@@ -62,21 +64,21 @@
protected I18nLanguage english;
protected I18nCountry gb;
@Inject
- protected Group groupFinder;
+ protected GroupFinder groupFinder;
@Inject
protected GroupManager groupManager;
@Inject
protected I18nLanguageManager languageManager;
@Inject
- protected License licenseFinder;
+ protected LicenseFinder licenseFinder;
@Inject
protected LicenseManager licenseManager;
// @Inject
// protected PropertyGroupManager propGroupManager;
protected User user;
@Inject
- protected User userFinder;
+ protected UserFinder userFinder;
@Inject
protected UserManager userManager;
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,8 +27,8 @@
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Provider;
-import com.wideplay.warp.persist.PersistenceService;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.PersistService;
+import com.google.inject.persist.Transactional;
public abstract class PersistenceTest {
private final String persistenceUnit;
@@ -40,7 +40,7 @@
// test: use memory
// test_db: use mysql
// Also configurable ein TestHelper
- this("test_db", "kune.properties");
+ this(TestConstants.PERSISTENCE_UNIT, "kune.properties");
}
public PersistenceTest(final String persistenceUnit, final String propetiesFileName) {
@@ -77,7 +77,7 @@
@Before
public void prepare() {
final Injector injector = TestHelper.create(new PlatformServerModule(), persistenceUnit, propetiesFileName);
- final PersistenceService persistence = injector.getInstance(PersistenceService.class);
+ final PersistService persistence = injector.getInstance(PersistService.class);
// To Debug insert breakpoint here
persistence.start();
injector.injectMembers(this);
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestConstants.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestConstants.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestConstants.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -3,7 +3,8 @@
public final class TestConstants {
// test: use memory
// test_db: use mysql
- public static final String PERSISTENCE_UNIT = "test_db";
+ // public static final String PERSISTENCE_UNIT = "test_db";
+ public static final String PERSISTENCE_UNIT = "test";
public static final String WAVE_TEST_PROPFILE = "wave-server-testing.properties";
private TestConstants() {
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestHelper.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestHelper.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/TestHelper.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -23,6 +23,7 @@
import org.apache.commons.configuration.ConfigurationException;
import org.ourproject.kune.platf.integration.HttpServletRequestMocked;
+import org.ourproject.kune.platf.server.init.FinderRegistry;
import org.ourproject.kune.platf.server.properties.PropertiesFileName;
import org.waveprotocol.box.server.CoreSettings;
import org.waveprotocol.box.server.authentication.AccountStoreHolder;
@@ -39,26 +40,26 @@
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.google.inject.name.Names;
+import com.google.inject.persist.jpa.JpaPersistModule;
import com.google.inject.servlet.RequestScoped;
import com.google.inject.servlet.SessionScoped;
-import com.wideplay.warp.jpa.JpaUnit;
public abstract class TestHelper {
public static Injector create(final Module module, final String persistenceUnit, final String propetiesFileName) {
try {
final Injector injector = Guice.createInjector(CustomSettingsBinder.bindSettings(
TestConstants.WAVE_TEST_PROPFILE, CoreSettings.class));
- final PersistenceModule persistenceModule = injector.getInstance(PersistenceModule.class);
- final Injector childInjector = injector.createChildInjector(persistenceModule, module, new Module() {
- @Override
- public void configure(final Binder binder) {
- binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
- binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
- binder.bindConstant().annotatedWith(JpaUnit.class).to(persistenceUnit);
- binder.bindConstant().annotatedWith(PropertiesFileName.class).to(propetiesFileName);
- binder.bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
- }
- });
+ final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class);
+ final Injector childInjector = injector.createChildInjector(wavePersistModule,
+ FinderRegistry.init(new JpaPersistModule(persistenceUnit)), module, new Module() {
+ @Override
+ public void configure(final Binder binder) {
+ binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
+ binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
+ binder.bindConstant().annotatedWith(PropertiesFileName.class).to(propetiesFileName);
+ binder.bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
+ }
+ });
final AccountStore accountStore = childInjector.getInstance(AccountStore.class);
accountStore.initializeAccountStore();
AccountStoreHolder.resetForTesting();
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -33,7 +33,7 @@
import cc.kune.core.shared.domain.AccessRol;
import cc.kune.core.shared.domain.utils.StateToken;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public class AuthorizatedMethodInterceptorTest extends IntegrationTest {
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/GroupFinderTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/GroupFinderTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/GroupFinderTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -27,13 +27,19 @@
import org.ourproject.kune.platf.server.PersistenceTest;
import cc.kune.domain.Group;
+import cc.kune.domain.finders.GroupFinder;
import com.google.inject.Inject;
public class GroupFinderTest extends PersistenceTest {
@Inject
- Group groupFinder;
+ GroupFinder groupFinder;
+ @After
+ public void close() {
+ closeTransaction();
+ }
+
@Before
public void insertData() {
openTransaction();
@@ -45,9 +51,4 @@
public void testGetAll() {
assertEquals(2, groupFinder.getAll().size());
}
-
- @After
- public void close() {
- closeTransaction();
- }
}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/LicenseFinderTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/LicenseFinderTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/LicenseFinderTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -17,86 +17,87 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package org.ourproject.kune.platf.server.finders;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.ourproject.kune.platf.server.PersistenceTest;
-import org.ourproject.kune.platf.server.properties.DatabaseProperties;
-
-import cc.kune.domain.License;
-
-import com.google.inject.Inject;
-
-public class LicenseFinderTest extends PersistenceTest {
- @Inject
- License finder;
- @Inject
- DatabaseProperties properties;
- private License license1;
- private License license2;
- private License licenseDef;
-
- @Before
- public void addData() {
- openTransaction();
- licenseDef = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "",
- "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
- persist(licenseDef);
- license1 = new License("by-nc-nd-v3.0", "Creative Commons Attribution-NonCommercial-NoDerivs", "",
- "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "", "");
- persist(license1);
- license2 = new License("gfdl-v1.3", "GNU Free Documentation License", "",
- "http://www.gnu.org/copyleft/fdl.html", false, true, false, "", "");
- persist(license2);
- }
-
- @After
- public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
- }
-
- @Test
- public void findAll() {
- List<License> all = finder.getAll();
- assertEquals(3, all.size());
- }
-
- @Test
- public void findById() {
- License lic = finder.findByShortName(license1.getShortName());
- assertNotNull(lic);
- assertEquals(license1.getShortName(), lic.getShortName());
- assertEquals(license1.getLongName(), lic.getLongName());
- }
-
- @Test
- public void findCC() {
- List<License> cc = finder.getCC();
- assertEquals(2, cc.size());
- }
-
- @Test
- public void findDefaultLicense() {
- String licenseDefId = properties.getDefaultLicense();
- License lic = finder.findByShortName(licenseDefId);
- assertNotNull(lic);
- assertEquals(licenseDef.getShortName(), lic.getShortName());
- assertEquals(licenseDef.getLongName(), lic.getLongName());
- }
-
- @Test
- public void findNotCC() {
- List<License> notCc = finder.getNotCC();
- assertEquals(1, notCc.size());
- }
-
-}
+package org.ourproject.kune.platf.server.finders;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.platf.server.PersistenceTest;
+import org.ourproject.kune.platf.server.properties.DatabaseProperties;
+
+import cc.kune.domain.License;
+import cc.kune.domain.finders.LicenseFinder;
+
+import com.google.inject.Inject;
+
+public class LicenseFinderTest extends PersistenceTest {
+ @Inject
+ LicenseFinder finder;
+ private License license1;
+ private License license2;
+ private License licenseDef;
+ @Inject
+ DatabaseProperties properties;
+
+ @Before
+ public void addData() {
+ openTransaction();
+ licenseDef = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "",
+ "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
+ persist(licenseDef);
+ license1 = new License("by-nc-nd-v3.0", "Creative Commons Attribution-NonCommercial-NoDerivs", "",
+ "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "", "");
+ persist(license1);
+ license2 = new License("gfdl-v1.3", "GNU Free Documentation License", "",
+ "http://www.gnu.org/copyleft/fdl.html", false, true, false, "", "");
+ persist(license2);
+ }
+
+ @After
+ public void close() {
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
+ }
+
+ @Test
+ public void findAll() {
+ final List<License> all = finder.getAll();
+ assertEquals(3, all.size());
+ }
+
+ @Test
+ public void findById() {
+ final License lic = finder.findByShortName(license1.getShortName());
+ assertNotNull(lic);
+ assertEquals(license1.getShortName(), lic.getShortName());
+ assertEquals(license1.getLongName(), lic.getLongName());
+ }
+
+ @Test
+ public void findCC() {
+ final List<License> cc = finder.getCC();
+ assertEquals(2, cc.size());
+ }
+
+ @Test
+ public void findDefaultLicense() {
+ final String licenseDefId = properties.getDefaultLicense();
+ final License lic = finder.findByShortName(licenseDefId);
+ assertNotNull(lic);
+ assertEquals(licenseDef.getShortName(), lic.getShortName());
+ assertEquals(licenseDef.getLongName(), lic.getLongName());
+ }
+
+ @Test
+ public void findNotCC() {
+ final List<License> notCc = finder.getNotCC();
+ assertEquals(1, notCc.size());
+ }
+
+}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -33,14 +33,15 @@
import cc.kune.domain.Content;
import cc.kune.domain.Rate;
import cc.kune.domain.User;
+import cc.kune.domain.finders.RateFinder;
import com.google.inject.Inject;
public class RateFinderTest extends PersistencePreLoadedDataTest {
+ private EntityManager entityManager;
@Inject
- Rate rateFinder;
- private EntityManager entityManager;
+ RateFinder rateFinder;
@Before
public void before() {
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/UserFinderTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/UserFinderTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/finders/UserFinderTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -30,12 +30,13 @@
import org.ourproject.kune.platf.server.PersistencePreLoadedDataTest;
import cc.kune.domain.User;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
public class UserFinderTest extends PersistencePreLoadedDataTest {
@Inject
- User finder;
+ UserFinder finder;
@Test
public void findAll() {
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/LicenseManagerTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/LicenseManagerTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/LicenseManagerTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -28,16 +28,24 @@
import org.ourproject.kune.platf.server.PersistenceTest;
import cc.kune.domain.License;
+import cc.kune.domain.finders.LicenseFinder;
import com.google.inject.Inject;
public class LicenseManagerTest extends PersistenceTest {
+ private License license;
@Inject
+ LicenseFinder licenseFinder;
+ @Inject
LicenseManager licenseManager;
- @Inject
- License licenseFinder;
- private License license;
+ @After
+ public void close() {
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
+ }
+
@Before
public void insertData() {
openTransaction();
@@ -52,11 +60,4 @@
assertNotNull(license.getId());
assertEquals(1, licenseFinder.getAll().size());
}
-
- @After
- public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
- }
}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagManagerTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagManagerTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagManagerTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -28,17 +28,18 @@
import org.ourproject.kune.platf.server.content.ContentManager;
import cc.kune.domain.Tag;
+import cc.kune.domain.finders.TagFinder;
import com.google.inject.Inject;
public class TagManagerTest extends PersistenceTest {
@Inject
- TagManager tagManager;
- @Inject
ContentManager contentManager;
+ private Tag tag;
@Inject
- Tag tagFinder;
- private Tag tag;
+ TagFinder tagFinder;
+ @Inject
+ TagManager tagManager;
@After
public void close() {
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagUserContentTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagUserContentTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/TagUserContentTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -30,13 +30,17 @@
import cc.kune.domain.Tag;
import cc.kune.domain.TagUserContent;
+import cc.kune.domain.finders.TagUserContentFinder;
import com.google.inject.Inject;
public class TagUserContentTest extends PersistencePreLoadedDataTest {
private static final String DUMMY_TAG = "dummy";
@Inject
+ TagUserContentFinder finder;
+ @Inject
TagUserContentManager manager;
+
private Tag tag;
@Inject
TagManager tagManager;
@@ -47,14 +51,33 @@
tagManager.persist(tag);
}
+ private void createSomeTagUserContent() {
+ List<Tag> tags = manager.find(user, content);
+ assertEquals(0, tags.size());
+ createTagUserContent();
+ tags = manager.find(user, content);
+ assertEquals(1, tags.size());
+ }
+
+ private TagUserContent createTagUserContent() {
+ final TagUserContent tagUC = new TagUserContent(tag, user, content);
+ manager.persist(tagUC);
+ return tagUC;
+ }
+
@Test
public void getTagsAsString() {
manager.setTags(user, content, DUMMY_TAG);
- String tagS = manager.getTagsAsString(user, content);
+ final String tagS = manager.getTagsAsString(user, content);
assertEquals(DUMMY_TAG, tagS);
}
@Test
+ public void getTagsGrouped() {
+ finder.getTagsGroups(user.getUserGroup());
+ }
+
+ @Test
public void insertSomeUserContent() {
createSomeTagUserContent();
}
@@ -63,7 +86,7 @@
public void removeSomeUserContent() {
createSomeTagUserContent();
manager.remove(user, content);
- List<Tag> tags = manager.find(user, content);
+ final List<Tag> tags = manager.find(user, content);
assertEquals(0, tags.size());
}
@@ -80,28 +103,14 @@
public void setTagsRemoveBefore() {
manager.setTags(user, content, "foo");
manager.setTags(user, content, DUMMY_TAG);
- List<Tag> tags = manager.find(user, content);
+ final List<Tag> tags = manager.find(user, content);
assertEquals(1, tags.size());
assertEquals(DUMMY_TAG, tags.get(0).getName());
}
@Test
public void testInsertData() {
- TagUserContent tagUC = createTagUserContent();
+ final TagUserContent tagUC = createTagUserContent();
assertNotNull(tagUC.getId());
}
-
- private void createSomeTagUserContent() {
- List<Tag> tags = manager.find(user, content);
- assertEquals(0, tags.size());
- createTagUserContent();
- tags = manager.find(user, content);
- assertEquals(1, tags.size());
- }
-
- private TagUserContent createTagUserContent() {
- TagUserContent tagUC = new TagUserContent(tag, user, content);
- manager.persist(tagUC);
- return tagUC;
- }
}
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -34,6 +34,7 @@
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
import cc.kune.core.client.errors.I18nNotFoundException;
+import cc.kune.core.client.errors.UserRegistrationException;
import cc.kune.domain.Group;
import cc.kune.domain.User;
@@ -94,10 +95,10 @@
}
/**
- * This is not working:
+ * This was not working:
* http://opensource.atlassian.com/projects/hibernate/browse/EJB-382
*/
- @Test(expected = PersistenceException.class)
+ @Test(expected = UserRegistrationException.class)
public void testUserExist() throws I18nNotFoundException {
final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
"GB", "GMT");
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/impl/AbstractSocialNetworkManagerTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/impl/AbstractSocialNetworkManagerTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/platf/server/manager/impl/AbstractSocialNetworkManagerTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -29,7 +29,7 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
-import com.wideplay.warp.persist.Transactional;
+import com.google.inject.persist.Transactional;
public abstract class AbstractSocialNetworkManagerTest extends PersistenceTest {
@Inject
Modified: branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java
===================================================================
--- branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java 2011-02-12 02:19:16 UTC (rev 1250)
+++ branches/wave-jetty-embed-guice/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java 2011-02-13 11:00:54 UTC (rev 1251)
@@ -23,8 +23,6 @@
import org.junit.Test;
import org.mockito.Mockito;
import org.ourproject.kune.workspace.client.themes.WsThemeManager;
-import org.ourproject.kune.workspace.client.tool.ToolSelectorItem;
-import org.ourproject.kune.workspace.client.tool.ToolSelectorPresenter;
import cc.kune.core.client.state.StateManager;
More information about the kune-commits
mailing list