-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added FormAwareServiceTask for CMMN and BPMN
- Loading branch information
1 parent
706e10f
commit cd7aefe
Showing
14 changed files
with
297 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...converter/src/main/java/org/flowable/bpmn/converter/FormAwareServiceTaskXMLConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* 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.flowable.bpmn.converter; | ||
|
||
import org.flowable.bpmn.model.BaseElement; | ||
import org.flowable.bpmn.model.FormAwareServiceTask; | ||
|
||
/** | ||
* @author Christopher Welsch | ||
*/ | ||
public class FormAwareServiceTaskXMLConverter extends ServiceTaskXMLConverter { | ||
|
||
@Override | ||
public Class<? extends BaseElement> getBpmnElementType() { | ||
return FormAwareServiceTask.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ter/src/test/java/org/flowable/editor/language/xml/FormAwareServiceTaskConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* 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.flowable.editor.language.xml; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.tuple; | ||
|
||
import org.flowable.bpmn.model.BpmnModel; | ||
import org.flowable.bpmn.model.FieldExtension; | ||
import org.flowable.bpmn.model.FlowElement; | ||
import org.flowable.bpmn.model.FormAwareServiceTask; | ||
import org.flowable.editor.language.xml.util.BpmnXmlConverterTest; | ||
|
||
class FormAwareServiceTaskConverterTest { | ||
|
||
@BpmnXmlConverterTest("formAwareServiceTask.bpmn") | ||
void validateModelWithFormReference(BpmnModel model) { | ||
FlowElement flowElement = model.getMainProcess().getFlowElement("servicetask"); | ||
assertThat(flowElement) | ||
.isInstanceOfSatisfying(FormAwareServiceTask.class, formAwareServiceTask -> { | ||
assertThat(formAwareServiceTask.getId()).isEqualTo("servicetask"); | ||
assertThat(formAwareServiceTask.getName()).isEqualTo("FormAwareServiceTask"); | ||
assertThat(formAwareServiceTask.getImplementation()) | ||
.isEqualTo("${delegateExpression}"); | ||
assertThat(formAwareServiceTask.getImplementationType()) | ||
.isEqualTo("delegateExpression"); | ||
assertThat(formAwareServiceTask.getValidateFormFields()) | ||
.isEqualTo("true"); | ||
assertThat(formAwareServiceTask.getFormKey()) | ||
.isEqualTo("someFormKey"); | ||
}); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
modules/flowable-bpmn-converter/src/test/resources/formAwareServiceTask.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-work-process-palette"> | ||
|
||
<process id="process" name="process1" isExecutable="true"> | ||
<endEvent id="end"></endEvent> | ||
<sequenceFlow id="flow1" sourceRef="start" targetRef="servicetask"></sequenceFlow> | ||
<serviceTask id="servicetask" name="FormAwareServiceTask" flowable:delegateExpression="${delegateExpression}" flowable:formKey="someFormKey" flowable:formFieldValidation="true"> | ||
|
||
</serviceTask> | ||
<startEvent id="start"></startEvent> | ||
<sequenceFlow id="flow2" sourceRef="servicetask" targetRef="end"></sequenceFlow> | ||
</process> | ||
</definitions> |
42 changes: 42 additions & 0 deletions
42
modules/flowable-bpmn-model/src/main/java/org/flowable/bpmn/model/FormAwareServiceTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* 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.flowable.bpmn.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Christopher Welsch | ||
*/ | ||
public class FormAwareServiceTask extends ServiceTask implements HasValidateFormFields { | ||
|
||
protected String validateFormFields; | ||
protected String formKey; | ||
|
||
@Override | ||
public String getValidateFormFields() { | ||
return validateFormFields; | ||
} | ||
|
||
@Override | ||
public void setValidateFormFields(String validateFormFields) { | ||
this.validateFormFields = validateFormFields; | ||
} | ||
|
||
public String getFormKey() { | ||
return formKey; | ||
} | ||
|
||
public void setFormKey(String formKey) { | ||
this.formKey = formKey; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ter/src/test/java/org/flowable/test/cmmn/converter/FormAwareServiceTaskConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* 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.flowable.test.cmmn.converter; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.flowable.cmmn.model.CmmnModel; | ||
import org.flowable.cmmn.model.FormAwareServiceTask; | ||
import org.flowable.cmmn.model.PlanItemDefinition; | ||
import org.flowable.test.cmmn.converter.util.CmmnXmlConverterTest; | ||
|
||
/** | ||
* @author Christopher Welsch | ||
*/ | ||
class FormAwareServiceTaskConverterTest { | ||
|
||
@CmmnXmlConverterTest("org/flowable/test/cmmn/converter/formAwareServiceTask.cmmn") | ||
public void validateModelWithCommaSeparatedStringExpressionCandidates(CmmnModel cmmnModel) { | ||
assertThat(cmmnModel).isNotNull(); | ||
|
||
PlanItemDefinition itemDefinition = cmmnModel.findPlanItemDefinition("task1"); | ||
assertThat(itemDefinition) | ||
.isInstanceOfSatisfying(FormAwareServiceTask.class, formAwareServiceTask -> { | ||
assertThat(formAwareServiceTask.getId()).isEqualTo("task1"); | ||
assertThat(formAwareServiceTask.getName()).isEqualTo("FormAwareServiceTask"); | ||
assertThat(formAwareServiceTask.getImplementationType()) | ||
.isEqualTo("delegateExpression"); | ||
assertThat(formAwareServiceTask.getValidateFormFields()) | ||
.isEqualTo("true"); | ||
assertThat(formAwareServiceTask.getFormKey()) | ||
.isEqualTo("someFormKey"); | ||
}); | ||
|
||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...n-converter/src/test/resources/org/flowable/test/cmmn/converter/formAwareServiceTask.cmmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:flowable="http://flowable.org/cmmn" xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" xmlns:design="http://flowable.org/design" targetNamespace="http://flowable.org/cmmn" design:palette="flowable-work-case-palette"> | ||
<case id="myCase" name="My Case"> | ||
<casePlanModel id="mainPlanModel" name="Case plan model"> | ||
<planItem id="planItem1" name="Task 1" definitionRef="task1"/> | ||
<task id="task1" name="FormAwareServiceTask" flowable:type="java" flowable:delegateExpression="${someDelegateExpression}" flowable:formKey="someFormKey" flowable:formFieldValidation="true"> | ||
</task> | ||
</casePlanModel> | ||
</case> | ||
</definitions> |
Oops, something went wrong.