Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
July 2013
- 6 participants
- 62 discussions
r2784 - in trunk: . topia-persistence topia-persistence/src/main/java/org/nuiton/topia/persistence/csv topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out topia-service-migration topia-service-replication topia-service-security
by tchemit@users.nuiton.org 25 Jul '13
by tchemit@users.nuiton.org 25 Jul '13
25 Jul '13
Author: tchemit
Date: 2013-07-25 19:03:03 +0200 (Thu, 25 Jul 2013)
New Revision: 2784
Url: http://nuiton.org/projects/topia/repository/revisions/2784
Log:
bump to version 3.0-alpha-2-SNAPSHOT
fixes #2796: Update to nuiton-utils 2.7
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportStrategy.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/pom.xml 2013-07-25 17:03:03 UTC (rev 2784)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -60,8 +60,9 @@
<!-- libs version -->
<eugeneVersion>2.7</eugeneVersion>
- <nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
- <nuitonUtilsCsvVersion>2.6.12.1</nuitonUtilsCsvVersion> <!-- TODO AThimel 2013/07/19 Remove as soon as nuiton-utils 2.6.13 is released -->
+ <nuitonUtilsVersion>2.7</nuitonUtilsVersion>
+ <nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
+ <nuitonDecoratorVersion>3.0-alpha-1</nuitonDecoratorVersion>
<nuitonI18nVersion>2.5.2</nuitonI18nVersion>
<processorPluginVersion>1.3</processorPluginVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
@@ -116,10 +117,16 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-csv</artifactId>
- <version>${nuitonUtilsCsvVersion}</version>
+ <version>${nuitonCsvVersion}</version>
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-decorator</artifactId>
+ <version>${nuitonDecoratorVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.i18n</groupId>
<artifactId>nuiton-i18n</artifactId>
<version>${nuitonI18nVersion}</version>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/pom.xml 2013-07-25 17:03:03 UTC (rev 2784)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
@@ -54,6 +54,11 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-decorator</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.i18n</groupId>
<artifactId>nuiton-i18n</artifactId>
<scope>test</scope>
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -29,9 +29,9 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.metadata.TableMeta;
-import org.nuiton.util.csv.ValueParserFormatter;
-import org.nuiton.util.csv.ext.AbstractImportExportModel;
-import org.nuiton.util.decorator.Decorator;
+import org.nuiton.csv.ValueParserFormatter;
+import org.nuiton.csv.ext.AbstractImportExportModel;
+import org.nuiton.decorator.Decorator;
import java.util.Collection;
import java.util.Collections;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -29,11 +29,11 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.util.StringUtil;
-import org.nuiton.util.csv.Common;
-import org.nuiton.util.csv.ValueFormatter;
-import org.nuiton.util.csv.ValueParser;
-import org.nuiton.util.csv.ValueParserFormatter;
-import org.nuiton.util.decorator.Decorator;
+import org.nuiton.csv.Common;
+import org.nuiton.csv.ValueFormatter;
+import org.nuiton.csv.ValueParser;
+import org.nuiton.csv.ValueParserFormatter;
+import org.nuiton.decorator.Decorator;
import java.sql.Timestamp;
import java.text.ParseException;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -37,7 +37,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.12
*/
-public abstract class AbstractImportModel<E> extends org.nuiton.util.csv.ext.AbstractImportModel<E> {
+public abstract class AbstractImportModel<E> extends org.nuiton.csv.ext.AbstractImportModel<E> {
public AbstractImportModel(char separator) {
super(separator);
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -27,7 +27,7 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.csv.TopiaCsvCommons;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
-import org.nuiton.util.csv.ImportModel;
+import org.nuiton.csv.ImportModel;
import java.util.Map;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -27,7 +27,7 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
import org.nuiton.topia.persistence.metadata.TableMeta;
-import org.nuiton.util.csv.ImportModel;
+import org.nuiton.csv.ImportModel;
import java.util.Map;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportStrategy.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportStrategy.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportStrategy.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -28,8 +28,8 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
import org.nuiton.topia.persistence.metadata.TableMeta;
-import org.nuiton.util.csv.Import;
-import org.nuiton.util.csv.ImportToMap;
+import org.nuiton.csv.Import;
+import org.nuiton.csv.ImportToMap;
import java.io.Reader;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -40,9 +40,9 @@
import org.nuiton.topia.persistence.metadata.MetaFilenameAware;
import org.nuiton.topia.persistence.metadata.TableMeta;
import org.nuiton.topia.persistence.util.TopiaEntityHelper;
-import org.nuiton.util.csv.Import;
-import org.nuiton.util.csv.ImportModel;
-import org.nuiton.util.csv.ImportToMap;
+import org.nuiton.csv.Import;
+import org.nuiton.csv.ImportModel;
+import org.nuiton.csv.ImportToMap;
import java.io.File;
import java.io.IOException;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -27,8 +27,8 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
import org.nuiton.topia.persistence.csv.TopiaCsvCommons;
-import org.nuiton.util.csv.ExportModel;
-import org.nuiton.util.csv.ext.AbstractExportModel;
+import org.nuiton.csv.ExportModel;
+import org.nuiton.csv.ext.AbstractExportModel;
/**
* A model to export associations of entities into csv files.
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -27,7 +27,7 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
import org.nuiton.topia.persistence.metadata.TableMeta;
-import org.nuiton.util.csv.ExportModel;
+import org.nuiton.csv.ExportModel;
/**
* To produce export model.
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2013-07-25 17:03:03 UTC (rev 2784)
@@ -40,9 +40,9 @@
import org.nuiton.topia.persistence.metadata.Metadatas;
import org.nuiton.topia.persistence.metadata.TableMeta;
import org.nuiton.util.TimeLog;
-import org.nuiton.util.csv.Export;
-import org.nuiton.util.csv.ExportModel;
-import org.nuiton.util.csv.ext.RepeatableExport;
+import org.nuiton.csv.Export;
+import org.nuiton.csv.ExportModel;
+import org.nuiton.csv.ext.RepeatableExport;
import java.io.Closeable;
import java.io.File;
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-service-migration/pom.xml 2013-07-25 17:03:03 UTC (rev 2784)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-service-replication/pom.xml 2013-07-25 17:03:03 UTC (rev 2784)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
+++ trunk/topia-service-security/pom.xml 2013-07-25 17:03:03 UTC (rev 2784)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
r2783 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 23 Jul '13
by maven-release@users.nuiton.org 23 Jul '13
23 Jul '13
Author: maven-release
Date: 2013-07-23 18:24:25 +0200 (Tue, 23 Jul 2013)
New Revision: 2783
Url: http://nuiton.org/projects/topia/repository/revisions/2783
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-07-23 16:24:22 UTC (rev 2782)
+++ trunk/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-alpha-1</version>
+ <version>3.0-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -77,9 +77,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-1</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-1</developerConnection>
- <url>http://nuiton.org/projects/topia/repository/show/branches/tags/topia-3.0-al…</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</developerConnection>
+ <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
</scm>
<distributionManagement>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-07-23 16:24:22 UTC (rev 2782)
+++ trunk/topia-persistence/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-1</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-07-23 16:24:22 UTC (rev 2782)
+++ trunk/topia-service-migration/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-1</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-07-23 16:24:22 UTC (rev 2782)
+++ trunk/topia-service-replication/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-1</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-07-23 16:24:22 UTC (rev 2782)
+++ trunk/topia-service-security/pom.xml 2013-07-23 16:24:25 UTC (rev 2783)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-1</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2013-07-23 18:24:22 +0200 (Tue, 23 Jul 2013)
New Revision: 2782
Url: http://nuiton.org/projects/topia/repository/revisions/2782
Log:
[maven-release-plugin] copy for tag topia-3.0-alpha-1
Added:
tags/topia-3.0-alpha-1/
Property changes on: tags/topia-3.0-alpha-1
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0
r2781 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 23 Jul '13
by maven-release@users.nuiton.org 23 Jul '13
23 Jul '13
Author: maven-release
Date: 2013-07-23 18:24:19 +0200 (Tue, 23 Jul 2013)
New Revision: 2781
Url: http://nuiton.org/projects/topia/repository/revisions/2781
Log:
[maven-release-plugin] prepare release topia-3.0-alpha-1
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
+++ trunk/pom.xml 2013-07-23 16:24:19 UTC (rev 2781)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-1</version>
<modules>
<module>topia-persistence</module>
@@ -77,9 +77,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</developerConnection>
- <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-1</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-1</developerConnection>
+ <url>http://nuiton.org/projects/topia/repository/show/branches/tags/topia-3.0-al…</url>
</scm>
<distributionManagement>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
+++ trunk/topia-persistence/pom.xml 2013-07-23 16:24:19 UTC (rev 2781)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-1</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
+++ trunk/topia-service-migration/pom.xml 2013-07-23 16:24:19 UTC (rev 2781)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-1</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
+++ trunk/topia-service-replication/pom.xml 2013-07-23 16:24:19 UTC (rev 2781)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-1</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
+++ trunk/topia-service-security/pom.xml 2013-07-23 16:24:19 UTC (rev 2781)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-1</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: athimel
Date: 2013-07-23 17:14:35 +0200 (Tue, 23 Jul 2013)
New Revision: 2780
Url: http://nuiton.org/projects/topia/repository/revisions/2780
Log:
refs #2775 Use Eugene 2.7
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-07-23 14:49:44 UTC (rev 2779)
+++ trunk/pom.xml 2013-07-23 15:14:35 UTC (rev 2780)
@@ -59,7 +59,7 @@
<projectId>topia</projectId>
<!-- libs version -->
- <eugeneVersion>2.6.4-SNAPSHOT</eugeneVersion>
+ <eugeneVersion>2.7</eugeneVersion>
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<nuitonUtilsCsvVersion>2.6.12.1</nuitonUtilsCsvVersion> <!-- TODO AThimel 2013/07/19 Remove as soon as nuiton-utils 2.6.13 is released -->
<nuitonI18nVersion>2.5.2</nuitonI18nVersion>
1
0
r2779 - trunk/topia-persistence/src/main/java/org/nuiton/topia/framework
by echatellier@users.nuiton.org 23 Jul '13
by echatellier@users.nuiton.org 23 Jul '13
23 Jul '13
Author: echatellier
Date: 2013-07-23 16:49:44 +0200 (Tue, 23 Jul 2013)
New Revision: 2779
Url: http://nuiton.org/projects/topia/repository/revisions/2779
Log:
fixes #2787: Cascade save is not managed by composition
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-22 23:57:38 UTC (rev 2778)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-23 14:49:44 UTC (rev 2779)
@@ -555,8 +555,7 @@
// we must call getServiceRegistry on factory to get a working one
ServiceRegistry serviceRegistryInit = ((SessionFactoryImplementor) hibernateFactory).getServiceRegistry();
EventListenerRegistry eventListenerRegistry = serviceRegistryInit.getService(EventListenerRegistry.class);
- TopiaFiresSupport.TopiaHibernateEvent listener =
- new TopiaFiresSupport.TopiaHibernateEvent(this);
+ TopiaFiresSupport.TopiaHibernateEvent listener = new TopiaFiresSupport.TopiaHibernateEvent(this);
eventListenerRegistry.appendListeners(EventType.PRE_INSERT, listener);
eventListenerRegistry.appendListeners(EventType.PRE_LOAD, listener);
eventListenerRegistry.appendListeners(EventType.PRE_UPDATE, listener);
@@ -565,6 +564,9 @@
eventListenerRegistry.appendListeners(EventType.POST_LOAD, listener);
eventListenerRegistry.appendListeners(EventType.POST_UPDATE, listener);
eventListenerRegistry.appendListeners(EventType.POST_DELETE, listener);
+
+ // following listeners must be called before hibernate
+ eventListenerRegistry.prependListeners(EventType.SAVE_UPDATE, listener);
}
}
return hibernateFactory;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2013-07-22 23:57:38 UTC (rev 2778)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2013-07-23 14:49:44 UTC (rev 2779)
@@ -36,8 +36,10 @@
import java.util.Set;
import org.apache.commons.collections.map.IdentityMap;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.event.spi.PostDeleteEvent;
import org.hibernate.event.spi.PostDeleteEventListener;
@@ -47,6 +49,8 @@
import org.hibernate.event.spi.PostLoadEventListener;
import org.hibernate.event.spi.PostUpdateEvent;
import org.hibernate.event.spi.PostUpdateEventListener;
+import org.hibernate.event.spi.PreCollectionUpdateEvent;
+import org.hibernate.event.spi.PreCollectionUpdateEventListener;
import org.hibernate.event.spi.PreDeleteEvent;
import org.hibernate.event.spi.PreDeleteEventListener;
import org.hibernate.event.spi.PreInsertEvent;
@@ -55,6 +59,8 @@
import org.hibernate.event.spi.PreLoadEventListener;
import org.hibernate.event.spi.PreUpdateEvent;
import org.hibernate.event.spi.PreUpdateEventListener;
+import org.hibernate.event.spi.SaveOrUpdateEvent;
+import org.hibernate.event.spi.SaveOrUpdateEventListener;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaVetoException;
@@ -544,7 +550,7 @@
PostInsertEventListener, PreLoadEventListener,
PostLoadEventListener, PreUpdateEventListener,
PostUpdateEventListener, PreDeleteEventListener,
- PostDeleteEventListener {
+ PostDeleteEventListener, SaveOrUpdateEventListener {
private static final long serialVersionUID = 7303593133642169218L;
@@ -622,9 +628,18 @@
TopiaContextImplementor context = getContext(rootContext, event
.getSession());
if (context != null && event.getEntity() instanceof TopiaEntity) {
- context.getFiresSupport().fireOnPreCreate(context,
- (TopiaEntity) event.getEntity(), event.getState());
+ TopiaEntity entity = (TopiaEntity) event.getEntity();
+ context.getFiresSupport().fireOnPreCreate(context, entity, event.getState());
+
+ // when using composition, hibernate will persist entities by him self
+ // entity must have an id in this case.
+ if (StringUtils.isBlank(entity.getTopiaId())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Adding topia id on entity " + entity.getClass().getSimpleName());
+ }
+ }
}
+
return false;
}
@@ -722,6 +737,31 @@
// context.getIndexEnginImplementor().recordForIndexation(id, null);
// }
}
+
+ @Override
+ public void onSaveOrUpdate(SaveOrUpdateEvent event) throws HibernateException {
+ try {
+ // this event is called when hibernate try to persist entities
+ // using cascade (save)
+ TopiaContextImplementor context = getContext(rootContext, event.getSession());
+ // warning, event.getEntity() return null here :(
+ if (event.getObject() instanceof TopiaEntity) {
+ TopiaEntity entity = (TopiaEntity)event.getObject();
+ if (StringUtils.isBlank(entity.getTopiaId())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Adding topiaId into entity " + entity.getClass());
+ }
+ // FIXME echatellier 20130713 : hack to find interface for current entity class
+ // #newTopiaId only accept interface
+ Class entityInterface = Class.forName(event.getEntityName().replace("Impl", ""));
+ String topiaId = context.getTopiaIdFactory().newTopiaId(entityInterface, entity);
+ entity.setTopiaId(topiaId);
+ }
+ }
+ } catch (ClassNotFoundException ex) {
+ throw new HibernateException("Can't set id", ex);
+ }
+ }
}
/**
1
0
r2778 - in trunk: src/site/rst topia-persistence/src/main/java/org/nuiton/topia topia-persistence/src/main/java/org/nuiton/topia/framework
by athimel@users.nuiton.org 22 Jul '13
by athimel@users.nuiton.org 22 Jul '13
22 Jul '13
Author: athimel
Date: 2013-07-23 01:57:38 +0200 (Tue, 23 Jul 2013)
New Revision: 2778
Url: http://nuiton.org/projects/topia/repository/revisions/2778
Log:
refs #552
- Improve TopiaContext API
- Add TopiaContext.evict(x) method
Modified:
trunk/src/site/rst/migrate_to_3.0.rst
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
Modified: trunk/src/site/rst/migrate_to_3.0.rst
===================================================================
--- trunk/src/site/rst/migrate_to_3.0.rst 2013-07-20 00:48:20 UTC (rev 2777)
+++ trunk/src/site/rst/migrate_to_3.0.rst 2013-07-22 23:57:38 UTC (rev 2778)
@@ -54,8 +54,8 @@
Modularisation de la génération des TopiaID
-------------------------------------------
-La forme des topiaIds générés à changer. Si vous souhaitez conserver l'ancienne forme parce que vous
-souhaitez conserver l'uniformité avec une base de données existante ou si vous utilise
+La forme des topiaIds générés à changé. Si vous souhaitez conserver l'ancienne forme parce que vous
+souhaitez conserver l'uniformité avec une base de données existante ou si vous utilisez
topia-service-security, vous devez explicitement le spécifier à Topia 3.0 via la configuration :
topia.persistence.topiaIdFactoryClassName=org.nuiton.topia.persistence.LegacyTopiaIdFactory
@@ -80,3 +80,13 @@
Si le code précédent réalisait un cast, il faut le supprimer car cela peut
causer maintenant une erreur de compilation.
+
+
+TopiaContextListener
+--------------------
+
+L'API TopiaContextListener contenant des opérations de manipulation du schéma de base de données a été déprécié.
+L'interface est remplacée par TopiaSchemaListener. Les méthodes présentes sur le TopiaContext qui servaient à ajouter/
+supprimer un TopiaContextListener sont elles aussi dépréciées au profit de méthodes manipulant des TopiaSchemaListener.
+
+
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2013-07-20 00:48:20 UTC (rev 2777)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2013-07-22 23:57:38 UTC (rev 2778)
@@ -379,6 +379,16 @@
void add(TopiaEntity e) throws TopiaException;
/**
+ * Detaches the given entity from the session
+ *
+ * @param e the entity to detach
+ * @throws TopiaException if any exception
+ *
+ * @since 3.0
+ */
+ void evict(TopiaEntity e) throws TopiaException;
+
+ /**
* Clear persistence implementation cache.
*
* @since 2.6.13
@@ -416,28 +426,28 @@
// TODO AThimel 20/07/13 Copy "String getSchemaName();" from topia-3.0-jpa ?
/**
- * Permet de créer le schema de la base de données.
+ * Triggers database schema creation
*
* @throws TopiaException if any exception
*/
void createSchema() throws TopiaException;
/**
- * Permet d'afficher les requetes SQL de creation de base.
+ * Displays the SQL queries that would be used for a schema creation
*
* @throws TopiaException if any exception
*/
void showCreateSchema() throws TopiaException;
/**
- * Permet de mettre à jour le schema de la base de données.
+ * Triggers database schema update
*
* @throws TopiaException if any exception
*/
void updateSchema() throws TopiaException;
/**
- * Permet de supprimer le schema de la base de données.
+ * Triggers database schema drop
*
* @throws TopiaException if any exception
* @since 3.0
@@ -469,56 +479,55 @@
/* ------------------ IMPORT / EXPORT / REPLICATION ---------------------*/
/**
- * Permet de dupliquer de ce context vers un context d'une autre base des
- * données sans modification des entites.
+ * Makes a replication of some entities from this context to the given
+ * context without any entity modification.
* <p/>
- * <b>Note:</b> Si le parametre <code>entityAndCondition</code> est vide,
- * alors on duplique toutes les entités de la base.
+ * <b>Note:</b> If the <code>entityAndCondition</code> parameter is empty,
+ * all the database will be replicated
* <p/>
- * <b>Note 2:</b> Il se peut que la replication simple ne soit pas
- * suffisante (par example si l'on veut repliquer q'une partie d'une
- * entité), on utilisera donc la seconde méthode {@link
+ * <b>Note 2:</b> The simple replication may not be sufficent. You may want
+ * to replicate only a part of some entities : use the method {@link
* #replicateEntities(TopiaContext, List)}.
*
- * @param dstCtxt le context de la base destination
- * @param entityAndCondition paramètre qui vont par deux, qui represente la
- * classe de l'entity a exporter et la condition
- * where que doit respecter l'objet pour etre
- * exporter (entityClass, condition)
- * @throws TopiaException si une erreur pendant la duplication
- * @throws IllegalArgumentException si l'un des context n'est pas ouvert, ou
- * si on essaye de dupliquer dans la même
- * base.
+ * @param destinationContext the destination context
+ * @param entityAndCondition [key;value;...] parameter which key is the
+ * entity class to replicate, and value the
+ * "where" condition to use when querying entities
+ * @throws TopiaException if any problem occurred during replicate
+ * @throws IllegalArgumentException if one of the context is closed or if
+ * trying to replicate within the same
+ * database
*/
- void replicate(TopiaContext dstCtxt,
+ void replicate(TopiaContext destinationContext,
Object... entityAndCondition) throws TopiaException, IllegalArgumentException;
/**
- * Permet de dupliquer une entité du type donné vers un autre context.
+ * Replicate a given entity from this context to the given context.
*
- * @param dstCtxt le context de la base destination
- * @param entity l'entité à répliquer
- * @param <T> le type des entités à répliquer
- * @throws TopiaException si une erreur pendant la duplication
- * @throws IllegalArgumentException si l'un des context n'est pas ouvert, ou
- * si on essaye de dupliquer dans la même
- * base.
+ * @param destinationContext the destination context
+ * @param entity the entity instance to replicate
+ * @param <T> type of the entity to replicate
+ * @throws TopiaException if any problem occurred during replicate
+ * @throws IllegalArgumentException if one of the context is closed or if
+ * trying to replicate within the same
+ * database
*/
- <T extends TopiaEntity> void replicateEntity(TopiaContext dstCtxt,
+ <T extends TopiaEntity> void replicateEntity(TopiaContext destinationContext,
T entity) throws TopiaException, IllegalArgumentException;
/**
- * Permet de dupliquer les entités du type donné vers un autre context.
+ * Makes a replication of some entities from this context to the given
+ * context without any entity modification.
*
- * @param dstCtxt le context de la base destination
- * @param entities les entités à répliquer
- * @param <T> le type des entités à répliquer
- * @throws TopiaException si une erreur pendant la duplication
- * @throws IllegalArgumentException si l'un des context n'est pas ouvert, ou
- * si on essaye de dupliquer dans la même
- * base.
+ * @param destinationContext the destination context
+ * @param entities the list of entities instance to replicate
+ * @param <T> type of the entities to replicate
+ * @throws TopiaException if any problem occurred during replicate
+ * @throws IllegalArgumentException if one of the context is closed or if
+ * trying to replicate within the same
+ * database
*/
- <T extends TopiaEntity> void replicateEntities(TopiaContext dstCtxt,
+ <T extends TopiaEntity> void replicateEntities(TopiaContext destinationContext,
List<T> entities) throws TopiaException, IllegalArgumentException;
/* ------------------ H2 specific methods ---------------------*/
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-20 00:48:20 UTC (rev 2777)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-22 23:57:38 UTC (rev 2778)
@@ -1076,6 +1076,11 @@
}
@Override
+ public void evict(TopiaEntity e) throws TopiaException {
+ getHibernate().evict(e);
+ }
+
+ @Override
public void replicate(TopiaContext dstCtxt, Object... entityAndCondition)
throws TopiaException, IllegalArgumentException {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
1
0
r2777 - in trunk/topia-persistence/src/main/java/org/nuiton/topia: . event framework persistence
by athimel@users.nuiton.org 20 Jul '13
by athimel@users.nuiton.org 20 Jul '13
20 Jul '13
Author: athimel
Date: 2013-07-20 02:48:20 +0200 (Sat, 20 Jul 2013)
New Revision: 2777
Url: http://nuiton.org/projects/topia/repository/revisions/2777
Log:
refs #552 Clean TopiaContext API
fixes #2781 Rename TopiaContextListener to TopiaSchemaListener
Added:
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2013-07-20 00:12:27 UTC (rev 2776)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -29,6 +29,7 @@
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.framework.TopiaService;
@@ -39,170 +40,317 @@
import java.util.List;
/**
- * TODO-FD20100507 : Need javadoc + translate the one on methods.
+ * The TopiaContext is the most important class of ToPIA. It contains all the
+ * methods to manipulate data : transaction management, entities querying, event
+ * firing, schema management, services management, ...
* <p/>
+ * To get an instance of TopiaContext, see {@link TopiaContextFactory#getContext(java.util.Properties)}
+ * <p/>
+ * <p/>
* Created: 3 janv. 2006 21:18:34
*
* @author poussin <poussin(a)codelutin.com>
* @author tchemit <tchemit(a)codelutin.com>
+ * @author athimel <thimel(a)codelutin.com>
* @version $Id$
*/
public interface TopiaContext {
- /* Adders */
+ /* -------------------- TRANSACTION MANAGEMENT --------------------------*/
- void addTopiaEntityListener(TopiaEntityListener listener);
+ /**
+ * Returns a new context containing its own transaction.
+ *
+ * @return new context with transaction
+ * @throws TopiaException if any exception
+ */
+ TopiaContext beginTransaction() throws TopiaException;
- void addTopiaEntityListener(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityListener listener);
+ /**
+ * Applies all the modifications made to this context on the persistence
+ * device. Once commit is done, a new transaction is started.
+ *
+ * @throws TopiaException if any exception
+ */
+ void commitTransaction() throws TopiaException;
- void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+ /**
+ * Cancels all the modifications made to this context, coming back to the
+ * state on the last beginTransaction. Once rollback is done, a new
+ * transaction is started.
+ *
+ * @throws TopiaException if any exception
+ */
+ void rollbackTransaction() throws TopiaException;
- void addTopiaEntityVetoable(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityVetoable vetoable);
+ /**
+ * Closes the context. All the children contexts will be closed in the same
+ * time.
+ *
+ * @throws TopiaException if any exception
+ */
+ void closeContext() throws TopiaException;
- void addTopiaTransactionListener(TopiaTransactionListener listener);
+ /**
+ * Tells if the context is closed
+ *
+ * @return {@code true} if the context is closed, {@code false} otherwise
+ */
+ boolean isClosed();
- void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
+ /* ------------------------ EVENT FIRING --------------------------*/
- void addPropertyChangeListener(PropertyChangeListener listener);
+ /* TopiaEntityListener */
- void addTopiaContextListener(TopiaContextListener listener);
+ /**
+ * Register to the context a TopiaEntityListener about any TopiaEntity.
+ * <code>listener</code> instance will be notified AFTER any operation on
+ * the entity.
+ *
+ * @param listener the listener instance to register
+ */
+ void addTopiaEntityListener(TopiaEntityListener listener);
- void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
+ /**
+ * Register to the context a TopiaEntityListener about the given entity
+ * class. <code>listener</code> instance will be notified AFTER any
+ * operation on the entity.
+ *
+ * @param entityClass the TopiaEntity's class to listen
+ * @param listener the listener instance to register
+ */
+ void addTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
+ TopiaEntityListener listener);
- /* Removers */
-
+ /**
+ * Unregister the given TopiaEntityListener about any TopiaEntity from the
+ * context
+ *
+ * @param listener the listener instance to unregister
+ */
void removeTopiaEntityListener(TopiaEntityListener listener);
- void removeTopiaEntityListener(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityListener listener);
+ /**
+ * Unregister the given TopiaEntityListener about the given entity class
+ * from the context
+ *
+ * @param entityClass the listened TopiaEntity's class
+ * @param listener the listener instance to unregister
+ */
+ void removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
+ TopiaEntityListener listener);
+
+ /* TopiaEntityVetoable */
+
+ /**
+ * Register to the context a TopiaEntityVetoable about any TopiaEntity.
+ * <code>vetoable</code> instance will be notified BEFORE any operation on
+ * the entity.
+ *
+ * @param vetoable the vetoable instance to register
+ */
+ void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+
+ /**
+ * Register to the context a TopiaEntityVetoable about the given entity
+ * class. <code>vetoable</code> instance will be notified BEFORE any
+ * operation on the entity.
+ *
+ * @param entityClass the TopiaEntity's class to listen
+ * @param vetoable the vetoable instance to register
+ */
+ void addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
+ TopiaEntityVetoable vetoable);
+
+ /**
+ * Unregister the given TopiaEntityVetoable about any TopiaEntity from the
+ * context
+ *
+ * @param vetoable the vetoable instance to unregister
+ */
void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
- void removeTopiaEntityVetoable(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityVetoable vetoable);
+ /**
+ * Unregister the given TopiaEntityVetoable about the given entity class
+ * from the context
+ *
+ * @param entityClass the listened TopiaEntity's class
+ * @param vetoable the vetoable instance to unregister
+ */
+ void removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
+ TopiaEntityVetoable vetoable);
- void removeTopiaTransactionListener(TopiaTransactionListener listener);
- void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
+ /* TopiaEntitiesVetoable */
- void removePropertyChangeListener(PropertyChangeListener listener);
+ /**
+ * Register to the context a TopiaEntitiesVetoable about any TopiaEntity.
+ * <code>vetoable</code> instance will be notified BEFORE any entity load
+ *
+ * @param vetoable the vetoable instance to register
+ */
+ void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
- void removeTopiaContextListener(TopiaContextListener listener);
-
+ /**
+ * Unregister the given TopiaEntitiesVetoable about any TopiaEntity from the
+ * context
+ *
+ * @param vetoable the vetoable instance to unregister
+ */
void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
+
+ /* TopiaTransactionListener */
+
/**
- * Return true if specific service is available.
+ * Register to the context a TopiaTransactionListener about the transaction.
+ * <code>listener</code> instance will be notified AFTER any operation on
+ * the transaction.
*
- * @param <E> type of service
- * @param interfaceService fqn of the service
- * @return the service
+ * @param listener the listener instance to register
*/
- <E extends TopiaService> boolean serviceEnabled(
- Class<E> interfaceService);
+ void addTopiaTransactionListener(TopiaTransactionListener listener);
/**
- * Return the service. This service must be valid with public static final
- * SERVICE_NAME property.
+ * Unregister the given TopiaTransactionListener about the transaction from
+ * the context
*
- * @param <E> type of service
- * @param interfaceService class of the service
- * @return the service
- * @throws TopiaNotFoundException if service can't be retrieved
+ * @param listener the listener instance to unregister
*/
- <E extends TopiaService> E getService(Class<E> interfaceService)
- throws TopiaNotFoundException;
+ void removeTopiaTransactionListener(TopiaTransactionListener listener);
+
+ /* TopiaTransactionVetoable */
+
/**
- * Permet de créer le schema de la base de données.
+ * Register to the context a TopiaTransactionVetoable about the transaction.
+ * <code>vetoable</code> instance will be notified BEFORE any operation on
+ * the transaction.
*
- * @throws TopiaException if any exception
+ * @param vetoable the vetoable instance to register
*/
- void createSchema() throws TopiaException;
+ void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
/**
- * Permet d'afficher les requetes SQL de creation de base.
+ * Unregister the given TopiaTransactionVetoable about the transaction from
+ * the context
*
- * @throws TopiaException if any exception
+ * @param vetoable the vetoable instance to unregister
*/
- void showCreateSchema() throws TopiaException;
+ void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
+
+ /* PropertyChangeListener */
+
/**
- * Permet de mettre à jour le schema de la base de données.
+ * Register to the context a PropertyChangeListener about some entity's
+ * property change. <code>listener</code> instance will be notified AFTER
+ * any change on the entity's property
*
- * @throws TopiaException if any exception
+ * @param listener the listener instance to register
*/
- void updateSchema() throws TopiaException;
+ void addPropertyChangeListener(PropertyChangeListener listener);
/**
- * Permet de supprimer le schema de la base de données.
+ * Unregister the given PropertyChangeListener about some entity's
+ * property change from the context
*
- * @throws TopiaException if any exception
- * @since 3.0
+ * @param listener the listener instance to unregister
*/
- void dropSchema() throws TopiaException;
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /* TopiaSchemaListener */
+
/**
- * Return a new context containing his own transaction.
+ * Register to the context a TopiaSchemaListener about any schema
+ * modification. <code>listener</code> instance will be notified BEFORE and
+ * AFTER any change on the schema
*
- * @return new context with transaction
- * @throws TopiaException if any exception
+ * @param listener the listener instance to register
*/
- TopiaContext beginTransaction() throws TopiaException;
+ void addTopiaSchemaListener(TopiaSchemaListener listener);
/**
- * applique les modifications apporté a ce context sur la base de données.
+ * Unregister the given TopiaSchemaListener about any schema modification
+ * from the context
*
- * @throws TopiaException if any exception
+ * @param listener the listener instance to unregister
*/
- void commitTransaction() throws TopiaException;
+ void removeTopiaSchemaListener(TopiaSchemaListener listener);
+
+ /* TopiaContextListener */
+
/**
- * annule les modifications apporté a ce context.
+ * Register to the context a TopiaContextListener about any schema
+ * modification. <code>listener</code> instance will be notified BEFORE and
+ * AFTER any change on the schema
*
- * @throws TopiaException if any exception
+ * @param listener the listener instance to register
+ * @deprecated Use addTopiaSchemaListener
*/
- void rollbackTransaction() throws TopiaException;
+ @Deprecated
+ void addTopiaContextListener(TopiaContextListener listener);
/**
+ * Unregister the given TopiaContextListener about any schema modification
+ * from the context
+ *
+ * @param listener the listener instance to unregister
+ * @deprecated Use removeTopiaSchemaListener
+ */
+ @Deprecated
+ void removeTopiaContextListener(TopiaContextListener listener);
+
+ /* -------------------- GLOBAL OPERATIONS ON ENTITIES --------------------*/
+
+ /**
* Retrieve {@link TopiaEntity} using its unique {@code id}.
*
* @param topiaId unique identifier of the entity in all the application.
- * @return the entity found or null if not
+ * @return the entity found or null
* @throws TopiaException for errors on retrieving the entity
*/
<E extends TopiaEntity> E findByTopiaId(String topiaId) throws TopiaException;
/**
- * Permet de faire une requete HQL hibernate directement sur la base.
+ * Allow to do some HQL query
+ * <p/>
+ * WARNING : Depending on the registered service, this method may not
+ * support something else than queries on TopiaEntity
*
- * @param hql la requete a faire
- * @param args les arguments de la requete
- * @return La liste des resultats
- * @throws TopiaException si une erreur survient durant la requete
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return The result list
+ * @throws TopiaException for any error during querying
*/
- <E> List<E> findAll(String hql, Object... args) throws TopiaException;
+ <E> List<E> findAll(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Permet de faire une requete HQL hibernate directement sur la base en
- * precisant la fenetre des elements a remonter avec les parametres {@code
- * startIndex} et {@code endIndex}.
+ * Allow to do some JPA-QL query using the given bounds.
+ * <p/>
+ * No lower bound : <code>startIndex</code> = 0.<br/>
+ * No upper bound : <code>endIndex</code> = -1.
+ * <p/>
+ * WARNING : Depending on the registered service, this method may not
+ * support something else than queries on TopiaEntity
*
- * @param hql la requete a faire
- * @param startIndex la position du premier element a remonter
- * @param endIndex la position du dernier element a remonter
- * @param args les arguments de la requete
- * @return La liste des resultats
- * @throws TopiaException si une erreur survient durant la requete
+ * @param hql the HQL query
+ * @param startIndex first index of entity to return
+ * @param endIndex last index of entity to return
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return The result list
+ * @throws TopiaException for any error during querying
*/
- <E> List<E> find(String hql, int startIndex, int endIndex, Object... args)
- throws TopiaException;
+ <E> List<E> find(String hql,
+ int startIndex,
+ int endIndex,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
* Allow to do some HQL query and return an unique result. If nothing if
@@ -212,36 +360,115 @@
* WARNING : Depending on the registered service, this method may not
* support something else than queries on TopiaEntity
*
- * @param jpaql the JPA-QL query to execute
- * @param paramNamesAndValues an array of query parameters based on
- * [key,value,key,value,...]
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return The result instance or null
* @throws TopiaException for any error during querying or if the the query
* returns more than one result.
*/
- <E> E findUnique(String jpaql, Object... paramNamesAndValues)
- throws TopiaException;
+ <E> E findUnique(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
+ * Add into this TopiaContext an entity created by another TopiaContext
+ *
+ * @param e the entity to add
+ * @throws TopiaException if any exception
+ */
+ void add(TopiaEntity e) throws TopiaException;
+
+ /**
+ * Clear persistence implementation cache.
+ *
+ * @since 2.6.13
+ */
+ void clearCache() throws TopiaException;
+
+ /**
* Execute HQL operation on data (Update, Delete).
*
- * @param hql la requete a faire
- * @param args les arguments de la requete
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return The number of entities updated or deleted.
* @throws TopiaException if any exception
*/
- int execute(String hql, Object... args) throws TopiaException;
+ int execute(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Permet d'ajouter dans le TopiaContext une TopiaEntity créé par un autre
- * context.
+ * Execute a given sql code inside this transaction.
*
- * @param e l'entity a ajouter
+ * @param sqlScript the sql script to execute
+ * @throws TopiaException if any problem occurred while executing the sql script.
+ */
+ void executeSQL(String sqlScript) throws TopiaException;
+
+ // TODO AThimel 20/07/13 Copy "void doSQLWork(TopiaSQLWork sqlWork);" from topia-3.0-jpa ?
+
+ /* -------------------- SCHEMA MANAGMENT -----------------------------*/
+
+ // TODO AThimel 20/07/13 Copy "boolean isSchemaEmpty();" from topia-3.0-jpa ?
+
+ // TODO AThimel 20/07/13 Copy "boolean isTableExists(Class<?> clazz);" from topia-3.0-jpa ?
+
+ // TODO AThimel 20/07/13 Copy "String getSchemaName();" from topia-3.0-jpa ?
+
+ /**
+ * Permet de créer le schema de la base de données.
+ *
* @throws TopiaException if any exception
*/
- void add(TopiaEntity e) throws TopiaException;
+ void createSchema() throws TopiaException;
/**
+ * Permet d'afficher les requetes SQL de creation de base.
+ *
+ * @throws TopiaException if any exception
+ */
+ void showCreateSchema() throws TopiaException;
+
+ /**
+ * Permet de mettre à jour le schema de la base de données.
+ *
+ * @throws TopiaException if any exception
+ */
+ void updateSchema() throws TopiaException;
+
+ /**
+ * Permet de supprimer le schema de la base de données.
+ *
+ * @throws TopiaException if any exception
+ * @since 3.0
+ */
+ void dropSchema() throws TopiaException;
+
+ /* -------------------- SERVICES MANAGMENT -------------------------------*/
+
+ /**
+ * Return true if specific service is available.
+ *
+ * @param <E> type of service
+ * @param interfaceService fqn of the service
+ * @return the service
+ */
+ <E extends TopiaService> boolean serviceEnabled(Class<E> interfaceService);
+
+ /**
+ * Return the service. This service must be valid with public static final
+ * SERVICE_NAME property.
+ *
+ * @param <E> type of service
+ * @param interfaceService class of the service
+ * @return the service
+ * @throws TopiaNotFoundException if service can't be retrieved
+ */
+ <E extends TopiaService> E getService(Class<E> interfaceService) throws TopiaNotFoundException;
+
+ /* ------------------ IMPORT / EXPORT / REPLICATION ---------------------*/
+
+ /**
* Permet de dupliquer de ce context vers un context d'une autre base des
* données sans modification des entites.
* <p/>
@@ -263,8 +490,8 @@
* si on essaye de dupliquer dans la même
* base.
*/
- void replicate(TopiaContext dstCtxt, Object... entityAndCondition)
- throws TopiaException, IllegalArgumentException;
+ void replicate(TopiaContext dstCtxt,
+ Object... entityAndCondition) throws TopiaException, IllegalArgumentException;
/**
* Permet de dupliquer une entité du type donné vers un autre context.
@@ -277,8 +504,8 @@
* si on essaye de dupliquer dans la même
* base.
*/
- <T extends TopiaEntity> void replicateEntity(TopiaContext dstCtxt, T entity)
- throws TopiaException, IllegalArgumentException;
+ <T extends TopiaEntity> void replicateEntity(TopiaContext dstCtxt,
+ T entity) throws TopiaException, IllegalArgumentException;
/**
* Permet de dupliquer les entités du type donné vers un autre context.
@@ -292,9 +519,10 @@
* base.
*/
<T extends TopiaEntity> void replicateEntities(TopiaContext dstCtxt,
- List<T> entities)
- throws TopiaException, IllegalArgumentException;
+ List<T> entities) throws TopiaException, IllegalArgumentException;
+ /* ------------------ H2 specific methods ---------------------*/
+
/**
* Sauve la base de données dans un format natif a la base, la
* representation n'est pas portable d'une base a l'autre. Cette methode ne
@@ -304,56 +532,35 @@
* @param file le nom du fichier ou stocker les informations
* @param compress si vrai compress le fichier avec gzip
* @throws TopiaException if any exception
+ * @deprecated Only H2 compatible : remove it, or move to another class
*/
- void backup(File file, boolean compress) throws TopiaException;
+ @Deprecated
+ void backup(File file,
+ boolean compress) throws TopiaException;
/**
- * Supprime toutes les tables et autres elements de la database.
- *
- * @param dropDatabase si vrai alors supprime aussi la base de données si la
- * base utilise des fichiers les fichiers seront
- * supprimé (ex: h2) ou sera fait sur la base
- * (postgresql)
- * @throws TopiaException if any exception
- */
- void clear(boolean dropDatabase) throws TopiaException;
-
- /**
- * Clear persistence implementation cache.
- *
- * @since 2.6.13
- */
- void clearCache() throws TopiaException;
-
- /**
* l'inverse de la methode {@link #backup(File,boolean)}.
*
* @param file le fichier ou prendre les informations, il peut-etre
* compressé avec gzip ou non.
* @throws TopiaException if any exception
+ * @deprecated Only H2 compatible : remove it, or move to another class
*/
+ @Deprecated
void restore(File file) throws TopiaException;
+
/**
- * Ferme le contexte.
+ * Supprime toutes les tables et autres elements de la database.
*
+ * @param dropDatabase si vrai alors supprime aussi la base de données si la
+ * base utilise des fichiers les fichiers seront
+ * supprimé (ex: h2) ou sera fait sur la base
+ * (postgresql)
* @throws TopiaException if any exception
+ * @deprecated Only H2 compatible : remove it, or move to another class
*/
- void closeContext() throws TopiaException;
+ @Deprecated
+ void clear(boolean dropDatabase) throws TopiaException;
- /**
- * Indique si le contexte a ete ferme.
- *
- * @return {@code true} si le context est ferme, {@code false} autrement
- */
- boolean isClosed();
-
- /**
- * Execute a given sql code inside this transaction.
- *
- * @param sqlScript the sql script to execute
- * @throws TopiaException if any problem occurs while executing the sql script.
- */
- void executeSQL(String sqlScript) throws TopiaException;
-
} //TopiaContext
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java 2013-07-20 00:12:27 UTC (rev 2776)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -25,8 +25,6 @@
package org.nuiton.topia.event;
-import java.util.EventListener;
-
/**
* Listener for TopiaContext actions.
* <p/>
@@ -40,63 +38,43 @@
* @author chatellier <chatellier(a)codelutin.com>
* @version $Id$
*/
-public interface TopiaContextListener extends EventListener {
+@Deprecated
+public interface TopiaContextListener extends TopiaSchemaListener {
/**
- * Called before dropSchema call
- *
- * @param event event
- * @since 3.0
+ * @deprecated Use {@link TopiaSchemaListener#preCreateSchema(TopiaContextEvent)}
*/
- void preDropSchema(TopiaContextEvent event);
-
- /**
- * Called after dropSchema call
- *
- * @param event event
- * @since 3.0
- */
- void postDropSchema(TopiaContextEvent event);
-
- /**
- * Called before createSchema call
- *
- * @param event event
- */
+ @Deprecated
void preCreateSchema(TopiaContextEvent event);
/**
- * Called after createSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postCreateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postCreateSchema(TopiaContextEvent event);
/**
- * Called before updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#preUpdateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void preUpdateSchema(TopiaContextEvent event);
/**
- * Called after updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postUpdateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postUpdateSchema(TopiaContextEvent event);
/**
- * Called before restoreSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#preRestoreSchema(TopiaContextEvent)}
*/
+ @Deprecated
void preRestoreSchema(TopiaContextEvent event);
/**
- * Called after restoreSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postRestoreSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postRestoreSchema(TopiaContextEvent event);
+
}
Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java (rev 0)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -0,0 +1,102 @@
+package org.nuiton.topia.event;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.EventListener;
+
+/**
+ * Listener for TopiaContext actions.
+ * <p/>
+ * Listener are notified for action such as :
+ * <ul>
+ * <li>createSchema</li>
+ * <li>updateSchema</li>
+ * <li>...</li>
+ * </ul>
+ *
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ * @since 3.0
+ */
+public interface TopiaSchemaListener extends EventListener {
+
+ /**
+ * Called before createSchema call
+ *
+ * @param event event
+ */
+ void preCreateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after createSchema call
+ *
+ * @param event event
+ */
+ void postCreateSchema(TopiaContextEvent event);
+
+ /**
+ * Called before updateSchema call
+ *
+ * @param event event
+ */
+ void preUpdateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void postUpdateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void preRestoreSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void postRestoreSchema(TopiaContextEvent event);
+
+ /**
+ * Called before dropSchema call
+ *
+ * @param event event
+ * @since 3.0
+ */
+ void preDropSchema(TopiaContextEvent event);
+
+ /**
+ * Called after dropSchema call
+ *
+ * @param event event
+ * @since 3.0
+ */
+ void postDropSchema(TopiaContextEvent event);
+
+}
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-20 00:12:27 UTC (rev 2776)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -55,6 +55,7 @@
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.persistence.DefaultTopiaIdFactory;
@@ -950,15 +951,15 @@
}
@Override
- public <E> List<E> findAll(String hql, Object... args) throws TopiaException {
+ public <E> List<E> findAll(String hql, Object... propertyNamesAndValues) throws TopiaException {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
"findAll"));
try {
Query query = getHibernate().createQuery(hql);
- for (int j = 0; j < args.length; j += 2) {
- String name = (String) args[j];
- Object value = args[j + 1];
+ for (int j = 0; j < propertyNamesAndValues.length; j += 2) {
+ String name = (String) propertyNamesAndValues[j];
+ Object value = propertyNamesAndValues[j + 1];
if (value.getClass().isArray()) {
query.setParameterList(name, (Object[]) value);
} else if (value instanceof Collection<?>) {
@@ -981,16 +982,16 @@
}
@Override
- public <E> List<E> find(String hql, int startIndex, int endIndex, Object... args)
+ public <E> List<E> find(String hql, int startIndex, int endIndex, Object... propertyNamesAndValues)
throws TopiaException {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
"find"));
try {
Query query = getHibernate().createQuery(hql);
- for (int j = 0; j < args.length; j += 2) {
- String name = (String) args[j];
- Object value = args[j + 1];
+ for (int j = 0; j < propertyNamesAndValues.length; j += 2) {
+ String name = (String) propertyNamesAndValues[j];
+ Object value = propertyNamesAndValues[j + 1];
if (value.getClass().isArray()) {
query.setParameterList(name, (Object[]) value);
} else if (value instanceof Collection<?>) {
@@ -1015,12 +1016,12 @@
}
@Override
- public <E> E findUnique(String hql, Object... paramNamesAndValues)
+ public <E> E findUnique(String hql, Object... propertyNamesAndValues)
throws TopiaException {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
"findUnique"));
- List<E> results = find(hql, 0, 1, paramNamesAndValues);
+ List<E> results = find(hql, 0, 1, propertyNamesAndValues);
// If there is more than 1 result, throw an exception
if (results.size() > 1) {
@@ -1041,19 +1042,19 @@
* Execute HQL operation on data (Update, Delete)
*
* @param hql HQL query
- * @param args arguments for query
+ * @param propertyNamesAndValues arguments for query
* @return The number of entities updated or deleted.
* @throws TopiaException
*/
@Override
- public int execute(String hql, Object... args) throws TopiaException {
+ public int execute(String hql, Object... propertyNamesAndValues) throws TopiaException {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
"find"));
try {
Query query = getHibernate().createQuery(hql);
- for (int j = 0; j < args.length; j += 2) {
- query.setParameter((String) args[j], args[j + 1]);
+ for (int j = 0; j < propertyNamesAndValues.length; j += 2) {
+ query.setParameter((String) propertyNamesAndValues[j], propertyNamesAndValues[j + 1]);
}
int result = query.executeUpdate();
return result;
@@ -1319,10 +1320,16 @@
}
@Override
+ @Deprecated
public void addTopiaContextListener(TopiaContextListener listener) {
getFiresSupport().addTopiaContextListener(listener);
}
+ @Override
+ public void addTopiaSchemaListener(TopiaSchemaListener listener) {
+ getFiresSupport().addTopiaSchemaListener(listener);
+ }
+
/* Listeners removers */
@Override
@@ -1369,11 +1376,17 @@
}
@Override
+ @Deprecated
public void removeTopiaContextListener(TopiaContextListener listener) {
getFiresSupport().removeTopiaContextListener(listener);
}
@Override
+ public void removeTopiaSchemaListener(TopiaSchemaListener listener) {
+ getFiresSupport().removeTopiaSchemaListener(listener);
+ }
+
+ @Override
public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
getFiresSupport().addTopiaEntitiesVetoable(vetoable);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2013-07-20 00:12:27 UTC (rev 2776)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -65,6 +65,7 @@
import org.nuiton.topia.event.TopiaEntityEvent;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionEvent;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
@@ -119,8 +120,8 @@
/* Pour les actions du topia context */
- protected ListenerSet<TopiaContextListener> topiaContextListeners =
- new ListenerSet<TopiaContextListener>();
+ protected ListenerSet<TopiaSchemaListener> topiaSchemaListeners =
+ new ListenerSet<TopiaSchemaListener>();
/**
* used to register objects loaded during transaction.
@@ -733,9 +734,9 @@
log.debug("firePreCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preCreateSchema(event);
+ topiaSchemaListener.preCreateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -752,9 +753,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postCreateSchema(event);
+ topiaSchemaListener.postCreateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -771,9 +772,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preUpdateSchema(event);
+ topiaSchemaListener.preUpdateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -790,9 +791,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postUpdateSchema(event);
+ topiaSchemaListener.postUpdateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -809,9 +810,9 @@
log.debug("firePreRestoreSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preRestoreSchema(event);
+ topiaSchemaListener.preRestoreSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -828,9 +829,9 @@
log.debug("firePostRestoreSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postRestoreSchema(event);
+ topiaSchemaListener.postRestoreSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -848,9 +849,9 @@
log.debug("firePreDropSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preDropSchema(event);
+ topiaSchemaListener.preDropSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -868,9 +869,9 @@
log.debug("firePostDropSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postDropSchema(event);
+ topiaSchemaListener.postDropSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -923,10 +924,21 @@
return transactionVetoables;
}
+ @Deprecated
public ListenerSet<TopiaContextListener> getTopiaContextListeners() {
- return topiaContextListeners;
+ ListenerSet<TopiaContextListener> copy = new ListenerSet<TopiaContextListener>();
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
+ if (topiaSchemaListener instanceof TopiaContextListener) {
+ copy.add((TopiaContextListener)topiaSchemaListener);
+ }
+ }
+ return copy;
}
+ public ListenerSet<TopiaSchemaListener> getTopiaSchemaListeners() {
+ return topiaSchemaListeners;
+ }
+
public ListenerSet<TopiaEntitiesVetoable> getTopiaEntitiesVetoable() {
return entitiesVetoables;
}
@@ -980,13 +992,21 @@
propertyChangeListeners.add(listener);
}
+ @Deprecated
public void addTopiaContextListener(TopiaContextListener listener) {
if (listener == null) {
throw new NullPointerException("listener can not be null.");
}
- topiaContextListeners.add(listener);
+ topiaSchemaListeners.add(listener);
}
+ public void addTopiaSchemaListener(TopiaSchemaListener listener) {
+ if (listener == null) {
+ throw new NullPointerException("listener can not be null.");
+ }
+ topiaSchemaListeners.add(listener);
+ }
+
public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
if (vetoable == null) {
throw new NullPointerException("listener can not be null.");
@@ -1047,9 +1067,16 @@
if (listener == null) {
throw new NullPointerException("listener can not be null.");
}
- topiaContextListeners.remove(listener);
+ topiaSchemaListeners.remove(listener);
}
+ public void removeTopiaSchemaListener(TopiaSchemaListener listener) {
+ if (listener == null) {
+ throw new NullPointerException("listener can not be null.");
+ }
+ topiaSchemaListeners.remove(listener);
+ }
+
public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
if (vetoable == null) {
throw new NullPointerException("listener can not be null.");
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java 2013-07-20 00:12:27 UTC (rev 2776)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java 2013-07-20 00:48:20 UTC (rev 2777)
@@ -41,6 +41,7 @@
*
* @since 2.6.12
*/
+ // TODO AThimel 20/07/13 Why is this function useful ? Why not use directly the GET_TOPIA_ID Function ?
public static Function<TopiaEntity, String> getTopiaIdFunction() {
return GET_TOPIA_ID;
}
1
0
r2776 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by athimel@users.nuiton.org 20 Jul '13
by athimel@users.nuiton.org 20 Jul '13
20 Jul '13
Author: athimel
Date: 2013-07-20 02:12:27 +0200 (Sat, 20 Jul 2013)
New Revision: 2776
Url: http://nuiton.org/projects/topia/repository/revisions/2776
Log:
Add missing SVN properties et file headers
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java 2013-07-19 23:32:02 UTC (rev 2775)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java 2013-07-20 00:12:27 UTC (rev 2776)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import org.nuiton.topia.TopiaException;
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java 2013-07-19 23:32:02 UTC (rev 2775)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java 2013-07-20 00:12:27 UTC (rev 2776)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import org.nuiton.topia.TopiaNotFoundException;
/**
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java 2013-07-19 23:32:02 UTC (rev 2775)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java 2013-07-20 00:12:27 UTC (rev 2776)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.base.Function;
public class TopiaEntities {
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntities.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-07-19 23:32:02 UTC (rev 2775)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-07-20 00:12:27 UTC (rev 2776)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
/**
* Contract representing a strategy of id generation.
*
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r2775 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by athimel@users.nuiton.org 19 Jul '13
by athimel@users.nuiton.org 19 Jul '13
19 Jul '13
Author: athimel
Date: 2013-07-20 01:32:02 +0200 (Sat, 20 Jul 2013)
New Revision: 2775
Url: http://nuiton.org/projects/topia/repository/revisions/2775
Log:
refs #552 Clean some APIs : mainly TopiaDAO and TopiaEntity (still not acheived, check out the TODOs
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/EntityVisitor.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntityEnum.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceHelper.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/EntityVisitor.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/EntityVisitor.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/EntityVisitor.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -60,7 +60,9 @@
* @param type the type of the visited property
* @param value the value of the visited property
*/
- void visit(TopiaEntity entity, String propertyName, Class<?> type,
+ void visit(TopiaEntity entity,
+ String propertyName,
+ Class<?> type,
Object value);
/**
@@ -74,8 +76,11 @@
* @param type the type of the visited property
* @param value the value of the visited property
*/
- void visit(TopiaEntity entity, String propertyName,
- Class<?> collectionType, Class<?> type, Object value);
+ void visit(TopiaEntity entity,
+ String propertyName,
+ Class<?> collectionType,
+ Class<?> type,
+ Object value);
/**
* Visit a indexed value from a collection property for the given entity.
@@ -89,8 +94,12 @@
* @param index the index of the visited property in his container
* @param value the value of the visited property
*/
- void visit(TopiaEntity entity, String propertyName,
- Class<?> collectionType, Class<?> type, int index, Object value);
+ void visit(TopiaEntity entity,
+ String propertyName,
+ Class<?> collectionType,
+ Class<?> type,
+ int index,
+ Object value);
/**
* Reset all states of the visitor.
@@ -101,4 +110,5 @@
* This method should be invoked after usage of the visitor.
*/
void clear();
+
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -77,60 +77,56 @@
E newInstance() throws TopiaException;
/**
- * Construit une nouvelle instance de l'objet géré par ce DAO
+ * Creates a new instance of the entity managed by the DAO
*
- * @param properties la liste des propriétés que doit avoir l'objet créé les
- * arguments vont par paire (propertyName, value)
- * @return un nouvel objet
- * @throws TopiaException si un problème est rencontré durant
- * l'instanciation
- * @throws IllegalArgumentException Si le nombre on le type des arguments
- * n'est pas bon ou que le type ou le nom
- * d'une propriété est fausse
+ * @param propertyNamesAndValues the list of properties that the created entity will have. Arguments are key-value
+ * paired : [propertyName;value;propertyName;value;...]
+ * @return the newly created entity
+ * @throws TopiaException if any problem during instantiation
+ * @throws IllegalArgumentException if the arguments count is not correct or
+ * if some property type is not the
+ * expected one
+ * @see #create(Map)
*/
- E create(Object... properties) throws TopiaException;
+ E create(Object... propertyNamesAndValues) throws TopiaException;
/**
- * Construit une nouvelle instance de l'objet géré par ce DAO
+ * Creates a new instance of the entity managed by the DAO
*
- * @param properties la liste des propriétés que doit avoir l'objet créé
- * @return un nouvel objet
- * @throws TopiaException si un problème est rencontré durant
- * l'instanciation
- * @throws IllegalArgumentException Si le nombre on le type des arguments
- * n'est pas bon ou que le type ou le nom
- * d'une propriété est fausse
+ * @param properties the key-value list of properties that the created entity will have.
+ * @return the newly created entity
+ * @throws TopiaException if any problem during instantiation
+ * @throws IllegalArgumentException if some property type is not the
+ * expected one
*/
E create(Map<String, Object> properties) throws TopiaException;
/**
- * Permet de sauver un object instancié sans le DAO.
- * Utilisé notement dans le cas ou le DAO est situé derriere une couche
- * de webservice et que l'appel à la methode {@link #create(Object...)}
- * serait trop couteux.
+ * Creates an entity not created without the DAO. Generally used when DAO
+ * is layered after a service layer where the {@link #create(Object...)}
+ * would be to onerous.
*
- * @param e l'entité instanciée à sauver
- * @return l'entité avec son topiaID valorisé
- * @throws TopiaException if any pb while creating datas
+ * @param e the instance to persist
+ * @return the persisted entity (with its topiaId valued)
+ * @throws TopiaException if any problem while creating data
* @since 2.3.1
*/
E create(E e) throws TopiaException;
/**
- * Permet d'ajouter ou de mettre a jour un objet. Cela permet d'ajouter par
- * exemple un objet provenant d'un autre context mais du meme type de DAO.
+ * Update an entity. May be used for an entity coming from another context.
*
- * @param e l'entite a ajouter ou mettre a jour
- * @return l'entity passé en paramètre.
- * @throws TopiaException if any pb while updating datas
+ * @param e the entity to create or update
+ * @return the given entity
+ * @throws TopiaException if any problem while updating datas
*/
E update(E e) throws TopiaException;
/**
- * Permet de supprimer une entite.
+ * Removes the given entity from the storage
*
- * @param e l'entite a supprimer
- * @throws TopiaException if any pb while deleting datas
+ * @param e the entity to remove
+ * @throws TopiaException if any problem while deleting datas
*/
void delete(E e) throws TopiaException;
@@ -160,339 +156,367 @@
* Find an entity matching {@code value} for the given {@code propertyName}.
*
* @param propertyName property name to filter
- * @param value value of the property to math
+ * @param value value of the property to match
* @return the first entity matching the request
- * @throws TopiaException
+ * @throws TopiaException if any pb while getting datas
*/
- E findByProperty(String propertyName, Object value) throws TopiaException;
+ E findByProperty(String propertyName,
+ Object value) throws TopiaException;
/**
- * @param propertyName le nom de la propriété
- * @param value la valeur à tester
- * @param others les autres proprietes doivent aller par 2
- * propertyName, value
- * @return l'entité trouvé
+ * Find an entity matching a succession of propertyName + value arguments.
+ *
+ * @param propertyName the first property name to filter
+ * @param value the first value of the property to match
+ * @param propertyNamesAndValues other property names and values. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the first entity matching the request
* @throws TopiaException if any pb while getting datas
*/
- E findByProperties(String propertyName, Object value, Object... others) throws TopiaException;
+ E findByProperties(String propertyName,
+ Object value,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
* Find an entity matching {@code properties}.
*
- * @param properties les propriétés à matcher
- * @return l'entité trouvé
+ * @param properties the properties key + value to match
+ * @return the first entity matching the request
* @throws TopiaException if any pb while getting datas
*/
E findByProperties(Map<String, Object> properties) throws TopiaException;
/**
- * Execute une requête basé sur l'entité du DAO. Permet de récupérer une
- * entité correspondant à la requête.
+ * Executes and returns the result (entity E) of the given HQL query string.
*
- * @param hql la requête hql à executer
- * @param params les paramètres de la requète
- * @return l'entité correspondant à la recherche ou null si aucune entité
- * n'a été trouvée
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the entity E found or null
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
- E findByQuery(String hql, Object... params) throws TopiaException;
+ E findByQuery(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
+ // TODO AThimel 20/07/13 Add this method : E findByQuery(String hql, Map<String, Object> propertyNamesAndValues) throws TopiaException;
+
/**
- * Execute une requête basé sur le {@code type} donné.
- * <p/>
- * Permet de récupérer une entité correspondant à la requête.
+ * Executes and returns the result (entity R) of the given HQL query string.
*
- * @param hql la requête hql à executer
- * @param params les paramètres de la requète
- * @return l'entité correspondant à la recherche ou null si aucune entité
- * n'a été trouvée
+ * @param type the expected result type
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the entity R found or null
* @throws TopiaException if any pb while getting datas
+ * @throws ClassCastException if the found type is not the expected one
* @since 2.6.12
*/
- <R> R findByQuery(Class<R> type, String hql, Object... params) throws TopiaException;
+ <R> R findByQuery(Class<R> type,
+ String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
+ // TODO AThimel 20/07/13 Add this method : <R> R findByQuery(Class<R> type, String hql, Map<String, Object> propertyNamesAndValues) throws TopiaException;
+
/**
- * Recherche la classe en utilisant la cle naturelle, chaque champs de la
- * cle naturelle est une entre de la map passe en argument.
+ * Find an entity using the natural ids. Each field of the natural id has to be present in the given Map.
*
- * @param keys la liste des champs de la cle naturelle avec leur valeur
- * @return l'entite trouvé
+ * @param keys Map with the natural id property name as Map.key, and value as Map.value
+ * @return the entity E found or null
* @throws TopiaException if any pb while getting datas
*/
E findByPrimaryKey(Map<String, Object> keys) throws TopiaException;
/**
- * Recherche la classe en utilisant la cle naturelle, si la cle naturelle
- * est composé de plusieurs champs alors les arguments passés doivent être
- * dans l'ordre de declaration dans le fichier de mapping
+ * Find an entity using the natural ids. Each field of the natural id has to
+ * be present in the given Map.
*
- * @param k l'objet cle naturelle de la classe
- * @return l'entité trouvé
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the entity E found or null
* @throws TopiaException if any pb while getting datas
*/
- E findByPrimaryKey(Object... k) throws TopiaException;
+ E findByPrimaryKey(Object... propertyNamesAndValues) throws TopiaException;
/**
- * Récupère la première entité (du type géré par ce dao) dont la
- * collection nommée {@code propertyName} contient la {@code property}
- * donnée.
+ * Find the first entity which given collection (propertyName) contains the
+ * given value
*
- * @param propertyName le nom de la propriété
- * @param property la propriété recherchée
- * @return la première entité recherchée
- * @throws TopiaException pour tout erreur lors de la recherche
+ * @param propertyName the name of the property (must be a collection)
+ * @param value the value to use for find
+ * @return the entity E found or null
+ * @throws TopiaException if any pb while getting datas
* @since 2.5.4
*/
- E findContains(String propertyName, Object property) throws TopiaException;
+ E findContains(String propertyName,
+ Object value) throws TopiaException;
//------------------------------------------------------------------------//
//-- findAllXXX methods --------------------------------------------------//
//------------------------------------------------------------------------//
/**
- * Gets all entitys of the dao type in db.
+ * Finds all the entities managed by this DAO.
*
- * @return all entities of the dao type in db
- * @throws TopiaException
+ * @return the full list of entities
+ * @throws TopiaException if any pb while getting datas
*/
List<E> findAll() throws TopiaException;
/**
- * Recuperation de tous les ids en base pour le type d'entite du dao.
+ * Finds all entites E managed by this DAO. The returned list will be ordered according to the given
+ * {@code propertyNames}.
+ * <p/>
+ * You can add on each {@code property} {@code ASC} or {@code DESC} to force the result order
+ * (by default is {@code ASC}).
*
- * @return la liste de tous les ids
- * @throws TopiaException si pb en base
+ * @param propertyNames property names of order to apply
+ * @return all entities E of the dao entity type with given order
+ * @throws TopiaException if any pb while getting datas
*/
+ List<E> findAllWithOrder(String... propertyNames) throws TopiaException;
+
+ /**
+ * Find all the ids for the E entity type
+ *
+ * @return the full list of ids
+ * @throws TopiaException if any pb while getting datas
+ */
+ // TODO AThimel 20/07/13 This method should return a Set ?
List<String> findAllIds() throws TopiaException;
/**
- * Gets all entities of the dao type matching the {@code value} for the
- * given {@code propertyName}.
+ * Finds all entities E which value for the given {@code propertyName} is
+ * {@code value}
*
- * @param propertyName property name to filter
- * @param value value to match
- * @return matching entities
+ * @param propertyName property name to use
+ * @param value value to expect
+ * @return the list of entities E having the given value
* @throws TopiaException if any pb while getting datas
*/
- List<E> findAllByProperty(String propertyName, Object value)
- throws TopiaException;
+ List<E> findAllByProperty(String propertyName,
+ Object value) throws TopiaException;
/**
- * Gets all entities of the dao type matching the {@code value} for the
- * given {@code propertyName} and {@code others}.
+ * Finds all entities E matching the given {@code propertyName}, {@code value}
+ * AND all other properties
*
- * @param propertyName le nom de la propriété
- * @param value la valeur à tester
- * @param others les autres proprietes doivent aller par 2
- * propertyName, value
- * @return matching entities
+ * @param propertyName property name to use
+ * @param value value to expect
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the list of entities E having the given value
* @throws TopiaException if any pb while getting datas
*/
- List<E> findAllByProperties(String propertyName, Object value,
- Object... others) throws TopiaException;
+ List<E> findAllByProperties(String propertyName,
+ Object value,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets all entities of the dao type matching all the {@code properties}.
+ * Finds all entities E matching all the {@code properties} values.
*
* @param properties properties to match
- * @return matching entities
+ * @return the list of entities E having the given values
* @throws TopiaException if any pb while getting datas
*/
- List<E> findAllByProperties(Map<String, Object> properties)
- throws TopiaException;
+ List<E> findAllByProperties(Map<String, Object> properties) throws TopiaException;
/**
- * Gets all entities when executing the given select query for the dao
- * entity type.
+ * Finds all entities E when executing the given HQL query.
*
- * @param hql hql query
- * @param params query params
- * @return entites of the query result
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return the list of entities E found by the query and parameters
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
- List<E> findAllByQuery(String hql, Object... params) throws TopiaException;
+ List<E> findAllByQuery(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
+ // TODO AThimel 20/07/13 Add this method : List<E> findAllByQuery(String hql, Map<String, Object> propertyNamesAndValues) throws TopiaException;
+
/**
* Gets all entities when executing the given select query for the given
* {@code type} which may not be a entity type (int, long, map,...).
*
- * @param hql hql query
- * @param params query params
+ * @param type the expected result type
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return entites of the query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
<R> List<R> findAllByQuery(Class<R> type,
String hql,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
+ // TODO AThimel 20/07/13 Add this method : <R> List<R> findAllByQuery(Class<R> type, String hql, Map<String, Object> propertyNamesAndValues) throws TopiaException;
+
/**
- * Gets all entities in lazy mode when executing the given select query
+ * Finds all entities E in lazy mode when executing the given select query
* for the dao entity type.
* <p/>
- * <strong>Important note:</strong>
+ * <strong>Important note:</strong> // TODO AThimel 20/07/13 Write the important note...
*
- * @param hql hql query
- * @param params query params
- * @return entites of the query result
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites E of the query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.14
*/
Iterable<E> findAllLazyByQuery(String hql,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets all entities in lazy mode when executing the given select query
+ * Finds all entities R in lazy mode when executing the given select query
* for the given {@code type} which may not be a entity type (int, long, map,...).
* <p/>
- * <strong>Important note:</strong>
+ * <strong>Important note:</strong> // TODO AThimel 20/07/13 Write the important note...
*
- * @param type type of data to return
- * @param hql hql query
- * @param params query params
- * @return entites of the query result
+ * @param type the expected result type
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites R of the query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.14
*/
<R> Iterable<R> findAllLazyByQuery(Class<R> type,
String hql,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets all entities in lazy mode when executing the given select query
+ * Finds all entities E in lazy mode when executing the given select query
* for the dao entity type.
* <p/>
- * <strong>Important note:</strong>
+ * <strong>Important note:</strong> // TODO AThimel 20/07/13 Write the important note...
*
- * @param batchSize batch size
- * @param hql hql query
- * @param params query params
- * @return entites of the query result
+ * @param batchSize batch size
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites E of the query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.14
*/
Iterable<E> findAllLazyByQuery(int batchSize,
String hql,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets all entities in lazy mode when executing the given select query
+ * Finds all entities R in lazy mode when executing the given select query
* for the given {@code type} which may not be a entity type (int, long, map,...).
* <p/>
- * <strong>Important note:</strong>
+ * <strong>Important note:</strong> // TODO AThimel 20/07/13 Write the important note...
*
- * @param type type of data to return
- * @param batchSize batch size
- * @param hql hql query
- * @param params query params
- * @return entites of the query result
+ * @param type the expected result type
+ * @param batchSize batch size
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites R of the query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.14
*/
<R> Iterable<R> findAllLazyByQuery(Class<R> type,
int batchSize,
String hql,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets a page of entities when executing the given select query for the dao
+ * Finds a page of entities E when executing the given select query for the dao
* entity type (will only return the window of {@code startIndex -
* endIndex} entities).
+ * // TODO AThimel 20/07/13 Reformulate(?) the "window thing"
*
- * @param hql hql query to execute
- * @param startIndex first index of entity to return
- * @param endIndex last index of entity to return
- * @param params query params
- * @return entites of the paginated query result
+ * @param hql the HQL query
+ * @param startIndex first index of entity to return
+ * @param endIndex last index of entity to return
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites E of the paginated query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
- <R> List<R> findAllByQueryWithBound(Class<R> type,
- String hql,
- int startIndex,
- int endIndex,
- Object... params) throws TopiaException;
+ List<E> findAllByQueryWithBound(String hql,
+ int startIndex,
+ int endIndex,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets a page of entities when executing the given select query for the dao
+ * Finds a page of entities R when executing the given select query for the dao
* entity type (will only return the window of {@code startIndex -
* endIndex} entities).
+ * // TODO AThimel 20/07/13 Reformulate(?) the "window thing"
*
- * @param hql hql query to execute
- * @param startIndex first index of entity to return
- * @param endIndex last index of entity to return
- * @param params query params
- * @return entites of the paginated query result
+ * @param type the expected result type
+ * @param hql the HQL query
+ * @param startIndex first index of entity to return
+ * @param endIndex last index of entity to return
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entites R of the paginated query result
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
- List<E> findAllByQueryWithBound(String hql,
- int startIndex,
- int endIndex,
- Object... params) throws TopiaException;
+ <R> List<R> findAllByQueryWithBound(Class<R> type,
+ String hql,
+ int startIndex,
+ int endIndex,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets a page of entities of the given select {@code hql} query using the
+ * Gets a page of entities E of the given select {@code hql} query using the
* {@code pager} to obtain the window of entities to return.
*
- * @param type type of data to return
- * @param hql hql query to execute
- * @param pager pager to obtan the correct window of data
- * @param params params of the query
- * @return entities of the paginated query result
+ * @param hql the HQL query
+ * @param pager pager to obtain the correct window of data
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entities E of the paginated query result
* @throws TopiaException if any pb while getting datas
* @see TopiaPagerBean
* @since 2.6.12
*/
- <R> List<R> findAllByQueryAndPager(Class<R> type,
- String hql,
- TopiaPagerBean pager,
- Object... params) throws TopiaException;
+ List<E> findAllByQueryAndPager(String hql,
+ TopiaPagerBean pager,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets a page of entities of the given select {@code hql} query using the
+ * Finds a page of entities R of the given select {@code hql} query using the
* {@code pager} to obtain the window of entities to return.
*
- * @param hql hql query to execute
- * @param pager pager to obtan the correct window of data
- * @param params params of the query
- * @return entities of the paginated query result
+ * @param type the expected result type
+ * @param hql the HQL query
+ * @param pager pager to obtain the correct window of data
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
+ * @return entities R of the paginated query result
* @throws TopiaException if any pb while getting datas
* @see TopiaPagerBean
* @since 2.6.12
*/
- List<E> findAllByQueryAndPager(String hql,
- TopiaPagerBean pager,
- Object... params) throws TopiaException;
+ <R> List<R> findAllByQueryAndPager(Class<R> type,
+ String hql,
+ TopiaPagerBean pager,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Gets all entites for the dao entity type order by given {@code propertyNames}.
- * <p/>
- * You can add on each {@code property} {@code ASC} ou {@code DESC} to
- * fix order way (by default is {@code ASC}).
+ * Find all the entities E which given collection (propertyName) contains the
+ * given value
*
- * @param propertyNames property names of order to apply
- * @return all entities of the dao entity type with given order
+ * @param propertyName the name of the property (must be a collection)
+ * @param value the value to use for find
+ * @return all the entities E found
* @throws TopiaException if any pb while getting datas
- */
- List<E> findAllWithOrder(String... propertyNames)
- throws TopiaException;
-
- /**
- * Récupère toutes les entités (du type géré par ce dao) dont la
- * collection nommée {@code propertyName} contient la {@code property}
- * donnée.
- *
- * @param propertyName le nom de la propriété
- * @param property la propriété recherchée
- * @return toutes les entités recherchées
- * @throws TopiaException pour tout erreur lors de la recherche
* @since 2.5.4
*/
List<E> findAllContains(String propertyName,
- Object property) throws TopiaException;
+ Object value) throws TopiaException;
//------------------------------------------------------------------------//
//-- existsByXXX methods -------------------------------------------------//
@@ -503,7 +527,7 @@
*
* @param id unique id of the entity to test existence.
* @return true if entity exists, false otherwise
- * @throws TopiaException for Topia errors
+ * @throws TopiaException for any error
* @since 2.3.4
*/
boolean existByTopiaId(String id) throws TopiaException;
@@ -513,26 +537,30 @@
* propertyValue}. {@code others} properties can be added to test
* existence.
*
- * @param propertyName first property name to test existence
- * @param propertyValue first property value to test existence
- * @param others altern propertyName and propertyValue
+ * @param propertyName the first property name to test existence
+ * @param propertyValue the first property value to test existence
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return true if entity exists, false otherwise
* @throws TopiaException for Topia errors
* @since 2.3.4
*/
- boolean existByProperties(String propertyName, Object propertyValue,
- Object... others) throws TopiaException;
+ boolean existByProperties(String propertyName,
+ Object propertyValue,
+ Object... propertyNamesAndValues) throws TopiaException;
/**
- * Check the existence of an entity using a {@code hql} query.
+ * Check the existence of an entity using the given HQL query.
*
- * @param hql query used to test existence
- * @param params params used by the query
+ * @param hql the HQL query
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return true if entity exists, false otherwise
* @throws TopiaException
* @since 2.6.12
*/
- boolean existsByQuery(String hql, Object... params) throws TopiaException;
+ boolean existsByQuery(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
//------------------------------------------------------------------------//
//-- countXXX methods ----------------------------------------------------//
@@ -548,14 +576,17 @@
long count() throws TopiaException;
/**
- * Count the number of entities based on a {@code hql}.
+ * Count the number of entities based on a the given HQL query.
*
- * @param hql hql query to use
+ * @param hql the HQL query to use
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @return number of entities filtered by the query
* @throws TopiaException if any pb while getting datas
* @since 2.6.12
*/
- long countByQuery(String hql, Object... params) throws TopiaException;
+ long countByQuery(String hql,
+ Object... propertyNamesAndValues) throws TopiaException;
//------------------------------------------------------------------------//
//-- other request methods -----------------------------------------------//
@@ -568,13 +599,12 @@
* @param type the type of entity to search
* @param entity the entity on which search is done
* @param <R> type of entity to search
- * @return the list of entities of the given type which uses the given
- * entity
+ * @return the list of entities R which uses the given entity
* @throws TopiaException if any problem while getting data
* @since 2.3.0
*/
- <R extends TopiaEntity> List<R> findUsages(Class<R> type, E entity)
- throws TopiaException;
+ <R extends TopiaEntity> List<R> findUsages(Class<R> type,
+ E entity) throws TopiaException;
/**
* Find all usages of the given {@code entity}.
@@ -587,8 +617,7 @@
* @since 2.3.0
*/
- Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity)
- throws TopiaException;
+ Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity) throws TopiaException;
/**
* Execute the count {@code hql} query and then synch the pager to this
@@ -596,36 +625,55 @@
* {@link TopiaPagerBean#records} field and then adapt
* the number of pages available and the current number page).
*
- * @param hql the count hql to execute
- * @param pager the page to synch
- * @param params params of the count query
+ * @param hql the HQL query to use
+ * @param pager pager to obtain the correct window of data
+ * @param propertyNamesAndValues the query parameters. Arguments are key-value paired :
+ * [propertyName;value;propertyName;value;...]
* @throws TopiaException if any pb while getting datas
* @see TopiaPagerBean
* @since 2.6.12
*/
void computeAndAddRecordsToPager(String hql,
TopiaPagerBean pager,
- Object... params) throws TopiaException;
+ Object... propertyNamesAndValues) throws TopiaException;
//------------------------------------------------------------------------//
//-- Misc methods --------------------------------------------------------//
//------------------------------------------------------------------------//
/**
- * Get the entityEnum of the type of entity managed by this DAO.
+ * Return the class of the entity managed by this DAO.
*
- * @return entity type enum managed by this DAO
+ * @return this DAO's managed entity's class
*/
- TopiaEntityEnum getTopiaEntityEnum();
+ Class<E> getEntityClass();
/**
- * Get the type of entity managed by this DAO.
+ * Returns the context used by this DAO.
*
- * @return entity type managed by this DAO
+ * @return Returns the context.
*/
- Class<E> getEntityClass();
+ TopiaContextImplementor getContext();
/**
+ * Method to invoke right after instance creation. It is done by the
+ * TopiaContext.
+ *
+ * @param context context
+ * @param entityClass entity class
+ * @throws TopiaException if any pb while init
+ */
+ void init(TopiaContextImplementor context,
+ Class<E> entityClass) throws TopiaException;
+
+ /**
+ * Get the entityEnum of the type of entity managed by this DAO.
+ *
+ * @return entity type enum managed by this DAO
+ */
+ TopiaEntityEnum getTopiaEntityEnum();
+
+ /**
* Obtains the batch size used to load data.
* <p/>
* Default value if 1000.
@@ -644,25 +692,7 @@
void setBatchSize(int batchSize);
/**
- * When TopiaContextImpl create the TopiaDAOHibernate, it must call this
- * method just after.
- *
- * @param context context
- * @param entityClass entity class
- * @throws TopiaException if any pb while init
- */
- void init(TopiaContextImplementor context, Class<E> entityClass)
- throws TopiaException;
-
- /**
- * Return context used by this DAO.
- *
- * @return the context.
- */
- TopiaContextImplementor getContext();
-
- /**
- * Create the simple hql query for the entity managed by the dao.
+ * Create the simple HQL query for the entity managed by the dao.
* <p/>
* A optional alias can be passed:
* <p/>
@@ -678,12 +708,16 @@
//-- Listener methods ----------------------------------------------------//
//------------------------------------------------------------------------//
+ // TODO AThimel 20/07/13 Javadoc
void addTopiaEntityListener(TopiaEntityListener listener);
+ // TODO AThimel 20/07/13 Javadoc
void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+ // TODO AThimel 20/07/13 Javadoc
void removeTopiaEntityListener(TopiaEntityListener listener);
+ // TODO AThimel 20/07/13 Javadoc
void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
/**
@@ -694,9 +728,13 @@
* @param actions encoded actions
* @return la liste des permissions
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.6.14, {@code TopiaQuery} will be removed in version 3.0
+ * @since 2.6.14
+ * @deprecated {@code TopiaQuery} will be removed in version 3.0
+ * @deprecated topia-service-security will be removed in 3.0
*/
- List<Permission> getRequestPermission(String topiaId, int actions)
- throws TopiaException;
+ @Deprecated
+ List<Permission> getRequestPermission(String topiaId,
+ int actions) throws TopiaException;
+
} //TopiaDAO
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -341,9 +341,9 @@
}
@Override
- public E create(Object... properties) throws TopiaException {
+ public E create(Object... propertyNamesAndValues) throws TopiaException {
- int propertiesLength = properties.length;
+ int propertiesLength = propertyNamesAndValues.length;
Preconditions.checkArgument(propertiesLength % 2 == 0,
"Wrong number of argument "
+ propertiesLength
@@ -351,8 +351,8 @@
Map<String, Object> map = new HashMap<String, Object>();
for (int i = 0; i < propertiesLength; ) {
- Object propertyName = properties[i++];
- Object value = properties[i++];
+ Object propertyName = propertyNamesAndValues[i++];
+ Object value = propertyNamesAndValues[i++];
Preconditions.checkArgument(
propertyName instanceof String,
"Argument at position [" + (i - 1) + "] " +
@@ -443,9 +443,9 @@
@Override
public E findByProperties(String propertyName, Object value,
- Object... others) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Map<String, Object> properties =
- convertPropertiesArrayToMap(propertyName, value, others);
+ convertPropertiesArrayToMap(propertyName, value, propertyNamesAndValues);
E result = findByProperties(properties);
return result;
}
@@ -487,9 +487,9 @@
@Override
public List<E> findAllByProperties(String propertyName, Object value,
- Object... others) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Map<String, Object> properties =
- convertPropertiesArrayToMap(propertyName, value, others);
+ convertPropertiesArrayToMap(propertyName, value, propertyNamesAndValues);
List<E> result = findAllByProperties(properties);
return result;
}
@@ -533,17 +533,17 @@
@Override
public E findContains(String propertyName,
- Object property) throws TopiaException {
+ Object value) throws TopiaException {
E find = context.findUnique("from " + getEntityClass().getName() +
- " WHERE :property in elements(" + propertyName + ")", "property", property);
+ " WHERE :property in elements(" + propertyName + ")", "property", value);
return find;
}
@Override
public List<E> findAllContains(String propertyName,
- Object property) throws TopiaException {
+ Object value) throws TopiaException {
List<E> find = context.findAll("from " + getEntityClass().getName() +
- " WHERE :property in elements(" + propertyName + ")", "property", property);
+ " WHERE :property in elements(" + propertyName + ")", "property", value);
return find;
}
@@ -555,9 +555,9 @@
@Override
public boolean existByProperties(String propertyName, Object propertyValue,
- Object... others) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Map<String, Object> properties =
- convertPropertiesArrayToMap(propertyName, propertyValue, others);
+ convertPropertiesArrayToMap(propertyName, propertyValue, propertyNamesAndValues);
try {
Criteria criteria = createCriteria(FlushMode.AUTO);
criteria.add(Restrictions.allEq(properties));
@@ -668,26 +668,26 @@
@Override
public boolean existsByQuery(String hql,
- Object... params) throws TopiaException {
- long count = countByQuery(hql, params);
+ Object... propertyNamesAndValues) throws TopiaException {
+ long count = countByQuery(hql, propertyNamesAndValues);
return count > 0;
}
@Override
public long countByQuery(String hql,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Preconditions.checkNotNull(StringUtils.isNotBlank(hql));
Preconditions.checkArgument(hql.toUpperCase().trim().startsWith("SELECT COUNT("));
- Long result = findByQuery(Long.class, hql, params);
+ Long result = findByQuery(Long.class, hql, propertyNamesAndValues);
return result;
}
@Override
public E findByQuery(String hql,
- Object... params) throws TopiaException {
- E result = findByQuery(getEntityClass(), hql, params);
+ Object... propertyNamesAndValues) throws TopiaException {
+ E result = findByQuery(getEntityClass(), hql, propertyNamesAndValues);
return result;
}
@@ -707,57 +707,57 @@
@Override
public List<E> findAllByQuery(String hql,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
- List<E> result = findAllByQuery(getEntityClass(), hql, params);
+ List<E> result = findAllByQuery(getEntityClass(), hql, propertyNamesAndValues);
return result;
}
@Override
public <R> List<R> findAllByQuery(Class<R> type,
String hql,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(hql);
- List<R> result = getContext().findAll(hql, params);
+ List<R> result = getContext().findAll(hql, propertyNamesAndValues);
return result;
}
@Override
public Iterable<E> findAllLazyByQuery(String hql,
- Object... params) throws TopiaException {
- Iterable<E> result = findAllLazyByQuery(batchSize, hql, params);
+ Object... propertyNamesAndValues) throws TopiaException {
+ Iterable<E> result = findAllLazyByQuery(batchSize, hql, propertyNamesAndValues);
return result;
}
@Override
public <R> Iterable<R> findAllLazyByQuery(Class<R> type,
String hql,
- Object... params) throws TopiaException {
- Iterable<R> result = findAllLazyByQuery(type, batchSize, hql, params);
+ Object... propertyNamesAndValues) throws TopiaException {
+ Iterable<R> result = findAllLazyByQuery(type, batchSize, hql, propertyNamesAndValues);
return result;
}
@Override
public Iterable<E> findAllLazyByQuery(int batchSize,
String hql,
- Object... params) throws TopiaException {
- return findAllLazyByQuery(getEntityClass(), batchSize, hql, params);
+ Object... propertyNamesAndValues) throws TopiaException {
+ return findAllLazyByQuery(getEntityClass(), batchSize, hql, propertyNamesAndValues);
}
@Override
public <R> Iterable<R> findAllLazyByQuery(Class<R> type,
int batchSize,
String hql,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
final Iterator<R> iterator = new FindAllIterator<E, R>(this,
type,
batchSize,
hql,
- params);
+ propertyNamesAndValues);
Iterable<R> result = new Iterable<R>() {
@Override
public Iterator<R> iterator() {
@@ -772,11 +772,11 @@
String hql,
int startIndex,
int endIndex,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(hql);
- List<R> result = getContext().find(hql, startIndex, endIndex, params);
+ List<R> result = getContext().find(hql, startIndex, endIndex, propertyNamesAndValues);
return result;
}
@@ -784,12 +784,12 @@
public List<E> findAllByQueryWithBound(String hql,
int startIndex,
int endIndex,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
List<E> result = findAllByQueryWithBound(getEntityClass(),
hql,
startIndex,
endIndex,
- params);
+ propertyNamesAndValues);
return result;
}
@@ -797,7 +797,7 @@
public <R> List<R> findAllByQueryAndPager(Class<R> type,
String hql,
TopiaPagerBean pager,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(hql);
@@ -810,28 +810,28 @@
List<R> result = findAllByQueryWithBound(type, hql,
(int) pager.getRecordStartIndex(),
(int) pager.getRecordEndIndex() - 1,
- params);
+ propertyNamesAndValues);
return result;
}
@Override
public List<E> findAllByQueryAndPager(String hql,
TopiaPagerBean pager,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
List<E> result = findAllByQueryAndPager(getEntityClass(),
hql,
pager,
- params);
+ propertyNamesAndValues);
return result;
}
@Override
public void computeAndAddRecordsToPager(String hql,
TopiaPagerBean pager,
- Object... params) throws TopiaException {
+ Object... propertyNamesAndValues) throws TopiaException {
- long records = countByQuery(hql, params);
+ long records = countByQuery(hql, propertyNamesAndValues);
pager.setRecords(records);
PagerBeanUtil.computeRecordIndexesAndPagesNumber(pager);
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -49,10 +49,10 @@
import java.util.List;
/**
- * The TopiaEntity is the main interface for each entities generated with {@link
+ * The TopiaEntity is the main interface for each entity generated with {@link
* TopiaMetaTransformer}. An entity is simply a persistent bean mapped with
- * hibernate. The manipulation on entities (create, update, delete, find) is
- * made by the dao associated. The corresponding dao interface is {@link
+ * Hibernate. The manipulation on entities (create, update, delete, find) is
+ * made by the DAO associated. The corresponding DAO interface is {@link
* TopiaDAO}.
* <p/>
* Setter methods have to be used only in internal. They are in the interface to
@@ -95,7 +95,7 @@
/**
* Unique technical Id of the entity. This id contains the full qualified
- * name of the entity interface. This id has also an index and his used to
+ * name of the entity interface. This id has also an index and is used to
* identify uniquely the entity in the database.
*
* @return the technical Id of the entity
@@ -167,84 +167,120 @@
/**
* @return all object that must be deleted if this object is deleted
* @throws TopiaException if any pb
+ * @deprecated from 3.0, method will be moved to entity's generated DAO (cf http://nuiton.org/issues/2776)
*/
+ @Deprecated
List<TopiaEntity> getComposite() throws TopiaException;
/**
* @return all object that are aggregate with this instance, aggreate object
* are not removed automaticaly
* @throws TopiaException if any pb
+ * @deprecated from 3.0, method will be moved to entity's generated DAO (cf http://nuiton.org/issues/2776)
*/
+ @Deprecated
List<TopiaEntity> getAggregate() throws TopiaException;
/**
- * Add listener for property writing.
+ * Route the entity using a {@code visitor}.
*
- * @param propertyName name of property to listen
- * @param listener the listener to register
+ * @param visitor to used
+ * @throws TopiaException for all type of error
*/
- void addPropertyChangeListener(String propertyName,
- PropertyChangeListener listener);
+ void accept(EntityVisitor visitor) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- PropertyListener (read) methods -------------------------------------//
+ //------------------------------------------------------------------------//
+
/**
- * Add listener for property writing.
+ * Add listener for property reading.
*
* @param listener the listener to register
*/
- void addPropertyChangeListener(PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void addPropertyListener(PropertyChangeListener listener);
- void addVetoableChangeListener(String propertyName,
- VetoableChangeListener vetoable);
-
- void addVetoableChangeListener(VetoableChangeListener vetoable);
-
- void removePropertyChangeListener(String propertyName,
- PropertyChangeListener listener);
-
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- void removeVetoableChangeListener(String propertyName,
- VetoableChangeListener vetoable);
-
- void removeVetoableChangeListener(VetoableChangeListener vetoable);
-
/**
* Add listener for property reading.
*
* @param propertyName the property name to listen
* @param listener the listener to register
*/
+ // TODO AThimel 20/07/13 Javadoc
void addPropertyListener(String propertyName,
PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void removePropertyListener(PropertyChangeListener listener);
+
+ // TODO AThimel 20/07/13 Javadoc
+ void removePropertyListener(String propertyName,
+ PropertyChangeListener listener);
+
+ //------------------------------------------------------------------------//
+ //-- PropertyChangeListener (write) methods ------------------------------//
+ //------------------------------------------------------------------------//
+
/**
- * Add listener for property reading.
+ * Add listener for property writing.
*
* @param listener the listener to register
*/
- void addPropertyListener(PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void addPropertyChangeListener(PropertyChangeListener listener);
- void addVetoableListener(String propertyName,
- VetoableChangeListener vetoable);
+ /**
+ * Add listener for property writing.
+ *
+ * @param propertyName name of property to listen
+ * @param listener the listener to register
+ */
+ // TODO AThimel 20/07/13 Javadoc
+ void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ // TODO AThimel 20/07/13 Javadoc
+ void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener);
+
+ //------------------------------------------------------------------------//
+ //-- VetoableListener (read) methods -------------------------------------//
+ //------------------------------------------------------------------------//
+
+ // TODO AThimel 20/07/13 Javadoc
void addVetoableListener(VetoableChangeListener vetoable);
- void removePropertyListener(String propertyName,
- PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void addVetoableListener(String propertyName,
+ VetoableChangeListener vetoable);
- void removePropertyListener(PropertyChangeListener listener);
+ // TODO AThimel 20/07/13 Javadoc
+ void removeVetoableListener(VetoableChangeListener vetoable);
+ // TODO AThimel 20/07/13 Javadoc
void removeVetoableListener(String propertyName,
VetoableChangeListener vetoable);
- void removeVetoableListener(VetoableChangeListener vetoable);
+ //------------------------------------------------------------------------//
+ //-- VetoableChangeListener (write) methods ------------------------------//
+ //------------------------------------------------------------------------//
- /**
- * Route the entity using a {@code visitor}.
- *
- * @param visitor to used
- * @throws TopiaException for all type of error
- */
- void accept(EntityVisitor visitor) throws TopiaException;
+ // TODO AThimel 20/07/13 Javadoc
+ void addVetoableChangeListener(VetoableChangeListener vetoable);
+ // TODO AThimel 20/07/13 Javadoc
+ void addVetoableChangeListener(String propertyName,
+ VetoableChangeListener vetoable);
+
+ // TODO AThimel 20/07/13 Javadoc
+ void removeVetoableChangeListener(VetoableChangeListener vetoable);
+
+ // TODO AThimel 20/07/13 Javadoc
+ void removeVetoableChangeListener(String propertyName,
+ VetoableChangeListener vetoable);
+
} //TopiaEntity
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntityEnum.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntityEnum.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntityEnum.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -128,4 +128,5 @@
* {@code false} otherwise.
*/
boolean accept(Class<? extends TopiaEntity> klass);
+
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -8,11 +8,10 @@
*/
public interface TopiaIdFactory {
+ // TODO AThimel 20/07/13 Javadoc
<E extends TopiaEntity> String newTopiaId(Class<E> entityClass, TopiaEntity topiaEntity);
- // TODO brendan 10/07/13 deprecated ?
- // TODO tchemit 11/07/13, We still use this paradigm in Topia, prefer not to remove this contract ?
- @Deprecated
+ // TODO AThimel 20/07/13 Javadoc
<E extends TopiaEntity> Class<E> getClassName(String topiaId);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceHelper.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceHelper.java 2013-07-19 15:21:11 UTC (rev 2774)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceHelper.java 2013-07-19 23:32:02 UTC (rev 2775)
@@ -34,10 +34,15 @@
*/
public interface TopiaPersistenceHelper<T extends TopiaEntityEnum> {
+ // TODO AThimel 20/07/13 Javadoc
<E extends TopiaEntity> T getEntityEnum(Class<E> type);
- <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, Class<E> type);
+ // TODO AThimel 20/07/13 Javadoc
+ <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx,
+ Class<E> type);
- <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, T type);
+ // TODO AThimel 20/07/13 Javadoc
+ <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx,
+ T type);
}
1
0