moved xpql over and test for release
This commit is contained in:
parent
a51eeeb254
commit
fa06f4e015
336
pom.xml
336
pom.xml
|
@ -4,75 +4,50 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc</name>
|
||||
<description>Simple crud'ing for all.</description>
|
||||
<description>Very Amazing/Advanced/Amplified Simple CRUD'ing for all.</description>
|
||||
<url>http://www.x4o.org/vasc</url>
|
||||
<inceptionYear>2007</inceptionYear>
|
||||
<organization>
|
||||
<name>IDCA</name>
|
||||
<url>http://www.idca.nl</url>
|
||||
</organization>
|
||||
|
||||
<issueManagement>
|
||||
<system>Trac</system>
|
||||
<url>https://decaid.idca.nl/trac/oss/</url>
|
||||
</issueManagement>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>BSD</name>
|
||||
<url>http://repository.idcanet.com/licenses/bsd.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:svn:https://decaid.idca.nl/svn/oss/com.idcanet.vasc/</connection>
|
||||
<developerConnection>scm:svn:https://decaid.idca.nl/svn/oss/com.idcanet.vasc/</developerConnection>
|
||||
<url>https://decaid.idca.nl/svn/oss/com.idcanet.vasc/</url>
|
||||
<connection>https://decaid.idca.nl/hg/com.idcanet.vasc/</connection>
|
||||
<developerConnection>scm:hg:${hg.repo.url}</developerConnection>
|
||||
<url>https://decaid.idca.nl/hg/com.idcanet.vasc/file/</url>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>willem.cazander</id>
|
||||
<name>Willem Cazander</name>
|
||||
<email>w.cazander@gmail.com</email>
|
||||
<organization>IDCA</organization>
|
||||
<timezone>+2</timezone>
|
||||
<roles>
|
||||
<role>Project Manager</role>
|
||||
<role>Architect</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>sqrbass</id>
|
||||
<name>Bas van Oostveen</name>
|
||||
<email></email>
|
||||
<organization>IDCA</organization>
|
||||
<timezone>+2</timezone>
|
||||
<roles>
|
||||
<role>Architect Reviewer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>JBoss Repository Switchboard</name>
|
||||
<layout>default</layout>
|
||||
<url>http://repository.jboss.com/maven2/</url>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ops4j-microba</id>
|
||||
<name>ops4j.org</name>
|
||||
<layout>default</layout>
|
||||
<url>http://repository.ops4j.org/maven2/</url>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<modules>
|
||||
<module>vasc-backend-jpa</module>
|
||||
<module>vasc-backend-ldap</module>
|
||||
<module>vasc-frontend-swing</module>
|
||||
<module>vasc-frontend-swt</module>
|
||||
<module>vasc-frontend-web-jsf</module>
|
||||
<module>vasc-core</module>
|
||||
<module>vasc-ejb3</module>
|
||||
<module>vasc-xpql</module>
|
||||
<module>vasc-xpql-ejb3</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<hg.repo.url>https://decaid.idca.nl/hg/com.idcanet.vasc/</hg.repo.url>
|
||||
<staging.mvn.repo.url>file://${project.build.directory}/target-maven-repo</staging.mvn.repo.url>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<juel.version>2.1.0</juel.version>
|
||||
<testng.version>5.8</testng.version>
|
||||
<x4o-core.version>0.8-SNAPSHOT</x4o-core.version>
|
||||
<x4o-core.version>0.8.1</x4o-core.version>
|
||||
<jldap.version>4.3</jldap.version>
|
||||
<xtes-xpql.version>0.6-SNAPSHOT</xtes-xpql.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -196,36 +171,29 @@
|
|||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>swt</groupId>
|
||||
<artifactId>${swt.os-specific-dep}-native</artifactId>
|
||||
<version>${swt.version}</version>
|
||||
<type>jar</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/appassembler/lib
|
||||
</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
<!-- Perform maven releases -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<configuration>
|
||||
<preparationGoals>clean install verify</preparationGoals>
|
||||
<!-- rmed assembly:assembly -->
|
||||
<goals>clean install javadoc:javadoc deploy</goals>
|
||||
<arguments>-Prelease -DaltDeploymentRepository="${altDeploymentRepository}"</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
|
@ -285,15 +253,205 @@
|
|||
|
||||
</plugins>
|
||||
</reporting>
|
||||
<modules>
|
||||
<module>vasc-backend-jpa</module>
|
||||
<module>vasc-backend-ldap</module>
|
||||
<module>vasc-frontend-swing</module>
|
||||
<module>vasc-frontend-swt</module>
|
||||
<module>vasc-frontend-web-jsf</module>
|
||||
<module>vasc-core</module>
|
||||
<module>vasc-ejb3</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>JBoss Repository Switchboard</name>
|
||||
<layout>default</layout>
|
||||
<url>http://repository.jboss.com/maven2/</url>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ops4j-microba</id>
|
||||
<name>ops4j.org</name>
|
||||
<layout>default</layout>
|
||||
<url>http://repository.ops4j.org/maven2/</url>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<!-- DistributionManagement -->
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<name>Internal Releases</name>
|
||||
<url>http://localhost:8081/nexus/content/repositories/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>snapshots</id>
|
||||
<name>Internal Snapshots</name>
|
||||
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>willem.cazander</id>
|
||||
<name>Willem Cazander</name>
|
||||
<email>w.cazander@gmail.com</email>
|
||||
<organization>IDCA</organization>
|
||||
<timezone>+2</timezone>
|
||||
<roles>
|
||||
<role>Project Manager</role>
|
||||
<role>Architect</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>sqrbass</id>
|
||||
<name>Bas van Oostveen</name>
|
||||
<email></email>
|
||||
<organization>IDCA</organization>
|
||||
<timezone>+2</timezone>
|
||||
<roles>
|
||||
<role>Architect Reviewer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<!-- Profiles -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<properties>
|
||||
<hg.repo.url>file://${project.build.directory}/dummy-hg-repo</hg.repo.url>
|
||||
<altDeploymentRepository>release-repo-hudson::default::${staging.mvn.repo.url}</altDeploymentRepository>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>clean-release-dirs</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<executable>rm</executable>
|
||||
<arguments>
|
||||
<argument>-rf</argument>
|
||||
<argument>${project.build.directory}/dummy-hg-repo</argument>
|
||||
<argument>${project.build.directory}/target-maven-repo</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>create-release-dirs</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<executable>mkdir</executable>
|
||||
<arguments>
|
||||
<argument>-p</argument>
|
||||
<argument>${project.build.directory}/dummy-hg-repo</argument>
|
||||
<argument>${project.build.directory}/target-maven-repo</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>init-dummy-hg-repo</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<executable>hg</executable>
|
||||
<workingDirectory>${project.build.directory}/dummy-hg-repo</workingDirectory>
|
||||
<arguments>
|
||||
<argument>init</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release-commit</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>push-hg</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<executable>hg</executable>
|
||||
<arguments>
|
||||
<argument>push</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>wagon-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${staging.mvn.repo.url}</source>
|
||||
<target>${project.distributionManagement.repository.url}</target>
|
||||
<targetId>${project.distributionManagement.repository.id}</targetId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>merge-repo</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>merge-maven-repos</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release-cancel</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>strip-hg</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<!-- FIXME: would be better to strip local changes -->
|
||||
<executable>rm</executable>
|
||||
<arguments>
|
||||
<argument>-rf</argument>
|
||||
<argument>.hg</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<!-- END -->
|
||||
</project>
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-backend-jpa</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
|
|
|
@ -40,7 +40,7 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.xtes.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
* Manages persistance with xpql queries
|
||||
|
@ -52,17 +52,17 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
|
||||
private HibernateSessionProvider hibernateSessionProvider = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query query = null;
|
||||
private com.idcanet.vasc.xpql.query.Query query = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryTotal = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveUp = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveUpDown = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveDown = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveDownUp = null;
|
||||
|
||||
private Class<?> resultClass = null;
|
||||
|
||||
|
@ -136,28 +136,28 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
/**
|
||||
* @return the query
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQuery() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param query the query to set
|
||||
*/
|
||||
public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
|
||||
public void setQuery(com.idcanet.vasc.xpql.query.Query query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryTotal
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryTotal() {
|
||||
return queryTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryTotal the queryTotal to set
|
||||
*/
|
||||
public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
|
||||
public void setQueryTotal(com.idcanet.vasc.xpql.query.Query queryTotal) {
|
||||
this.queryTotal = queryTotal;
|
||||
}
|
||||
|
||||
|
@ -378,56 +378,56 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
/**
|
||||
* @return the queryMoveUp
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveUp() {
|
||||
return queryMoveUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveUp the queryMoveUp to set
|
||||
*/
|
||||
public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
|
||||
public void setQueryMoveUp(com.idcanet.vasc.xpql.query.Query queryMoveUp) {
|
||||
this.queryMoveUp = queryMoveUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveDown
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveDown() {
|
||||
return queryMoveDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveDown the queryMoveDown to set
|
||||
*/
|
||||
public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
|
||||
public void setQueryMoveDown(com.idcanet.vasc.xpql.query.Query queryMoveDown) {
|
||||
this.queryMoveDown = queryMoveDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveUpDown
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveUpDown() {
|
||||
return queryMoveUpDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveUpDown the queryMoveUpDown to set
|
||||
*/
|
||||
public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
|
||||
public void setQueryMoveUpDown(com.idcanet.vasc.xpql.query.Query queryMoveUpDown) {
|
||||
this.queryMoveUpDown = queryMoveUpDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveDownUp
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveDownUp() {
|
||||
return queryMoveDownUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveDownUp the queryMoveDownUp to set
|
||||
*/
|
||||
public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
|
||||
public void setQueryMoveDownUp(com.idcanet.vasc.xpql.query.Query queryMoveDownUp) {
|
||||
this.queryMoveDownUp = queryMoveDownUp;
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.xtes.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
* Manages persistance with xpql queries
|
||||
|
@ -51,17 +51,17 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
|
||||
private EntityManagerProvider entityManagerProvider = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query query = null;
|
||||
private com.idcanet.vasc.xpql.query.Query query = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryTotal = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveUp = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveUpDown = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveDown = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
|
||||
private com.idcanet.vasc.xpql.query.Query queryMoveDownUp = null;
|
||||
|
||||
private Class<?> resultClass = null;
|
||||
|
||||
|
@ -141,28 +141,28 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
/**
|
||||
* @return the query
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQuery() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param query the query to set
|
||||
*/
|
||||
public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
|
||||
public void setQuery(com.idcanet.vasc.xpql.query.Query query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryTotal
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryTotal() {
|
||||
return queryTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryTotal the queryTotal to set
|
||||
*/
|
||||
public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
|
||||
public void setQueryTotal(com.idcanet.vasc.xpql.query.Query queryTotal) {
|
||||
this.queryTotal = queryTotal;
|
||||
}
|
||||
|
||||
|
@ -371,56 +371,56 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
/**
|
||||
* @return the queryMoveUp
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveUp() {
|
||||
return queryMoveUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveUp the queryMoveUp to set
|
||||
*/
|
||||
public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
|
||||
public void setQueryMoveUp(com.idcanet.vasc.xpql.query.Query queryMoveUp) {
|
||||
this.queryMoveUp = queryMoveUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveDown
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveDown() {
|
||||
return queryMoveDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveDown the queryMoveDown to set
|
||||
*/
|
||||
public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
|
||||
public void setQueryMoveDown(com.idcanet.vasc.xpql.query.Query queryMoveDown) {
|
||||
this.queryMoveDown = queryMoveDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveUpDown
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveUpDown() {
|
||||
return queryMoveUpDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveUpDown the queryMoveUpDown to set
|
||||
*/
|
||||
public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
|
||||
public void setQueryMoveUpDown(com.idcanet.vasc.xpql.query.Query queryMoveUpDown) {
|
||||
this.queryMoveUpDown = queryMoveUpDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the queryMoveDownUp
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQueryMoveDownUp() {
|
||||
return queryMoveDownUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param queryMoveDownUp the queryMoveDownUp to set
|
||||
*/
|
||||
public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
|
||||
public void setQueryMoveDownUp(com.idcanet.vasc.xpql.query.Query queryMoveDownUp) {
|
||||
this.queryMoveDownUp = queryMoveDownUp;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-backend-ldap</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${x4o-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.xtes</groupId>
|
||||
<artifactId>xtes-xpql</artifactId>
|
||||
<version>${xtes-xpql.version}</version>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-xpql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.xtes.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -54,7 +54,7 @@ public class JdbcXpqlVascBackend extends AbstractVascBackend {
|
|||
|
||||
private JdbcConnectionProvider jdbcConnectionProvider = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query query = null;
|
||||
private com.idcanet.vasc.xpql.query.Query query = null;
|
||||
|
||||
/**
|
||||
* @return the JdbcConnectionProvider
|
||||
|
@ -73,14 +73,14 @@ public class JdbcXpqlVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @return the query
|
||||
*/
|
||||
public com.idcanet.xtes.xpql.query.Query getQuery() {
|
||||
public com.idcanet.vasc.xpql.query.Query getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param query the query to set
|
||||
*/
|
||||
public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
|
||||
public void setQuery(com.idcanet.vasc.xpql.query.Query query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.idcanet.vasc.core.VascController;
|
|||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
|
||||
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-ejb3</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
|
@ -32,9 +32,9 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.xtes</groupId>
|
||||
<artifactId>xtes-xpql-ejb3</artifactId>
|
||||
<version>0.6-SNAPSHOT</version>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.idcanet.vasc.core.VascBackend;
|
|||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryController;
|
||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||
|
@ -63,14 +64,16 @@ import com.idcanet.vasc.impl.actions.EditRowAction;
|
|||
import com.idcanet.vasc.impl.actions.XMLExportGlobalAction;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import com.idcanet.vasc.impl.x4o.VascParser;
|
||||
|
||||
import com.idcanet.vasc.xpql.ejb3.XpqlQueryManager;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
import com.idcanet.x4o.core.AbstractX4OPhaseHandler;
|
||||
import com.idcanet.x4o.core.X4OPhase;
|
||||
import com.idcanet.x4o.core.X4OPhaseException;
|
||||
import com.idcanet.x4o.core.X4OPhaseHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementContext;
|
||||
import com.idcanet.xtes.xpql.ejb3.XpqlQueryManager;
|
||||
import com.idcanet.xtes.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-frontend-swing</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-frontend-swt</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-frontend-web-jsf</artifactId>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
|
|
|
@ -57,7 +57,6 @@ import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
|||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.vasc.ejb3.VascServiceManager;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryState;
|
||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||
import com.idcanet.vasc.impl.VascBackendProxyEventExecutor;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
|
@ -183,6 +182,24 @@ abstract public class AbstractJSFVascFacesController {
|
|||
entry.getVascFrontendData().getVascEntryState().setVascBackend(backend);
|
||||
entry.getVascFrontendData().getVascEntryState().setVascEntry(entry);
|
||||
|
||||
// set def para
|
||||
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
|
||||
for (String key2:entry.getEntryParameterKeys()) {
|
||||
Object value = entry.getEntryParameter(key2);
|
||||
//System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName());
|
||||
state.setDataParameter(key2, value);
|
||||
}
|
||||
|
||||
// set list para
|
||||
for (VascEntryField vef:entry.getListOptions()) {
|
||||
Object def = vef.getDefaultValue();
|
||||
if (def==null) {
|
||||
continue;
|
||||
}
|
||||
String backendName = vef.getBackendName();
|
||||
state.setDataParameter(backendName, def);
|
||||
}
|
||||
|
||||
// copy para
|
||||
if (para!=null) {
|
||||
for (String key:para.keySet()) {
|
||||
|
@ -409,7 +426,7 @@ abstract public class AbstractJSFVascFacesController {
|
|||
SetParameterBackendListener listener = new SetParameterBackendListener(vui.userId,vui.username);
|
||||
listener.setName(key);
|
||||
listener.setType(type);
|
||||
// listener.setValue(paraTypeValue);
|
||||
listener.setValue(paraTypeValue);
|
||||
|
||||
List<VascEntryBackendEventListener> listeners=new ArrayList<VascEntryBackendEventListener>(10);
|
||||
listeners.add(listener);
|
||||
|
|
|
@ -53,7 +53,7 @@ import com.idcanet.vasc.impl.DefaultVascFactory;
|
|||
/**
|
||||
* Renders an JSF vasc entry views.
|
||||
*
|
||||
* This is a bit hacky because I'm not a JSF guro.
|
||||
* This is a already less hacky this is second incarnation of this bean
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
|
|
10
vasc-xpql-ejb3/.classpath
Normal file
10
vasc-xpql-ejb3/.classpath
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
23
vasc-xpql-ejb3/.project
Normal file
23
vasc-xpql-ejb3/.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-xpql-ejb3</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
6
vasc-xpql-ejb3/.settings/org.eclipse.jdt.core.prefs
Normal file
6
vasc-xpql-ejb3/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Mon Jan 10 02:21:44 CET 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
9
vasc-xpql-ejb3/.settings/org.maven.ide.eclipse.prefs
Normal file
9
vasc-xpql-ejb3/.settings/org.maven.ide.eclipse.prefs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#Mon Jan 10 02:21:43 CET 2011
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
38
vasc-xpql-ejb3/pom.xml
Normal file
38
vasc-xpql-ejb3/pom.xml
Normal file
|
@ -0,0 +1,38 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3</artifactId>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<name>vasc-xpql-ejb3</name>
|
||||
<description>xpql parsing service for ejb3</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-xpql</artifactId>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ejb</groupId>
|
||||
<artifactId>ejb-api</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
<version>3.4.0.GA</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
package com.idcanet.vasc.xpql.ejb3;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 17 Sep 2010
|
||||
*/
|
||||
public interface XpqlQueryManager {
|
||||
|
||||
public Query getQuery(String name);
|
||||
|
||||
public List<Object> execute(Query query);
|
||||
|
||||
public Object executeObject(Query query);
|
||||
|
||||
public Integer executeUpdate(Query query);
|
||||
|
||||
public List<Object> execute(String query,Map<String,Object> parameters);
|
||||
|
||||
public Object executeObject(String query,Map<String,Object> parameters);
|
||||
|
||||
public Integer executeUpdate(String query,Map<String,Object> parameters);
|
||||
|
||||
@Local
|
||||
public interface ILocal extends XpqlQueryManager {
|
||||
}
|
||||
|
||||
@Remote
|
||||
public interface IRemote extends XpqlQueryManager {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,321 @@
|
|||
|
||||
package com.idcanet.vasc.xpql.ejb3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionManagement;
|
||||
import javax.ejb.TransactionManagementType;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import com.idcanet.vasc.xpql.QueryStore;
|
||||
import com.idcanet.vasc.xpql.XPQLParser;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 16 Jul 2007
|
||||
*/
|
||||
@Stateless(name="ejb/xpqlQueryManager")
|
||||
@TransactionManagement(TransactionManagementType.BEAN)
|
||||
public class XpqlQueryManagerImpl implements XpqlQueryManager.ILocal,XpqlQueryManager.IRemote {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(XpqlQueryManagerImpl.class.getName());
|
||||
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Resource
|
||||
private UserTransaction utx;
|
||||
|
||||
private Map<String,Query> queries = new HashMap<String,Query>(100);
|
||||
|
||||
@PostConstruct
|
||||
public void loadAll() {
|
||||
logger.fine("XtesManager created now loading resources...");
|
||||
try {
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
Map<String,String> keys = loadKeys();
|
||||
for (String key:keys.keySet()) {
|
||||
String value = keys.get(key);
|
||||
if (key.startsWith("load")) {
|
||||
loadResource(value);
|
||||
}
|
||||
if ("persistenceUnit".equals(key)) {
|
||||
logger.fine("getting EntityManager: "+value);
|
||||
entityManager = (EntityManager)new InitialContext().lookup(value);
|
||||
}
|
||||
}
|
||||
long t = System.currentTimeMillis()-s;
|
||||
logger.info("Total loaded xpql queries: "+queries.size()+" in "+t+" ms.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error while load xpql resources error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
|
||||
*/
|
||||
protected Map<String,String> loadKeys() throws IOException {
|
||||
|
||||
Properties properties = new Properties();
|
||||
|
||||
logger.fine("Getting urls");
|
||||
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("META-INF/xtes-xpql-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/xtes-xpql-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/xtes-xpql-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading root namespaces of: "+u+" for: /META-INF/xtes-xpql-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.fine("done loading");
|
||||
|
||||
Map<String,String> result = new HashMap<String,String>(20);
|
||||
for (Object key:properties.keySet()) {
|
||||
if (key instanceof String) {
|
||||
String key2 = (String) key;
|
||||
String value = properties.getProperty(key2);
|
||||
result.put(key2, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void loadResource(String resource) {
|
||||
XPQLParser parser = new XPQLParser();
|
||||
logger.fine("Try loading: "+resource);
|
||||
try {
|
||||
parser.parseResource(resource);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load xpql resource: "+resource+" error: "+e.getMessage(),e);
|
||||
}
|
||||
QueryStore store = parser.getQueryStore();
|
||||
|
||||
for (String key:store.getQueryNames()) {
|
||||
Query q = store.getQuery(key);
|
||||
|
||||
queries.put(q.getName(),q);
|
||||
|
||||
String out = "\n\n=========== SQL: "+q.getName()+"\n";
|
||||
//out +=q.toSQL(q);
|
||||
out +="=========== XML: "+q.getName()+"\n";
|
||||
out +=q.toXML(q);
|
||||
//out +="=========== Edit: "+q.getName()+"\n";
|
||||
//out +=q.toEdit(q);
|
||||
out +="=========== Prepard: "+q.getName()+"\n";
|
||||
out +=q.toPreparedSQL(q)+"\n";
|
||||
logger.finer("FOUND Query: "+out);
|
||||
}
|
||||
}
|
||||
|
||||
public Query getQuery(String name) {
|
||||
Query q = queries.get(name);
|
||||
return q;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(Query query) {
|
||||
String sql = query.toPreparedSQL(query);
|
||||
logger.finer("Executing: "+query.getName()+" sql: "+sql);
|
||||
javax.persistence.Query q2 = null;
|
||||
if (Query.QueryType.hql==query.getType()) {
|
||||
q2 = entityManager.createQuery(sql);
|
||||
}
|
||||
if (Query.QueryType.sql==query.getType()) {
|
||||
q2 = entityManager.createNativeQuery(sql);
|
||||
}
|
||||
|
||||
// TODO: move this hack to xtest xpql
|
||||
if (query.getProperty("limit")!=null) {
|
||||
int max = new Integer(query.getPropertyString("limit"));
|
||||
q2.setMaxResults(max);
|
||||
}
|
||||
if (query.getProperty("offset")!=null) {
|
||||
int offset = new Integer(query.getPropertyString("offset"));
|
||||
q2.setFirstResult(offset);
|
||||
}
|
||||
|
||||
|
||||
List<QueryParameterValue> options = query.getOrderQueryParameterValues();
|
||||
int i=1;
|
||||
for ( QueryParameterValue value : options ) {
|
||||
Object para = value.getValue();
|
||||
if(para==null) {
|
||||
para = value.getDefaultValue();
|
||||
}
|
||||
logger.finest( "nr: " + i + " value: " + para+" name: "+value.getName());
|
||||
q2.setParameter(i,para);
|
||||
i++;
|
||||
}
|
||||
return q2.getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object executeObject(Query query) {
|
||||
String sql = query.toPreparedSQL(query);
|
||||
logger.finer("Executing: "+query.getName()+" sql: "+sql);
|
||||
javax.persistence.Query q2 = null;
|
||||
if (Query.QueryType.hql==query.getType()) {
|
||||
q2 = entityManager.createQuery(sql);
|
||||
}
|
||||
if (Query.QueryType.sql==query.getType()) {
|
||||
q2 = entityManager.createNativeQuery(sql);
|
||||
}
|
||||
|
||||
|
||||
// TODO: move this hack to xtest xpql
|
||||
if (query.getProperty("limit")!=null) {
|
||||
int max = new Integer(query.getPropertyString("limit"));
|
||||
q2.setMaxResults(max);
|
||||
}
|
||||
if (query.getProperty("offset")!=null) {
|
||||
int offset = new Integer(query.getPropertyString("offset"));
|
||||
q2.setFirstResult(offset);
|
||||
}
|
||||
|
||||
List<QueryParameterValue> options = query.getOrderQueryParameterValues();
|
||||
int i=1;
|
||||
for ( QueryParameterValue value : options ) {
|
||||
Object para = value.getValue();
|
||||
if(para==null) {
|
||||
para = value.getDefaultValue();
|
||||
}
|
||||
logger.finest( "nr: " + i + " value: " + para+" name: "+value.getName());
|
||||
q2.setParameter(i,para);
|
||||
i++;
|
||||
}
|
||||
try {
|
||||
utx.begin();
|
||||
Object result = null;
|
||||
try {
|
||||
result = q2.getSingleResult();
|
||||
utx.commit();
|
||||
} finally {
|
||||
if (result==null) {
|
||||
utx.rollback();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} catch (Exception se) {
|
||||
throw new RuntimeException("Transaction error: "+se.getMessage(),se);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Object> execute(String name,Map<String,Object> parameters) {
|
||||
Query query = getQuery(name);
|
||||
if (parameters!=null) {
|
||||
for (String key:parameters.keySet()) {
|
||||
Object value = parameters.get(key);
|
||||
query.setQueryParameter(key, value);
|
||||
}
|
||||
}
|
||||
return execute(query);
|
||||
}
|
||||
|
||||
public Object executeObject(String name,Map<String,Object> parameters) {
|
||||
Query query = getQuery(name);
|
||||
if (parameters!=null) {
|
||||
for (String key:parameters.keySet()) {
|
||||
Object value = parameters.get(key);
|
||||
query.setQueryParameter(key, value);
|
||||
}
|
||||
}
|
||||
return executeObject(query);
|
||||
}
|
||||
|
||||
public Integer executeUpdate(Query query) {
|
||||
String sql = query.toPreparedSQL(query);
|
||||
logger.fine("Executing: "+query.getName()+" sql: "+sql);
|
||||
try {
|
||||
javax.persistence.Query q2 = null;
|
||||
if (Query.QueryType.hql==query.getType()) {
|
||||
q2 = entityManager.createQuery(sql);
|
||||
List<QueryParameterValue> options = query.getOrderQueryParameterValues();
|
||||
int i=1;
|
||||
for ( QueryParameterValue value : options ) {
|
||||
Object para = value.getValue();
|
||||
if(para==null) {
|
||||
para = value.getDefaultValue();
|
||||
}
|
||||
logger.finest( "nr: " + i + " value: " + para+" name: "+value.getName());
|
||||
q2.setParameter(i,para);
|
||||
i++;
|
||||
}
|
||||
utx.begin();
|
||||
Integer result = q2.executeUpdate();
|
||||
utx.commit();
|
||||
return result;
|
||||
}
|
||||
|
||||
if (Query.QueryType.sql==query.getType()) {
|
||||
q2 = entityManager.createNativeQuery(sql);
|
||||
List<QueryParameterValue> options = query.getOrderQueryParameterValues();
|
||||
int i=1;
|
||||
for ( QueryParameterValue value : options ) {
|
||||
Object para = value.getValue();
|
||||
if(para==null) {
|
||||
para = value.getDefaultValue();
|
||||
}
|
||||
logger.finest( "nr: " + i + " value: " + para+" name: "+value.getName());
|
||||
q2.setParameter(i,para);
|
||||
i++;
|
||||
}
|
||||
utx.begin();
|
||||
Integer result = q2.executeUpdate();
|
||||
utx.commit();
|
||||
return result;
|
||||
}
|
||||
} catch (Exception se) {
|
||||
throw new RuntimeException("Transaction error: "+se.getMessage(),se);
|
||||
}
|
||||
throw new IllegalStateException("unknow query type");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.showplanner.ejb.services.XtesManagerLocal#executeUpdate(java.lang.String, java.lang.String, java.util.Map)
|
||||
*/
|
||||
public Integer executeUpdate(String name,Map<String, Object> parameters) {
|
||||
Query query = getQuery(name);
|
||||
for (String key:parameters.keySet()) {
|
||||
Object value = parameters.get(key);
|
||||
query.setQueryParameter(key, value);
|
||||
}
|
||||
return executeUpdate(query);
|
||||
}
|
||||
}
|
0
vasc-xpql-ejb3/src/main/resources/.empty
Normal file
0
vasc-xpql-ejb3/src/main/resources/.empty
Normal file
0
vasc-xpql-ejb3/src/test/java/.empty
Normal file
0
vasc-xpql-ejb3/src/test/java/.empty
Normal file
0
vasc-xpql-ejb3/src/test/resources/.empty
Normal file
0
vasc-xpql-ejb3/src/test/resources/.empty
Normal file
10
vasc-xpql/.classpath
Normal file
10
vasc-xpql/.classpath
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
23
vasc-xpql/.project
Normal file
23
vasc-xpql/.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-xpql</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
6
vasc-xpql/.settings/org.eclipse.jdt.core.prefs
Normal file
6
vasc-xpql/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Mon Jan 10 02:20:38 CET 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
9
vasc-xpql/.settings/org.maven.ide.eclipse.prefs
Normal file
9
vasc-xpql/.settings/org.maven.ide.eclipse.prefs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#Mon Jan 10 02:20:38 CET 2011
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
36
vasc-xpql/pom.xml
Normal file
36
vasc-xpql/pom.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-base</artifactId>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-xpql</artifactId>
|
||||
<version>0.3.1-SNAPSHOT</version>
|
||||
<name>vasc-xpql</name>
|
||||
<description>vasc xpql parser for queries.</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${x4o-core.version}</version>
|
||||
</dependency>
|
||||
<!-- JSP depency -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Metamodel
|
||||
<dependency>
|
||||
<groupId>dk.eobjects.metamodel</groupId>
|
||||
<artifactId>MetaModel-full</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<scope>compile</scope>
|
||||
<optional/>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright 2004-2010 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
* Holds all the queries.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 30, 2010
|
||||
*/
|
||||
public class QueryStore {
|
||||
|
||||
private Map<String,Query> queryMap = new HashMap<String,Query>(100);
|
||||
|
||||
public void addQuery(Query query) {
|
||||
if (query==null) {
|
||||
throw new NullPointerException("Can't add null query.");
|
||||
}
|
||||
if (query.getName()==null) {
|
||||
throw new NullPointerException("Can't add query with null name.");
|
||||
}
|
||||
if (query.getName().isEmpty()) {
|
||||
throw new IllegalArgumentException("Can't add query with empty name.");
|
||||
}
|
||||
queryMap.put(query.getName(),query);
|
||||
}
|
||||
|
||||
public Query getQuery(String name) {
|
||||
return queryMap.get(name);
|
||||
}
|
||||
|
||||
public Set<String> getQueryNames() {
|
||||
return queryMap.keySet();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2004-2010 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
|
||||
import com.idcanet.x4o.core.X4OParser;
|
||||
import com.idcanet.x4o.element.ElementContext;
|
||||
|
||||
/**
|
||||
* Parse an xpql file/resource
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 29, 2010
|
||||
*/
|
||||
public class XPQLParser extends X4OParser {
|
||||
|
||||
static public String XPQL_LANGUAGE = "xpql";
|
||||
|
||||
private QueryStore queryStore = null;
|
||||
|
||||
public XPQLParser() {
|
||||
this(new QueryStore());
|
||||
}
|
||||
|
||||
public XPQLParser(QueryStore queryStore) {
|
||||
super(XPQL_LANGUAGE);
|
||||
if (queryStore==null) {
|
||||
throw new NullPointerException("Can work with null QueryStore.");
|
||||
}
|
||||
this.queryStore=queryStore;
|
||||
addGlobalELBean("__queryStore__", queryStore);
|
||||
}
|
||||
|
||||
public QueryStore getQueryStore() {
|
||||
return queryStore;
|
||||
}
|
||||
|
||||
static public QueryStore getQueryStore(ElementContext elementContext) {
|
||||
if (elementContext==null) {
|
||||
throw new NullPointerException("ElementContext may not be null.");
|
||||
}
|
||||
ValueExpression ee = elementContext.getExpressionFactory().createValueExpression(elementContext.getELContext(),"${__queryStore__}",QueryStore.class);
|
||||
QueryStore qs = (QueryStore)ee.getValue(elementContext.getELContext());
|
||||
return qs;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.AbstractQuery;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
* This class defines an executable SQL query.
|
||||
*
|
||||
* @author Willem Cazander, Arjan Tijms
|
||||
* @version 1.0 17/11/2004
|
||||
* @since 1.0
|
||||
*/
|
||||
public class DefaultQuery extends AbstractQuery {
|
||||
|
||||
|
||||
/** Is set as option values when value is null */
|
||||
static final String NULL_STRING = "";
|
||||
|
||||
|
||||
// ========= QueryPart interface
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.AbstractQueryPart#toEdit()
|
||||
*/
|
||||
@Override
|
||||
public String toEdit(Query query) {
|
||||
StringBuffer queryBuffer = new StringBuffer();
|
||||
for ( QueryPart queryPart:getQueryParts() ) {
|
||||
queryBuffer.append( queryPart.toEdit(query) );
|
||||
}
|
||||
return queryBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.AbstractQueryPart#toPreparedSQL()
|
||||
*/
|
||||
@Override
|
||||
public String toPreparedSQL(Query query) {
|
||||
this.getOrderQueryParameterValues().clear();
|
||||
StringBuffer queryBuffer = new StringBuffer();
|
||||
for ( QueryPart queryPart:getQueryParts() ) {
|
||||
queryBuffer.append( queryPart.toPreparedSQL(query) );
|
||||
}
|
||||
return queryBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.AbstractQueryPart#toSQL()
|
||||
*/
|
||||
@Override
|
||||
public String toSQL(Query query) {
|
||||
StringBuffer queryBuffer = new StringBuffer();
|
||||
for ( QueryPart queryPart:getQueryParts() ) {
|
||||
queryBuffer.append( queryPart.toSQL(query) );
|
||||
}
|
||||
return queryBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.AbstractQueryPart#toXML()
|
||||
*/
|
||||
@Override
|
||||
public String toXML(Query query) {
|
||||
StringBuffer queryBuffer = new StringBuffer();
|
||||
|
||||
queryBuffer.append("\t<query name=\""+getName()+"\" type=\""+getType()+"\">\n");
|
||||
|
||||
for (String key:getPropertyKeys()) {
|
||||
queryBuffer.append("\t\t<x4o:property name=\""+key+"\" value=\""+getPropertyString(key)+"\"/>\n");
|
||||
}
|
||||
|
||||
queryBuffer.append("\t\t<sql>");
|
||||
for ( QueryPart queryPart:getQueryParts() ) {
|
||||
queryBuffer.append( queryPart.toXML(query) );
|
||||
}
|
||||
queryBuffer.append("</sql>\n");
|
||||
|
||||
for ( String comment:getQueryComments()) {
|
||||
queryBuffer.append("\t\t<comment>");
|
||||
queryBuffer.append(comment);
|
||||
queryBuffer.append("</comment>\n");
|
||||
}
|
||||
|
||||
for ( QueryParameterValue qpv:getLocalQueryParameterValues()) {
|
||||
queryBuffer.append("\t\t<parameterValue ");
|
||||
queryBuffer.append("name=\""+qpv.getName()+"\" ");
|
||||
if (qpv.getValue()!=null) {
|
||||
queryBuffer.append("value=\""+qpv.getValue()+"\" ");
|
||||
}
|
||||
if (qpv.getDefaultValue()!=null) {
|
||||
queryBuffer.append("defaultValue=\""+qpv.getDefaultValue()+"\" ");
|
||||
}
|
||||
queryBuffer.append("type=\""+qpv.getType()+"\" ");
|
||||
queryBuffer.append("/>\n");
|
||||
}
|
||||
|
||||
queryBuffer.append("\t</query>\n");
|
||||
|
||||
return queryBuffer.toString();
|
||||
}
|
||||
|
||||
public Query clone() throws CloneNotSupportedException {
|
||||
Query query = new DefaultQuery();
|
||||
//query.setTemplateStore(getTemplateStore());
|
||||
query.setName(getName());
|
||||
query.setType(getType());
|
||||
|
||||
for (String key:getPropertyKeys()) {
|
||||
query.setProperty(key,getProperty(key));
|
||||
}
|
||||
for (QueryPart part:getQueryParts()) {
|
||||
query.addQueryPart(part.clone());
|
||||
}
|
||||
for (String com:getQueryComments()) {
|
||||
query.addQueryComment(com);
|
||||
}
|
||||
|
||||
for (QueryParameterValue q:getLocalQueryParameterValues()) {
|
||||
query.addQueryParameterValue(q.clone());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.AbstractQueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public class DefaultQueryParameterValue extends AbstractQueryParameterValue {
|
||||
|
||||
public QueryParameterValue clone() throws CloneNotSupportedException {
|
||||
QueryParameterValue p = new DefaultQueryParameterValue();
|
||||
p.setDefaultValue(getDefaultValue());
|
||||
p.setName(getName());
|
||||
p.setType(getType());
|
||||
p.setValue(getValue());
|
||||
p.setValueType(getValueType());
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl;
|
||||
|
||||
import com.idcanet.vasc.xpql.XPQLParser;
|
||||
import com.idcanet.vasc.xpql.query.AbstractQueryPart;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
* Handled included query parts
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public class QueryInclude extends AbstractQueryPart {
|
||||
|
||||
private String name = null;
|
||||
private String resource = null;
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resource
|
||||
*/
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource the resource to set
|
||||
*/
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSQL(Query query) {
|
||||
if (query.getQueryStore().getQuery(getName())==null) {
|
||||
if (resource!=null) {
|
||||
try {
|
||||
XPQLParser parser = new XPQLParser(query.getQueryStore());
|
||||
parser.parseResource(resource);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return query.getQueryStore().getQuery(getName()).toSQL(query);
|
||||
}
|
||||
|
||||
public String toPreparedSQL(Query query) {
|
||||
if (query.getQueryStore().getQuery(getName())==null) {
|
||||
if (resource!=null) {
|
||||
try {
|
||||
XPQLParser parser = new XPQLParser(query.getQueryStore());
|
||||
parser.parseResource(resource);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return query.getQueryStore().getQuery(getName()).toPreparedSQL(query);
|
||||
}
|
||||
|
||||
public String toXML(Query query) {
|
||||
if (resource==null) {
|
||||
return "<include name=\""+name+"\"/>";
|
||||
}
|
||||
return "<include name=\""+name+"\" resource=\""+resource+"\"/>";
|
||||
}
|
||||
|
||||
public String toEdit(Query query) {
|
||||
if (resource==null) {
|
||||
return "@inc:"+name;
|
||||
}
|
||||
return "@inc:"+name+"@"+resource;
|
||||
}
|
||||
|
||||
public QueryPart clone() throws CloneNotSupportedException {
|
||||
QueryInclude include = new QueryInclude();
|
||||
include.setName(getName());
|
||||
include.setResource(getResource());
|
||||
return include;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.AbstractQueryPart;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public class QueryParameter extends AbstractQueryPart {
|
||||
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String toSQL(Query query) {
|
||||
QueryParameterValue value = query.getQueryParameterValue(getName());
|
||||
if ( value == null ) {
|
||||
return "";
|
||||
}
|
||||
if ( value.getValue() == null) {
|
||||
if (value.getDefaultValue() == null ) {
|
||||
return "";
|
||||
}
|
||||
return value.getDefaultValue().toString();
|
||||
}
|
||||
|
||||
if (value.getType()==null) {
|
||||
value.setType(QueryParameterValue.QueryParameterType.parameter);
|
||||
}
|
||||
if (value.getType()==QueryParameterValue.QueryParameterType.parameterList) {
|
||||
List valueList = null;
|
||||
if (value.getValue() instanceof List) {
|
||||
valueList = (List)value.getValue();
|
||||
}
|
||||
if (value.getValue() instanceof String) {
|
||||
valueList = new ArrayList();
|
||||
String[] array = ((String)value.getValue()).split(",");
|
||||
for (String a:array) {
|
||||
valueList.add(a);
|
||||
}
|
||||
}
|
||||
if (valueList==null) {
|
||||
valueList = new ArrayList();
|
||||
valueList.add(value.getValue());
|
||||
}
|
||||
StringBuilder builder = new StringBuilder(valueList.size()+3);
|
||||
Iterator i = valueList.iterator();
|
||||
while (i.hasNext()) {
|
||||
Object v = i.next();
|
||||
builder.append(v.toString());
|
||||
if (i.hasNext()) {
|
||||
builder.append(',');
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
return value.getValue().toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String toPreparedSQL(Query query) {
|
||||
|
||||
QueryParameterValue value = query.getQueryParameterValue(getName());
|
||||
if ( value == null ) {
|
||||
return "";
|
||||
}
|
||||
if (value.getType()==null) {
|
||||
value.setType(QueryParameterValue.QueryParameterType.parameter);
|
||||
}
|
||||
|
||||
String result = null;
|
||||
switch (value.getType()) {
|
||||
default:
|
||||
case parameter:
|
||||
//if (query.getOrderQueryParameterValues().contains(value)==false) {
|
||||
query.addOrderQueryParameterValue(value);
|
||||
result = "?";
|
||||
break;
|
||||
case parameterList:
|
||||
|
||||
// add extra method so , toObjectList, which does al the prepare work.
|
||||
|
||||
Object valueO = value.getValue();
|
||||
if (valueO==null) {
|
||||
return "";
|
||||
}
|
||||
List valueList = null;
|
||||
if (valueO instanceof List) {
|
||||
valueList = (List)valueO;
|
||||
}
|
||||
if (valueO instanceof String) {
|
||||
valueList = new ArrayList();
|
||||
String[] array = ((String)valueO).split(",");
|
||||
for (String a:array) {
|
||||
valueList.add(a);
|
||||
}
|
||||
}
|
||||
if (valueList==null) {
|
||||
valueList = new ArrayList();
|
||||
valueList.add(value);
|
||||
}
|
||||
|
||||
|
||||
//boolean doAdd = false;
|
||||
//if (query.getOrderQueryParameterValues().contains(value)==false) {
|
||||
//}
|
||||
|
||||
StringBuilder builder = new StringBuilder(valueList.size()+3);
|
||||
Iterator i = valueList.iterator();
|
||||
while (i.hasNext()) {
|
||||
Object v = i.next();
|
||||
builder.append('?');
|
||||
//if (doAdd) {
|
||||
QueryParameterValue vv = new DefaultQueryParameterValue();
|
||||
vv.setName(value.getName());
|
||||
vv.setValue(v);
|
||||
vv.setType(QueryParameterValue.QueryParameterType.parameter);
|
||||
query.addOrderQueryParameterValue(vv);
|
||||
//}
|
||||
if (i.hasNext()) {
|
||||
builder.append(',');
|
||||
}
|
||||
}
|
||||
result = builder.toString();
|
||||
break;
|
||||
case raw:
|
||||
// The structural type of a "value" indicates that we're dealing with a SQL construct
|
||||
// instead of a 'value' in the sense of values for prepared statements. In the XPQL dialect,
|
||||
// options can be structure as well as values.
|
||||
if (value.getValue()!=null) {
|
||||
result = value.getValue().toString();
|
||||
} else if (value.getDefaultValue()!=null) {
|
||||
result = value.getDefaultValue().toString();
|
||||
} else {
|
||||
result = "";
|
||||
}
|
||||
break;
|
||||
case xpql:
|
||||
result = null;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toXML(Query query) {
|
||||
return "<parameter name=\"" + getName() + "\"/>";
|
||||
}
|
||||
|
||||
public String toEdit(Query query) {
|
||||
return "@"+getName();
|
||||
}
|
||||
|
||||
public QueryPart clone() throws CloneNotSupportedException {
|
||||
QueryParameter p = new QueryParameter();
|
||||
p.setName(getName());
|
||||
return p;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl;
|
||||
|
||||
import com.idcanet.vasc.xpql.query.AbstractQueryPart;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public class QueryText extends AbstractQueryPart {
|
||||
|
||||
String text = null;
|
||||
|
||||
/**
|
||||
* @return the text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text the text to set
|
||||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSQL(Query query) {
|
||||
return text;
|
||||
}
|
||||
|
||||
public QueryPart clone() throws CloneNotSupportedException {
|
||||
QueryText text = new QueryText();
|
||||
text.setText(getText());
|
||||
return text;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 20, 2006
|
||||
*/
|
||||
public class CommentElement extends AbstractElement {
|
||||
|
||||
private StringBuffer comment = null;
|
||||
|
||||
public CommentElement() {
|
||||
comment = new StringBuffer(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doCharacters(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doCharacters(String arg0) {
|
||||
comment.append(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doComment(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doComment(String arg0) {
|
||||
comment.append(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doElementEnd()
|
||||
*/
|
||||
@Override
|
||||
public void doElementEnd() throws ElementException {
|
||||
if (getParent()==null) {
|
||||
throw new ElementException("No parent element");
|
||||
}
|
||||
if ((getParent().getElementObject() instanceof Query)==false) {
|
||||
throw new ElementException("No query parent element object");
|
||||
}
|
||||
((Query)getParent().getElementObject()).addQueryComment(comment.toString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElementAttributeConverter;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementAttributeConverterException;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue.QueryParameterType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 21, 2007
|
||||
*/
|
||||
public class ParameterTypeAttributeConverter extends AbstractElementAttributeConverter {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementClassParameterConverter#doConvertAttribute(com.idcanet.x4o.element.Element, java.lang.Object)
|
||||
*/
|
||||
public Object doConvertAttribute(Element arg0, Object value) throws ElementAttributeConverterException {
|
||||
try {
|
||||
return QueryParameterType.valueOf(""+value);
|
||||
} catch (Exception ex) {
|
||||
throw new ElementAttributeConverterException(this,"Could not convert to QueryParameterType value="+value,ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElementBindingHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementBindingHandlerException;
|
||||
import com.idcanet.vasc.xpql.impl.QueryInclude;
|
||||
import com.idcanet.vasc.xpql.impl.QueryParameter;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryParameterValue;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 21, 2007
|
||||
*/
|
||||
public class QueryBindingHandler extends AbstractElementBindingHandler {
|
||||
|
||||
public boolean canBind(Element element) {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
boolean p = false;
|
||||
boolean c = false;
|
||||
if(parent instanceof Query) { p=true; }
|
||||
if(child instanceof QueryPart) { c=true; }
|
||||
if(child instanceof QueryParameterValue) { c=true; }
|
||||
|
||||
// remove recuive stack
|
||||
if(element instanceof SQLElement) { c=false; }
|
||||
|
||||
if(p&c) { return true; } else { return false; }
|
||||
}
|
||||
|
||||
public void doBind(Element element) throws ElementBindingHandlerException {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
if(parent instanceof Query) {
|
||||
Query query = (Query)parent;
|
||||
|
||||
// skip those with diffent life cycle because of sql characters adding elements in sax phase.
|
||||
if (child instanceof QueryParameter) {
|
||||
return;
|
||||
}
|
||||
if (child instanceof QueryInclude) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (child instanceof QueryPart) {
|
||||
query.addQueryPart((QueryPart)child);
|
||||
}
|
||||
if (child instanceof QueryParameterValue) {
|
||||
query.addLocalQueryParameterValue((QueryParameterValue)child);
|
||||
query.addQueryParameterValue((QueryParameterValue)child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElementConfigurator;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementConfiguratorException;
|
||||
import com.idcanet.vasc.xpql.QueryStore;
|
||||
import com.idcanet.vasc.xpql.XPQLParser;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class QueryElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.ElementConfigurator#doConfigElement(com.idcanet.x4o.element.Element)
|
||||
*/
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
if ((element.getElementObject() instanceof Query)==false) {
|
||||
throw new ElementConfiguratorException(this,"No query element object");
|
||||
}
|
||||
QueryStore store = XPQLParser.getQueryStore(element.getElementContext());
|
||||
Query query = (Query)element.getElementObject();
|
||||
query.setQueryStore(store);
|
||||
store.addQuery(query);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
* Inserts the query inlude element direct on start-tag
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 2, 2009
|
||||
*/
|
||||
public class QueryIncludeElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doElementEnd()
|
||||
*/
|
||||
@Override
|
||||
public void doElementStart() throws ElementException {
|
||||
if (getParent()==null) {
|
||||
throw new ElementException("No parent element");
|
||||
}
|
||||
if ((getParent().getElementObject() instanceof Query)==false) {
|
||||
throw new ElementException("No query parent element object");
|
||||
}
|
||||
if ((getElementObject() instanceof QueryPart)==false) {
|
||||
throw new ElementException("No QueryPart element object");
|
||||
}
|
||||
((Query)getParent().getElementObject()).addQueryPart((QueryPart)getElementObject());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
import com.idcanet.vasc.xpql.query.QueryPart;
|
||||
|
||||
/**
|
||||
* Inserts the query element direct on start-tag
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 24, 2009
|
||||
*/
|
||||
public class QueryParameterElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doElementEnd()
|
||||
*/
|
||||
@Override
|
||||
public void doElementStart() throws ElementException {
|
||||
if (getParent()==null) {
|
||||
throw new ElementException("No parent element");
|
||||
}
|
||||
if ((getParent().getElementObject() instanceof Query)==false) {
|
||||
throw new ElementException("No query parent element object");
|
||||
}
|
||||
if ((getElementObject() instanceof QueryPart)==false) {
|
||||
throw new ElementException("No QueryPart element object");
|
||||
}
|
||||
((Query)getParent().getElementObject()).addQueryPart((QueryPart)getElementObject());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElementAttributeConverter;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementAttributeConverterException;
|
||||
import com.idcanet.vasc.xpql.query.Query.QueryType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 21, 2007
|
||||
*/
|
||||
public class QueryTypeAttributeConverter extends AbstractElementAttributeConverter {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementClassParameterConverter#doConvertAttribute(com.idcanet.x4o.element.Element, java.lang.Object)
|
||||
*/
|
||||
public Object doConvertAttribute(Element arg0, Object value) throws ElementAttributeConverterException {
|
||||
try {
|
||||
return QueryType.valueOf(""+value);
|
||||
} catch (Exception ex) {
|
||||
throw new ElementAttributeConverterException(this,"Could not convert to QueryType value="+value,ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.impl.x4o;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
import com.idcanet.vasc.xpql.impl.QueryText;
|
||||
import com.idcanet.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 20, 2006
|
||||
*/
|
||||
public class SQLElement extends AbstractElement {
|
||||
|
||||
private StringBuffer sql = null;
|
||||
|
||||
public SQLElement() {
|
||||
sql = new StringBuffer(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doCharacters(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doCharacters(String text) throws ElementException {
|
||||
if (getParent()==null) {
|
||||
throw new ElementException("No parent element");
|
||||
}
|
||||
if ((getParent().getElementObject() instanceof Query)==false) {
|
||||
throw new ElementException("No query parent element object");
|
||||
}
|
||||
QueryText q = new QueryText();
|
||||
q.setText(text);
|
||||
((Query)getParent().getElementObject()).addQueryPart(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doComment(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doComment(String arg0) {
|
||||
sql.append("/* "+arg0+" */");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#getElementObject()
|
||||
*/
|
||||
@Override
|
||||
public Object getElementObject() {
|
||||
return getParent().getElementObject();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.xpql.QueryStore;
|
||||
import com.idcanet.vasc.xpql.impl.DefaultQueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
abstract public class AbstractQuery extends AbstractQueryPart implements Query {
|
||||
|
||||
private String name = null;
|
||||
private List<QueryPart> queryParts = null;
|
||||
private Map<String,QueryParameterValue> localQueryParameterValues = null;
|
||||
private Map<String,QueryParameterValue> queryParameterValues = null;
|
||||
private List<QueryParameterValue> orderQueryParameterValues = null;
|
||||
private List<String> queryComments = null;
|
||||
private Map<String,Object> properties = null;
|
||||
private QueryType type = null;
|
||||
private QueryStore queryStore = null;
|
||||
|
||||
/**
|
||||
* Init all fields.
|
||||
*/
|
||||
public AbstractQuery() {
|
||||
queryParts = new ArrayList<QueryPart>(10);
|
||||
localQueryParameterValues = new HashMap<String,QueryParameterValue>(6);
|
||||
queryParameterValues = new HashMap<String,QueryParameterValue>(6);
|
||||
orderQueryParameterValues = new ArrayList<QueryParameterValue>(6);
|
||||
queryComments = new ArrayList<String>(2);
|
||||
properties = new HashMap<String,Object>(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#setName(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#addQueryComment(java.lang.String)
|
||||
*/
|
||||
public void addQueryComment(String comment) {
|
||||
queryComments.add(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#addQueryParameterValue(com.idcanet.xtes.xpql.query.QueryParameterValue)
|
||||
*/
|
||||
public void addQueryParameterValue(QueryParameterValue value) {
|
||||
queryParameterValues.put(value.getName(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#addLocalQueryParameterValue(com.idcanet.xtes.xpql.query.QueryParameterValue)
|
||||
*/
|
||||
public void addLocalQueryParameterValue(QueryParameterValue value) {
|
||||
localQueryParameterValues.put(value.getName(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#addOrderQueryParameterValue(com.idcanet.xtes.xpql.query.QueryParameterValue)
|
||||
*/
|
||||
public void addOrderQueryParameterValue(QueryParameterValue value) {
|
||||
orderQueryParameterValues.add(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#addQueryPart(com.idcanet.xtes.xpql.query.QueryPart)
|
||||
*/
|
||||
public void addQueryPart(QueryPart queryPart) {
|
||||
queryParts.add(queryPart);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getProperty(java.lang.String)
|
||||
*/
|
||||
public Object getProperty(String name) {
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getPropertyString(java.lang.String)
|
||||
*/
|
||||
public String getPropertyString(String name) {
|
||||
return getProperty(name).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryComments()
|
||||
*/
|
||||
public List<String> getQueryComments() {
|
||||
return queryComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryParameterValue(java.lang.String)
|
||||
*/
|
||||
public QueryParameterValue getQueryParameterValue(String name) {
|
||||
return queryParameterValues.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryParts()
|
||||
*/
|
||||
public List<QueryPart> getQueryParts() {
|
||||
return queryParts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#setProperty(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void setProperty(String name, Object value) {
|
||||
properties.put(name,value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getPropertyKeys()
|
||||
*/
|
||||
public Collection<String> getPropertyKeys() {
|
||||
return properties.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryParameters()
|
||||
*/
|
||||
public List<String> getQueryParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryParameterValues()
|
||||
*/
|
||||
public Collection<QueryParameterValue> getQueryParameterValues() {
|
||||
return queryParameterValues.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getLocalQueryParameterValues()
|
||||
*/
|
||||
public Collection<QueryParameterValue> getLocalQueryParameterValues() {
|
||||
return localQueryParameterValues.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getOrderQueryParameterValues()
|
||||
*/
|
||||
public List<QueryParameterValue> getOrderQueryParameterValues() {
|
||||
return orderQueryParameterValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#setQueryParameter(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void setQueryParameter(String name, Object value) {
|
||||
if (name==null) {
|
||||
throw new NullPointerException("name can't be null.");
|
||||
}
|
||||
QueryParameterValue parameter = getQueryParameterValue(name);
|
||||
if (parameter==null) {
|
||||
// not found create new one
|
||||
parameter = new DefaultQueryParameterValue();
|
||||
parameter.setName(name);
|
||||
parameter.setType(QueryParameterValue.QueryParameterType.parameter);
|
||||
addQueryParameterValue(parameter);
|
||||
}
|
||||
|
||||
// check if we need to convert
|
||||
//System.out.println("Con: "+parameter.getValueType()+" value: "+value+" valueClass: "+value.getClass());
|
||||
if (parameter.getValueType()!=null && value instanceof String) {
|
||||
try {
|
||||
Constructor<?> c = parameter.getValueType().getConstructor(String.class);
|
||||
value = c.newInstance(value);
|
||||
} catch (Exception e) {
|
||||
// TODO: fix
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
parameter.setValue(value);
|
||||
}
|
||||
|
||||
public void setQueryParameters(Map<String,Object> parameters) {
|
||||
for (String key:parameters.keySet()) {
|
||||
setQueryParameter(key,parameters.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getType()
|
||||
*/
|
||||
public QueryType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#setType(com.idcanet.xtes.xpql.query.Query.QueryType)
|
||||
*/
|
||||
public void setType(QueryType type) {
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#getQueryStore()
|
||||
*/
|
||||
public QueryStore getQueryStore() {
|
||||
return queryStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.Query#setQueryStore(com.idcanet.xtes.xpql.QueryStore)
|
||||
*/
|
||||
public void setQueryStore(QueryStore store) {
|
||||
this.queryStore=store;
|
||||
}
|
||||
|
||||
abstract public Query clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
abstract public class AbstractQueryParameterValue implements QueryParameterValue {
|
||||
|
||||
private String name = null;
|
||||
private Object value = null;
|
||||
private Object defaultValue = null;
|
||||
private QueryParameterType type = null;
|
||||
private Class<?> valueType = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#setName(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#getDefaultValue()
|
||||
*/
|
||||
public Object getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#setDefaultValue(java.lang.Object)
|
||||
*/
|
||||
public void setDefaultValue(Object defaultValue) {
|
||||
this.defaultValue=defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#getValue()
|
||||
*/
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#setType(com.idcanet.xtes.xpql.query.QueryParameterValue.QueryParameterType)
|
||||
*/
|
||||
public void setType(QueryParameterType type) {
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#getType()
|
||||
*/
|
||||
public QueryParameterType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryParameterValue#setValue(java.lang.Object)
|
||||
*/
|
||||
public void setValue(Object value) {
|
||||
this.value=value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the valueType
|
||||
*/
|
||||
public Class<?> getValueType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param valueType the valueType to set
|
||||
*/
|
||||
public void setValueType(Class<?> valueType) {
|
||||
this.valueType = valueType;
|
||||
}
|
||||
|
||||
abstract public QueryParameterValue clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
abstract public class AbstractQueryPart implements QueryPart {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.xtes.xpql.query.QueryPart#toSQL()
|
||||
*/
|
||||
abstract public String toSQL(Query query);
|
||||
|
||||
/**
|
||||
* Returns the toSQL() retult.
|
||||
* @see com.idcanet.xtes.xpql.query.QueryPart#toPreparedSQL()
|
||||
*/
|
||||
public String toPreparedSQL(Query query) {
|
||||
return toSQL(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* XML escapes the toSQL() return String.
|
||||
* @see com.idcanet.xtes.xpql.query.QueryPart#toXML()
|
||||
*/
|
||||
public String toXML(Query query) {
|
||||
return escapeXML(toSQL(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the toSQL() retult.
|
||||
* @see com.idcanet.xtes.xpql.query.QueryPart#toEdit()
|
||||
*/
|
||||
public String toEdit(Query query) {
|
||||
return toSQL(query);
|
||||
}
|
||||
|
||||
// helper method
|
||||
public static String escapeXML(String input) {
|
||||
StringBuffer filtered = new StringBuffer();
|
||||
|
||||
for ( char c : input.toCharArray() ) {
|
||||
switch (c) {
|
||||
case '<':
|
||||
filtered.append("<");
|
||||
break;
|
||||
case '>':
|
||||
filtered.append(">");
|
||||
break;
|
||||
case '"':
|
||||
filtered.append(""");
|
||||
break;
|
||||
case '&':
|
||||
filtered.append("&");
|
||||
break;
|
||||
default:
|
||||
filtered.append(c);
|
||||
}
|
||||
}
|
||||
return filtered.toString();
|
||||
}
|
||||
|
||||
abstract public QueryPart clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.xpql.QueryStore;
|
||||
|
||||
/**
|
||||
* TODO: add clonale support
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public interface Query extends QueryPart {
|
||||
|
||||
static public enum QueryType {
|
||||
sql,
|
||||
hql
|
||||
}
|
||||
|
||||
public void setName(String name);
|
||||
public String getName();
|
||||
|
||||
public void setType(QueryType type);
|
||||
public QueryType getType();
|
||||
|
||||
public void addQueryPart(QueryPart queryPart);
|
||||
public List<QueryPart> getQueryParts();
|
||||
|
||||
public void addQueryComment(String comment);
|
||||
public List<String> getQueryComments();
|
||||
|
||||
public void addQueryParameterValue(QueryParameterValue value);
|
||||
public void addLocalQueryParameterValue(QueryParameterValue value);
|
||||
public void addOrderQueryParameterValue(QueryParameterValue value);
|
||||
public Collection<QueryParameterValue> getQueryParameterValues();
|
||||
public Collection<QueryParameterValue> getLocalQueryParameterValues();
|
||||
public List<QueryParameterValue> getOrderQueryParameterValues();
|
||||
public QueryParameterValue getQueryParameterValue(String name);
|
||||
|
||||
public void setQueryParameter(String name,Object value);
|
||||
public void setQueryParameters(Map<String,Object> parameters);
|
||||
public List<String> getQueryParameters();
|
||||
|
||||
public void setProperty(String name,Object value);
|
||||
public Object getProperty(String name);
|
||||
public String getPropertyString(String name);
|
||||
public Collection<String> getPropertyKeys();
|
||||
|
||||
public void setQueryStore(QueryStore store);
|
||||
public QueryStore getQueryStore();
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public Query clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
/**
|
||||
* A QueryParameterValue
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public interface QueryParameterValue {
|
||||
|
||||
/**
|
||||
* The value type
|
||||
*/
|
||||
static public enum QueryParameterType {
|
||||
/** one parameter value */
|
||||
parameter,
|
||||
/** Multiple value */
|
||||
parameterList,
|
||||
/** parser the value as xpql syntax */
|
||||
xpql,
|
||||
/** Put the value in raw in the output */
|
||||
raw
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name);
|
||||
|
||||
/**
|
||||
* Gets the name
|
||||
* @return Returns the name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Sets the value
|
||||
* @param value The value to set.
|
||||
*/
|
||||
public void setValue(Object value);
|
||||
|
||||
/**
|
||||
* Gets the value
|
||||
* @return Returns the value
|
||||
*/
|
||||
public Object getValue();
|
||||
|
||||
/**
|
||||
* Sets the defaultValue
|
||||
* @param defaultValue The defaultValue to set.
|
||||
*/
|
||||
public void setDefaultValue(Object defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the defaultValue
|
||||
* @return Returns the defaultValue
|
||||
*/
|
||||
public Object getDefaultValue();
|
||||
|
||||
/**
|
||||
* Sets type value Type
|
||||
* @param type The type to set.
|
||||
*/
|
||||
public void setType(QueryParameterType type);
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
* @return Returns the type
|
||||
*/
|
||||
public QueryParameterType getType();
|
||||
|
||||
/**
|
||||
* @return the valueType
|
||||
*/
|
||||
public Class<?> getValueType();
|
||||
|
||||
/**
|
||||
* @param valueType the valueType to set
|
||||
*/
|
||||
public void setValueType(Class<?> valueType);
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public QueryParameterValue clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.xpql.query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 4, 2007
|
||||
*/
|
||||
public interface QueryPart extends Cloneable {
|
||||
|
||||
/**
|
||||
* This method is for building the SQL version of the query part.
|
||||
* This version is intended for execution.
|
||||
* @return
|
||||
*/
|
||||
public String toSQL(Query query);
|
||||
|
||||
/**
|
||||
* This method is for building the prepared statement SQL version of the query part.
|
||||
* This version is intended for execution via a prepared statement.
|
||||
* @return
|
||||
*/
|
||||
public String toPreparedSQL(Query query);
|
||||
|
||||
/**
|
||||
* This method is for building the XML version of the query part.
|
||||
* This version is intended for storage.
|
||||
* @return
|
||||
*/
|
||||
public String toXML(Query query);
|
||||
|
||||
/**
|
||||
* This method is for building the edit mode version of the query part.
|
||||
* This version is intended for humans working with the format in an editor.
|
||||
* @return
|
||||
*/
|
||||
public String toEdit(Query query);
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public QueryPart clone() throws CloneNotSupportedException;
|
||||
}
|
0
vasc-xpql/src/test/java/.empty
Normal file
0
vasc-xpql/src/test/java/.empty
Normal file
20
vasc-xpql/src/test/resources/META-INF/logging.properties
Normal file
20
vasc-xpql/src/test/resources/META-INF/logging.properties
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# Enables all logging for debugging unit tests.
|
||||
|
||||
# Specify the handlers to create in the root logger
|
||||
# (all loggers are children of the root logger)
|
||||
# The following creates two handlers
|
||||
handlers = java.util.logging.ConsoleHandler
|
||||
|
||||
# Set the default logging level for new ConsoleHandler instances
|
||||
java.util.logging.ConsoleHandler.level = ALL
|
||||
|
||||
# Set the default logging level for the root logger
|
||||
.level = ALL
|
||||
|
||||
com.idcanet.x4o = ALL
|
||||
|
||||
# Java 6 has internal logging on many builtin libs
|
||||
sun.level=OFF
|
||||
java.level=OFF
|
||||
javax.level=OFF
|
87
vasc-xpql/src/test/resources/xpql/test-all.xml
Normal file
87
vasc-xpql/src/test/resources/xpql/test-all.xml
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xtes xmlns="http://xtes.idcanet.com/eld/xtes-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
<query name="limit">
|
||||
<sql>
|
||||
LIMIT <parameter name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="limit" value="10" defaultValue="200" type="parameter"/>
|
||||
</query>
|
||||
<query name="paging" type="hql">
|
||||
<sql>
|
||||
OFFSET <parameter name="offset"/>
|
||||
<include name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="offset" value="0" defaultValue="0" type="parameter"/>
|
||||
</query>
|
||||
<query name="baseSelect">
|
||||
<x4o:property name="executionTimeout" value="200"/>
|
||||
<x4o:property name="cacheTimeout" value="99"/>
|
||||
<x4o:property name="jdniConnection" value="somewhere"/>
|
||||
<sql>
|
||||
SELECT
|
||||
USERS.USERNAME AS USERNAME
|
||||
USERS.PASSWD AS PASSWORD
|
||||
FROM
|
||||
USERS
|
||||
</sql>
|
||||
<comment>Bla bla</comment>
|
||||
<comment>Also see this site http://www.google.com</comment>
|
||||
</query>
|
||||
|
||||
<xslt name="test">
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<!-- Import of the original stylesheet which "just" creates a bunch of HTML files from any valid DocBook instance -->
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
|
||||
|
||||
<!-- You must plug-in your custom templates here -->
|
||||
<xsl:template match="/">
|
||||
<!-- Call original code from the imported stylesheet -->
|
||||
<xsl:apply-imports/>
|
||||
|
||||
<!-- Call custom templates for the ToC and the manifest -->
|
||||
<xsl:call-template name="etoc"/>
|
||||
<!-- DISABLED WRITE PLUGIN.xml(only needed in sepertor help project) <xsl:call-template name="plugin.xml"/> -->
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
</xslt>
|
||||
|
||||
<mail name="test-email">
|
||||
<x4o:property name="mail.from" value="ergens@nowhere.nl"/>
|
||||
<x4o:property name="mail.subject" value="Check je porn collectie"/>
|
||||
<x4o:property name="mail.bcc" value="bcc@yoyo.nl"/>
|
||||
Beste <parameter name="name"/>,<br/>
|
||||
<br/>
|
||||
Hier is uw factuur;<br/>
|
||||
datum: <parameter name="date"/><br/>
|
||||
total: <parameter name="total"/><br/>
|
||||
<a href="[#]${appiets.map['key']}[/#]/affiliatelinks.jsp">clickje</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<query name="get_products">
|
||||
<queryvalue name="userid" value="[from_id/]"/>
|
||||
</query>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
Groeten,<br/>
|
||||
<parameter name="full_name"/><br/>
|
||||
</mail>
|
||||
|
||||
|
||||
<query name="testUsers2" type="hql">
|
||||
<x4o:property name="persistanceSession" value="sessionName"/>
|
||||
<sql>
|
||||
<!-- SOME COMMENT -->
|
||||
<include name="baseSelect"/>
|
||||
<parameter name="extra_where"/>
|
||||
AND role is in <parameter name="roles"/>
|
||||
<include name="paging"/>
|
||||
</sql>
|
||||
<parameterValue name="extra_where" defaultValue="WHERE true=true" type="raw"/>
|
||||
<parameterValue name="roles" value="1,12,99,200" type="parameterList"/>
|
||||
<parameterValue name="limit" value="15"/>
|
||||
<parameterValue name="offset" value="25"/>
|
||||
</query>
|
||||
</xtes>
|
12
vasc-xpql/src/test/resources/xpql/test-meta.xml
Normal file
12
vasc-xpql/src/test/resources/xpql/test-meta.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<xtes xmlns:meta="iets" xmlns="iets1">
|
||||
<meta:query>
|
||||
<meta:fromItem data="schema.table['products']" alias="p"/>
|
||||
<meta:select data="schema.table['products'].column['product_type']"/>
|
||||
<meta:groupBy data="schema.table['products'].column['product_type']"/>
|
||||
|
||||
<meta:select data="schema.table['products'].column['price']" type="SUM"/>
|
||||
|
||||
<meta:where />
|
||||
<meta:orderBy />
|
||||
</meta:query>
|
||||
</xtes>
|
47
vasc-xpql/src/test/resources/xpql/tests.xml
Normal file
47
vasc-xpql/src/test/resources/xpql/tests.xml
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xtes xmlns="http://xtes.idcanet.com/eld/xtes-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
<query name="limit">
|
||||
<sql>
|
||||
LIMIT <parameter name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="limit" value="10" defaultValue="200" type="parameter"/>
|
||||
</query>
|
||||
<query name="paging" type="hql">
|
||||
<sql>
|
||||
OFFSET <parameter name="offset"/>
|
||||
<include name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="offset" value="0" defaultValue="0" type="parameter"/>
|
||||
</query>
|
||||
<query name="baseSelect">
|
||||
<x4o:property name="executionTimeout" value="200"/>
|
||||
<x4o:property name="cacheTimeout" value="99"/>
|
||||
<x4o:property name="jdniConnection" value="somewhere"/>
|
||||
<sql>
|
||||
SELECT
|
||||
USERS.USERNAME AS USERNAME
|
||||
USERS.PASSWD AS PASSWORD
|
||||
FROM
|
||||
USERS
|
||||
</sql>
|
||||
<comment>Bla bla</comment>
|
||||
<comment>Also see this site http://www.google.com</comment>
|
||||
</query>
|
||||
|
||||
<query name="testUsers2" type="hql">
|
||||
<x4o:property name="persistanceSession" value="sessionName"/>
|
||||
<sql>
|
||||
<!-- SOME COMMENT -->
|
||||
<include name="baseSelect"/>
|
||||
<parameter name="extra_where"/>
|
||||
AND role is in <parameter name="roles"/>
|
||||
<include name="paging"/>
|
||||
</sql>
|
||||
<parameterValue name="extra_where" defaultValue="WHERE true=true" type="raw"/>
|
||||
<parameterValue name="roles" value="1,12,99,200" type="parameterList"/>
|
||||
<parameterValue name="limit" value="15"/>
|
||||
<parameterValue name="offset" value="25"/>
|
||||
</query>
|
||||
</xtes>
|
Loading…
Reference in a new issue