Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
17340008
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,发现更多精彩内容 >>
提交
17340008
编写于
7月 03, 2013
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cherry pick of deployment category update and process definition key query
上级
30f17e68
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
119 addition
and
14 deletion
+119
-14
modules/activiti-engine/src/main/java/org/activiti/engine/RepositoryService.java
.../src/main/java/org/activiti/engine/RepositoryService.java
+8
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RepositoryServiceImpl.java
.../java/org/activiti/engine/impl/RepositoryServiceImpl.java
+9
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/SetDeploymentCategoryCmd.java
...rg/activiti/engine/impl/cmd/SetDeploymentCategoryCmd.java
+73
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntity.java
...viti/engine/impl/persistence/entity/DeploymentEntity.java
+7
-10
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/Deployment.xml
...n/resources/org/activiti/db/mapping/entity/Deployment.xml
+6
-0
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/DeploymentCategoryTest.java
...ti/engine/test/api/repository/DeploymentCategoryTest.java
+16
-0
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/RepositoryService.java
浏览文件 @
17340008
...
...
@@ -65,6 +65,14 @@ public interface RepositoryService {
* @param deploymentId id of the deployment, cannot be null.
*/
void
deleteDeployment
(
String
deploymentId
,
boolean
cascade
);
/**
* Sets the category of the deployment.
* Deployments can be queried by category: see {@link DeploymentQuery#deploymentCategory(String)}.
*
* @throws ActivitiObjectNotFoundException if no deployment with the provided id can be found.
*/
void
setDeploymentCategory
(
String
deploymentId
,
String
category
);
/**
* Retrieves a list of deployment resources for the given deployment,
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RepositoryServiceImpl.java
浏览文件 @
17340008
...
...
@@ -13,6 +13,10 @@
package
org.activiti.engine.impl
;
import
java.io.InputStream
;
import
java.util.Date
;
import
java.util.List
;
import
org.activiti.bpmn.model.BpmnModel
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.impl.cmd.ActivateProcessDefinitionCmd
;
...
...
@@ -36,6 +40,7 @@ import org.activiti.engine.impl.cmd.GetModelCmd;
import
org.activiti.engine.impl.cmd.GetModelEditorSourceCmd
;
import
org.activiti.engine.impl.cmd.GetModelEditorSourceExtraCmd
;
import
org.activiti.engine.impl.cmd.SaveModelCmd
;
import
org.activiti.engine.impl.cmd.SetDeploymentCategoryCmd
;
import
org.activiti.engine.impl.cmd.SetProcessDefinitionCategoryCmd
;
import
org.activiti.engine.impl.cmd.SuspendProcessDefinitionCmd
;
import
org.activiti.engine.impl.persistence.entity.ModelEntity
;
...
...
@@ -54,10 +59,6 @@ import org.activiti.engine.repository.ProcessDefinition;
import
org.activiti.engine.repository.ProcessDefinitionQuery
;
import
org.activiti.engine.task.IdentityLink
;
import
java.io.InputStream
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Tom Baeyens
...
...
@@ -85,6 +86,10 @@ public class RepositoryServiceImpl extends ServiceImpl implements RepositoryServ
public
void
deleteDeployment
(
String
deploymentId
,
boolean
cascade
)
{
commandExecutor
.
execute
(
new
DeleteDeploymentCmd
(
deploymentId
,
cascade
));
}
public
void
setDeploymentCategory
(
String
deploymentId
,
String
category
)
{
commandExecutor
.
execute
(
new
SetDeploymentCategoryCmd
(
deploymentId
,
category
));
}
public
ProcessDefinitionQuery
createProcessDefinitionQuery
()
{
return
new
ProcessDefinitionQueryImpl
(
commandExecutor
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/SetDeploymentCategoryCmd.java
0 → 100644
浏览文件 @
17340008
/* 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.ActivitiIllegalArgumentException
;
import
org.activiti.engine.ActivitiObjectNotFoundException
;
import
org.activiti.engine.impl.context.Context
;
import
org.activiti.engine.impl.interceptor.Command
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.persistence.entity.DeploymentEntity
;
import
org.activiti.engine.repository.Deployment
;
/**
* @author Tijs Rademakers
*/
public
class
SetDeploymentCategoryCmd
implements
Command
<
Void
>
{
protected
String
deploymentId
;
protected
String
category
;
public
SetDeploymentCategoryCmd
(
String
deploymentId
,
String
category
)
{
this
.
deploymentId
=
deploymentId
;
this
.
category
=
category
;
}
public
Void
execute
(
CommandContext
commandContext
)
{
if
(
deploymentId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Deployment id is null"
);
}
DeploymentEntity
deployment
=
Context
.
getCommandContext
()
.
getDeploymentEntityManager
()
.
findDeploymentById
(
deploymentId
);
if
(
deployment
==
null
)
{
throw
new
ActivitiObjectNotFoundException
(
"No deployment found for id = '"
+
deploymentId
+
"'"
,
Deployment
.
class
);
}
// Update category
deployment
.
setCategory
(
category
);
return
null
;
}
public
String
getDeploymentId
()
{
return
deploymentId
;
}
public
void
setDeploymentId
(
String
deploymentId
)
{
this
.
deploymentId
=
deploymentId
;
}
public
String
getCategory
()
{
return
category
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntity.java
浏览文件 @
17340008
...
...
@@ -45,15 +45,6 @@ public class DeploymentEntity implements Serializable, Deployment, PersistentObj
*/
protected
Map
<
Class
<?>,
List
<
Object
>>
deployedArtifacts
;
public
Object
getPersistentState
()
{
// properties of this entity are immutable
// so always the same value is returned
// so never will an update be issued for a DeploymentEntity
return
DeploymentEntity
.
class
;
}
// lazy loading /////////////////////////////////////////////////////////////
public
ResourceEntity
getResource
(
String
resourceName
)
{
return
getResources
().
get
(
resourceName
);
}
...
...
@@ -65,6 +56,7 @@ public class DeploymentEntity implements Serializable, Deployment, PersistentObj
resources
.
put
(
resource
.
getName
(),
resource
);
}
// lazy loading /////////////////////////////////////////////////////////////
public
Map
<
String
,
ResourceEntity
>
getResources
()
{
if
(
resources
==
null
&&
id
!=
null
)
{
List
<
ResourceEntity
>
resourcesList
=
Context
...
...
@@ -79,8 +71,13 @@ public class DeploymentEntity implements Serializable, Deployment, PersistentObj
return
resources
;
}
// deployed artifacts manipulation //////////////////////////////////////////
public
Object
getPersistentState
()
{
Map
<
String
,
Object
>
persistentState
=
new
HashMap
<
String
,
Object
>();
persistentState
.
put
(
"category"
,
this
.
category
);
return
persistentState
;
}
// Deployed artifacts manipulation //////////////////////////////////////////
public
void
addDeployedArtifact
(
Object
deployedArtifact
)
{
if
(
deployedArtifacts
==
null
)
{
deployedArtifacts
=
new
HashMap
<
Class
<?>,
List
<
Object
>>();
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/Deployment.xml
浏览文件 @
17340008
...
...
@@ -13,6 +13,12 @@
<!-- DEPLOYMENT UPDATE -->
<update
id=
"updateDeployment"
parameterType=
"org.activiti.engine.impl.persistence.entity.DeploymentEntity"
>
update ${prefix}ACT_RE_DEPLOYMENT set
CATEGORY_ = #{category, jdbcType=VARCHAR}
where ID_ = #{id, jdbcType=VARCHAR}
</update>
<!-- DEPLOYMENT DELETE -->
<delete
id=
"deleteDeployment"
parameterType=
"string"
>
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/DeploymentCategoryTest.java
浏览文件 @
17340008
...
...
@@ -32,6 +32,7 @@ public class DeploymentCategoryTest extends PluggableActivitiTestCase {
String
deploymentOneId
=
null
;
String
deploymentTwoV1Id
=
null
;
String
deploymentTwoV2Id
=
null
;
String
deploymentTwoNoCategory
=
null
;
try
{
noCategoryDeploymentId
=
repositoryService
...
...
@@ -86,12 +87,27 @@ public class DeploymentCategoryTest extends PluggableActivitiTestCase {
expectedDeploymentNames
.
add
(
"0"
);
assertEquals
(
expectedDeploymentNames
,
deploymentNames
);
deploymentTwoNoCategory
=
repositoryService
.
createDeployment
()
.
name
(
"noCategory"
)
.
addClasspathResource
(
"org/activiti/engine/test/repository/two.bpmn20.xml"
)
.
deploy
()
.
getId
();
Deployment
deploymentNoCategory
=
repositoryService
.
createDeploymentQuery
().
deploymentId
(
deploymentTwoNoCategory
).
singleResult
();
assertNull
(
deploymentNoCategory
.
getCategory
());
repositoryService
.
setDeploymentCategory
(
deploymentTwoNoCategory
,
"newCategory"
);
deploymentNoCategory
=
repositoryService
.
createDeploymentQuery
().
deploymentId
(
deploymentTwoNoCategory
).
singleResult
();
assertEquals
(
"newCategory"
,
deploymentNoCategory
.
getCategory
());
}
finally
{
if
(
noCategoryDeploymentId
!=
null
)
undeploy
(
noCategoryDeploymentId
);
if
(
deploymentOneId
!=
null
)
undeploy
(
deploymentOneId
);
if
(
deploymentTwoV1Id
!=
null
)
undeploy
(
deploymentTwoV1Id
);
if
(
deploymentTwoV2Id
!=
null
)
undeploy
(
deploymentTwoV2Id
);
if
(
deploymentTwoNoCategory
!=
null
)
undeploy
(
deploymentTwoNoCategory
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录