Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
86b54f06
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,发现更多精彩内容 >>
提交
86b54f06
编写于
11月 05, 2013
作者:
T
tijsrademakers
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/Activiti/Activiti
上级
7ccf79c4
96e5b0b9
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
241 addition
and
45 deletion
+241
-45
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoConversionConstants.java
...mple/alfresco/conversion/AlfrescoConversionConstants.java
+6
-1
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoConversionUtil.java
...ow/simple/alfresco/conversion/AlfrescoConversionUtil.java
+5
-5
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoEmailStepConverter.java
...imple/alfresco/conversion/AlfrescoEmailStepConverter.java
+13
-6
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoHumanStepDefinitionConverter.java
...esco/conversion/AlfrescoHumanStepDefinitionConverter.java
+1
-1
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/InitializeAlfrescoModelsConversionListener.java
...onversion/InitializeAlfrescoModelsConversionListener.java
+38
-15
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/form/AlfrescoReferencePropertyConverter.java
...o/conversion/form/AlfrescoReferencePropertyConverter.java
+38
-1
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/export/AlfrescoArtifactExporter.java
...flow/simple/alfresco/export/AlfrescoArtifactExporter.java
+60
-11
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/model/config/ModuleDeployment.java
...rkflow/simple/alfresco/model/config/ModuleDeployment.java
+42
-0
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/step/AlfrescoReviewStepDefinition.java
...ow/simple/alfresco/step/AlfrescoReviewStepDefinition.java
+2
-1
modules/activiti-simple-workflow-alfresco/src/test/java/org/activiti/workflow/simple/alfresco/test/WorkflowDefinitionConversionTest.java
...imple/alfresco/test/WorkflowDefinitionConversionTest.java
+2
-2
modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/definition/FormStepDefinition.java
...tiviti/workflow/simple/definition/FormStepDefinition.java
+28
-0
modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/definition/HumanStepDefinition.java
...iviti/workflow/simple/definition/HumanStepDefinition.java
+6
-2
未找到文件。
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoConversionConstants.java
浏览文件 @
86b54f06
...
...
@@ -59,6 +59,7 @@ public interface AlfrescoConversionConstants {
String
PROPERTY_WORKFLOW_DUE_DATE
=
"bpm:workflowDueDate"
;
String
PROPERTY_WORKFLOW_PRIORITY
=
"bpm:workflowPriority"
;
String
PROPERTY_SEND_EMAIL_NOTIFICATIONS
=
"bpm:sendEMailNotifications"
;
String
PROPERTY_COMMENT
=
"bpm:comment"
;
String
PROPERTY_PACKAGEITEMS
=
"packageItems"
;
String
PROPERTY_PACKAGEITEMS_ITEM_ACTION_GROUP
=
"bpm:packageItemActionGroup"
;
...
...
@@ -123,6 +124,7 @@ public interface AlfrescoConversionConstants {
String
FORM_SET_ITEMS_LABEL
=
"workflow.set.items"
;
String
FORM_SET_OTHER_LABEL
=
"workflow.set.other"
;
String
FORM_WORKFLOW_DESCRIPTION_LABEL
=
"workflow.field.message"
;
String
FORM_COMMENT_LABEL
=
"workflow.field.comment"
;
String
FORM_WORKFLOW_DUE_DATE_LABEL
=
"workflow.field.due"
;
String
FORM_WORKFLOW_PRIORITY_LABEL
=
"workflow.field.priority"
;
...
...
@@ -134,6 +136,8 @@ public interface AlfrescoConversionConstants {
String
FORM_GROUP_LAYOUT_3_COLUMNS
=
"three-column"
;
String
FORM_REFERENCE_DUEDATE
=
"duedate"
;
String
FORM_REFERENCE_EMAIL_NOTIFICATION
=
"email-notification"
;
String
FORM_REFERENCE_COMMENT
=
"comment"
;
String
FORM_REFERENCE_PRIORITY
=
"priority"
;
String
FORM_REFERENCE_WORKFLOW_DESCRIPTION
=
"workflow-description"
;
String
FORM_REFERENCE_PACKAGE_ITEMS
=
"package-items"
;
...
...
@@ -153,11 +157,12 @@ public interface AlfrescoConversionConstants {
String
PARAMETER_PACKAGEITEMS_ALLOW_REMOVE
=
"allow-remove"
;
String
PARAMETER_ADD_PROPERTY_TO_OUTPUT
=
"property-output"
;
String
PARAMETER_REFERENCE_MANY
=
"reference-many"
;
String
PARAMETER_FORCE_NOTOFICATIONS
=
"force-notifications"
;
// Artifact keys
String
ARTIFACT_CONTENT_MODEL_KEY
=
"contentModel"
;
String
ARTIFACT_SHARE_CONFIG_
MODULE
=
"configModule
"
;
String
ARTIFACT_SHARE_CONFIG_
EXTENSION
=
"configExtension
"
;
String
ARTIFACT_MODEL_NAMESPACE_PREFIX
=
"modelNamespacePrefix"
;
String
ARTIFACT_PROPERTY_SHARING
=
"propertySharing"
;
String
ARTIFACT_PROPERTY_TASK_SCRIPT_BUILDER
=
"scriptTaskListenerBuilder"
;
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoConversionUtil.java
浏览文件 @
86b54f06
...
...
@@ -22,7 +22,7 @@ import org.activiti.workflow.simple.alfresco.conversion.script.PropertyReference
import
org.activiti.workflow.simple.alfresco.conversion.script.ScriptTaskListenerBuilder
;
import
org.activiti.workflow.simple.alfresco.model.M2Model
;
import
org.activiti.workflow.simple.alfresco.model.M2Namespace
;
import
org.activiti.workflow.simple.alfresco.model.config.
Module
;
import
org.activiti.workflow.simple.alfresco.model.config.
Extension
;
import
org.activiti.workflow.simple.converter.WorkflowDefinitionConversion
;
/**
...
...
@@ -72,12 +72,12 @@ public class AlfrescoConversionUtil implements AlfrescoConversionConstants {
return
(
M2Model
)
conversion
.
getArtifact
(
ARTIFACT_CONTENT_MODEL_KEY
);
}
public
static
void
store
Module
(
Module
module
,
WorkflowDefinitionConversion
conversion
)
{
conversion
.
setArtifact
(
ARTIFACT_SHARE_CONFIG_
MODULE
,
module
);
public
static
void
store
Extension
(
Extension
module
,
WorkflowDefinitionConversion
conversion
)
{
conversion
.
setArtifact
(
ARTIFACT_SHARE_CONFIG_
EXTENSION
,
module
);
}
public
static
Module
getModule
(
WorkflowDefinitionConversion
conversion
)
{
return
(
Module
)
conversion
.
getArtifact
(
ARTIFACT_SHARE_CONFIG_MODULE
);
public
static
Extension
getExtension
(
WorkflowDefinitionConversion
conversion
)
{
return
(
Extension
)
conversion
.
getArtifact
(
ARTIFACT_SHARE_CONFIG_EXTENSION
);
}
public
static
void
storeModelNamespacePrefix
(
String
prefix
,
WorkflowDefinitionConversion
conversion
)
{
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoEmailStepConverter.java
浏览文件 @
86b54f06
...
...
@@ -35,11 +35,11 @@ public class AlfrescoEmailStepConverter extends BaseStepDefinitionConverter<Alfr
ScriptServiceTaskBuilder
builder
=
new
ScriptServiceTaskBuilder
();
builder
.
addLine
(
"var mail = actions.create('mail');"
);
addMailActionParameter
(
"to"
,
stepDefinition
.
getTo
(
),
builder
);
addMailActionParameter
(
"cc"
,
stepDefinition
.
getCc
(
),
builder
);
addMailActionParameter
(
"from"
,
stepDefinition
.
getFrom
(
),
builder
);
addMailActionParameter
(
"subject"
,
stepDefinition
.
getSubject
(
),
builder
);
addMailActionParameter
(
"text"
,
stepDefinition
.
getBody
(
),
builder
);
addMailActionParameter
(
"to"
,
getSafeJsString
(
stepDefinition
.
getTo
()
),
builder
);
addMailActionParameter
(
"cc"
,
getSafeJsString
(
stepDefinition
.
getCc
()
),
builder
);
addMailActionParameter
(
"from"
,
getSafeJsString
(
stepDefinition
.
getFrom
()
),
builder
);
addMailActionParameter
(
"subject"
,
getSafeJsString
(
stepDefinition
.
getSubject
()
),
builder
);
addMailActionParameter
(
"text"
,
getSafeJsString
(
stepDefinition
.
getBody
()
),
builder
);
builder
.
addLine
(
"mail.execute(bpm_package);"
);
// Build the actual task and add it to the process
...
...
@@ -50,13 +50,20 @@ public class AlfrescoEmailStepConverter extends BaseStepDefinitionConverter<Alfr
return
serviceTask
;
}
protected
String
getSafeJsString
(
String
string
)
{
if
(
string
!=
null
)
{
string
=
string
.
replace
(
"'"
,
"\\'"
);
}
return
string
;
}
protected
void
addMailActionParameter
(
String
name
,
String
value
,
ScriptServiceTaskBuilder
builder
)
{
builder
.
addLine
(
"mail.parameters."
+
name
+
"='"
+
getSafeScriptLiteral
(
value
)
+
"';"
);
}
protected
String
getSafeScriptLiteral
(
String
value
)
{
if
(
value
!=
null
)
{
return
value
.
replace
(
"\n"
,
"\\\n"
);
return
value
.
replace
(
"\n"
,
"\\
n\\
\n"
);
}
else
{
return
""
;
}
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/AlfrescoHumanStepDefinitionConverter.java
浏览文件 @
86b54f06
...
...
@@ -84,7 +84,7 @@ public class AlfrescoHumanStepDefinitionConverter extends HumanStepDefinitionCon
userTask
.
setFormKey
(
type
.
getName
());
// Create a form-config for the task
Module
shareModule
=
AlfrescoConversionUtil
.
get
Module
(
conversion
);
Module
shareModule
=
AlfrescoConversionUtil
.
get
Extension
(
conversion
).
getModules
().
get
(
0
);
Configuration
configuration
=
shareModule
.
addConfiguration
(
AlfrescoConversionConstants
.
EVALUATOR_TASK_TYPE
,
type
.
getName
());
Form
formConfig
=
configuration
.
createForm
();
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/InitializeAlfrescoModelsConversionListener.java
浏览文件 @
86b54f06
...
...
@@ -39,15 +39,20 @@ import org.activiti.workflow.simple.alfresco.model.M2Model;
import
org.activiti.workflow.simple.alfresco.model.M2Namespace
;
import
org.activiti.workflow.simple.alfresco.model.M2Type
;
import
org.activiti.workflow.simple.alfresco.model.config.Configuration
;
import
org.activiti.workflow.simple.alfresco.model.config.Extension
;
import
org.activiti.workflow.simple.alfresco.model.config.Form
;
import
org.activiti.workflow.simple.alfresco.model.config.FormField
;
import
org.activiti.workflow.simple.alfresco.model.config.FormFieldControl
;
import
org.activiti.workflow.simple.alfresco.model.config.FormFieldControlParameter
;
import
org.activiti.workflow.simple.alfresco.model.config.Module
;
import
org.activiti.workflow.simple.alfresco.step.AlfrescoReviewStepDefinition
;
import
org.activiti.workflow.simple.converter.WorkflowDefinitionConversion
;
import
org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener
;
import
org.activiti.workflow.simple.definition.HumanStepDefinition
;
import
org.activiti.workflow.simple.definition.AbstractConditionStepListContainer
;
import
org.activiti.workflow.simple.definition.AbstractStepDefinitionContainer
;
import
org.activiti.workflow.simple.definition.AbstractStepListContainer
;
import
org.activiti.workflow.simple.definition.FormStepDefinition
;
import
org.activiti.workflow.simple.definition.ListConditionStepDefinition
;
import
org.activiti.workflow.simple.definition.ListStepDefinition
;
import
org.activiti.workflow.simple.definition.StepDefinition
;
import
org.activiti.workflow.simple.definition.WorkflowDefinition
;
import
org.activiti.workflow.simple.definition.form.FormDefinition
;
...
...
@@ -90,7 +95,7 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
}
M2Model
model
=
addContentModel
(
conversion
,
processId
);
add
Module
(
conversion
,
processId
);
add
Extension
(
conversion
,
processId
);
// In case the same property definitions are used across multiple forms, we need to identify this
// up-front and create an aspect for this that can be shared due to the fact that you cannot define the same
...
...
@@ -111,7 +116,7 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
StartEvent
startEvent
=
(
StartEvent
)
flowElement
;
if
(
startEvent
.
getFormKey
()
==
null
)
{
Module
module
=
AlfrescoConversionUtil
.
get
Module
(
conversion
);
Module
module
=
AlfrescoConversionUtil
.
get
Extension
(
conversion
).
getModules
().
get
(
0
);
Configuration
detailsForm
=
module
.
addConfiguration
(
EVALUATOR_STRING_COMPARE
,
MessageFormat
.
format
(
EVALUATOR_CONDITION_ACTIVITI
,
conversion
.
getProcess
().
getId
()));
...
...
@@ -129,7 +134,7 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
type
.
setParentName
(
AlfrescoConversionConstants
.
DEFAULT_START_FORM_TYPE
);
// Create a form-config for the start-task
Module
shareModule
=
AlfrescoConversionUtil
.
get
Module
(
conversion
);
Module
shareModule
=
AlfrescoConversionUtil
.
get
Extension
(
conversion
).
getModules
().
get
(
0
);
Configuration
configuration
=
shareModule
.
addConfiguration
(
AlfrescoConversionConstants
.
EVALUATOR_TASK_TYPE
,
type
.
getName
());
Form
formConfig
=
configuration
.
createForm
();
...
...
@@ -242,13 +247,8 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
// Add start-form properties
addDefinitionsToMap
(
workflowDefinition
.
getStartFormDefinition
(),
definitionMap
);
for
(
StepDefinition
step
:
workflowDefinition
.
getSteps
())
{
if
(
step
instanceof
HumanStepDefinition
)
{
addDefinitionsToMap
(((
HumanStepDefinition
)
step
).
getForm
(),
definitionMap
);
}
else
if
(
step
instanceof
AlfrescoReviewStepDefinition
)
{
addDefinitionsToMap
(((
AlfrescoReviewStepDefinition
)
step
).
getForm
(),
definitionMap
);
}
}
// Run through steps recursivelye, looking for properties
addAspectsForReusedProperties
(
workflowDefinition
.
getSteps
(),
model
,
processId
,
definitionMap
);
// Check if the map contains values other than null, this indicates duplicate properties are found
for
(
Entry
<
String
,
FormPropertyDefinition
>
entry
:
definitionMap
.
entrySet
())
{
...
...
@@ -260,7 +260,28 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
model
.
getAspects
().
add
(
aspect
);
}
}
}
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
protected
void
addAspectsForReusedProperties
(
List
<
StepDefinition
>
steps
,
M2Model
model
,
String
processId
,
Map
<
String
,
FormPropertyDefinition
>
definitionMap
)
{
for
(
StepDefinition
step
:
steps
)
{
if
(
step
instanceof
FormStepDefinition
)
{
addDefinitionsToMap
(((
FormStepDefinition
)
step
).
getForm
(),
definitionMap
);
}
else
if
(
step
instanceof
AbstractStepListContainer
<?>)
{
List
<
ListStepDefinition
<?>>
stepList
=
((
AbstractStepListContainer
)
step
).
getStepList
();
for
(
ListStepDefinition
<?>
list
:
stepList
)
{
addAspectsForReusedProperties
(
list
.
getSteps
(),
model
,
processId
,
definitionMap
);
}
}
else
if
(
step
instanceof
AbstractConditionStepListContainer
<?>)
{
List
<
ListConditionStepDefinition
<?>>
stepList
=
((
AbstractConditionStepListContainer
)
step
).
getStepList
();
for
(
ListConditionStepDefinition
<?>
list
:
stepList
)
{
addAspectsForReusedProperties
(
list
.
getSteps
(),
model
,
processId
,
definitionMap
);
}
}
else
if
(
step
instanceof
AbstractStepDefinitionContainer
<?>)
{
addAspectsForReusedProperties
(((
AbstractStepDefinitionContainer
<
WorkflowDefinition
>)
step
).
getSteps
(),
model
,
processId
,
definitionMap
);
}
}
}
protected
void
addDefinitionsToMap
(
FormDefinition
formDefinition
,
Map
<
String
,
FormPropertyDefinition
>
definitionMap
)
{
if
(
formDefinition
!=
null
&&
formDefinition
.
getFormGroups
()
!=
null
)
{
...
...
@@ -315,11 +336,13 @@ public class InitializeAlfrescoModelsConversionListener implements WorkflowDefin
return
model
;
}
protected
void
add
Module
(
WorkflowDefinitionConversion
conversion
,
String
processId
)
{
protected
void
add
Extension
(
WorkflowDefinitionConversion
conversion
,
String
processId
)
{
// Create form-configuration
Extension
extension
=
new
Extension
();
Module
module
=
new
Module
();
extension
.
addModule
(
module
);
module
.
setId
(
MessageFormat
.
format
(
MODULE_ID
,
processId
));
AlfrescoConversionUtil
.
store
Module
(
module
,
conversion
);
AlfrescoConversionUtil
.
store
Extension
(
extension
,
conversion
);
}
protected
void
populateDefaultDetailFormConfig
(
Configuration
configuration
)
{
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/conversion/form/AlfrescoReferencePropertyConverter.java
浏览文件 @
86b54f06
...
...
@@ -47,10 +47,14 @@ public class AlfrescoReferencePropertyConverter extends BaseAlfrescoFormProperty
addDueDateReference
(
form
,
formSet
,
referenceDefinition
.
isWritable
());
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_PACKAGE_ITEMS
.
equals
(
referenceDefinition
.
getType
()))
{
addPackageReference
(
form
,
formSet
,
contentType
,
referenceDefinition
);
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_EMAIL_NOTIFICATION
.
equals
(
referenceDefinition
.
getType
()))
{
addEmailNotificationReference
(
form
,
formSet
,
contentType
,
referenceDefinition
);
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_PRIORITY
.
equals
(
referenceDefinition
.
getType
()))
{
addPriorityReference
(
form
,
formSet
,
referenceDefinition
.
isWritable
());
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_WORKFLOW_DESCRIPTION
.
equals
(
referenceDefinition
.
getType
()))
{
addWorkflowDescriptionReference
(
form
,
formSet
);
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_COMMENT
.
equals
(
referenceDefinition
.
getType
()))
{
addCommentReference
(
form
,
formSet
);
}
else
if
(
AlfrescoConversionConstants
.
FORM_REFERENCE_FIELD
.
equals
(
referenceDefinition
.
getType
()))
{
addFieldReference
(
form
,
formSet
,
referenceDefinition
,
contentType
,
conversion
);
}
else
{
...
...
@@ -167,6 +171,17 @@ public class AlfrescoReferencePropertyConverter extends BaseAlfrescoFormProperty
}
form
.
getFormAppearance
().
addFormAppearanceElement
(
descriptionField
);
}
protected
void
addCommentReference
(
Form
form
,
String
formSet
)
{
form
.
getFormFieldVisibility
().
addShowFieldElement
(
AlfrescoConversionConstants
.
PROPERTY_COMMENT
);
FormField
commentField
=
new
FormField
();
commentField
.
setId
(
AlfrescoConversionConstants
.
PROPERTY_COMMENT
);
commentField
.
setLabelId
(
AlfrescoConversionConstants
.
FORM_COMMENT_LABEL
);
commentField
.
setSet
(
formSet
);
commentField
.
setControl
(
new
FormFieldControl
(
AlfrescoConversionConstants
.
FORM_MULTILINE_TEXT_TEMPLATE
));
form
.
getFormAppearance
().
addFormAppearanceElement
(
commentField
);
}
protected
void
addPriorityReference
(
Form
form
,
String
formSet
,
boolean
writable
)
{
...
...
@@ -206,7 +221,6 @@ public class AlfrescoReferencePropertyConverter extends BaseAlfrescoFormProperty
addOrAlterPackageItemActions
(
contentType
,
allowAddingItems
,
allowRemovingItems
);
}
}
protected
void
addDueDateReference
(
Form
form
,
String
formSet
,
boolean
writable
)
{
...
...
@@ -241,6 +255,29 @@ public class AlfrescoReferencePropertyConverter extends BaseAlfrescoFormProperty
form
.
getFormAppearance
().
addFormAppearanceElement
(
formField
);
}
protected
void
addEmailNotificationReference
(
Form
form
,
String
formSet
,
M2Type
type
,
ReferencePropertyDefinition
def
)
{
// Only relevant on a start-form
if
(
form
.
isStartForm
())
{
boolean
forced
=
extractBooleanFromParameters
(
def
.
getParameters
(),
AlfrescoConversionConstants
.
PARAMETER_FORCE_NOTOFICATIONS
,
false
);
if
(
forced
)
{
// Notifications are needed, add an override to the model
if
(
type
.
getPropertyOverride
(
AlfrescoConversionConstants
.
PROPERTY_SEND_EMAIL_NOTIFICATIONS
)
==
null
)
{
M2PropertyOverride
override
=
new
M2PropertyOverride
();
override
.
setName
(
AlfrescoConversionConstants
.
PROPERTY_SEND_EMAIL_NOTIFICATIONS
);
override
.
setDefaultValue
(
Boolean
.
TRUE
.
toString
());
type
.
getPropertyOverrides
().
add
(
override
);
}
}
else
{
// Render a control to select whether notifications are needed or not
form
.
getFormFieldVisibility
().
addShowFieldElement
(
AlfrescoConversionConstants
.
PROPERTY_SEND_EMAIL_NOTIFICATIONS
);
FormField
formField
=
form
.
getFormAppearance
().
addFormField
(
AlfrescoConversionConstants
.
PROPERTY_SEND_EMAIL_NOTIFICATIONS
,
null
,
formSet
);
formField
.
setControl
(
new
FormFieldControl
(
AlfrescoConversionConstants
.
FORM_EMAIL_NOTIFICATION_TEMPLATE
));
form
.
getFormAppearance
().
addFormAppearanceElement
(
formField
);
}
}
}
protected
void
addOrAlterPackageItemActions
(
M2Type
contentType
,
boolean
allowAdd
,
boolean
allowRemove
)
{
if
(
allowAdd
)
{
M2PropertyOverride
addOverride
=
contentType
.
getPropertyOverride
(
AlfrescoConversionConstants
.
PROPERTY_PACKAGEITEMS_ACTION_GROUP
);
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/export/AlfrescoArtifactExporter.java
浏览文件 @
86b54f06
...
...
@@ -31,7 +31,9 @@ import org.activiti.workflow.simple.alfresco.model.beans.BeanProperty;
import
org.activiti.workflow.simple.alfresco.model.beans.BeanPropertyProp
;
import
org.activiti.workflow.simple.alfresco.model.beans.Beans
;
import
org.activiti.workflow.simple.alfresco.model.config.AlfrescoConfiguration
;
import
org.activiti.workflow.simple.alfresco.model.config.Extension
;
import
org.activiti.workflow.simple.alfresco.model.config.Module
;
import
org.activiti.workflow.simple.alfresco.model.config.ModuleDeployment
;
import
org.activiti.workflow.simple.converter.WorkflowDefinitionConversion
;
/**
...
...
@@ -48,6 +50,7 @@ public class AlfrescoArtifactExporter {
protected
static
final
String
MODEL_FILE_SUFFIX
=
"-model.xml"
;
protected
static
final
String
SPRING_CONTEXT_FILE_SUFFIX
=
"-context.xml"
;
protected
static
final
String
SHARE_CONFIG_FILE_SUFFIX
=
"-config-custom.xml"
;
protected
static
final
String
SHARE_CONFIG_MODULE_DEPLOYMENT_SUFFIX
=
"-module-deployment.xml"
;
protected
static
final
String
SHARE_CONTEXT_FILE_SUFFIX
=
"-share-context.xml"
;
protected
static
final
String
WORKFLOW_DEPLOYER_PARENT
=
"workflowDeployer"
;
...
...
@@ -79,7 +82,7 @@ public class AlfrescoArtifactExporter {
bpmnConverter
=
new
BpmnXMLConverter
();
try
{
modelJaxbContext
=
JAXBContext
.
newInstance
(
M2Model
.
class
);
moduleJaxbContext
=
JAXBContext
.
newInstance
(
Module
.
class
,
AlfrescoConfiguration
.
class
);
moduleJaxbContext
=
JAXBContext
.
newInstance
(
Extension
.
class
,
Module
.
class
,
AlfrescoConfiguration
.
class
,
ModuleDeployment
.
class
);
beansJaxbContext
=
JAXBContext
.
newInstance
(
Beans
.
class
);
}
catch
(
JAXBException
jaxbe
)
{
throw
new
AlfrescoSimpleWorkflowException
(
"Error while building JAXB-context for exporting content-model"
,
jaxbe
);
...
...
@@ -94,21 +97,21 @@ public class AlfrescoArtifactExporter {
* @param repositoryFolder the folder where all repository-artifacts and configurations are exported to
* @param shareFolder the folder where all share-artifacts and configurations are exported to
*/
public
void
exportArtifacts
(
WorkflowDefinitionConversion
conversion
,
File
repositoryFolder
,
File
shareFolder
)
{
public
void
exportArtifacts
(
WorkflowDefinitionConversion
conversion
,
File
repositoryFolder
,
File
shareFolder
,
boolean
asExtension
)
{
validateArtifactTargets
(
repositoryFolder
,
shareFolder
);
String
processId
=
conversion
.
getProcess
().
getId
();
try
{
// Export process BPMN
File
processFile
=
new
File
(
repositoryFolder
,
processId
+
PROCESS_FILE_SUFFIX
);
File
processFile
=
new
File
(
repositoryFolder
,
getBpmnFileName
(
conversion
)
);
processFile
.
createNewFile
();
FileOutputStream
processStream
=
new
FileOutputStream
(
processFile
);
writeBpmnModel
(
processStream
,
conversion
);
processStream
.
close
();
// Export content model
File
contentModelFile
=
new
File
(
repositoryFolder
,
processId
+
MODEL_FILE_SUFFIX
);
File
contentModelFile
=
new
File
(
repositoryFolder
,
getContentModelFileName
(
conversion
)
);
contentModelFile
.
createNewFile
();
FileOutputStream
modelStream
=
new
FileOutputStream
(
contentModelFile
);
writeContentModel
(
modelStream
,
conversion
);
...
...
@@ -122,12 +125,20 @@ public class AlfrescoArtifactExporter {
springContextStream
.
close
();
// Export share config
File
shareConfigFile
=
new
File
(
shareFolder
,
processId
+
SHARE_CONFIG_FILE_SUFFIX
);
File
shareConfigFile
=
new
File
(
shareFolder
,
getShareConfigFileName
(
conversion
)
);
shareConfigFile
.
createNewFile
();
FileOutputStream
shareConfigStream
=
new
FileOutputStream
(
shareConfigFile
);
writeShareConfig
(
shareConfigStream
,
conversion
,
false
);
writeShareConfig
(
shareConfigStream
,
conversion
,
asExtension
);
shareConfigStream
.
close
();
if
(
asExtension
)
{
File
shareModuleDeploymentFile
=
new
File
(
shareFolder
,
getShareModuleDeploymentFileName
(
conversion
));
shareModuleDeploymentFile
.
createNewFile
();
FileOutputStream
shareModuleStream
=
new
FileOutputStream
(
shareModuleDeploymentFile
);
writeShareExtensionModule
(
shareModuleStream
,
conversion
);
shareModuleStream
.
close
();
}
// Export share custom context
File
shareContextFile
=
new
File
(
shareFolder
,
processId
+
SHARE_CONTEXT_FILE_SUFFIX
);
shareContextFile
.
createNewFile
();
...
...
@@ -140,6 +151,26 @@ public class AlfrescoArtifactExporter {
}
}
public
String
getBpmnFileName
(
WorkflowDefinitionConversion
conversion
)
{
String
processId
=
conversion
.
getProcess
().
getId
();
return
processId
+
PROCESS_FILE_SUFFIX
;
}
public
String
getContentModelFileName
(
WorkflowDefinitionConversion
conversion
)
{
String
processId
=
conversion
.
getProcess
().
getId
();
return
processId
+
MODEL_FILE_SUFFIX
;
}
public
String
getShareConfigFileName
(
WorkflowDefinitionConversion
conversion
)
{
String
processId
=
conversion
.
getProcess
().
getId
();
return
processId
+
SHARE_CONFIG_FILE_SUFFIX
;
}
public
String
getShareModuleDeploymentFileName
(
WorkflowDefinitionConversion
conversion
)
{
String
processId
=
conversion
.
getProcess
().
getId
();
return
processId
+
SHARE_CONFIG_MODULE_DEPLOYMENT_SUFFIX
;
}
/**
* Write the BPMN-model in the given conversion to the given stream.
*/
...
...
@@ -152,16 +183,16 @@ public class AlfrescoArtifactExporter {
/**
* Write the Share module XML in the given conversion to the given stream.
*/
public
void
writeShareConfig
(
OutputStream
out
,
WorkflowDefinitionConversion
conversion
,
boolean
as
Module
)
throws
IOException
{
Module
module
=
AlfrescoConversionUtil
.
getModule
(
conversion
);
public
void
writeShareConfig
(
OutputStream
out
,
WorkflowDefinitionConversion
conversion
,
boolean
as
Extension
)
throws
IOException
{
Extension
extension
=
AlfrescoConversionUtil
.
getExtension
(
conversion
);
try
{
Object
toMarshall
=
module
;
Object
toMarshall
=
extension
;
// In case the configuration should NOT be exported as a module, wrap the configurations
// in a "alfresco-configuration" element instead
if
(!
as
Module
)
{
if
(!
as
Extension
)
{
toMarshall
=
new
AlfrescoConfiguration
();
((
AlfrescoConfiguration
)
toMarshall
).
setConfigurations
(
module
.
getConfigurations
());
((
AlfrescoConfiguration
)
toMarshall
).
setConfigurations
(
extension
.
getModules
().
get
(
0
)
.
getConfigurations
());
}
Marshaller
marshaller
=
moduleJaxbContext
.
createMarshaller
();
marshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
Boolean
.
TRUE
);
...
...
@@ -171,6 +202,24 @@ public class AlfrescoArtifactExporter {
}
}
/**
* Write the Share module XML in the given conversion to the given stream.
*/
public
void
writeShareExtensionModule
(
OutputStream
out
,
WorkflowDefinitionConversion
conversion
)
throws
IOException
{
Extension
extension
=
AlfrescoConversionUtil
.
getExtension
(
conversion
);
try
{
ModuleDeployment
toMarshall
=
new
ModuleDeployment
();
toMarshall
.
setModule
(
extension
.
getModules
().
get
(
0
).
getId
());
// In case the configuration should NOT be exported as a module, wrap the configurations
// in a "alfresco-configuration" element instead
Marshaller
marshaller
=
moduleJaxbContext
.
createMarshaller
();
marshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
Boolean
.
TRUE
);
marshaller
.
marshal
(
toMarshall
,
out
);
}
catch
(
JAXBException
jaxbe
)
{
throw
new
IOException
(
jaxbe
);
}
}
/**
* Write the content model XML in the given conversion to the given stream.
*/
...
...
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/model/config/ModuleDeployment.java
0 → 100644
浏览文件 @
86b54f06
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.activiti.workflow.simple.alfresco.model.config
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
* @author Joram Barrez
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlRootElement
(
name
=
"module-deployment"
)
public
class
ModuleDeployment
{
@XmlElement
(
name
=
"extension-module"
)
private
String
module
;
public
String
getModule
()
{
return
module
;
}
public
void
setModule
(
String
module
)
{
this
.
module
=
module
;
}
}
modules/activiti-simple-workflow-alfresco/src/main/java/org/activiti/workflow/simple/alfresco/step/AlfrescoReviewStepDefinition.java
浏览文件 @
86b54f06
...
...
@@ -18,6 +18,7 @@ import java.util.Map;
import
org.activiti.workflow.simple.alfresco.conversion.exception.AlfrescoSimpleWorkflowException
;
import
org.activiti.workflow.simple.definition.AbstractStepDefinitionContainer
;
import
org.activiti.workflow.simple.definition.FormStepDefinition
;
import
org.activiti.workflow.simple.definition.HumanStepAssignment.HumanStepAssignmentType
;
import
org.activiti.workflow.simple.definition.NamedStepDefinition
;
import
org.activiti.workflow.simple.definition.StepDefinition
;
...
...
@@ -36,7 +37,7 @@ import org.codehaus.jackson.annotate.JsonTypeName;
* @author Frederik Heremans
*/
@JsonTypeName
(
"review-step"
)
public
class
AlfrescoReviewStepDefinition
extends
AbstractStepDefinitionContainer
<
AlfrescoReviewStepDefinition
>
implements
StepDefinition
,
NamedStepDefinition
{
public
class
AlfrescoReviewStepDefinition
extends
AbstractStepDefinitionContainer
<
AlfrescoReviewStepDefinition
>
implements
StepDefinition
,
NamedStepDefinition
,
FormStepDefinition
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
modules/activiti-simple-workflow-alfresco/src/test/java/org/activiti/workflow/simple/alfresco/test/WorkflowDefinitionConversionTest.java
浏览文件 @
86b54f06
...
...
@@ -99,7 +99,7 @@ public class WorkflowDefinitionConversionTest {
assertNotNull
(
contentModel
);
// Check presence of form-config and default workflow-details
Module
module
=
AlfrescoConversionUtil
.
get
Module
(
conversion
);
Module
module
=
AlfrescoConversionUtil
.
get
Extension
(
conversion
).
getModules
().
get
(
0
);
assertNotNull
(
module
);
assertEquals
(
1L
,
module
.
getConfigurations
().
size
());
...
...
@@ -437,7 +437,7 @@ public class WorkflowDefinitionConversionTest {
conversion
.
convert
();
new
File
(
"target/repo"
).
mkdir
();
new
File
(
"target/share"
).
mkdir
();
conversionFactory
.
getArtifactExporter
().
exportArtifacts
(
conversion
,
new
File
(
"target/repo"
),
new
File
(
"target/share"
));
conversionFactory
.
getArtifactExporter
().
exportArtifacts
(
conversion
,
new
File
(
"target/repo"
),
new
File
(
"target/share"
)
,
false
);
}
protected
M2Property
getPropertyFromType
(
String
shortName
,
M2Type
type
)
{
...
...
modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/definition/FormStepDefinition.java
0 → 100644
浏览文件 @
86b54f06
/* 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.workflow.simple.definition
;
import
org.activiti.workflow.simple.definition.form.FormDefinition
;
/**
* Interface describing a step which has a form.
*
* @author Frederik Heremans
*/
public
interface
FormStepDefinition
extends
StepDefinition
{
FormDefinition
getForm
();
void
setForm
(
FormDefinition
form
);
}
modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/definition/HumanStepDefinition.java
浏览文件 @
86b54f06
...
...
@@ -28,7 +28,7 @@ import org.codehaus.jackson.annotate.JsonTypeName;
* @author Joram Barrez
*/
@JsonTypeName
(
"human-step"
)
public
class
HumanStepDefinition
extends
AbstractNamedStepDefinition
{
public
class
HumanStepDefinition
extends
AbstractNamedStepDefinition
implements
FormStepDefinition
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -71,11 +71,15 @@ public class HumanStepDefinition extends AbstractNamedStepDefinition {
return
form
;
}
public
HumanStepDefinition
set
Form
(
FormDefinition
form
)
{
public
HumanStepDefinition
add
Form
(
FormDefinition
form
)
{
this
.
form
=
form
;
return
this
;
}
public
void
setForm
(
FormDefinition
form
)
{
this
.
form
=
form
;
}
public
HumanStepAssignment
getAssignment
()
{
return
ensureAssignment
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录