Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
052d1a38
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
052d1a38
编写于
10月 19, 2010
作者:
T
tombaeyens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACT-258 Added form service and form instances
上级
4f37a868
变更
54
隐藏空白更改
内联
并排
Showing
54 changed file
with
997 addition
and
303 deletion
+997
-303
modules/activiti-engine/src/main/java/org/activiti/engine/FormService.java
...engine/src/main/java/org/activiti/engine/FormService.java
+38
-0
modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngine.java
...gine/src/main/java/org/activiti/engine/ProcessEngine.java
+1
-0
modules/activiti-engine/src/main/java/org/activiti/engine/RuntimeService.java
...ine/src/main/java/org/activiti/engine/RuntimeService.java
+1
-2
modules/activiti-engine/src/main/java/org/activiti/engine/TaskService.java
...engine/src/main/java/org/activiti/engine/TaskService.java
+0
-22
modules/activiti-engine/src/main/java/org/activiti/engine/form/FormInstance.java
.../src/main/java/org/activiti/engine/form/FormInstance.java
+30
-0
modules/activiti-engine/src/main/java/org/activiti/engine/form/StartFormInstance.java
...main/java/org/activiti/engine/form/StartFormInstance.java
+26
-0
modules/activiti-engine/src/main/java/org/activiti/engine/form/TaskFormInstance.java
.../main/java/org/activiti/engine/form/TaskFormInstance.java
+25
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricFormInstance.java
...ava/org/activiti/engine/history/HistoricFormInstance.java
+31
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricVariableUpdate.java
...a/org/activiti/engine/history/HistoricVariableUpdate.java
+2
-3
modules/activiti-engine/src/main/java/org/activiti/engine/impl/FormServiceImpl.java
...c/main/java/org/activiti/engine/impl/FormServiceImpl.java
+62
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessDefinitionQueryImpl.java
.../org/activiti/engine/impl/ProcessDefinitionQueryImpl.java
+15
-15
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessEngineImpl.java
...main/java/org/activiti/engine/impl/ProcessEngineImpl.java
+10
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RuntimeServiceImpl.java
...ain/java/org/activiti/engine/impl/RuntimeServiceImpl.java
+6
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskServiceImpl.java
...c/main/java/org/activiti/engine/impl/TaskServiceImpl.java
+1
-14
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/UserTaskActivity.java
.../java/org/activiti/engine/impl/bpmn/UserTaskActivity.java
+1
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
.../java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
+18
-7
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfiguration.java
.../activiti/engine/impl/cfg/ProcessEngineConfiguration.java
+30
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedFormCmd.java
...java/org/activiti/engine/impl/cmd/GetRenderedFormCmd.java
+0
-107
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedStartFormCmd.java
...org/activiti/engine/impl/cmd/GetRenderedStartFormCmd.java
+63
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java
.../org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java
+64
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetStartFormInstanceCmd.java
...org/activiti/engine/impl/cmd/GetStartFormInstanceCmd.java
+52
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetTaskFormInstanceCmd.java
.../org/activiti/engine/impl/cmd/GetTaskFormInstanceCmd.java
+52
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/DefaultStartFormHandler.java
...rg/activiti/engine/impl/form/DefaultStartFormHandler.java
+38
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/DefaultTaskFormHandler.java
...org/activiti/engine/impl/form/DefaultTaskFormHandler.java
+37
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/FormEngine.java
...c/main/java/org/activiti/engine/impl/form/FormEngine.java
+4
-3
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/FormInstanceImpl.java
.../java/org/activiti/engine/impl/form/FormInstanceImpl.java
+56
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/JuelFormEngine.java
...in/java/org/activiti/engine/impl/form/JuelFormEngine.java
+34
-29
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/StartFormHandler.java
.../java/org/activiti/engine/impl/form/StartFormHandler.java
+29
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/StartFormInstanceImpl.java
.../org/activiti/engine/impl/form/StartFormInstanceImpl.java
+47
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/TaskFormHandler.java
...n/java/org/activiti/engine/impl/form/TaskFormHandler.java
+29
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/TaskFormInstanceImpl.java
...a/org/activiti/engine/impl/form/TaskFormInstanceImpl.java
+46
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/history/HistoricVariableUpdateEntity.java
...iti/engine/impl/history/HistoricVariableUpdateEntity.java
+10
-10
modules/activiti-engine/src/main/java/org/activiti/engine/impl/repository/ProcessDefinitionEntity.java
...iviti/engine/impl/repository/ProcessDefinitionEntity.java
+31
-9
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ExecutionEntity.java
...ava/org/activiti/engine/impl/runtime/ExecutionEntity.java
+2
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/VariableInstanceEntity.java
.../activiti/engine/impl/runtime/VariableInstanceEntity.java
+4
-13
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskDefinition.java
...in/java/org/activiti/engine/impl/task/TaskDefinition.java
+26
-5
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskEntity.java
...c/main/java/org/activiti/engine/impl/task/TaskEntity.java
+26
-7
modules/activiti-engine/src/main/java/org/activiti/engine/impl/test/ActivitiInternalTestCase.java
...g/activiti/engine/impl/test/ActivitiInternalTestCase.java
+3
-0
modules/activiti-engine/src/main/java/org/activiti/engine/repository/ProcessDefinition.java
...ava/org/activiti/engine/repository/ProcessDefinition.java
+7
-1
modules/activiti-engine/src/main/java/org/activiti/engine/repository/ProcessDefinitionQuery.java
...rg/activiti/engine/repository/ProcessDefinitionQuery.java
+0
-2
modules/activiti-engine/src/main/java/org/activiti/engine/task/Task.java
...i-engine/src/main/java/org/activiti/engine/task/Task.java
+0
-3
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.h2.create.sql
...n/resources/org/activiti/db/create/activiti.h2.create.sql
+2
-2
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql.create.sql
...esources/org/activiti/db/create/activiti.mysql.create.sql
+2
-2
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.sql
...sources/org/activiti/db/create/activiti.oracle.create.sql
+2
-2
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.postgres.create.sql
...urces/org/activiti/db/create/activiti.postgres.create.sql
+2
-2
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/history.mapping.xml
...main/resources/org/activiti/db/ibatis/history.mapping.xml
+1
-3
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/repository.mapping.xml
...n/resources/org/activiti/db/ibatis/repository.mapping.xml
+3
-3
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/task.mapping.xml
...rc/main/resources/org/activiti/db/ibatis/task.mapping.xml
+5
-5
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/RepositoryServiceTest.java
...iti/engine/test/api/repository/RepositoryServiceTest.java
+5
-14
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
...va/org/activiti/engine/test/api/task/TaskServiceTest.java
+3
-3
modules/activiti-engine/src/test/java/org/activiti/examples/taskforms/TaskFormsTest.java
...t/java/org/activiti/examples/taskforms/TaskFormsTest.java
+5
-5
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/process/ProcessDefinitionFormGet.java
...g/activiti/rest/api/process/ProcessDefinitionFormGet.java
+1
-1
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/task/TaskFormGet.java
...src/main/java/org/activiti/rest/api/task/TaskFormGet.java
+1
-1
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/util/ActivitiStreamingWebScript.java
...va/org/activiti/rest/util/ActivitiStreamingWebScript.java
+8
-1
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/FormService.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine
;
import
java.util.Map
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.form.TaskFormInstance
;
/** Access to forms for starting new process instances and completing tasks.
*
* @author Tom Baeyens
*/
public
interface
FormService
{
StartFormInstance
getStartFormInstance
(
String
processDefinitionId
);
Object
getRenderedStartForm
(
String
processDefinitionId
);
Object
getRenderedStartForm
(
String
processDefinitionId
,
String
formEngineName
);
void
submitStartFormInstance
(
String
processDefinitionId
,
Map
<
String
,
Object
>
properties
);
TaskFormInstance
getTaskFormInstance
(
String
taskId
);
Object
getRenderedTaskForm
(
String
taskId
);
Object
getRenderedTaskForm
(
String
taskId
,
String
formEngineName
);
void
submitTaskFormInstance
(
String
taskId
,
Map
<
String
,
Object
>
properties
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/ProcessEngine.java
浏览文件 @
052d1a38
...
...
@@ -58,6 +58,7 @@ public interface ProcessEngine {
RepositoryService
getRepositoryService
();
RuntimeService
getRuntimeService
();
FormService
getFormService
();
TaskService
getTaskService
();
HistoryService
getHistoryService
();
IdentityService
getIdentityService
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/RuntimeService.java
浏览文件 @
052d1a38
...
...
@@ -147,7 +147,7 @@ public interface RuntimeService {
* @throws ActivitiException when no process definition is deployed with the given key.
*/
ProcessInstance
startProcessInstanceById
(
String
processDefinitionId
,
String
businessKey
,
Map
<
String
,
Object
>
variables
);
/** Delete an existing runtime process instance.
* @param processInstanceId id of process instance to delete, cannot be null.
* @param deleteReason reason for deleting, can be null.
...
...
@@ -207,5 +207,4 @@ public interface RuntimeService {
* to query process instances.
*/
ProcessInstanceQuery
createProcessInstanceQuery
();
}
\ No newline at end of file
modules/activiti-engine/src/main/java/org/activiti/engine/TaskService.java
浏览文件 @
052d1a38
...
...
@@ -151,26 +151,4 @@ public interface TaskService {
* Returns a new {@link TaskQuery} that can be used to dynamically query tasks.
*/
TaskQuery
createTaskQuery
();
// forms ////////////////////////////////////////////////////////////////////
/** Get a rendered startform, for collecting parameters from a user to start
* a new process instance. Returns null if the processdefinition doesn't have a start form.
* @param processDefinitionId process definition id, cannot be null.
* @throws ActivitiException when no deployed process exists with the given key.
*/
Object
getRenderedStartFormById
(
String
processDefinitionId
);
/** Get a rendered startform, for collecting parameters from a user to start
* a new process instance. Returns null if the processdefinition doesn't have a start form.
* @param processDefinitionKey process definition key, cannot be null.
* @throws ActivitiException when no deployed process exists with the given key.
*/
Object
getRenderedStartFormByKey
(
String
processDefinitionKey
);
/** Get the rendered task form for the given task.
* @param taskId the id of the task to render the form for, cannot be null.
* @return rendered task form. Returns null when the given task has no task form.
*/
Object
getRenderedTaskForm
(
String
taskId
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/form/FormInstance.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.form
;
import
java.util.Map
;
/**
* @author Tom Baeyens
*/
public
interface
FormInstance
{
String
getFormKey
();
String
getDeploymentId
();
Map
<
String
,
Object
>
getProperties
();
Object
getProperty
(
String
propertyName
);
void
setProperty
(
String
propertyName
,
Object
propertyValue
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/form/StartFormInstance.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.form
;
import
org.activiti.engine.repository.ProcessDefinition
;
/**
* @author Tom Baeyens
*/
public
interface
StartFormInstance
extends
FormInstance
{
ProcessDefinition
getProcessDefinition
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/form/TaskFormInstance.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.form
;
import
org.activiti.engine.task.Task
;
/**
* @author Tom Baeyens
*/
public
interface
TaskFormInstance
extends
FormInstance
{
Task
getTask
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricFormInstance.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.history
;
import
java.util.Date
;
/**
* @author Tom Baeyens
*/
public
interface
HistoricFormInstance
{
String
getId
();
String
getProcessInstanceId
();
String
getExecutionId
();
String
getActivityId
();
String
getAuthenticatedUserId
();
Date
getTime
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricVariableUpdate.java
浏览文件 @
052d1a38
...
...
@@ -13,7 +13,6 @@
package
org.activiti.engine.history
;
import
java.util.Date
;
/**
...
...
@@ -21,11 +20,11 @@ import java.util.Date;
*/
public
interface
HistoricVariableUpdate
{
String
getHistoricFormInstanceId
();
String
getProcessInstanceId
();
String
getExecutionId
();
String
getVariableName
();
String
getVariableType
();
Object
getValue
();
int
getIndex
();
Date
getTime
();
int
getRevision
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/FormServiceImpl.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl
;
import
java.util.Map
;
import
org.activiti.engine.FormService
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.cmd.GetRenderedStartFormCmd
;
import
org.activiti.engine.impl.cmd.GetRenderedTaskFormCmd
;
import
org.activiti.engine.impl.cmd.GetStartFormInstanceCmd
;
import
org.activiti.engine.impl.cmd.GetTaskFormInstanceCmd
;
/**
* @author Tom Baeyens
*/
public
class
FormServiceImpl
extends
ServiceImpl
implements
FormService
{
public
Object
getRenderedStartForm
(
String
processDefinitionId
)
{
return
commandExecutor
.
execute
(
new
GetRenderedStartFormCmd
(
processDefinitionId
,
null
));
}
public
Object
getRenderedStartForm
(
String
processDefinitionId
,
String
engineName
)
{
return
commandExecutor
.
execute
(
new
GetRenderedStartFormCmd
(
processDefinitionId
,
engineName
));
}
public
Object
getRenderedTaskForm
(
String
taskId
)
{
return
commandExecutor
.
execute
(
new
GetRenderedTaskFormCmd
(
taskId
,
null
));
}
public
Object
getRenderedTaskForm
(
String
taskId
,
String
engineName
)
{
return
commandExecutor
.
execute
(
new
GetRenderedTaskFormCmd
(
taskId
,
engineName
));
}
public
StartFormInstance
getStartFormInstance
(
String
processDefinitionId
)
{
return
commandExecutor
.
execute
(
new
GetStartFormInstanceCmd
(
processDefinitionId
));
}
public
TaskFormInstance
getTaskFormInstance
(
String
taskId
)
{
return
commandExecutor
.
execute
(
new
GetTaskFormInstanceCmd
(
taskId
));
}
public
void
submitStartFormInstance
(
String
processDefinitionId
,
Map
<
String
,
Object
>
properties
)
{
}
public
void
submitTaskFormInstance
(
String
taskId
,
Map
<
String
,
Object
>
properties
)
{
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessDefinitionQueryImpl.java
浏览文件 @
052d1a38
...
...
@@ -48,12 +48,12 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
super
(
commandExecutor
);
}
public
ProcessDefinitionQuery
id
(
String
processDefinitionId
)
{
public
ProcessDefinitionQuery
Impl
id
(
String
processDefinitionId
)
{
this
.
id
=
processDefinitionId
;
return
this
;
}
public
ProcessDefinitionQuery
name
(
String
name
)
{
public
ProcessDefinitionQuery
Impl
name
(
String
name
)
{
if
(
name
==
null
)
{
throw
new
ActivitiException
(
"name is null"
);
}
...
...
@@ -61,7 +61,7 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
nameLike
(
String
nameLike
)
{
public
ProcessDefinitionQuery
Impl
nameLike
(
String
nameLike
)
{
if
(
nameLike
==
null
)
{
throw
new
ActivitiException
(
"nameLike is null"
);
}
...
...
@@ -77,7 +77,7 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
key
(
String
key
)
{
public
ProcessDefinitionQuery
Impl
key
(
String
key
)
{
if
(
key
==
null
)
{
throw
new
ActivitiException
(
"key is null"
);
}
...
...
@@ -85,7 +85,7 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
keyLike
(
String
keyLike
)
{
public
ProcessDefinitionQuery
Impl
keyLike
(
String
keyLike
)
{
if
(
keyLike
==
null
)
{
throw
new
ActivitiException
(
"keyLike is null"
);
}
...
...
@@ -93,7 +93,7 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
version
(
Integer
version
)
{
public
ProcessDefinitionQuery
Impl
version
(
Integer
version
)
{
if
(
version
==
null
)
{
throw
new
ActivitiException
(
"version is null"
);
}
else
if
(
version
<=
0
)
{
...
...
@@ -103,30 +103,30 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
latest
()
{
public
ProcessDefinitionQuery
Impl
latest
()
{
this
.
latest
=
true
;
return
this
;
}
//sorting ////////////////////////////////////////////
public
ProcessDefinitionQuery
orderByDeploymentId
()
{
public
ProcessDefinitionQuery
Impl
orderByDeploymentId
()
{
return
orderBy
(
ProcessDefinitionQueryProperty
.
DEPLOYMENT_ID
);
}
public
ProcessDefinitionQuery
orderById
()
{
public
ProcessDefinitionQuery
Impl
orderById
()
{
return
orderBy
(
ProcessDefinitionQueryProperty
.
ID
);
}
public
ProcessDefinitionQuery
orderByKey
()
{
public
ProcessDefinitionQuery
Impl
orderByKey
()
{
return
orderBy
(
ProcessDefinitionQueryProperty
.
KEY
);
}
public
ProcessDefinitionQuery
orderByVersion
()
{
public
ProcessDefinitionQuery
Impl
orderByVersion
()
{
return
orderBy
(
ProcessDefinitionQueryProperty
.
VERSION
);
}
public
ProcessDefinitionQuery
orderBy
(
QueryProperty
property
)
{
public
ProcessDefinitionQuery
Impl
orderBy
(
QueryProperty
property
)
{
if
(!(
property
instanceof
ProcessDefinitionQueryProperty
))
{
throw
new
ActivitiException
(
"Only ProcessDefinitionQueryProperty can be used with orderBy"
);
}
...
...
@@ -134,15 +134,15 @@ public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQ
return
this
;
}
public
ProcessDefinitionQuery
asc
()
{
public
ProcessDefinitionQuery
Impl
asc
()
{
return
direction
(
Direction
.
ASCENDING
);
}
public
ProcessDefinitionQuery
desc
()
{
public
ProcessDefinitionQuery
Impl
desc
()
{
return
direction
(
Direction
.
DESCENDING
);
}
public
ProcessDefinitionQuery
direction
(
Direction
direction
)
{
public
ProcessDefinitionQuery
Impl
direction
(
Direction
direction
)
{
if
(
orderProperty
==
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessEngineImpl.java
浏览文件 @
052d1a38
...
...
@@ -15,12 +15,13 @@ package org.activiti.engine.impl;
import
java.util.logging.Logger
;
import
org.activiti.engine.DbSchemaStrategy
;
import
org.activiti.engine.FormService
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.IdentityService
;
import
org.activiti.engine.ManagementService
;
import
org.activiti.engine.ProcessEngine
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.impl.cfg.ProcessEngineConfiguration
;
import
org.activiti.engine.impl.db.DbSqlSessionFactory
;
...
...
@@ -43,6 +44,7 @@ public class ProcessEngineImpl implements ProcessEngine {
protected
HistoryService
historicDataService
;
protected
IdentityService
identityService
;
protected
TaskService
taskService
;
protected
FormService
formService
;
protected
ManagementService
managementService
;
protected
String
dbSchemaStrategy
;
protected
JobExecutor
jobExecutor
;
...
...
@@ -56,6 +58,7 @@ public class ProcessEngineImpl implements ProcessEngine {
this
.
historicDataService
=
processEngineConfiguration
.
getHistoryService
();
this
.
identityService
=
processEngineConfiguration
.
getIdentityService
();
this
.
taskService
=
processEngineConfiguration
.
getTaskService
();
this
.
formService
=
processEngineConfiguration
.
getFormService
();
this
.
managementService
=
processEngineConfiguration
.
getManagementService
();
this
.
dbSchemaStrategy
=
processEngineConfiguration
.
getDbSchemaStrategy
();
this
.
jobExecutor
=
processEngineConfiguration
.
getJobExecutor
();
...
...
@@ -155,9 +158,11 @@ public class ProcessEngineImpl implements ProcessEngine {
public
RuntimeService
getRuntimeService
()
{
return
runtimeService
;
}
public
String
getDbSchemaStrategy
()
{
return
dbSchemaStrategy
;
}
public
ProcessEngineConfiguration
getProcessEngineConfiguration
()
{
return
processEngineConfiguration
;
}
...
...
@@ -165,4 +170,8 @@ public class ProcessEngineImpl implements ProcessEngine {
public
RepositoryService
getRepositoryService
()
{
return
repositoryService
;
}
public
FormService
getFormService
()
{
return
formService
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RuntimeServiceImpl.java
浏览文件 @
052d1a38
...
...
@@ -18,8 +18,10 @@ import java.util.Map;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.form.FormInstance
;
import
org.activiti.engine.impl.cmd.DeleteProcessInstanceCmd
;
import
org.activiti.engine.impl.cmd.FindActiveActivityIdsCmd
;
import
org.activiti.engine.impl.cmd.GetStartFormInstanceCmd
;
import
org.activiti.engine.impl.cmd.GetVariableCmd
;
import
org.activiti.engine.impl.cmd.GetVariablesCmd
;
import
org.activiti.engine.impl.cmd.SetVariablesCmd
;
...
...
@@ -106,4 +108,8 @@ public class RuntimeServiceImpl extends ServiceImpl implements RuntimeService {
public
List
<
String
>
getActiveActivityIds
(
String
executionId
)
{
return
commandExecutor
.
execute
(
new
FindActiveActivityIdsCmd
(
executionId
));
}
public
FormInstance
getFormInstanceById
(
String
processDefinitionId
)
{
return
commandExecutor
.
execute
(
new
GetStartFormInstanceCmd
(
processDefinitionId
));
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskServiceImpl.java
浏览文件 @
052d1a38
...
...
@@ -21,15 +21,14 @@ import org.activiti.engine.impl.cmd.AddIdentityLinkCmd;
import
org.activiti.engine.impl.cmd.ClaimTaskCmd
;
import
org.activiti.engine.impl.cmd.CompleteTaskCmd
;
import
org.activiti.engine.impl.cmd.DeleteTaskCmd
;
import
org.activiti.engine.impl.cmd.GetRenderedFormCmd
;
import
org.activiti.engine.impl.cmd.GetIdentityLinksForTaskCmd
;
import
org.activiti.engine.impl.cmd.SaveTaskCmd
;
import
org.activiti.engine.impl.cmd.SetTaskPriorityCmd
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.task.TaskEntity
;
import
org.activiti.engine.task.IdentityLink
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.IdentityLinkType
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.TaskQuery
;
...
...
@@ -109,18 +108,6 @@ public class TaskServiceImpl extends ServiceImpl implements TaskService {
return
new
TaskQueryImpl
(
commandExecutor
);
}
public
Object
getRenderedStartFormById
(
String
processDefinitionId
)
{
return
commandExecutor
.
execute
(
new
GetRenderedFormCmd
(
processDefinitionId
,
null
,
null
));
}
public
Object
getRenderedStartFormByKey
(
String
processDefinitionKey
)
{
return
commandExecutor
.
execute
(
new
GetRenderedFormCmd
(
null
,
processDefinitionKey
,
null
));
}
public
Object
getRenderedTaskForm
(
String
taskId
)
{
return
commandExecutor
.
execute
(
new
GetRenderedFormCmd
(
null
,
null
,
taskId
));
}
// getters and setters //////////////////////////////////////////////////////
public
CommandExecutor
getCommandExecutor
()
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/UserTaskActivity.java
浏览文件 @
052d1a38
...
...
@@ -36,7 +36,7 @@ public class UserTaskActivity extends TaskActivity {
public
void
execute
(
ActivityExecution
execution
)
throws
Exception
{
TaskEntity
task
=
TaskEntity
.
createAndInsert
();
task
.
setExecution
(
execution
);
task
.
set
FormResourceKey
(
taskDefinition
.
getFormResourceKey
()
);
task
.
set
TaskDefinition
(
taskDefinition
);
if
(
taskDefinition
.
getNameValueExpression
()
!=
null
)
{
String
name
=
(
String
)
taskDefinition
.
getNameValueExpression
().
getValue
(
execution
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
浏览文件 @
052d1a38
...
...
@@ -54,6 +54,8 @@ import org.activiti.engine.impl.el.ActivitiValueExpression;
import
org.activiti.engine.impl.el.ExpressionManager
;
import
org.activiti.engine.impl.el.UelMethodExpressionCondition
;
import
org.activiti.engine.impl.el.UelValueExpressionCondition
;
import
org.activiti.engine.impl.form.DefaultStartFormHandler
;
import
org.activiti.engine.impl.form.StartFormHandler
;
import
org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl
;
import
org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
...
...
@@ -83,6 +85,9 @@ public class BpmnParse extends Parse {
public
static
final
String
PROPERTYNAME_VARIABLE_DECLARATIONS
=
"variableDeclarations"
;
public
static
final
String
PROPERTYNAME_TIMER_DECLARATION
=
"timerDeclarations"
;
public
static
final
String
PROPERTYNAME_INITIAL
=
"initial"
;
public
static
final
String
PROPERTYNAME_INITIATOR_VARIABLE_NAME
=
"initiatorVariableName"
;
private
static
final
StartFormHandler
DEFAULT_FORM_INSTANCE_FACTORY
=
new
DefaultStartFormHandler
();
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
BpmnParse
.
class
.
getName
());
...
...
@@ -363,6 +368,7 @@ public class BpmnParse extends Parse {
processDefinition
.
setKey
(
processElement
.
attribute
(
"id"
));
processDefinition
.
setProperty
(
"name"
,
processElement
.
attribute
(
"name"
));
processDefinition
.
setProperty
(
"documentation"
,
parseDocumentation
(
processElement
));
processDefinition
.
setTaskDefinitions
(
new
HashMap
<
String
,
TaskDefinition
>());
String
historyLevelText
=
processElement
.
attribute
(
"history"
);
if
(
historyLevelText
!=
null
)
{
...
...
@@ -439,14 +445,15 @@ public class BpmnParse extends Parse {
}
processDefinition
.
setInitial
(
startEventActivity
);
String
startFormResourceKey
=
startEventElement
.
attributeNS
(
BpmnParser
.
BPMN_EXTENSIONS_NS
,
"form"
);
if
(
startFormResourceKey
!=
null
)
{
processDefinition
.
setStartFormResourceKey
(
startFormResourceKey
);
String
formKey
=
startEventElement
.
attributeNS
(
BpmnParser
.
BPMN_EXTENSIONS_NS
,
"form"
);
if
(
formKey
!=
null
)
{
processDefinition
.
setFormKey
(
formKey
);
processDefinition
.
setStartFormHandler
(
DEFAULT_FORM_INSTANCE_FACTORY
);
}
String
initiatorVariableName
=
startEventElement
.
attributeNS
(
BpmnParser
.
BPMN_EXTENSIONS_NS
,
"initiator"
);
if
(
initiatorVariableName
!=
null
)
{
processDefinition
.
setProperty
(
"initiatorVariableName"
,
initiatorVariableName
);
processDefinition
.
setProperty
(
PROPERTYNAME_INITIATOR_VARIABLE_NAME
,
initiatorVariableName
);
}
}
else
{
...
...
@@ -774,11 +781,12 @@ public class BpmnParse extends Parse {
*/
public
void
parseUserTask
(
Element
userTaskElement
,
ScopeImpl
scope
)
{
ActivityImpl
activity
=
parseAndCreateActivityOnScopeElement
(
userTaskElement
,
scope
);
TaskDefinition
taskDefinition
=
parseTaskDefinition
(
userTaskElement
);
TaskDefinition
taskDefinition
=
parseTaskDefinition
(
userTaskElement
,
activity
.
getId
(),
(
ProcessDefinitionEntity
)
scope
.
getProcessDefinition
());
UserTaskActivity
userTaskActivity
=
new
UserTaskActivity
(
expressionManager
,
taskDefinition
);
String
formResourceKey
=
userTaskElement
.
attributeNS
(
BpmnParser
.
BPMN_EXTENSIONS_NS
,
"form"
);
taskDefinition
.
setForm
Resource
Key
(
formResourceKey
);
taskDefinition
.
setFormKey
(
formResourceKey
);
activity
.
setActivityBehavior
(
userTaskActivity
);
...
...
@@ -789,9 +797,12 @@ public class BpmnParse extends Parse {
}
}
public
TaskDefinition
parseTaskDefinition
(
Element
taskElement
)
{
public
TaskDefinition
parseTaskDefinition
(
Element
taskElement
,
String
taskDefinitionKey
,
ProcessDefinitionEntity
processDefinition
)
{
TaskDefinition
taskDefinition
=
new
TaskDefinition
();
taskDefinition
.
setKey
(
taskDefinitionKey
);
processDefinition
.
getTaskDefinitions
().
put
(
taskDefinitionKey
,
taskDefinition
);
String
name
=
taskElement
.
attribute
(
"name"
);
if
(
name
!=
null
)
{
taskDefinition
.
setNameValueExpression
(
expressionManager
.
createValueExpression
(
name
));
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfiguration.java
浏览文件 @
052d1a38
...
...
@@ -21,6 +21,7 @@ import javax.sql.DataSource;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.DbSchemaStrategy
;
import
org.activiti.engine.FormService
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.IdentityService
;
import
org.activiti.engine.ManagementService
;
...
...
@@ -29,6 +30,7 @@ import org.activiti.engine.ProcessEngines;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.impl.FormServiceImpl
;
import
org.activiti.engine.impl.HistoryServiceImpl
;
import
org.activiti.engine.impl.IdentityServiceImpl
;
import
org.activiti.engine.impl.ManagementServiceImpl
;
...
...
@@ -51,6 +53,8 @@ import org.activiti.engine.impl.db.DbSqlSession;
import
org.activiti.engine.impl.db.DbSqlSessionFactory
;
import
org.activiti.engine.impl.db.DbTaskSessionFactory
;
import
org.activiti.engine.impl.el.ExpressionManager
;
import
org.activiti.engine.impl.form.FormEngine
;
import
org.activiti.engine.impl.form.JuelFormEngine
;
import
org.activiti.engine.impl.history.handler.HistoryTaskAssignmentHandler
;
import
org.activiti.engine.impl.interceptor.CommandContextFactory
;
import
org.activiti.engine.impl.interceptor.CommandContextInterceptor
;
...
...
@@ -136,6 +140,7 @@ public class ProcessEngineConfiguration {
protected
HistoryService
historyService
;
protected
IdentityService
identityService
;
protected
TaskService
taskService
;
protected
FormService
formService
;
protected
ManagementService
managementService
;
protected
Map
<
Class
<?>,
SessionFactory
>
sessionFactories
;
...
...
@@ -173,6 +178,8 @@ public class ProcessEngineConfiguration {
protected
String
mailServerSmtpPassword
;
protected
int
mailServerSmtpPort
;
protected
String
mailServerDefaultFrom
;
protected
Map
<
String
,
FormEngine
>
formEngines
;
public
ProcessEngineConfiguration
()
{
processEngineName
=
ProcessEngines
.
NAME_DEFAULT
;
...
...
@@ -189,6 +196,7 @@ public class ProcessEngineConfiguration {
repositoryService
=
new
RepositoryServiceImpl
();
runtimeService
=
new
RuntimeServiceImpl
();
taskService
=
new
TaskServiceImpl
();
formService
=
new
FormServiceImpl
();
managementService
=
new
ManagementServiceImpl
();
identityService
=
new
IdentityServiceImpl
();
historyService
=
new
HistoryServiceImpl
();
...
...
@@ -232,6 +240,11 @@ public class ProcessEngineConfiguration {
mailServerDefaultFrom
=
DEFAULT_FROM_EMAIL_ADDRESS
;
mailServerSmtpPort
=
DEFAULT_MAIL_SERVER_SMTP_PORT
;
formEngines
=
new
HashMap
<
String
,
FormEngine
>();
FormEngine
defaultFormEngine
=
new
JuelFormEngine
();
formEngines
.
put
(
null
,
defaultFormEngine
);
// default form engine is looked up with null
formEngines
.
put
(
"juel"
,
defaultFormEngine
);
}
public
ProcessEngine
buildProcessEngine
()
{
...
...
@@ -254,6 +267,7 @@ public class ProcessEngineConfiguration {
notifyConfigurationComplete
(
repositoryService
);
notifyConfigurationComplete
(
runtimeService
);
notifyConfigurationComplete
(
taskService
);
notifyConfigurationComplete
(
formService
);
notifyConfigurationComplete
(
managementService
);
notifyConfigurationComplete
(
identityService
);
notifyConfigurationComplete
(
historyService
);
...
...
@@ -660,17 +674,14 @@ public class ProcessEngineConfiguration {
this
.
commandInterceptorsTxRequired
=
commandInterceptorsTxRequired
;
}
public
List
<
CommandInterceptor
>
getCommandInterceptorsTxRequiresNew
()
{
return
commandInterceptorsTxRequiresNew
;
}
public
void
setCommandInterceptorsTxRequiresNew
(
List
<
CommandInterceptor
>
commandInterceptorsTxRequiresNew
)
{
this
.
commandInterceptorsTxRequiresNew
=
commandInterceptorsTxRequiresNew
;
}
public
CommandExecutor
getCommandExecutorTxRequiresNew
()
{
return
commandExecutorTxRequiresNew
;
}
...
...
@@ -678,9 +689,24 @@ public class ProcessEngineConfiguration {
public
int
getHistoryLevel
()
{
return
historyLevel
;
}
public
void
setHistoryLevel
(
int
historyLevel
)
{
this
.
historyLevel
=
historyLevel
;
}
public
Map
<
String
,
FormEngine
>
getFormEngines
()
{
return
formEngines
;
}
public
void
setFormEngines
(
Map
<
String
,
FormEngine
>
formEngines
)
{
this
.
formEngines
=
formEngines
;
}
public
FormService
getFormService
()
{
return
formService
;
}
public
void
setFormService
(
FormService
formService
)
{
this
.
formService
=
formService
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedFormCmd.java
已删除
100644 → 0
浏览文件 @
4f37a868
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.cmd
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.cfg.RepositorySession
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.repository.DeploymentEntity
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.repository.ResourceEntity
;
import
org.activiti.engine.impl.runtime.ExecutionEntity
;
import
org.activiti.engine.impl.scripting.ScriptingEngines
;
import
org.activiti.engine.impl.task.TaskEntity
;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public
class
GetRenderedFormCmd
implements
Command
<
Object
>
{
protected
String
processDefinitionId
;
protected
String
processDefinitionKey
;
protected
String
taskId
;
public
GetRenderedFormCmd
(
String
processDefinitionId
,
String
processDefinitionKey
,
String
taskId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
this
.
processDefinitionKey
=
processDefinitionKey
;
this
.
taskId
=
taskId
;
}
public
Object
execute
(
CommandContext
commandContext
)
{
RepositorySession
repositorySession
=
commandContext
.
getRepositorySession
();
ProcessDefinitionEntity
processDefinition
=
null
;
TaskEntity
task
=
null
;
ExecutionEntity
execution
=
null
;
String
formResourceKey
=
null
;
if
(
taskId
!=
null
)
{
task
=
commandContext
.
getTaskSession
()
.
findTaskById
(
taskId
);
if
(
task
==
null
)
{
throw
new
ActivitiException
(
"No task found for id = '"
+
taskId
+
"'"
);
}
execution
=
task
.
getExecution
();
processDefinition
=
(
ProcessDefinitionEntity
)
execution
.
getProcessDefinition
();
formResourceKey
=
task
.
getFormResourceKey
();
}
else
if
(
processDefinitionId
!=
null
)
{
processDefinition
=
repositorySession
.
findDeployedProcessDefinitionById
(
processDefinitionId
);
if
(
processDefinition
==
null
)
{
throw
new
ActivitiException
(
"No process definition found for id = '"
+
processDefinitionId
+
"'"
);
}
formResourceKey
=
processDefinition
.
getStartFormResourceKey
();
}
else
if
(
processDefinitionKey
!=
null
)
{
processDefinition
=
repositorySession
.
findDeployedLatestProcessDefinitionByKey
(
processDefinitionKey
);
if
(
processDefinition
==
null
)
{
throw
new
ActivitiException
(
"No process definition found for key '"
+
processDefinitionKey
+
"'"
);
}
formResourceKey
=
processDefinition
.
getStartFormResourceKey
();
}
else
{
throw
new
ActivitiException
(
"processDefinitionKey, processDefinitionId and taskId are null"
);
}
Object
result
=
null
;
if
(
formResourceKey
!=
null
)
{
String
deploymentId
=
processDefinition
.
getDeploymentId
();
DeploymentEntity
deployment
=
repositorySession
.
findDeploymentById
(
deploymentId
);
String
formTemplateString
=
getFormTemplateString
(
formResourceKey
,
deployment
);
ScriptingEngines
scriptingEngines
=
commandContext
.
getProcessEngineConfiguration
().
getScriptingEngines
();
result
=
scriptingEngines
.
evaluate
(
formTemplateString
,
ScriptingEngines
.
DEFAULT_SCRIPTING_LANGUAGE
,
execution
);
}
return
result
;
}
protected
String
getFormTemplateString
(
String
formResourceName
,
DeploymentEntity
deployment
)
{
// get the template
ResourceEntity
formResource
=
deployment
.
getResource
(
formResourceName
);
if
(
formResource
==
null
)
{
throw
new
ActivitiException
(
"form '"
+
formResourceName
+
"' not available in "
+
deployment
);
}
byte
[]
formResourceBytes
=
formResource
.
getBytes
();
return
new
String
(
formResourceBytes
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedStartFormCmd.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.cmd
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.impl.cfg.RepositorySession
;
import
org.activiti.engine.impl.form.FormEngine
;
import
org.activiti.engine.impl.form.StartFormHandler
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public
class
GetRenderedStartFormCmd
implements
Command
<
Object
>
{
protected
String
processDefinitionId
;
protected
String
formEngineName
;
public
GetRenderedStartFormCmd
(
String
processDefinitionId
,
String
formEngineName
)
{
this
.
processDefinitionId
=
processDefinitionId
;
this
.
formEngineName
=
formEngineName
;
}
public
Object
execute
(
CommandContext
commandContext
)
{
RepositorySession
repositorySession
=
commandContext
.
getRepositorySession
();
ProcessDefinitionEntity
processDefinition
=
repositorySession
.
findDeployedProcessDefinitionById
(
processDefinitionId
);
if
(
processDefinition
==
null
)
{
throw
new
ActivitiException
(
"Process Definition '"
+
processDefinitionId
+
"' not found"
);
}
StartFormHandler
startFormHandler
=
processDefinition
.
getStartFormHandler
();
if
(
startFormHandler
==
null
)
{
return
null
;
}
FormEngine
formEngine
=
commandContext
.
getProcessEngineConfiguration
()
.
getFormEngines
()
.
get
(
formEngineName
);
if
(
formEngine
==
null
)
{
throw
new
ActivitiException
(
"No formEngine '"
+
formEngineName
+
"' defined process engine configuration"
);
}
StartFormInstance
startFormInstance
=
startFormHandler
.
createStartFormInstance
(
processDefinition
);
return
formEngine
.
renderStartForm
(
startFormInstance
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetRenderedTaskFormCmd.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.cmd
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.cfg.TaskSession
;
import
org.activiti.engine.impl.form.FormEngine
;
import
org.activiti.engine.impl.form.TaskFormHandler
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.task.TaskEntity
;
/**
* @author Tom Baeyens
*/
public
class
GetRenderedTaskFormCmd
implements
Command
<
Object
>
{
protected
String
taskId
;
protected
String
formEngineName
;
public
GetRenderedTaskFormCmd
(
String
taskId
,
String
formEngineName
)
{
this
.
taskId
=
taskId
;
this
.
formEngineName
=
formEngineName
;
}
public
Object
execute
(
CommandContext
commandContext
)
{
TaskSession
taskSession
=
commandContext
.
getTaskSession
();
TaskEntity
task
=
taskSession
.
findTaskById
(
taskId
);
if
(
task
==
null
)
{
throw
new
ActivitiException
(
"Task '"
+
taskId
+
"' not found"
);
}
TaskFormHandler
taskFormHandler
=
task
.
getTaskDefinition
().
getTaskFormHandler
();
if
(
taskFormHandler
==
null
)
{
return
null
;
}
FormEngine
formEngine
=
commandContext
.
getProcessEngineConfiguration
()
.
getFormEngines
()
.
get
(
formEngineName
);
if
(
formEngine
==
null
)
{
throw
new
ActivitiException
(
"No formEngine '"
+
formEngineName
+
"' defined process engine configuration"
);
}
TaskFormInstance
taskFormInstance
=
taskFormHandler
.
createTaskFormInstance
(
task
);
return
formEngine
.
renderTaskForm
(
taskFormInstance
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetStartFormInstanceCmd.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.cmd
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.impl.cfg.RepositorySession
;
import
org.activiti.engine.impl.form.StartFormHandler
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
/**
* @author Tom Baeyens
*/
public
class
GetStartFormInstanceCmd
implements
Command
<
StartFormInstance
>
{
protected
String
processDefinitionId
;
public
GetStartFormInstanceCmd
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
public
StartFormInstance
execute
(
CommandContext
commandContext
)
{
RepositorySession
repositorySession
=
commandContext
.
getRepositorySession
();
ProcessDefinitionEntity
processDefinition
=
repositorySession
.
findDeployedProcessDefinitionById
(
processDefinitionId
);
if
(
processDefinition
==
null
)
{
throw
new
ActivitiException
(
"No process definition found for id '"
+
processDefinitionId
+
"'"
);
}
StartFormHandler
startFormHandler
=
processDefinition
.
getStartFormHandler
();
if
(
startFormHandler
==
null
)
{
throw
new
ActivitiException
(
"No startFormHandler defined in process '"
+
processDefinitionId
+
"'"
);
}
return
startFormHandler
.
createStartFormInstance
(
processDefinition
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetTaskFormInstanceCmd.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.cmd
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.cfg.TaskSession
;
import
org.activiti.engine.impl.form.TaskFormHandler
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.task.TaskEntity
;
/**
* @author Tom Baeyens
*/
public
class
GetTaskFormInstanceCmd
implements
Command
<
TaskFormInstance
>
{
protected
String
taskId
;
public
GetTaskFormInstanceCmd
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
TaskFormInstance
execute
(
CommandContext
commandContext
)
{
TaskSession
taskSession
=
commandContext
.
getTaskSession
();
TaskEntity
task
=
taskSession
.
findTaskById
(
taskId
);
if
(
task
==
null
)
{
throw
new
ActivitiException
(
"No task found for taskId '"
+
taskId
+
"'"
);
}
TaskFormHandler
taskFormHandler
=
task
.
getTaskDefinition
().
getTaskFormHandler
();
if
(
taskFormHandler
==
null
)
{
throw
new
ActivitiException
(
"No taskFormHandler specified for task '"
+
taskId
+
"'"
);
}
return
taskFormHandler
.
createTaskFormInstance
(
task
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/DefaultStartFormHandler.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
java.util.Map
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
/**
* @author Tom Baeyens
*/
public
class
DefaultStartFormHandler
implements
StartFormHandler
{
public
StartFormInstance
createStartFormInstance
(
ProcessDefinitionEntity
processDefinition
)
{
StartFormInstanceImpl
startFormInstance
=
new
StartFormInstanceImpl
(
processDefinition
);
//...
return
startFormInstance
;
}
public
void
submitStartFormInstance
(
String
processDefinitionId
,
Map
<
String
,
Object
>
properties
)
{
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/DefaultTaskFormHandler.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
java.util.Map
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.task.TaskEntity
;
/**
* @author Tom Baeyens
*/
public
class
DefaultTaskFormHandler
implements
TaskFormHandler
{
public
TaskFormInstance
createTaskFormInstance
(
TaskEntity
task
)
{
TaskFormInstance
taskFormInstance
=
new
TaskFormInstanceImpl
(
task
);
return
taskFormInstance
;
}
public
void
submitTaskFormInstance
(
String
taskId
,
Map
<
String
,
Object
>
properties
)
{
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/FormEngine.java
浏览文件 @
052d1a38
...
...
@@ -12,8 +12,8 @@
*/
package
org.activiti.engine.impl.form
;
import
org.activiti.engine.
impl.repository.DeploymentEntity
;
import
org.activiti.engine.
impl.task.TaskEntity
;
import
org.activiti.engine.
form.StartFormInstance
;
import
org.activiti.engine.
form.TaskFormInstance
;
/**
...
...
@@ -21,6 +21,7 @@ import org.activiti.engine.impl.task.TaskEntity;
*/
public
interface
FormEngine
{
Object
render
(
DeploymentEntity
deployment
,
String
formReference
,
TaskEntity
taskImpl
);
Object
renderStartForm
(
StartFormInstance
startFormInstance
);
Object
renderTaskForm
(
TaskFormInstance
taskFormInstance
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/FormInstanceImpl.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.activiti.engine.form.FormInstance
;
/**
* @author Tom Baeyens
*/
public
abstract
class
FormInstanceImpl
implements
FormInstance
,
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
protected
String
formKey
;
protected
String
deploymentId
;
protected
Map
<
String
,
Object
>
properties
=
new
HashMap
<
String
,
Object
>();
public
Object
getProperty
(
String
propertyName
)
{
return
properties
.
get
(
propertyName
);
}
public
void
setProperty
(
String
propertyName
,
Object
propertyValue
)
{
properties
.
put
(
propertyName
,
propertyValue
);
}
// getters and setters //////////////////////////////////////////////////////
public
String
getFormKey
()
{
return
formKey
;
}
public
void
setProperties
(
Map
<
String
,
Object
>
properties
)
{
this
.
properties
=
properties
;
}
public
Map
<
String
,
Object
>
getProperties
()
{
return
properties
;
}
public
String
getDeploymentId
()
{
return
deploymentId
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/JuelFormEngine.java
浏览文件 @
052d1a38
...
...
@@ -12,14 +12,13 @@
*/
package
org.activiti.engine.impl.form
;
import
org.activiti.el.juel.ExpressionFactoryImpl
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.repository.DeploymentEntity
;
import
org.activiti.engine.form.FormInstance
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.repository.ResourceEntity
;
import
org.activiti.engine.impl.scripting.ScriptingEngines
;
import
org.activiti.engine.impl.task.TaskEntity
;
import
org.activiti.javax.el.ELContext
;
import
org.activiti.javax.el.ExpressionFactory
;
import
org.activiti.javax.el.ValueExpression
;
/**
...
...
@@ -27,31 +26,37 @@ import org.activiti.javax.el.ValueExpression;
*/
public
class
JuelFormEngine
implements
FormEngine
{
ExpressionFactory
expressionFactory
=
new
ExpressionFactoryImpl
();
public
Object
renderStartForm
(
StartFormInstance
startFormInstance
)
{
if
(
startFormInstance
.
getFormKey
()==
null
)
{
return
null
;
}
CommandContext
commandContext
=
CommandContext
.
getCurrent
();
String
formTemplateString
=
getFormTemplateString
(
startFormInstance
,
commandContext
);
ScriptingEngines
scriptingEngines
=
commandContext
.
getProcessEngineConfiguration
().
getScriptingEngines
();
return
scriptingEngines
.
evaluate
(
formTemplateString
,
ScriptingEngines
.
DEFAULT_SCRIPTING_LANGUAGE
,
null
);
}
public
String
render
(
DeploymentEntity
deployment
,
String
formReference
,
TaskEntity
task
)
{
try
{
// get the template
ResourceEntity
formResourceEntity
=
deployment
.
getResource
(
formReference
);
if
(
formResourceEntity
==
null
)
{
throw
new
ActivitiException
(
"form '"
+
formReference
+
"' not available in "
+
deployment
);
}
byte
[]
formResourceBytes
=
formResourceEntity
.
getBytes
();
String
formString
=
new
String
(
formResourceBytes
);
ELContext
elContext
=
new
TaskElContext
(
task
);
ValueExpression
result
=
expressionFactory
.
createValueExpression
(
elContext
,
formString
,
String
.
class
);
return
(
String
)
result
.
getValue
(
elContext
);
}
catch
(
Exception
e
)
{
throw
new
ActivitiException
(
"problem rendering template: "
+
e
.
getMessage
(),
e
);
public
Object
renderTaskForm
(
TaskFormInstance
taskFormInstance
)
{
if
(
taskFormInstance
.
getFormKey
()==
null
)
{
return
null
;
}
CommandContext
commandContext
=
CommandContext
.
getCurrent
();
String
formTemplateString
=
getFormTemplateString
(
taskFormInstance
,
commandContext
);
ScriptingEngines
scriptingEngines
=
commandContext
.
getProcessEngineConfiguration
().
getScriptingEngines
();
TaskEntity
task
=
(
TaskEntity
)
taskFormInstance
.
getTask
();
return
scriptingEngines
.
evaluate
(
formTemplateString
,
ScriptingEngines
.
DEFAULT_SCRIPTING_LANGUAGE
,
task
.
getExecution
());
}
// private Object createFormData(TaskEntity task) {
// if (task!=null) {
// return task.getActivityInstanceVariables();
// }
// return null;
// }
private
String
getFormTemplateString
(
FormInstance
formInstance
,
CommandContext
commandContext
)
{
String
deploymentId
=
formInstance
.
getDeploymentId
();
String
formKey
=
formInstance
.
getFormKey
();
ResourceEntity
resourceStream
=
commandContext
.
getRepositorySession
()
.
findResourceByDeploymentIdAndResourceName
(
deploymentId
,
formKey
);
byte
[]
resourceBytes
=
resourceStream
.
getBytes
();
String
formTemplateString
=
new
String
(
resourceBytes
);
return
formTemplateString
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/StartFormHandler.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
java.util.Map
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
/**
* @author Tom Baeyens
*/
public
interface
StartFormHandler
{
StartFormInstance
createStartFormInstance
(
ProcessDefinitionEntity
processDefinition
);
void
submitStartFormInstance
(
String
processDefinitionId
,
Map
<
String
,
Object
>
properties
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/StartFormInstanceImpl.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
org.activiti.engine.form.StartFormInstance
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
import
org.activiti.engine.repository.ProcessDefinition
;
/**
* @author Tom Baeyens
*/
public
class
StartFormInstanceImpl
extends
FormInstanceImpl
implements
StartFormInstance
,
Command
<
Object
>
{
private
static
final
long
serialVersionUID
=
1L
;
protected
ProcessDefinition
processDefinition
;
public
StartFormInstanceImpl
(
ProcessDefinitionEntity
processDefinition
)
{
this
.
formKey
=
(
String
)
processDefinition
.
getFormKey
();
this
.
deploymentId
=
processDefinition
.
getDeploymentId
();
this
.
processDefinition
=
processDefinition
;
}
public
Object
execute
(
CommandContext
commandContext
)
{
return
null
;
}
// getters and setters //////////////////////////////////////////////////////
public
ProcessDefinition
getProcessDefinition
()
{
return
processDefinition
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/TaskFormHandler.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
java.util.Map
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.task.TaskEntity
;
/**
* @author Tom Baeyens
*/
public
interface
TaskFormHandler
{
TaskFormInstance
createTaskFormInstance
(
TaskEntity
task
);
void
submitTaskFormInstance
(
String
taskId
,
Map
<
String
,
Object
>
properties
);
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/form/TaskFormInstanceImpl.java
0 → 100644
浏览文件 @
052d1a38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.form
;
import
org.activiti.engine.form.TaskFormInstance
;
import
org.activiti.engine.impl.ProcessDefinitionQueryImpl
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.task.TaskEntity
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.task.Task
;
/**
* @author Tom Baeyens
*/
public
class
TaskFormInstanceImpl
extends
FormInstanceImpl
implements
TaskFormInstance
{
private
static
final
long
serialVersionUID
=
1L
;
protected
Task
task
;
public
TaskFormInstanceImpl
(
TaskEntity
task
)
{
this
.
task
=
task
;
this
.
formKey
=
task
.
getTaskDefinition
().
getFormKey
();
String
processDefinitionId
=
task
.
getProcessDefinitionId
();
ProcessDefinition
processDefinition
=
new
ProcessDefinitionQueryImpl
()
.
id
(
processDefinitionId
)
.
executeSingleResult
(
CommandContext
.
getCurrent
());
this
.
deploymentId
=
processDefinition
.
getDeploymentId
();
}
public
Task
getTask
()
{
return
task
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/history/HistoricVariableUpdateEntity.java
浏览文件 @
052d1a38
...
...
@@ -32,7 +32,7 @@ public class HistoricVariableUpdateEntity extends VariableInstanceEntity impleme
private
static
final
long
serialVersionUID
=
1L
;
protected
int
index
;
protected
String
historicFormInstanceId
;
protected
Date
time
;
public
HistoricVariableUpdateEntity
()
{
...
...
@@ -47,10 +47,10 @@ public class HistoricVariableUpdateEntity extends VariableInstanceEntity impleme
if
(
executionId
==
null
)
{
throw
new
ActivitiException
(
"bug"
);
}
this
.
revision
=
variableInstance
.
getRevision
();
this
.
name
=
variableInstance
.
getName
();
this
.
type
=
variableInstance
.
getType
();
this
.
time
=
ClockUtil
.
getCurrentTime
();
this
.
index
=
variableInstance
.
generateNextHistoryIndex
();
if
(
variableInstance
.
getByteArrayValueId
()!=
null
)
{
// TODO test and review. name ok here?
this
.
byteArrayValue
=
new
ByteArrayEntity
(
name
,
variableInstance
.
getByteArrayValue
().
getBytes
());
...
...
@@ -84,14 +84,6 @@ public class HistoricVariableUpdateEntity extends VariableInstanceEntity impleme
return
HistoricVariableUpdateEntity
.
class
;
}
public
int
getIndex
()
{
return
index
;
}
public
void
setIndex
(
int
index
)
{
this
.
index
=
index
;
}
public
Date
getTime
()
{
return
time
;
...
...
@@ -108,4 +100,12 @@ public class HistoricVariableUpdateEntity extends VariableInstanceEntity impleme
public
String
getVariableType
()
{
return
type
.
getTypeName
();
}
public
String
getHistoricFormInstanceId
()
{
return
historicFormInstanceId
;
}
public
void
setHistoricFormInstanceId
(
String
historicFormInstanceId
)
{
this
.
historicFormInstanceId
=
historicFormInstanceId
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/repository/ProcessDefinitionEntity.java
浏览文件 @
052d1a38
...
...
@@ -13,12 +13,15 @@
package
org.activiti.engine.impl.repository
;
import
java.util.ArrayList
;
import
java.util.Map
;
import
org.activiti.engine.impl.db.PersistentObject
;
import
org.activiti.engine.impl.form.StartFormHandler
;
import
org.activiti.engine.impl.identity.Authentication
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.runtime.ExecutionEntity
;
import
org.activiti.engine.impl.runtime.VariableMap
;
import
org.activiti.engine.impl.task.TaskDefinition
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.pvm.impl.process.ProcessDefinitionImpl
;
import
org.activiti.pvm.impl.runtime.ExecutionImpl
;
...
...
@@ -35,8 +38,11 @@ public class ProcessDefinitionEntity extends ProcessDefinitionImpl implements Pr
protected
int
version
;
protected
String
deploymentId
;
protected
String
resourceName
;
protected
String
startFormResourceKey
;
protected
String
formKey
;
protected
Integer
historyLevel
;
protected
StartFormHandler
startFormHandler
;
protected
Map
<
String
,
TaskDefinition
>
taskDefinitions
;
public
ProcessDefinitionEntity
()
{
super
(
null
);
...
...
@@ -129,14 +135,6 @@ public class ProcessDefinitionEntity extends ProcessDefinitionImpl implements Pr
this
.
resourceName
=
resourceName
;
}
public
String
getStartFormResourceKey
()
{
return
startFormResourceKey
;
}
public
void
setStartFormResourceKey
(
String
startFormResourceKey
)
{
this
.
startFormResourceKey
=
startFormResourceKey
;
}
public
Integer
getHistoryLevel
()
{
return
historyLevel
;
}
...
...
@@ -144,4 +142,28 @@ public class ProcessDefinitionEntity extends ProcessDefinitionImpl implements Pr
public
void
setHistoryLevel
(
Integer
historyLevel
)
{
this
.
historyLevel
=
historyLevel
;
}
public
StartFormHandler
getStartFormHandler
()
{
return
startFormHandler
;
}
public
void
setStartFormHandler
(
StartFormHandler
startFormHandler
)
{
this
.
startFormHandler
=
startFormHandler
;
}
public
String
getFormKey
()
{
return
formKey
;
}
public
void
setFormKey
(
String
formKey
)
{
this
.
formKey
=
formKey
;
}
public
Map
<
String
,
TaskDefinition
>
getTaskDefinitions
()
{
return
taskDefinitions
;
}
public
void
setTaskDefinitions
(
Map
<
String
,
TaskDefinition
>
taskDefinitions
)
{
this
.
taskDefinitions
=
taskDefinitions
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ExecutionEntity.java
浏览文件 @
052d1a38
...
...
@@ -31,6 +31,7 @@ import org.activiti.engine.impl.db.PersistentObject;
import
org.activiti.engine.impl.history.HistoricActivityInstanceEntity
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.task.TaskEntity
;
import
org.activiti.engine.impl.variable.VariableDeclaration
;
import
org.activiti.engine.runtime.Execution
;
...
...
@@ -445,7 +446,7 @@ public class ExecutionEntity extends ExecutionImpl implements PersistentObject,
}
// getters and setters //////////////////////////////////////////////////////
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/VariableInstanceEntity.java
浏览文件 @
052d1a38
...
...
@@ -46,8 +46,6 @@ public class VariableInstanceEntity implements Serializable, PersistentObject {
protected
ByteArrayEntity
byteArrayValue
;
protected
String
byteArrayValueId
;
protected
int
historyNextIndex
;
protected
Object
cachedValue
;
protected
Type
type
;
...
...
@@ -71,7 +69,6 @@ public class VariableInstanceEntity implements Serializable, PersistentObject {
VariableInstanceEntity
variableInstance
=
new
VariableInstanceEntity
();
variableInstance
.
name
=
name
;
variableInstance
.
type
=
type
;
variableInstance
.
historyNextIndex
=
0
;
variableInstance
.
setValue
(
value
);
return
variableInstance
;
...
...
@@ -99,6 +96,10 @@ public class VariableInstanceEntity implements Serializable, PersistentObject {
dbSqlSession
.
delete
(
VariableInstanceEntity
.
class
,
id
);
if
(
byteArrayValueId
!=
null
)
{
// the next apparently useless line is probably to ensure consistency in the DbSqlSession
// cache, but should be checked and docced here (or removed if it turns out to be unnecessary)
// @see also HistoricVariableUpdateEntity
getByteArrayValue
();
dbSqlSession
.
delete
(
ByteArrayEntity
.
class
,
byteArrayValueId
);
}
}
...
...
@@ -157,10 +158,6 @@ public class VariableInstanceEntity implements Serializable, PersistentObject {
return
byteArrayValue
;
}
public
int
generateNextHistoryIndex
()
{
return
historyNextIndex
++;
}
// type /////////////////////////////////////////////////////////////////////
public
Object
getValue
()
{
...
...
@@ -243,10 +240,4 @@ public class VariableInstanceEntity implements Serializable, PersistentObject {
public
void
setTextValue2
(
String
textValue2
)
{
this
.
textValue2
=
textValue2
;
}
public
int
getHistoryNextIndex
()
{
return
historyNextIndex
;
}
public
void
setHistoryNextIndex
(
int
historyNextIndex
)
{
this
.
historyNextIndex
=
historyNextIndex
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskDefinition.java
浏览文件 @
052d1a38
...
...
@@ -16,6 +16,8 @@ import java.util.HashSet;
import
java.util.Set
;
import
org.activiti.engine.impl.el.ActivitiValueExpression
;
import
org.activiti.engine.impl.form.DefaultTaskFormHandler
;
import
org.activiti.engine.impl.form.TaskFormHandler
;
/**
* Container for task definition information gathered at parsing time.
...
...
@@ -24,12 +26,16 @@ import org.activiti.engine.impl.el.ActivitiValueExpression;
*/
public
class
TaskDefinition
{
protected
String
key
;
// assignment fields
protected
ActivitiValueExpression
nameValueExpression
;
protected
ActivitiValueExpression
descriptionValueExpression
;
protected
ActivitiValueExpression
assigneeValueExpression
;
protected
Set
<
ActivitiValueExpression
>
candidateUserIdValueExpressions
=
new
HashSet
<
ActivitiValueExpression
>();
protected
Set
<
ActivitiValueExpression
>
candidateGroupIdValueExpressions
=
new
HashSet
<
ActivitiValueExpression
>();
protected
String
formResourceKey
;
// form fields
protected
String
formKey
;
protected
TaskFormHandler
taskFormHandler
=
new
DefaultTaskFormHandler
();
// getters and setters //////////////////////////////////////////////////////
...
...
@@ -73,12 +79,27 @@ public class TaskDefinition {
candidateGroupIdValueExpressions
.
add
(
groupId
);
}
public
String
getForm
Resource
Key
()
{
return
form
Resource
Key
;
public
String
getFormKey
()
{
return
formKey
;
}
public
void
setForm
ResourceKey
(
String
formResource
Key
)
{
this
.
form
ResourceKey
=
formResource
Key
;
public
void
setForm
Key
(
String
form
Key
)
{
this
.
form
Key
=
form
Key
;
}
public
TaskFormHandler
getTaskFormHandler
()
{
return
taskFormHandler
;
}
public
void
setTaskFormHandler
(
TaskFormHandler
taskFormHandler
)
{
this
.
taskFormHandler
=
taskFormHandler
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskEntity.java
浏览文件 @
052d1a38
...
...
@@ -22,8 +22,10 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
org.activiti.engine.impl.cfg.RepositorySession
;
import
org.activiti.engine.impl.db.PersistentObject
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.repository.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.runtime.ExecutionEntity
;
import
org.activiti.engine.impl.runtime.VariableMap
;
import
org.activiti.engine.impl.util.ClockUtil
;
...
...
@@ -45,7 +47,6 @@ public class TaskEntity implements Task, Serializable, PersistentObject {
protected
String
assignee
;
protected
String
name
;
protected
String
description
;
protected
String
formResourceKey
;
protected
int
priority
=
Task
.
PRIORITY_NORMAL
;
protected
Date
createTime
;
// The time when the task has been created
protected
boolean
isIdentityLinksInitialized
=
false
;
...
...
@@ -59,6 +60,9 @@ public class TaskEntity implements Task, Serializable, PersistentObject {
protected
String
processDefinitionId
;
protected
String
taskDefinitionKey
;
protected
TaskDefinition
taskDefinition
;
public
TaskEntity
()
{
}
...
...
@@ -249,6 +253,22 @@ public class TaskEntity implements Task, Serializable, PersistentObject {
}
}
// modified getters and setters /////////////////////////////////////////////
public
void
setTaskDefinition
(
TaskDefinition
taskDefinition
)
{
this
.
taskDefinition
=
taskDefinition
;
this
.
taskDefinitionKey
=
taskDefinition
.
getKey
();
}
public
TaskDefinition
getTaskDefinition
()
{
if
(
taskDefinition
==
null
&&
taskDefinitionKey
!=
null
)
{
RepositorySession
repositorySession
=
CommandContext
.
getCurrentSession
(
RepositorySession
.
class
);
ProcessDefinitionEntity
processDefinition
=
repositorySession
.
findDeployedProcessDefinitionById
(
processDefinitionId
);
taskDefinition
=
processDefinition
.
getTaskDefinitions
().
get
(
taskDefinitionKey
);
}
return
taskDefinition
;
}
// getters and setters //////////////////////////////////////////////////////
public
String
getId
()
{
...
...
@@ -319,12 +339,11 @@ public class TaskEntity implements Task, Serializable, PersistentObject {
return
assignee
;
}
public
String
getFormResourceKey
()
{
return
formResourceKey
;
}
public
void
setFormResourceKey
(
String
formResourceKey
)
{
this
.
formResourceKey
=
formResourceKey
;
public
String
getTaskDefinitionKey
()
{
return
taskDefinitionKey
;
}
public
void
setTaskDefinitionKey
(
String
taskDefinitionKey
)
{
this
.
taskDefinitionKey
=
taskDefinitionKey
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/test/ActivitiInternalTestCase.java
浏览文件 @
052d1a38
...
...
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
import
junit.framework.AssertionFailedError
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.FormService
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.IdentityService
;
import
org.activiti.engine.ManagementService
;
...
...
@@ -74,6 +75,7 @@ public class ActivitiInternalTestCase extends PvmTestCase {
protected
RepositoryService
repositoryService
;
protected
RuntimeService
runtimeService
;
protected
TaskService
taskService
;
protected
FormService
formService
;
protected
HistoryService
historyService
;
protected
IdentityService
identityService
;
protected
ManagementService
managementService
;
...
...
@@ -193,6 +195,7 @@ public class ActivitiInternalTestCase extends PvmTestCase {
repositoryService
=
processEngine
.
getRepositoryService
();
runtimeService
=
processEngine
.
getRuntimeService
();
taskService
=
processEngine
.
getTaskService
();
formService
=
processEngine
.
getFormService
();
historyService
=
processEngine
.
getHistoryService
();
identityService
=
processEngine
.
getIdentityService
();
managementService
=
processEngine
.
getManagementService
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/repository/ProcessDefinition.java
浏览文件 @
052d1a38
...
...
@@ -12,6 +12,8 @@
*/
package
org.activiti.engine.repository
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.runtime.ProcessInstance
;
/** Is an object structure representing an executable process composed of
...
...
@@ -42,9 +44,13 @@ public interface ProcessDefinition {
/** label used for display purposes */
String
getName
();
/** name of {@link RepositoryService#getResourceAsStream(String, String) the resource}
* of this process definition. */
String
getResourceName
();
/** The deployment in which this process definition is contained. */
String
getDeploymentId
();
String
getStartFormResourceKey
();
/** logical name for the form that can be used by UI's to render the form. */
String
getFormKey
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/repository/ProcessDefinitionQuery.java
浏览文件 @
052d1a38
...
...
@@ -13,8 +13,6 @@
package
org.activiti.engine.repository
;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.query.Query
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/task/Task.java
浏览文件 @
052d1a38
...
...
@@ -54,8 +54,5 @@ public interface Task {
String
getProcessDefinitionId
();
String
getFormResourceKey
();
Date
getCreateTime
();
}
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.h2.create.sql
浏览文件 @
052d1a38
...
...
@@ -92,7 +92,7 @@ create table ACT_RE_PROC_DEF (
VERSION_
integer
,
DEPLOYMENT_ID_
varchar
(
64
),
RESOURCE_NAME_
varchar
(
255
),
START_FORM
_
varchar
(
255
),
FORM_KEY
_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -104,7 +104,7 @@ create table ACT_RU_TASK (
PROC_DEF_ID_
varchar
(
64
),
NAME_
varchar
(
255
),
DESCRIPTION_
varchar
(
255
),
FORM
_
varchar
(
255
),
TASK_DEF_KEY
_
varchar
(
255
),
ASSIGNEE_
varchar
(
64
),
PRIORITY_
integer
,
CREATE_TIME_
timestamp
,
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql.create.sql
浏览文件 @
052d1a38
...
...
@@ -93,7 +93,7 @@ create table ACT_RE_PROC_DEF (
VERSION_
integer
,
DEPLOYMENT_ID_
varchar
(
64
),
RESOURCE_NAME_
varchar
(
255
),
START_FORM
_
varchar
(
255
),
FORM_KEY
_
varchar
(
255
),
primary
key
(
ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
@@ -105,7 +105,7 @@ create table ACT_RU_TASK (
PROC_DEF_ID_
varchar
(
64
),
NAME_
varchar
(
255
),
DESCRIPTION_
varchar
(
255
),
FORM
_
varchar
(
255
),
TASK_DEF_KEY
_
varchar
(
255
),
ASSIGNEE_
varchar
(
64
),
PRIORITY_
integer
,
CREATE_TIME_
timestamp
,
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.sql
浏览文件 @
052d1a38
...
...
@@ -92,7 +92,7 @@ create table ACT_RE_PROC_DEF (
VERSION_
INTEGER
,
DEPLOYMENT_ID_
NVARCHAR2
(
64
),
RESOURCE_NAME_
NVARCHAR2
(
255
),
START_FORM
_
NVARCHAR2
(
255
),
FORM_KEY
_
NVARCHAR2
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -104,7 +104,7 @@ create table ACT_RU_TASK (
PROC_DEF_ID_
NVARCHAR2
(
64
),
NAME_
NVARCHAR2
(
255
),
DESCRIPTION_
NVARCHAR2
(
255
),
FORM
_
NVARCHAR2
(
255
),
TASK_DEF_KEY
_
NVARCHAR2
(
255
),
ASSIGNEE_
NVARCHAR2
(
64
),
PRIORITY_
INTEGER
,
CREATE_TIME_
TIMESTAMP
(
6
),
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.postgres.create.sql
浏览文件 @
052d1a38
...
...
@@ -93,7 +93,7 @@ create table ACT_RE_PROC_DEF (
VERSION_
integer
,
DEPLOYMENT_ID_
varchar
(
64
),
RESOURCE_NAME_
varchar
(
255
),
START_FORM
_
varchar
(
255
),
FORM_KEY
_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -105,7 +105,7 @@ create table ACT_RU_TASK (
PROC_DEF_ID_
varchar
(
64
),
NAME_
varchar
(
255
),
DESCRIPTION_
varchar
(
255
),
FORM
_
varchar
(
255
),
TASK_DEF_KEY
_
varchar
(
255
),
ASSIGNEE_
varchar
(
64
),
PRIORITY_
integer
,
CREATE_TIME_
timestamp
,
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/history.mapping.xml
浏览文件 @
052d1a38
...
...
@@ -227,7 +227,7 @@
<!-- HISTORIC VARIABLE UPDATE INSERT -->
<insert
id=
"insertHistoricVariableUpdate"
parameterType=
"org.activiti.engine.impl.history.HistoricVariableUpdateEntity"
>
insert into ACT_HI_VAR_UPDATE (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, TYPE_,
INDEX_,
TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT1_, TEXT2_)
insert into ACT_HI_VAR_UPDATE (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT1_, TEXT2_)
values (
#{id, jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
...
...
@@ -235,7 +235,6 @@
#{taskId, jdbcType=VARCHAR},
#{variableName, jdbcType=VARCHAR},
#{variableType, jdbcType=VARCHAR },
#{index, jdbcType=INTEGER },
#{time, jdbcType=TIMESTAMP },
#{byteArrayValueId, jdbcType=VARCHAR},
#{doubleValue, jdbcType=DOUBLE},
...
...
@@ -261,7 +260,6 @@
<result
property=
"name"
column=
"NAME_"
javaType=
"String"
jdbcType=
"VARCHAR"
/>
<result
property=
"type"
column=
"TYPE_"
javaType=
"org.activiti.engine.impl.variable.Type"
jdbcType=
"VARCHAR"
/>
<result
property=
"activityId"
column=
"ACTIVITY_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"index"
column=
"INDEX_"
jdbcType=
"INTEGER"
/>
<result
property=
"time"
column=
"TIME_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"activityId"
column=
"ACTIVITY_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"byteArrayValueId"
column=
"BYTEARRAY_ID_"
/>
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/repository.mapping.xml
浏览文件 @
052d1a38
...
...
@@ -118,13 +118,13 @@
<!-- PROCESSDEFINITION INSERT -->
<insert
id=
"insertProcessDefinition"
parameterType=
"org.activiti.engine.impl.repository.ProcessDefinitionEntity"
>
insert into ACT_RE_PROC_DEF(ID_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_,
START_FORM
_, RESOURCE_NAME_)
insert into ACT_RE_PROC_DEF(ID_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_,
FORM_KEY
_, RESOURCE_NAME_)
values (#{id, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{key, jdbcType=VARCHAR},
#{version, jdbcType=INTEGER},
#{deploymentId, jdbcType=VARCHAR},
#{
startFormResource
Key, jdbcType=VARCHAR},
#{
form
Key, jdbcType=VARCHAR},
#{resourceName, jdbcType=VARCHAR})
</insert>
...
...
@@ -145,7 +145,7 @@
<result
property=
"version"
column=
"VERSION_"
jdbcType=
"INTEGER"
/>
<result
property=
"deploymentId"
column=
"DEPLOYMENT_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"resourceName"
column=
"RESOURCE_NAME_"
jdbcType=
"VARCHAR"
/>
<result
property=
"
startFormResourceKey"
column=
"START_FORM
_"
jdbcType=
"VARCHAR"
/>
<result
property=
"
formKey"
column=
"FORM_KEY
_"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- PROCESSDEFINITION SELECT -->
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/task.mapping.xml
浏览文件 @
052d1a38
...
...
@@ -7,19 +7,19 @@
<!-- TASK INSERT -->
<insert
id=
"insertTask"
parameterType=
"org.activiti.engine.impl.task.TaskEntity"
>
insert into ACT_RU_TASK (ID_, REV_, NAME_, DESCRIPTION_,
FORM_,
PRIORITY_, CREATE_TIME_,
ASSIGNEE_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_)
insert into ACT_RU_TASK (ID_, REV_, NAME_, DESCRIPTION_, PRIORITY_, CREATE_TIME_,
ASSIGNEE_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_
, TASK_DEF_KEY_
)
values (#{id, jdbcType=VARCHAR},
1,
#{name, jdbcType=VARCHAR},
#{description, jdbcType=VARCHAR},
#{formResourceKey, jdbcType=VARCHAR},
#{priority, jdbcType=INTEGER},
#{createTime, jdbcType=TIMESTAMP},
#{assignee, jdbcType=VARCHAR},
#{executionId, jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
#{processDefinitionId, jdbcType=VARCHAR}
#{processDefinitionId, jdbcType=VARCHAR},
#{taskDefinitionKey, jdbcType=VARCHAR}
)
</insert>
...
...
@@ -52,12 +52,12 @@
<result
property=
"revision"
column=
"REV_"
jdbcType=
"INTEGER"
/>
<result
property=
"name"
column=
"NAME_"
jdbcType=
"VARCHAR"
/>
<result
property=
"description"
column=
"DESCRIPTION_"
jdbcType=
"VARCHAR"
/>
<result
property=
"formResourceKey"
column=
"FORM_"
jdbcType=
"VARCHAR"
/>
<result
property=
"priority"
column=
"PRIORITY_"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"CREATE_TIME_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"assignee"
column=
"ASSIGNEE_"
jdbcType=
"VARCHAR"
/>
<result
property=
"executionId"
column=
"EXECUTION_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"processDefinitionId"
column=
"PROC_DEF_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskDefinitionKey"
column=
"TASK_DEF_KEY_"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- TASK SELECT -->
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/RepositoryServiceTest.java
浏览文件 @
052d1a38
...
...
@@ -106,7 +106,7 @@ public class RepositoryServiceTest extends ActivitiInternalTestCase {
assertEquals
(
1
,
processDefinitions
.
size
());
ProcessDefinition
processDefinition
=
processDefinitions
.
get
(
0
);
Object
startForm
=
taskService
.
getRenderedStartFormById
(
processDefinition
.
getId
());
Object
startForm
=
formService
.
getRenderedStartForm
(
processDefinition
.
getId
());
assertNotNull
(
startForm
);
}
...
...
@@ -116,31 +116,22 @@ public class RepositoryServiceTest extends ActivitiInternalTestCase {
assertEquals
(
1
,
processDefinitions
.
size
());
ProcessDefinition
processDefinition
=
processDefinitions
.
get
(
0
);
Object
startForm
=
taskService
.
getRenderedStartFormById
(
processDefinition
.
getId
());
Object
startForm
=
formService
.
getRenderedStartForm
(
processDefinition
.
getId
());
assertNull
(
startForm
);
}
public
void
testGetStartFormByKeyNullKey
()
{
try
{
taskService
.
getRenderedStartFormByKey
(
null
);
formService
.
getRenderedStartForm
(
null
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
// Exception expected
}
}
public
void
testGetStartFormByKeyUnexistingProcessDefinitionKey
()
{
try
{
taskService
.
getRenderedStartFormByKey
(
"unexisting"
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
assertTextPresent
(
"no processes deployed with key"
,
ae
.
getMessage
());
}
}
public
void
testGetStartFormByIdNullId
()
{
try
{
taskService
.
getRenderedStartFormById
(
null
);
formService
.
getRenderedStartForm
(
null
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
// Exception expected
...
...
@@ -149,7 +140,7 @@ public class RepositoryServiceTest extends ActivitiInternalTestCase {
public
void
testGetStartFormByIdUnexistingProcessDefinitionId
()
{
try
{
taskService
.
getRenderedStartFormById
(
"unexistingId"
);
formService
.
getRenderedStartForm
(
"unexistingId"
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
assertTextPresent
(
"no deployed process definition found with id"
,
ae
.
getMessage
());
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
浏览文件 @
052d1a38
...
...
@@ -208,7 +208,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
public
void
testGetTaskFormNullTaskId
()
{
try
{
task
Service
.
getRenderedTaskForm
(
null
);
form
Service
.
getRenderedTaskForm
(
null
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
// Expected Exception
...
...
@@ -217,10 +217,10 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
public
void
testGetTaskFormUnexistingTaskId
()
{
try
{
task
Service
.
getRenderedTaskForm
(
"unexistingtask"
);
form
Service
.
getRenderedTaskForm
(
"unexistingtask"
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
assertTextPresent
(
"
No task found for id = 'unexistingtask'
"
,
ae
.
getMessage
());
assertTextPresent
(
"
Task 'unexistingtask' not found
"
,
ae
.
getMessage
());
}
}
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/taskforms/TaskFormsTest.java
浏览文件 @
052d1a38
...
...
@@ -45,11 +45,11 @@ public class TaskFormsTest extends ActivitiInternalTestCase {
public
void
testTaskFormsWithVacationRequestProcess
()
{
// Get start form
Object
startForm
=
taskService
.
getRenderedStartFormByKey
(
"vacationRequest
"
);
Object
startForm
=
formService
.
getRenderedStartForm
(
"vacationRequest:1
"
);
assertNotNull
(
startForm
);
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
singleResult
();
assertEquals
(
"org/activiti/examples/taskforms/request.form"
,
processDefinition
.
get
StartFormResource
Key
());
assertEquals
(
"org/activiti/examples/taskforms/request.form"
,
processDefinition
.
get
Form
Key
());
// Define variables that would be filled in through the form
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -61,18 +61,18 @@ public class TaskFormsTest extends ActivitiInternalTestCase {
// Management should now have a task assigned to them
Task
task
=
taskService
.
createTaskQuery
().
candidateGroup
(
"management"
).
singleResult
();
assertEquals
(
"Vacation request by kermit"
,
task
.
getDescription
());
Object
taskForm
=
task
Service
.
getRenderedTaskForm
(
task
.
getId
());
Object
taskForm
=
form
Service
.
getRenderedTaskForm
(
task
.
getId
());
assertNotNull
(
taskForm
);
}
@Deployment
public
void
testTaskFormUnavailable
()
{
assertNull
(
taskService
.
getRenderedStartFormByKey
(
"noStartOrTaskForm
"
));
assertNull
(
formService
.
getRenderedStartForm
(
"noStartOrTaskForm:1
"
));
runtimeService
.
startProcessInstanceByKey
(
"noStartOrTaskForm"
);
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
assertNull
(
task
Service
.
getRenderedTaskForm
(
task
.
getId
()));
assertNull
(
form
Service
.
getRenderedTaskForm
(
task
.
getId
()));
}
}
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/process/ProcessDefinitionFormGet.java
浏览文件 @
052d1a38
...
...
@@ -28,7 +28,7 @@ public class ProcessDefinitionFormGet extends ActivitiStreamingWebScript
@Override
protected
void
executeStreamingWebScript
(
ActivitiRequest
req
,
WebScriptResponse
res
)
{
String
processDefinitionId
=
req
.
getMandatoryPathParameter
(
"processDefinitionId"
);
Object
form
=
get
TaskService
().
getRenderedStartFormById
(
processDefinitionId
);
Object
form
=
get
FormService
().
getRenderedStartForm
(
processDefinitionId
);
InputStream
is
=
null
;
if
(
form
!=
null
&&
form
instanceof
String
)
{
is
=
new
ByteArrayInputStream
(((
String
)
form
).
getBytes
());
...
...
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/task/TaskFormGet.java
浏览文件 @
052d1a38
...
...
@@ -31,7 +31,7 @@ public class TaskFormGet extends ActivitiStreamingWebScript
@Override
protected
void
executeStreamingWebScript
(
ActivitiRequest
req
,
WebScriptResponse
res
)
{
String
taskId
=
req
.
getMandatoryPathParameter
(
"taskId"
);
Object
form
=
get
Task
Service
().
getRenderedTaskForm
(
taskId
);
Object
form
=
get
Form
Service
().
getRenderedTaskForm
(
taskId
);
InputStream
is
=
null
;
if
(
form
!=
null
&&
form
instanceof
String
)
{
is
=
new
ByteArrayInputStream
(((
String
)
form
).
getBytes
());
...
...
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/util/ActivitiStreamingWebScript.java
浏览文件 @
052d1a38
...
...
@@ -206,5 +206,12 @@ public class ActivitiStreamingWebScript extends AbstractWebScript {
return
getProcessEngine
().
getTaskService
();
}
/**
* Returns the form service.
*
* @return The form service
*/
protected
FormService
getFormService
()
{
return
getProcessEngine
().
getFormService
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录