Skip to content

Commit

Permalink
Bugfix: Missing implicit variables workflowContext, roles and user in…
Browse files Browse the repository at this point in the history
… scripted-assignment tag for workflow definitions
  • Loading branch information
dmarks2 committed Dec 28, 2023
1 parent 05bed54 commit eb41b4e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- Feature: check if service-builder and rest-builder maven plugins match the used liferay version
- Feature: check if portal-web dependency matches the used liferay version
- Bugfix: fix encoding when executing Poshi Scripts (UTF-8 instead of system dependant encoding)
- Bugfix: Missing implicit variables workflowContext, roles and user in scripted-assignment tag for workflow definitions
- Change: Update support for IntelliJ 2023.3, dropped support for older versions

## 0.0.17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class LiferayWorkflowContextVariablesUtil {
new AbstractMap.SimpleEntry<>("user", "com.liferay.portal.kernel.model.User")
));

WORKFLOW_SCRIPT_OUTPUT_VARIABLES.put("scripted-receipient", Arrays.asList(
WORKFLOW_SCRIPT_OUTPUT_VARIABLES.put("scripted-recipient", Arrays.asList(
new AbstractMap.SimpleEntry<>("workflowContext", "java.util.Map<java.lang.String, java.lang.Serializable>"),
new AbstractMap.SimpleEntry<>("roles", "java.util.List<com.liferay.portal.kernel.model.Role>"),
new AbstractMap.SimpleEntry<>("user", "com.liferay.portal.kernel.model.User")
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<li>Feature: check if service-builder and rest-builder maven plugins match the used liferay version</li>
<li>Feature: check if portal-web dependency matches the used liferay version</li>
<li>Bugfix: fix encoding when executing Poshi Scripts (UTF-8 instead of system dependant encoding)</li>
<li>Bugfix: Missing implicit variables workflowContext, roles and user in scripted-assignment tag for workflow definitions</li>
<li>Change: Update support for IntelliJ 2023.3, dropped support for older versions</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void testGroovyInputImplicitVariables() {
assertTrue(strings.contains("taskName"));
}

public void testGroovyOutputImplicitVariables() {
public void testGroovyOutputImplicitVariablesScriptedAssignment() {
myFixture.configureByFiles("workflow-definition-scripted-assignment-groovy.xml");
myFixture.complete(CompletionType.BASIC, 1);
List<String> strings = myFixture.getLookupElementStrings();
Expand All @@ -42,4 +42,13 @@ public void testGroovyOutputImplicitVariables() {
assertTrue("Workflow groovy script for <scripted-assignment> should offer output variable \"roles\"", strings.contains("roles"));
}

public void testGroovyOutputImplicitVariablesScriptedRecipient() {
myFixture.configureByFiles("workflow-definition-scripted-recipient-groovy.xml");
myFixture.complete(CompletionType.BASIC, 1);
List<String> strings = myFixture.getLookupElementStrings();

assertNotNull(strings);
assertTrue("Workflow groovy script for <scripted-recipient> should offer output variable \"roles\"", strings.contains("roles"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>

<workflow-definition
xmlns="urn:liferay.com:liferay-workflow_7.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:liferay.com:liferay-workflow_7.4.0 http://www.liferay.com/dtd/liferay-workflow-definition_7_4_0.xsd"
>
<name>Sample Workflow</name>
<version>1</version>
<state>
<name>created</name>
<initial>true</initial>
<transitions>
<transition>
<name>approved</name>
<target>approved</target>
<default>true</default>
</transition>
</transitions>
</state>
<task>
<name>review</name>
<actions>
<notification>
<name>notify</name>
<template>foo</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<recipients>
<scripted-recipient>
<script>
<![CDATA[
<caret>
]]>
</script>
<script-language>groovy</script-language>
</scripted-recipient>
</recipients>
<execution-type>onEntry</execution-type>
</notification>
</actions>
</task>
</workflow-definition>

0 comments on commit eb41b4e

Please sign in to comment.