Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBPM-4599 - Centralize (dynamic) query code
- Loading branch information
Marco Rietveld
committed
Apr 11, 2015
1 parent
cd7b9ec
commit 7b440b6
Showing
25 changed files
with
1,451 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/target | ||
/local | ||
/data | ||
/bin | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
!.gitignore | ||
/nbproject | ||
/*.ipr | ||
/*.iws | ||
/*.iml | ||
|
||
# test database | ||
/JPADroolsFlow.*.db | ||
/btm.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jbpm</groupId> | ||
<artifactId>jbpm</artifactId> | ||
<version>6.3.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jbpm-query-jpa</artifactId> | ||
<packaging>bundle</packaging><!-- bundle = jar + OSGi metadata --> | ||
|
||
<name>jBPM :: Query</name> | ||
<description>jBPM Query</description> | ||
|
||
<build> | ||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<filtering>false</filtering> | ||
</testResource> | ||
<testResource> | ||
<directory>src/test/filtered-resources</directory> | ||
<filtering>true</filtering> | ||
</testResource> | ||
</testResources> | ||
|
||
<plugins> | ||
<plugin> | ||
<!-- ensure that db files are deleted before _any_ run | ||
otherwise we get tests failing because of leftover db's --> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>${basedir}</directory> | ||
<includes> | ||
<include>btm*</include> | ||
<include>*.db</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<configuration> | ||
<instructions> | ||
<Bundle-SymbolicName>org.jbpm.query.jpa</Bundle-SymbolicName> | ||
<Import-Package> | ||
* | ||
</Import-Package> | ||
<Private-Package></Private-Package> | ||
<Export-Package> | ||
org.jbpm.query.*, | ||
</Export-Package> | ||
<!-- does this module need an activator? | ||
<Bundle-Activator>org.jbpm.osgi.flow.core.Activator</Bundle-Activator> | ||
--> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-internal</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-mapper-asl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-core-asl</artifactId> | ||
</dependency> | ||
|
||
<!-- osgi --> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.compendium</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- TEST --> | ||
</dependencies> | ||
</project> |
57 changes: 57 additions & 0 deletions
57
jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/builder/impl/AbstractDeleteBuilderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.jbpm.query.jpa.builder.impl; | ||
|
||
import org.kie.internal.query.data.QueryData; | ||
|
||
public abstract class AbstractDeleteBuilderImpl<T> { | ||
|
||
protected QueryData queryData = new QueryData(); | ||
|
||
public QueryData getQueryData() { | ||
return queryData; | ||
} | ||
|
||
protected <P> void addRangeParameter( String listId, String name, P parameter, boolean start) { | ||
if( parameter == null ) { | ||
throw new IllegalArgumentException("A null " + name + " criteria is invalid." ); | ||
} | ||
this.queryData.addRangeParameter(listId, parameter, start); | ||
} | ||
|
||
private <P> void addParameter( String listId, P... parameter ) { | ||
this.queryData.addAppropriateParam(listId, parameter); | ||
} | ||
|
||
protected void addLongParameter( String listId, String name, long [] parameter) { | ||
if( parameter == null ) { | ||
throw new IllegalArgumentException("A null " + name + " criteria is invalid." ); | ||
} | ||
Long [] wrapArr = new Long[parameter.length]; | ||
for( int i = 0; i < parameter.length; ++i ) { | ||
wrapArr[i] = parameter[i]; | ||
} | ||
addParameter(listId, wrapArr); | ||
} | ||
|
||
protected void addIntParameter( String listId, String name, int [] parameter) { | ||
if( parameter == null ) { | ||
throw new IllegalArgumentException("A null " + name + " criteria is invalid." ); | ||
} | ||
Integer [] wrapArr = new Integer[parameter.length]; | ||
for( int i = 0; i < parameter.length; ++i ) { | ||
wrapArr[i] = parameter[i]; | ||
} | ||
addParameter(listId, wrapArr); | ||
} | ||
|
||
protected <P> void addObjectParameter(String listId, String name, P... parameter) { | ||
if( parameter == null ) { | ||
throw new IllegalArgumentException("A null " + name + " criteria is invalid." ); | ||
} | ||
for( int i = 0; i < parameter.length; ++i ) { | ||
if( parameter[i] == null ) { | ||
throw new IllegalArgumentException("A null " + name + " criteria (argument " + i + ") is invalid." ); | ||
} | ||
} | ||
addParameter(listId, parameter); | ||
} | ||
} |
Oops, something went wrong.