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
September 2012
- 2 participants
- 16 discussions
r2670 - in branches/topia-2.6.x: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 14 Sep '12
by maven-release@users.nuiton.org 14 Sep '12
14 Sep '12
Author: maven-release
Date: 2012-09-14 17:56:07 +0200 (Fri, 14 Sep 2012)
New Revision: 2670
Url: http://nuiton.org/repositories/revision/topia/2670
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
branches/topia-2.6.x/pom.xml
branches/topia-2.6.x/topia-persistence/pom.xml
branches/topia-2.6.x/topia-service-migration/pom.xml
branches/topia-2.6.x/topia-service-replication/pom.xml
branches/topia-2.6.x/topia-service-security/pom.xml
Modified: branches/topia-2.6.x/pom.xml
===================================================================
--- branches/topia-2.6.x/pom.xml 2012-09-14 15:56:05 UTC (rev 2669)
+++ branches/topia-2.6.x/pom.xml 2012-09-14 15:56:07 UTC (rev 2670)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.7</version>
+ <version>2.7.1-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -452,9 +452,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.7</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.7</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/topia/tags/topia-2.7</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.6.x</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.6.x</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/topia/branches/topia-2.6.x</url>
</scm>
<distributionManagement>
Modified: branches/topia-2.6.x/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 15:56:05 UTC (rev 2669)
+++ branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 15:56:07 UTC (rev 2670)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 15:56:05 UTC (rev 2669)
+++ branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 15:56:07 UTC (rev 2670)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 15:56:05 UTC (rev 2669)
+++ branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 15:56:07 UTC (rev 2670)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 15:56:05 UTC (rev 2669)
+++ branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 15:56:07 UTC (rev 2670)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2012-09-14 17:56:05 +0200 (Fri, 14 Sep 2012)
New Revision: 2669
Url: http://nuiton.org/repositories/revision/topia/2669
Log:
[maven-release-plugin] copy for tag topia-2.7
Added:
tags/topia-2.7/
Property changes on: tags/topia-2.7
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0
r2668 - in branches/topia-2.6.x: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 14 Sep '12
by maven-release@users.nuiton.org 14 Sep '12
14 Sep '12
Author: maven-release
Date: 2012-09-14 17:56:03 +0200 (Fri, 14 Sep 2012)
New Revision: 2668
Url: http://nuiton.org/repositories/revision/topia/2668
Log:
[maven-release-plugin] prepare release topia-2.7
Modified:
branches/topia-2.6.x/pom.xml
branches/topia-2.6.x/topia-persistence/pom.xml
branches/topia-2.6.x/topia-service-migration/pom.xml
branches/topia-2.6.x/topia-service-replication/pom.xml
branches/topia-2.6.x/topia-service-security/pom.xml
Modified: branches/topia-2.6.x/pom.xml
===================================================================
--- branches/topia-2.6.x/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
+++ branches/topia-2.6.x/pom.xml 2012-09-14 15:56:03 UTC (rev 2668)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.7</version>
<modules>
<module>topia-persistence</module>
@@ -452,9 +452,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.6.x</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.6.x</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/topia/branches/topia-2.6.x</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.7</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.7</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/topia/tags/topia-2.7</url>
</scm>
<distributionManagement>
Modified: branches/topia-2.6.x/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
+++ branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 15:56:03 UTC (rev 2668)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.7</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
+++ branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 15:56:03 UTC (rev 2668)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.7</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
+++ branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 15:56:03 UTC (rev 2668)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.7</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
+++ branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 15:56:03 UTC (rev 2668)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.7</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: tchemit
Date: 2012-09-14 17:33:14 +0200 (Fri, 14 Sep 2012)
New Revision: 2667
Url: http://nuiton.org/repositories/revision/topia/2667
Log:
fixes #2314: Updates to nuiton-utils 2.6.2
Modified:
branches/topia-2.6.x/pom.xml
Modified: branches/topia-2.6.x/pom.xml
===================================================================
--- branches/topia-2.6.x/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
+++ branches/topia-2.6.x/pom.xml 2012-09-14 15:33:14 UTC (rev 2667)
@@ -60,7 +60,7 @@
<!-- libs version -->
<eugeneVersion>2.5</eugeneVersion>
- <nuitonUtilsVersion>2.6.2-SNAPSHOT</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.2</nuitonUtilsVersion>
<processorPluginVersion>1.2.2</processorPluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
1
0
r2666 - in branches/topia-2.6.x: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by tchemit@users.nuiton.org 14 Sep '12
by tchemit@users.nuiton.org 14 Sep '12
14 Sep '12
Author: tchemit
Date: 2012-09-14 17:31:35 +0200 (Fri, 14 Sep 2012)
New Revision: 2666
Url: http://nuiton.org/repositories/revision/topia/2666
Log:
move to version 2.7-SNAPSHOT
Modified:
branches/topia-2.6.x/pom.xml
branches/topia-2.6.x/topia-persistence/pom.xml
branches/topia-2.6.x/topia-service-migration/pom.xml
branches/topia-2.6.x/topia-service-replication/pom.xml
branches/topia-2.6.x/topia-service-security/pom.xml
Modified: branches/topia-2.6.x/pom.xml
===================================================================
--- branches/topia-2.6.x/pom.xml 2012-09-14 10:02:42 UTC (rev 2665)
+++ branches/topia-2.6.x/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.6.14-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
Modified: branches/topia-2.6.x/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 10:02:42 UTC (rev 2665)
+++ branches/topia-2.6.x/topia-persistence/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.6.14-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 10:02:42 UTC (rev 2665)
+++ branches/topia-2.6.x/topia-service-migration/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.6.14-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 10:02:42 UTC (rev 2665)
+++ branches/topia-2.6.x/topia-service-replication/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.6.14-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.6.x/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 10:02:42 UTC (rev 2665)
+++ branches/topia-2.6.x/topia-service-security/pom.xml 2012-09-14 15:31:35 UTC (rev 2666)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.6.14-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
r2665 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager
by tchemit@users.nuiton.org 14 Sep '12
by tchemit@users.nuiton.org 14 Sep '12
14 Sep '12
Author: tchemit
Date: 2012-09-14 12:02:42 +0200 (Fri, 14 Sep 2012)
New Revision: 2665
Url: http://nuiton.org/repositories/revision/topia/2665
Log:
refs #2313: Use new PageBean API from nuiton-utils (improve Topia Filter api)
Added:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleGroupOperator.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleOperator.java
Removed:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
Deleted: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java 2012-09-14 09:51:06 UTC (rev 2664)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -1,152 +0,0 @@
-package org.nuiton.topia.persistence.pager;
-
-import java.util.Map;
-
-/**
-* TODO
-*
-* @author tchemit <chemit(a)codelutin.com>
-* @since 2.6.14
-*/
-public enum FilterOperation {
- /** Equals operator. */
- eq {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " = :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Not equals operator. */
- ne {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " != :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Contains operator. */
- cn {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " like :" + paramName;
- filterParams.put(paramName, "%" + data + "%");
- return ruleFilter;
- }
- },
- /** Not contains operator. */
- nc {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " not like :" + paramName;
- filterParams.put(paramName, "%" + data + "%");
- return ruleFilter;
- }
- },
- /** Begins with operator. */
- bw {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " like :" + paramName;
- filterParams.put(paramName, data + "%");
- return ruleFilter;
- }
- },
- /** Not between with operator. */
- bn {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " not like :" + paramName;
- filterParams.put(paramName, data + "%");
- return ruleFilter;
- }
- },
- /** Ends with operator. */
- ew {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " like :" + paramName;
- filterParams.put(paramName, "%" + data);
- return ruleFilter;
- }
- },
- /** Not End with operator. */
- en {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " not like :" + paramName;
- filterParams.put(paramName, "%" + data);
- return ruleFilter;
- }
- },
- /** Lesser than operator. */
- lt {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " < :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Lesser or equals operator. */
- le {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " <= :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Greater than operator. */
- gt {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " > :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Greater or equals operator. */
- ge {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " >= :" + paramName;
- filterParams.put(paramName, data);
- return ruleFilter;
- }
- },
- /** Is null operator. */
- nu {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " is null";
- return ruleFilter;
- }
- },
- /** Is not null operator. */
- nn {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- String ruleFilter = propertyName + " is not null";
- return ruleFilter;
- }
- },
- /** Is among operator. */
- in {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- throw new UnsupportedOperationException();
- }
- },
- /** Not is among operator. */
- ni {
- @Override
- public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
- throw new UnsupportedOperationException();
- }
- };
-
- public abstract String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams);
-}
Deleted: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java 2012-09-14 09:51:06 UTC (rev 2664)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -1,11 +0,0 @@
-package org.nuiton.topia.persistence.pager;
-
-/**
-* TODO
-*
-* @author tchemit <chemit(a)codelutin.com>
-* @since 2.6.14
-*/
-public enum FilterOperationGroup {
- OR, AND
-}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java 2012-09-14 09:51:06 UTC (rev 2664)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -1,9 +1,33 @@
package org.nuiton.topia.persistence.pager;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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.io.Serializable;
/**
- * TODO
+ * Rule for a filtered pager.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.14
@@ -12,19 +36,19 @@
private static final long serialVersionUID = 1L;
- protected final FilterOperation op;
+ protected final FilterRuleOperator op;
protected final String field;
protected final String data;
- public FilterRule(FilterOperation op, String field, String data) {
+ public FilterRule(FilterRuleOperator op, String field, String data) {
this.op = op;
this.field = field;
this.data = data;
}
- public FilterOperation getOp() {
+ public FilterRuleOperator getOp() {
return op;
}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Copied: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleGroupOperator.java (from rev 2664, branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java)
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleGroupOperator.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleGroupOperator.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -0,0 +1,35 @@
+package org.nuiton.topia.persistence.pager;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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%
+ */
+
+/**
+ * Define the operator to apply between some rules.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public enum FilterRuleGroupOperator {
+ OR, AND
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleGroupOperator.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleOperator.java (from rev 2664, branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java)
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleOperator.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleOperator.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -0,0 +1,176 @@
+package org.nuiton.topia.persistence.pager;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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.Map;
+
+/**
+ * Operator used in a rule.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public enum FilterRuleOperator {
+ /** Equals operator. */
+ eq {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " = :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Not equals operator. */
+ ne {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " != :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Contains operator. */
+ cn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, "%" + data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Not contains operator. */
+ nc {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, "%" + data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Begins with operator. */
+ bw {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Not between with operator. */
+ bn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Ends with operator. */
+ ew {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, "%" + data);
+ return ruleFilter;
+ }
+ },
+ /** Not End with operator. */
+ en {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, "%" + data);
+ return ruleFilter;
+ }
+ },
+ /** Lesser than operator. */
+ lt {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " < :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Lesser or equals operator. */
+ le {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " <= :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Greater than operator. */
+ gt {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " > :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Greater or equals operator. */
+ ge {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " >= :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Is null operator. */
+ nu {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " is null";
+ return ruleFilter;
+ }
+ },
+ /** Is not null operator. */
+ nn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " is not null";
+ return ruleFilter;
+ }
+ },
+ /** Is among operator. */
+ in {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ throw new UnsupportedOperationException();
+ }
+ },
+ /** Not is among operator. */
+ ni {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ throw new UnsupportedOperationException();
+ }
+ };
+
+ public abstract String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams);
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRuleOperator.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java 2012-09-14 09:51:06 UTC (rev 2664)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -1,12 +1,36 @@
package org.nuiton.topia.persistence.pager;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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.apache.commons.collections.CollectionUtils;
import org.nuiton.util.PagerBean;
import java.util.List;
/**
- * Extension of a {@link PagerBean} to add filter capacity.
+ * Extension of a {@link PagerBean} to add filter and ordering capacities.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.14
@@ -21,7 +45,7 @@
// get index row - i.e. user click to sort.
protected String sortColumn;
- protected FilterOperationGroup groupOp;
+ protected FilterRuleGroupOperator groupOp;
private List<FilterRule> rules;
@@ -29,11 +53,11 @@
return groupOp != null && CollectionUtils.isNotEmpty(rules);
}
- public FilterOperationGroup getGroupOp() {
+ public FilterRuleGroupOperator getGroupOp() {
return groupOp;
}
- public void setGroupOp(FilterOperationGroup groupOp) {
+ public void setGroupOp(FilterRuleGroupOperator groupOp) {
this.groupOp = groupOp;
}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java 2012-09-14 09:51:06 UTC (rev 2664)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java 2012-09-14 10:02:42 UTC (rev 2665)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence.pager;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -23,7 +47,7 @@
this.bean = bean;
}
- public TopiaPagerBeanBuilder setFilterOperationGroup(FilterOperationGroup groupOp) {
+ public TopiaPagerBeanBuilder setFilterRuleGroup(FilterRuleGroupOperator groupOp) {
bean.setGroupOp(groupOp);
return this;
}
@@ -39,19 +63,19 @@
}
public TopiaPagerBeanBuilder setFilterOperationGroup(String groupOp) {
- setFilterOperationGroup(FilterOperationGroup.valueOf(groupOp));
+ setFilterRuleGroup(FilterRuleGroupOperator.valueOf(groupOp));
return this;
}
- public TopiaPagerBeanBuilder addOperations(Collection<Map<String, String>> operations) {
- for (Map<String, String> operation : operations) {
- addRule(operation);
+ public TopiaPagerBeanBuilder addRules(Collection<Map<String, String>> rules) {
+ for (Map<String, String> rule : rules) {
+ addRule(rule);
}
return this;
}
public TopiaPagerBeanBuilder addRule(String op, String property, String value) {
- FilterOperation operator = FilterOperation.valueOf(op);
+ FilterRuleOperator operator = FilterRuleOperator.valueOf(op);
return addRule(new FilterRule(operator, property, value));
}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
r2664 - in branches/topia-2.6.x: . topia-persistence/src/main/java/org/nuiton/topia/framework topia-persistence/src/main/java/org/nuiton/topia/persistence topia-persistence/src/main/java/org/nuiton/topia/persistence/pager
by tchemit@users.nuiton.org 14 Sep '12
by tchemit@users.nuiton.org 14 Sep '12
14 Sep '12
Author: tchemit
Date: 2012-09-14 11:51:06 +0200 (Fri, 14 Sep 2012)
New Revision: 2664
Url: http://nuiton.org/repositories/revision/topia/2664
Log:
fixes #2313: Use new PageBean from nuiton-utils + refs #2314: Updates to nuiton-utils 2.6.2
Added:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
Modified:
branches/topia-2.6.x/pom.xml
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java
Modified: branches/topia-2.6.x/pom.xml
===================================================================
--- branches/topia-2.6.x/pom.xml 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/pom.xml 2012-09-14 09:51:06 UTC (rev 2664)
@@ -60,7 +60,7 @@
<!-- libs version -->
<eugeneVersion>2.5</eugeneVersion>
- <nuitonUtilsVersion>2.6</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.2-SNAPSHOT</nuitonUtilsVersion>
<processorPluginVersion>1.2.2</processorPluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -212,9 +212,9 @@
* @throws SQLException if any pb
* @since 2.6.4
*/
- protected int getNbRows(ResultSet set) throws SQLException {
+ protected long getNbRows(ResultSet set) throws SQLException {
- int nbRows = 0;
+ long nbRows = 0;
while (set.next()) {
nbRows++;
}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -41,8 +41,8 @@
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.generator.EntityDAOTransformer;
+import org.nuiton.topia.persistence.pager.TopiaPagerBean;
-import java.security.Permission;
import java.util.List;
import java.util.Map;
@@ -442,12 +442,12 @@
* @param params params of the query
* @return entities of the paginated query result
* @throws TopiaException if any pb while getting datas
- * @see TopiaFilterPagerUtil.FilterPagerBean
+ * @see TopiaPagerBean
* @since 2.6.12
*/
<R> List<R> findAllByQueryAndPager(Class<R> type,
String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException;
/**
@@ -459,11 +459,11 @@
* @param params params of the query
* @return entities of the paginated query result
* @throws TopiaException if any pb while getting datas
- * @see TopiaFilterPagerUtil.FilterPagerBean
+ * @see TopiaPagerBean
* @since 2.6.12
*/
List<E> findAllByQueryAndPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException;
/**
@@ -592,18 +592,18 @@
/**
* Execute the count {@code hql} query and then synch the pager to this
* result (says fill the
- * {@link TopiaFilterPagerUtil.FilterPagerBean#records} field and then adapt
+ * {@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
* @throws TopiaException if any pb while getting datas
- * @see TopiaFilterPagerUtil.FilterPagerBean
+ * @see TopiaPagerBean
* @since 2.6.12
*/
void computeAndAddRecordsToPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException;
//------------------------------------------------------------------------//
@@ -661,16 +661,17 @@
TopiaContextImplementor getContext();
/**
- * Retourne les permissions a verifier pour l'acces a l'entite pour le
- * service Taas.
+ * Create the simple hql query for the entity managed by the dao.
+ * <p/>
+ * A optional alias can be passed:
+ * <p/>
+ * <pre>FROM MyEntityImpl myAlias</pre>
*
- * @param topiaId topiaId d'une entite
- * @param actions encoded actions
- * @return la liste des permissions
- * @throws TopiaException if any pb while getting datas
+ * @param alias optional alias to use in query
+ * @return the hql query
+ * @since 2.6.14
*/
- List<Permission> getRequestPermission(String topiaId, int actions)
- throws TopiaException;
+ String createSimpleQuery(String alias);
//------------------------------------------------------------------------//
//-- Listener methods ----------------------------------------------------//
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -27,6 +27,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
+import java.security.Permission;
import java.util.List;
import java.util.Map;
@@ -152,4 +153,17 @@
*/
@Deprecated
int countByQuery(TopiaQuery query) throws TopiaException;
+
+ /**
+ * Retourne les permissions a verifier pour l'acces a l'entite pour le
+ * service Taas.
+ *
+ * @param topiaId topiaId d'une entite
+ * @param actions encoded actions
+ * @return la liste des permissions
+ * @throws TopiaException if any pb while getting datas
+ * @deprecated since 2.6.14, {@link TopiaQuery} will be removed in version 3.0
+ */
+ List<Permission> getRequestPermission(String topiaId, int actions)
+ throws TopiaException;
}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -52,7 +52,8 @@
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.util.PagerUtil;
+import org.nuiton.topia.persistence.pager.TopiaPagerBean;
+import org.nuiton.util.PagerBeanUtil;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -198,6 +199,15 @@
return context;
}
+ @Override
+ public String createSimpleQuery(String alias) {
+ String hql = "FROM " + getTopiaEntityEnum().getImplementationFQN();
+ if (StringUtils.isNotBlank(alias)) {
+ hql += " " + alias;
+ }
+ return hql;
+ }
+
@SuppressWarnings("unchecked")
@Override
public E newInstance() throws TopiaException {
@@ -758,7 +768,7 @@
@Override
public <R> List<R> findAllByQueryAndPager(Class<R> type,
String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(hql);
@@ -770,15 +780,15 @@
}
}
List<R> result = findAllByQueryWithBound(type, hql,
- pager.getRecordStartIndex(),
- pager.getRecordEndIndex() - 1,
+ (int) pager.getRecordStartIndex(),
+ (int) pager.getRecordEndIndex() - 1,
params);
return result;
}
@Override
public List<E> findAllByQueryAndPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException {
return findAllByQueryAndPager(getEntityClass(),
@@ -789,13 +799,13 @@
@Override
public void computeAndAddRecordsToPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
+ TopiaPagerBean pager,
Object... params) throws TopiaException {
long records = countByQuery(hql, params);
- pager.setRecords((int) records);
- PagerUtil.computeRecordIndexesAndPagesNumber(pager);
+ pager.setRecords(records);
+ PagerBeanUtil.computeRecordIndexesAndPagesNumber(pager);
}
/**
@@ -837,7 +847,7 @@
protected final Object[] params;
- protected TopiaFilterPagerUtil.FilterPagerBean pager;
+ protected TopiaPagerBean pager;
public FindAllIterator(TopiaDAO<E> dao,
Class<R> type,
@@ -858,11 +868,12 @@
}
// get the count (removing the order-by)
- long count2 = dao.countByQuery("SELECT COUNT(*) " + hql.substring(0, i), params);
- pager = TopiaFilterPagerUtil.newFilterPagerBean();
- pager.setRecords((int) count2);
+ long count2 = dao.countByQuery("SELECT COUNT(*) " +
+ hql.substring(0, i), params);
+ pager = new TopiaPagerBean();
+ pager.setRecords(count2);
pager.setPageSize(batchSize);
- TopiaFilterPagerUtil.computeRecordIndexesAndPagesNumber(pager);
+ PagerBeanUtil.computeRecordIndexesAndPagesNumber(pager);
} catch (TopiaException e) {
throw new TopiaRuntimeException(e);
}
@@ -889,7 +900,7 @@
// increments page index
pager.setPageIndex(pager.getPageIndex() + 1);
- TopiaFilterPagerUtil.computeRecordIndexesAndPagesNumber(pager);
+ PagerBeanUtil.computeRecordIndexesAndPagesNumber(pager);
// load new window of data
try {
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java 2012-09-13 09:23:35 UTC (rev 2663)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -27,6 +27,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.pager.TopiaPagerBean;
import org.nuiton.util.PagerUtil;
import java.io.Serializable;
@@ -42,7 +43,9 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.9
+ * @deprecated since 2.6.14, use now {@link TopiaPagerBean}.
*/
+@Deprecated
public class TopiaFilterPagerUtil extends PagerUtil {
protected TopiaFilterPagerUtil() {
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -0,0 +1,152 @@
+package org.nuiton.topia.persistence.pager;
+
+import java.util.Map;
+
+/**
+* TODO
+*
+* @author tchemit <chemit(a)codelutin.com>
+* @since 2.6.14
+*/
+public enum FilterOperation {
+ /** Equals operator. */
+ eq {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " = :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Not equals operator. */
+ ne {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " != :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Contains operator. */
+ cn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, "%" + data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Not contains operator. */
+ nc {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, "%" + data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Begins with operator. */
+ bw {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Not between with operator. */
+ bn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, data + "%");
+ return ruleFilter;
+ }
+ },
+ /** Ends with operator. */
+ ew {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " like :" + paramName;
+ filterParams.put(paramName, "%" + data);
+ return ruleFilter;
+ }
+ },
+ /** Not End with operator. */
+ en {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " not like :" + paramName;
+ filterParams.put(paramName, "%" + data);
+ return ruleFilter;
+ }
+ },
+ /** Lesser than operator. */
+ lt {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " < :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Lesser or equals operator. */
+ le {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " <= :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Greater than operator. */
+ gt {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " > :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Greater or equals operator. */
+ ge {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " >= :" + paramName;
+ filterParams.put(paramName, data);
+ return ruleFilter;
+ }
+ },
+ /** Is null operator. */
+ nu {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " is null";
+ return ruleFilter;
+ }
+ },
+ /** Is not null operator. */
+ nn {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ String ruleFilter = propertyName + " is not null";
+ return ruleFilter;
+ }
+ },
+ /** Is among operator. */
+ in {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ throw new UnsupportedOperationException();
+ }
+ },
+ /** Not is among operator. */
+ ni {
+ @Override
+ public String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams) {
+ throw new UnsupportedOperationException();
+ }
+ };
+
+ public abstract String toHql(String paramName, String propertyName, Object data, Map<String, Object> filterParams);
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperation.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -0,0 +1,11 @@
+package org.nuiton.topia.persistence.pager;
+
+/**
+* TODO
+*
+* @author tchemit <chemit(a)codelutin.com>
+* @since 2.6.14
+*/
+public enum FilterOperationGroup {
+ OR, AND
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterOperationGroup.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -0,0 +1,38 @@
+package org.nuiton.topia.persistence.pager;
+
+import java.io.Serializable;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public class FilterRule implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final FilterOperation op;
+
+ protected final String field;
+
+ protected final String data;
+
+ public FilterRule(FilterOperation op, String field, String data) {
+ this.op = op;
+ this.field = field;
+ this.data = data;
+ }
+
+ public FilterOperation getOp() {
+ return op;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public String getData() {
+ return data;
+ }
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/FilterRule.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -0,0 +1,64 @@
+package org.nuiton.topia.persistence.pager;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.nuiton.util.PagerBean;
+
+import java.util.List;
+
+/**
+ * Extension of a {@link PagerBean} to add filter capacity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public class TopiaPagerBean extends PagerBean {
+
+ private static final long serialVersionUID = 1L;
+
+ // sorting order - asc or desc
+ protected boolean sortAscendant;
+
+ // get index row - i.e. user click to sort.
+ protected String sortColumn;
+
+ protected FilterOperationGroup groupOp;
+
+ private List<FilterRule> rules;
+
+ public boolean canFilter() {
+ return groupOp != null && CollectionUtils.isNotEmpty(rules);
+ }
+
+ public FilterOperationGroup getGroupOp() {
+ return groupOp;
+ }
+
+ public void setGroupOp(FilterOperationGroup groupOp) {
+ this.groupOp = groupOp;
+ }
+
+ public List<FilterRule> getRules() {
+ return rules;
+ }
+
+ public void setRules(List<FilterRule> rules) {
+ this.rules = rules;
+ }
+
+ public boolean isSortAscendant() {
+ return sortAscendant;
+ }
+
+ public void setSortAscendant(boolean sortAscendant) {
+ this.sortAscendant = sortAscendant;
+ }
+
+ public String getSortColumn() {
+ return sortColumn;
+ }
+
+ public void setSortColumn(String sortColumn) {
+ this.sortColumn = sortColumn;
+ }
+
+}
\ No newline at end of file
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java 2012-09-14 09:51:06 UTC (rev 2664)
@@ -0,0 +1,78 @@
+package org.nuiton.topia.persistence.pager;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * To build a {@link TopiaPagerBean} from scratch.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public class TopiaPagerBeanBuilder {
+
+ protected final TopiaPagerBean bean;
+
+ public TopiaPagerBeanBuilder() {
+ this(new TopiaPagerBean());
+ }
+
+ public TopiaPagerBeanBuilder(TopiaPagerBean bean) {
+ this.bean = bean;
+ }
+
+ public TopiaPagerBeanBuilder setFilterOperationGroup(FilterOperationGroup groupOp) {
+ bean.setGroupOp(groupOp);
+ return this;
+ }
+
+ public TopiaPagerBeanBuilder setSortcolumn(String sortColumn) {
+ bean.setSortColumn(sortColumn);
+ return this;
+ }
+
+ public TopiaPagerBeanBuilder setSortAscendant(boolean sortAscendant) {
+ bean.setSortAscendant(sortAscendant);
+ return this;
+ }
+
+ public TopiaPagerBeanBuilder setFilterOperationGroup(String groupOp) {
+ setFilterOperationGroup(FilterOperationGroup.valueOf(groupOp));
+ return this;
+ }
+
+ public TopiaPagerBeanBuilder addOperations(Collection<Map<String, String>> operations) {
+ for (Map<String, String> operation : operations) {
+ addRule(operation);
+ }
+ return this;
+ }
+
+ public TopiaPagerBeanBuilder addRule(String op, String property, String value) {
+ FilterOperation operator = FilterOperation.valueOf(op);
+ return addRule(new FilterRule(operator, property, value));
+ }
+
+ public TopiaPagerBeanBuilder addRule(Map<String, String> ruleMap) {
+ String op = ruleMap.get("op");
+ String property = ruleMap.get("field");
+ String value = ruleMap.get("data");
+ return addRule(op, property, value);
+ }
+
+ public TopiaPagerBeanBuilder addRule(FilterRule rule) {
+ List<FilterRule> rules = bean.getRules();
+ if (rules == null) {
+ rules = new LinkedList<FilterRule>();
+ bean.setRules(rules);
+ }
+ rules.add(rule);
+ return this;
+ }
+
+ public TopiaPagerBean toBean() {
+ return bean;
+ }
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/pager/TopiaPagerBeanBuilder.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
r2663 - in branches/topia-2.6.x/topia-persistence/src: main/java/org/nuiton/topia/persistence test/java/org/nuiton/topia/persistence
by tchemit@users.nuiton.org 13 Sep '12
by tchemit@users.nuiton.org 13 Sep '12
13 Sep '12
Author: tchemit
Date: 2012-09-13 11:23:35 +0200 (Thu, 13 Sep 2012)
New Revision: 2663
Url: http://nuiton.org/repositories/revision/topia/2663
Log:
refs #2301: Add methods findAllLazyByQuery on TopiaDAO to iterate on result by a lazy mecanism (force to have an orber by in the incoming hql)"
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaDAOTest.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-09-13 04:51:15 UTC (rev 2662)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-09-13 09:23:35 UTC (rev 2663)
@@ -133,7 +133,7 @@
this,
getEntityClass(),
batchSize,
- "FROM " + getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
return iterator;
}
@@ -849,9 +849,18 @@
this.hql = hql;
this.params = params;
try {
- long count = dao.countByQuery("SELECT COUNT(*) " + hql, params);
+ String hql2 = hql.toLowerCase();
+ int i = hql2.indexOf("order by");
+ if (i == -1) {
+ throw new IllegalStateException(
+ "must have a *order by* in hql, " +
+ "but did not find it in " + hql);
+ }
+
+ // get the count (removing the order-by)
+ long count2 = dao.countByQuery("SELECT COUNT(*) " + hql.substring(0, i), params);
pager = TopiaFilterPagerUtil.newFilterPagerBean();
- pager.setRecords((int) count);
+ pager.setRecords((int) count2);
pager.setPageSize(batchSize);
TopiaFilterPagerUtil.computeRecordIndexesAndPagesNumber(pager);
} catch (TopiaException e) {
Modified: branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaDAOTest.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaDAOTest.java 2012-09-13 04:51:15 UTC (rev 2662)
+++ branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaDAOTest.java 2012-09-13 09:23:35 UTC (rev 2663)
@@ -107,7 +107,7 @@
Iterable<Person> allByLazy = dao.findAllLazyByQuery(
100,
- "FROM " + dao.getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
List<Person> actual = Lists.newArrayList();
@@ -118,7 +118,7 @@
allByLazy = dao.findAllLazyByQuery(
54,
- "FROM " + dao.getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
actual = Lists.newArrayList();
@@ -129,7 +129,7 @@
allByLazy = dao.findAllLazyByQuery(
49,
- "FROM " + dao.getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
actual = Lists.newArrayList();
@@ -140,7 +140,7 @@
allByLazy = dao.findAllLazyByQuery(
101,
- "FROM " + dao.getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
actual = Lists.newArrayList();
@@ -151,7 +151,7 @@
allByLazy = dao.findAllLazyByQuery(
102,
- "FROM " + dao.getTopiaEntityEnum().getImplementationFQN());
+ "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + " ORDER BY id");
actual = Lists.newArrayList();
1
0
r2662 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out
by tchemit@users.nuiton.org 13 Sep '12
by tchemit@users.nuiton.org 13 Sep '12
13 Sep '12
Author: tchemit
Date: 2012-09-13 06:51:15 +0200 (Thu, 13 Sep 2012)
New Revision: 2662
Url: http://nuiton.org/repositories/revision/topia/2662
Log:
fixes #2311: Improve entity visitor to export as csv files
Removed:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
Deleted: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java 2012-09-12 15:04:21 UTC (rev 2661)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java 2012-09-13 04:51:15 UTC (rev 2662)
@@ -1,40 +0,0 @@
-package org.nuiton.topia.persistence.csv.out;
-/*
- * #%L
- * ToPIA :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2012 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.persistence.EntityVisitor;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-/**
- * To mark some entites visitable but not by generatl
- * {@link TopiaEntity#accept(EntityVisitor)} method.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.6.12
- */
-public interface Entity2 {
-
- void accept2(EntityVisitor visitor);
-
-}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-09-12 15:04:21 UTC (rev 2661)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-09-13 04:51:15 UTC (rev 2662)
@@ -155,24 +155,26 @@
if (CollectionUtils.isNotEmpty(cValue)) {
- if (isNoChildVisit(propertyName, entity) &&
- Entity2.class.isAssignableFrom(type)) {
+ visitEntityCollection(entity,
+ propertyName,
+ collectionType,
+ type,
+ cValue);
+ }
+ }
+ }
- // special case, when visiting a entity with no child
- // visisting at this time...
- for (Object currentValue : cValue) {
- ((Entity2) currentValue).accept2(this);
- }
- } else {
- for (Object currentValue : cValue) {
- try {
- ((TopiaEntity) currentValue).accept(this);
- } catch (TopiaException e) {
- if (log.isErrorEnabled()) {
- log.error("Can not visit entity " + value, e);
- }
- }
- }
+ protected void visitEntityCollection(TopiaEntity entity,
+ String propertyName,
+ Class<?> collectionType,
+ Class<?> type,
+ Collection<?> cValue) {
+ for (Object currentValue : cValue) {
+ try {
+ ((TopiaEntity) currentValue).accept(this);
+ } catch (TopiaException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can not visit entity " + currentValue, e);
}
}
}
@@ -207,10 +209,4 @@
T entityEnum = persistenceHelper.getEntityEnum(entityType);
return entityEnum == null ? null : entityExporters.get(entityEnum);
}
-
- protected boolean isNoChildVisit(String propertyName, TopiaEntity entity) {
-
- // by default accept all associations
- return false;
- }
}
1
0
r2661 - in branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv: . in
by tchemit@users.nuiton.org 12 Sep '12
by tchemit@users.nuiton.org 12 Sep '12
12 Sep '12
Author: tchemit
Date: 2012-09-12 17:04:21 +0200 (Wed, 12 Sep 2012)
New Revision: 2661
Url: http://nuiton.org/repositories/revision/topia/2661
Log:
refs #2310: Add progress model while importing data
Added:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressModel.java
Removed:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressionModel.java
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
Copied: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressModel.java (from rev 2660, branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressionModel.java)
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressModel.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressModel.java 2012-09-12 15:04:21 UTC (rev 2661)
@@ -0,0 +1,46 @@
+package org.nuiton.topia.persistence.csv;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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.io.Serializable;
+
+/**
+ * Csv progress model contract.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.14
+ */
+public interface CsvProgressModel extends Serializable {
+
+ long getNbSteps();
+
+ void setNbSteps(long nbSteps);
+
+ float getProgress();
+
+ void setProgress(float progress);
+
+ void incrementsProgress();
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressionModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressionModel.java 2012-09-11 16:47:05 UTC (rev 2660)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/CsvProgressionModel.java 2012-09-12 15:04:21 UTC (rev 2661)
@@ -1,46 +0,0 @@
-package org.nuiton.topia.persistence.csv;
-
-/*
- * #%L
- * ToPIA :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2012 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.io.Serializable;
-
-/**
- * Csv progression model contract.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.6.13
- */
-public interface CsvProgressionModel extends Serializable {
-
- long getNbSteps();
-
- float getProgression();
-
- void setProgression(float progression);
-
- void incrementsProgression();
-
- void setNbSteps(long nbSteps);
-}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java 2012-09-11 16:47:05 UTC (rev 2660)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java 2012-09-12 15:04:21 UTC (rev 2661)
@@ -24,7 +24,7 @@
*/
import org.nuiton.topia.persistence.TopiaEntityEnum;
-import org.nuiton.topia.persistence.csv.CsvProgressionModel;
+import org.nuiton.topia.persistence.csv.CsvProgressModel;
import java.io.Serializable;
@@ -54,7 +54,7 @@
/** Count of updated entities. */
protected int numberUpdated;
- protected final CsvProgressionModel progressionModel;
+ protected final CsvProgressModel progressModel;
public static <T extends TopiaEntityEnum> CsvImportResult<T> newResult(T entityType,
String importFileName,
@@ -67,20 +67,20 @@
public static <T extends TopiaEntityEnum> CsvImportResult<T> newResult(T entityType,
String importFileName,
boolean createIfNotFound,
- CsvProgressionModel progressionModel) {
+ CsvProgressModel progressModel) {
CsvImportResult<T> result = new CsvImportResult<T>(entityType, importFileName,
- createIfNotFound, progressionModel);
+ createIfNotFound, progressModel);
return result;
}
protected CsvImportResult(T entityType,
String importFileName,
boolean createIfNotFound,
- CsvProgressionModel progressionModel) {
+ CsvProgressModel progressModel) {
this.entityType = entityType;
this.importFileName = importFileName;
this.createIfNotFound = createIfNotFound;
- this.progressionModel = progressionModel;
+ this.progressModel = progressModel;
}
public T getEntityType() {
@@ -112,7 +112,7 @@
numberUpdated++;
}
- public CsvProgressionModel getProgressionModel() {
- return progressionModel;
+ public CsvProgressModel getProgressModel() {
+ return progressModel;
}
}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2012-09-11 16:47:05 UTC (rev 2660)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2012-09-12 15:04:21 UTC (rev 2661)
@@ -35,7 +35,7 @@
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
-import org.nuiton.topia.persistence.csv.CsvProgressionModel;
+import org.nuiton.topia.persistence.csv.CsvProgressModel;
import org.nuiton.topia.persistence.metadata.AssociationMeta;
import org.nuiton.topia.persistence.metadata.MetaFilenameAware;
import org.nuiton.topia.persistence.metadata.TableMeta;
@@ -248,8 +248,8 @@
Import<E> importer,
CsvImportResult<T> csvResult) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
for (E entity : importer) {
Map<String, Object> properties = meta.prepareCreate(
@@ -260,8 +260,8 @@
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
}
@@ -275,8 +275,8 @@
TopiaContextImplementor context = dao.getContext();
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
int compt = 0;
for (E entity : importer) {
@@ -289,8 +289,8 @@
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
compt++;
@@ -306,8 +306,8 @@
Import<E> importer,
CsvImportResult<T> csvResult) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
List<E> result = Lists.newArrayList();
for (E entity : importer) {
@@ -319,8 +319,8 @@
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
@@ -335,8 +335,8 @@
Import<E> importer,
CsvImportResult<T> csvResult) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
for (E entity : importer) {
String topiaId = entity.getTopiaId();
@@ -360,8 +360,8 @@
if (csvResult != null) {
csvResult.incrementsNumberCreated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
} else {
@@ -382,8 +382,8 @@
CsvImportResult<T> csvResult,
int nbRowBuffer) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
T source = meta.getSource();
T target = meta.getTarget();
@@ -415,8 +415,8 @@
}
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
}
@@ -431,8 +431,8 @@
CsvImportResult<T> csvResult,
int nbRowBuffer) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
T source = meta.getSource();
T target = meta.getTarget();
@@ -468,8 +468,8 @@
}
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
}
@@ -485,8 +485,8 @@
CsvImportResult<T> csvResult,
int nbRowBuffer) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
T source = meta.getSource();
T target = meta.getTarget();
@@ -524,8 +524,8 @@
}
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
}
@@ -541,8 +541,8 @@
CsvImportResult<T> csvResult,
int nbRowBuffer) throws TopiaException {
- CsvProgressionModel progressionModel = csvResult == null ? null :
- csvResult.getProgressionModel();
+ CsvProgressModel progressModel = csvResult == null ? null :
+ csvResult.getProgressModel();
T source = meta.getSource();
T target = meta.getTarget();
@@ -578,8 +578,8 @@
}
if (csvResult != null) {
csvResult.incrementsNumberUpdated();
- if (progressionModel != null) {
- progressionModel.incrementsProgression();
+ if (progressModel != null) {
+ progressModel.incrementsProgress();
}
}
}
1
0