提交 684a1b6f 编写于 作者: J Joram Barrez

Merge branch 'master' of github.com:Activiti/Activiti

......@@ -35,14 +35,12 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
private static final long serialVersionUID = 1L;
private static enum ResultType {
LIST, LIST_PAGE, SINGLE_RESULT, COUNT
LIST, SINGLE_RESULT, COUNT
}
protected transient CommandExecutor commandExecutor;
protected transient CommandContext commandContext;
protected int maxResults = Integer.MAX_VALUE;
protected int firstResult = 0;
protected ResultType resultType;
private Map<String, Object> parameters = new HashMap<String, Object>();
......@@ -90,17 +88,6 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
}
return executeList(Context.getCommandContext(), getParameterMap(), 0, Integer.MAX_VALUE);
}
@SuppressWarnings("unchecked")
public List<U> listPage(int firstResult, int maxResults) {
this.firstResult =firstResult;
this.maxResults = maxResults;
this.resultType = ResultType.LIST_PAGE;
if (commandExecutor!=null) {
return (List<U>) commandExecutor.execute(this);
}
return executeList(Context.getCommandContext(), getParameterMap(), firstResult, maxResults);
}
public long count() {
this.resultType = ResultType.COUNT;
......@@ -113,21 +100,6 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
public Object execute(CommandContext commandContext) {
if (resultType == ResultType.LIST) {
return executeList(commandContext, getParameterMap(), 0, Integer.MAX_VALUE);
} else if (resultType == ResultType.LIST_PAGE) {
Map<String, Object> parameterMap = getParameterMap();
parameterMap.put("resultType", "LIST_PAGE");
parameterMap.put("firstResult", firstResult);
parameterMap.put("maxResults", maxResults);
int firstRow = firstResult + 1;
parameterMap.put("firstRow", firstRow);
int lastRow = 0;
if(maxResults == Integer.MAX_VALUE) {
lastRow = maxResults;
}
lastRow = firstResult + maxResults + 1;
parameterMap.put("lastRow", lastRow);
return executeList(commandContext, parameterMap, firstResult, maxResults);
} else if (resultType == ResultType.SINGLE_RESULT) {
return executeSingleResult(commandContext);
} else {
......
......@@ -51,8 +51,4 @@ public interface NativeQuery<T extends NativeQuery< ? , ? >, U extends Object> {
/** Executes the query and get a list of entities as the result. */
List<U> list();
/** Executes the query and get a list of entities as the result. */
List<U> listPage(int firstResult, int maxResults);
}
......@@ -275,13 +275,7 @@
</select>
<select id="selectExecutionByNativeQuery" parameterType="java.util.Map" resultMap="executionResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectExecutionCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -143,13 +143,7 @@
</sql>
<select id="selectHistoricActivityInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicActivityInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricActivityInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -260,13 +260,7 @@
</sql>
<select id="selectHistoricProcessInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicProcessInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricProcessInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -269,13 +269,7 @@
</sql>
<select id="selectHistoricTaskInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicTaskInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricTaskInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -328,13 +328,7 @@
</sql>
<select id="selectTaskByNativeQuery" parameterType="java.util.Map" resultMap="taskResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectTaskCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -485,7 +485,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
......@@ -493,7 +492,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
......@@ -501,7 +499,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
}
......@@ -1241,11 +1241,6 @@ public class ExecutionQueryTest extends PluggableActivitiTestCase {
assertEquals(executionCount, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).list().size());
assertEquals(executionCount, runtimeService.createNativeExecutionQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Execution.class)).count());
}
public void testNativeQueryPaging() {
assertEquals(5, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).listPage(1, 5).size());
assertEquals(1, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).listPage(2, 1).size());
}
@Deployment(resources={"org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml"})
public void testExecutionQueryWithProcessVariable() {
......
......@@ -1292,9 +1292,4 @@ public class ProcessInstanceQueryTest extends PluggableActivitiTestCase {
assertEquals(piCount, runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class)).list().size());
assertEquals(piCount, runtimeService.createNativeProcessInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(ProcessInstance.class)).count());
}
public void testNativeQueryPaging() {
assertEquals(5, runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class)).listPage(0, 5).size());
}
}
......@@ -890,13 +890,6 @@ public class TaskQueryTest extends PluggableActivitiTestCase {
assertEquals(6, taskService.createTaskQuery().orderByTaskId().taskName("testTask").desc().list().size());
}
public void testNativeQueryPaging() {
assertEquals("ACT_RU_TASK", managementService.getTableName(Task.class));
assertEquals("ACT_RU_TASK", managementService.getTableName(TaskEntity.class));
assertEquals(5, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class)).listPage(0, 5).size());
assertEquals(2, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class)).listPage(10, 12).size());
}
public void testNativeQuery() {
assertEquals("ACT_RU_TASK", managementService.getTableName(Task.class));
assertEquals("ACT_RU_TASK", managementService.getTableName(TaskEntity.class));
......
......@@ -73,7 +73,6 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>compile</scope>
</dependency>
<!-- Database -->
......
......@@ -132,7 +132,7 @@
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
......@@ -141,7 +141,7 @@
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<executions>
<execution>
<phase>prepare-package</phase>
......@@ -207,14 +207,19 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</dependency>
<!-- Vaadin addons -->
<!-- Must be defined both in activiti-explorer and activiti-webapp-explorer, as otherwise the gwt compiler won't find it -->
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>dcharts-widget</artifactId>
<version>0.10.0</version>
</dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>dcharts-widget</artifactId>
<version>0.10.0</version>
</dependency>
</dependencies>
......
function org_activiti_explorer_CustomWidgetset(){var O='',vb='" for "gwt:onLoadErrorFn"',tb='" for "gwt:onPropertyErrorFn"',hb='"><\/script>',Y='#',Vb='.cache.html',$='/',Ob='2BADF336E827CE547D0FEF5C74C2A013',Pb='419702D66820E68BE89501603AAB106F',Qb='5B54A23C6184FE8742EF42E2474A2CE5',Rb='8C1AF52665FB58E2F0925361E8CDE162',Ub=':',nb='::',bc='<script defer="defer">org_activiti_explorer_CustomWidgetset.onInjectionDone(\'org.activiti.explorer.CustomWidgetset\')<\/script>',gb='<script id="',qb='=',Z='?',sb='Bad handler "',Sb='D391FCC6F662E7CD49FB7E5D0ABAF41D',ac='DOMContentLoaded',Tb='F6EDA597217FB283EE695EFC6E2195F3',ib='SCRIPT',fb='__gwt_marker_org.activiti.explorer.CustomWidgetset',jb='base',bb='baseUrl',S='begin',R='bootstrap',ab='clear.cache.gif',pb='content',Wb='dcharts/styles.css',X='end',Ib='gecko',Jb='gecko1_8',T='gwt.codesvr=',U='gwt.hosted=',V='gwt.hybrid',ub='gwt:onLoadErrorFn',rb='gwt:onPropertyErrorFn',ob='gwt:property',_b='head',Mb='hosted.html?org_activiti_explorer_CustomWidgetset',$b='href',Hb='ie6',Gb='ie8',Fb='ie9',wb='iframe',_='img',xb="javascript:''",Xb='link',Lb='loadExternalRefs',kb='meta',zb='moduleRequested',W='moduleStartup',Eb='msie',lb='name',Bb='opera',P='org.activiti.explorer.CustomWidgetset',db='org.activiti.explorer.CustomWidgetset.nocache.js',mb='org.activiti.explorer.CustomWidgetset::',yb='position:absolute;width:0;height:0;border:none',Yb='rel',Db='safari',cb='script',Nb='selectingPermutation',Q='startup',Zb='stylesheet',eb='undefined',Kb='unknown',Ab='user.agent',Cb='webkit';var l=window,m=document,n=l.__gwtStatsEvent?function(a){return l.__gwtStatsEvent(a)}:null,o=l.__gwtStatsSessionId?l.__gwtStatsSessionId:null,p,q,r,s=O,t={},u=[],v=[],w=[],x=0,y,z;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:S});if(!l.__gwt_stylesLoaded){l.__gwt_stylesLoaded={}}if(!l.__gwt_scriptsLoaded){l.__gwt_scriptsLoaded={}}function A(){var b=false;try{var c=l.location.search;return (c.indexOf(T)!=-1||(c.indexOf(U)!=-1||l.external&&l.external.gwtOnLoad))&&c.indexOf(V)==-1}catch(a){}A=function(){return b};return b}
function org_activiti_explorer_CustomWidgetset(){var O='',vb='" for "gwt:onLoadErrorFn"',tb='" for "gwt:onPropertyErrorFn"',hb='"><\/script>',Y='#',Vb='.cache.html',$='/',Ob='51F0F75F652C07C3D4A94041764E0BDF',Pb='7DCE794BC875B2EB158C471AAE605A9C',Qb='7FC8F9BA1880B9FD4242AAA23BDE00EC',Ub=':',nb='::',bc='<script defer="defer">org_activiti_explorer_CustomWidgetset.onInjectionDone(\'org.activiti.explorer.CustomWidgetset\')<\/script>',gb='<script id="',qb='=',Z='?',Rb='B30394F53E23EE027289EEE987984B57',Sb='BAA63810C9D1D3E7DD6472EDBD8A2016',sb='Bad handler "',ac='DOMContentLoaded',Tb='EF39561F1C79BACDED6EFD7217A4D4E3',ib='SCRIPT',fb='__gwt_marker_org.activiti.explorer.CustomWidgetset',jb='base',bb='baseUrl',S='begin',R='bootstrap',ab='clear.cache.gif',pb='content',Wb='dcharts/styles.css',X='end',Ib='gecko',Jb='gecko1_8',T='gwt.codesvr=',U='gwt.hosted=',V='gwt.hybrid',ub='gwt:onLoadErrorFn',rb='gwt:onPropertyErrorFn',ob='gwt:property',_b='head',Mb='hosted.html?org_activiti_explorer_CustomWidgetset',$b='href',Hb='ie6',Gb='ie8',Fb='ie9',wb='iframe',_='img',xb="javascript:''",Xb='link',Lb='loadExternalRefs',kb='meta',zb='moduleRequested',W='moduleStartup',Eb='msie',lb='name',Bb='opera',P='org.activiti.explorer.CustomWidgetset',db='org.activiti.explorer.CustomWidgetset.nocache.js',mb='org.activiti.explorer.CustomWidgetset::',yb='position:absolute;width:0;height:0;border:none',Yb='rel',Db='safari',cb='script',Nb='selectingPermutation',Q='startup',Zb='stylesheet',eb='undefined',Kb='unknown',Ab='user.agent',Cb='webkit';var l=window,m=document,n=l.__gwtStatsEvent?function(a){return l.__gwtStatsEvent(a)}:null,o=l.__gwtStatsSessionId?l.__gwtStatsSessionId:null,p,q,r,s=O,t={},u=[],v=[],w=[],x=0,y,z;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:S});if(!l.__gwt_stylesLoaded){l.__gwt_stylesLoaded={}}if(!l.__gwt_scriptsLoaded){l.__gwt_scriptsLoaded={}}function A(){var b=false;try{var c=l.location.search;return (c.indexOf(T)!=-1||(c.indexOf(U)!=-1||l.external&&l.external.gwtOnLoad))&&c.indexOf(V)==-1}catch(a){}A=function(){return b};return b}
function B(){if(p&&q){var b=m.getElementById(P);var c=b.contentWindow;if(A()){c.__gwt_getProperty=function(a){return G(a)}}org_activiti_explorer_CustomWidgetset=null;c.gwtOnLoad(y,P,s,x);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:W,millis:(new Date).getTime(),type:X})}}
function C(){function e(a){var b=a.lastIndexOf(Y);if(b==-1){b=a.length}var c=a.indexOf(Z);if(c==-1){c=a.length}var d=a.lastIndexOf($,Math.min(c,b));return d>=0?a.substring(0,d+1):O}
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=m.createElement(_);b.src=a+ab;a=e(b.src)}return a}
......@@ -12,6 +12,6 @@ function E(a){var b=t[a];return b==null?null:b}
function F(a,b){var c=w;for(var d=0,e=a.length-1;d<e;++d){c=c[a[d]]||(c[a[d]]=[])}c[a[e]]=b}
function G(a){var b=v[a](),c=u[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(z){z(a,d,b)}throw null}
var H;function I(){if(!H){H=true;var a=m.createElement(wb);a.src=xb;a.id=P;a.style.cssText=yb;a.tabIndex=-1;m.body.appendChild(a);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:W,millis:(new Date).getTime(),type:zb});a.contentWindow.location.replace(s+K)}}
v[Ab]=function(){var b=navigator.userAgent.toLowerCase();var c=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return b.indexOf(Bb)!=-1}())return Bb;if(function(){return b.indexOf(Cb)!=-1}())return Db;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=9}())return Fb;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=8}())return Gb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(b);if(a&&a.length==3)return c(a)>=6000}())return Hb;if(function(){return b.indexOf(Ib)!=-1}())return Jb;return Kb};u[Ab]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};org_activiti_explorer_CustomWidgetset.onScriptLoad=function(){if(H){q=true;B()}};org_activiti_explorer_CustomWidgetset.onInjectionDone=function(){p=true;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:X});B()};D();C();var J;var K;if(A()){if(l.external&&(l.external.initModule&&l.external.initModule(P))){l.location.reload();return}K=Mb;J=O}n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:Nb});if(!A()){try{F([Gb],Ob);F([Fb],Pb);F([Hb],Qb);F([Db],Rb);F([Bb],Sb);F([Jb],Tb);J=w[G(Ab)];var L=J.indexOf(Ub);if(L!=-1){x=Number(J.substring(L+1));J=J.substring(0,L)}K=J+Vb}catch(a){return}}var M;function N(){if(!r){r=true;if(!__gwt_stylesLoaded[Wb]){var a=m.createElement(Xb);__gwt_stylesLoaded[Wb]=a;a.setAttribute(Yb,Zb);a.setAttribute($b,s+Wb);m.getElementsByTagName(_b)[0].appendChild(a)}B();if(m.removeEventListener){m.removeEventListener(ac,N,false)}if(M){clearInterval(M)}}}
v[Ab]=function(){var b=navigator.userAgent.toLowerCase();var c=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return b.indexOf(Bb)!=-1}())return Bb;if(function(){return b.indexOf(Cb)!=-1}())return Db;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=9}())return Fb;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=8}())return Gb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(b);if(a&&a.length==3)return c(a)>=6000}())return Hb;if(function(){return b.indexOf(Ib)!=-1}())return Jb;return Kb};u[Ab]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};org_activiti_explorer_CustomWidgetset.onScriptLoad=function(){if(H){q=true;B()}};org_activiti_explorer_CustomWidgetset.onInjectionDone=function(){p=true;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:X});B()};D();C();var J;var K;if(A()){if(l.external&&(l.external.initModule&&l.external.initModule(P))){l.location.reload();return}K=Mb;J=O}n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:Nb});if(!A()){try{F([Db],Ob);F([Hb],Pb);F([Bb],Qb);F([Jb],Rb);F([Fb],Sb);F([Gb],Tb);J=w[G(Ab)];var L=J.indexOf(Ub);if(L!=-1){x=Number(J.substring(L+1));J=J.substring(0,L)}K=J+Vb}catch(a){return}}var M;function N(){if(!r){r=true;if(!__gwt_stylesLoaded[Wb]){var a=m.createElement(Xb);__gwt_stylesLoaded[Wb]=a;a.setAttribute(Yb,Zb);a.setAttribute($b,s+Wb);m.getElementsByTagName(_b)[0].appendChild(a)}B();if(m.removeEventListener){m.removeEventListener(ac,N,false)}if(M){clearInterval(M)}}}
if(m.addEventListener){m.addEventListener(ac,function(){I();N()},false)}var M=setInterval(function(){if(/loaded|complete/.test(m.readyState)){I();N()}},50);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:X});n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:S});m.write(bc)}
org_activiti_explorer_CustomWidgetset();
\ No newline at end of file
......@@ -13,4 +13,10 @@ if(!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
\ No newline at end of file
}
if (!Object.isSVGElement) {
Object.isSVGElement = function(vArg) {
var str = Object.prototype.toString.call(vArg);
return (str.indexOf("[object SVG") == 0);
};
......@@ -515,6 +515,12 @@
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Camel integration -->
<dependency>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册