Skip to content

Commit

Permalink
XIVY-13943 extended sub-process connector example
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Dec 20, 2024
1 parent 321932a commit 64ef24f
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 0 deletions.
23 changes: 23 additions & 0 deletions playwright/process-test-project/dataclasses/market/Person.d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema" : "https://json-schema.axonivy.com/data-class/12.0.0/data-class.json",
"simpleName" : "Person",
"namespace" : "market",
"isBusinessCaseData" : false,
"fields" : [ {
"name" : "id",
"type" : "Long",
"modifiers" : [ "PERSISTENT" ]
}, {
"name" : "firstname",
"type" : "String",
"modifiers" : [ "PERSISTENT" ]
}, {
"name" : "lastname",
"type" : "String",
"modifiers" : [ "PERSISTENT" ]
}, {
"name" : "title",
"type" : "String",
"modifiers" : [ "PERSISTENT" ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema" : "https://json-schema.axonivy.com/data-class/12.0.0/data-class.json",
"simpleName" : "UserScriptData",
"namespace" : "market",
"isBusinessCaseData" : false,
"fields" : [ {
"name" : "user",
"type" : "market.Person",
"modifiers" : [ "PERSISTENT" ]
} ]
}
11 changes: 11 additions & 0 deletions playwright/process-test-project/dataclasses/market/erpData.d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema" : "https://json-schema.axonivy.com/data-class/12.0.0/data-class.json",
"simpleName" : "erpData",
"namespace" : "market",
"isBusinessCaseData" : false,
"fields" : [ {
"name" : "user",
"type" : "market.Person",
"modifiers" : [ "PERSISTENT" ]
} ]
}
52 changes: 52 additions & 0 deletions playwright/process-test-project/processes/market/UserEnroll.p.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "193E3ABB2D641C01",
"config" : {
"data" : "market.UserScriptData"
},
"elements" : [ {
"id" : "f0",
"type" : "RequestStart",
"name" : "enroll",
"config" : {
"signature" : "start"
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
},
"connect" : [
{ "id" : "f2", "to" : "f5" }
]
}, {
"id" : "f1",
"type" : "TaskEnd",
"visual" : {
"at" : { "x" : 352, "y" : 64 },
"labelOffset" : { "x" : 13, "y" : 33 }
}
}, {
"id" : "f5",
"type" : "SubProcessCall",
"name" : "evalUser",
"config" : {
"processCall" : "market/erp:evalUser(Long)",
"call" : {
"map" : {
"param.id" : "in.user.id"
}
},
"output" : {
"map" : {
"out" : "in",
"out.user" : "result.user"
}
}
},
"visual" : {
"at" : { "x" : 224, "y" : 64 }
},
"connect" : [
{ "id" : "f3", "to" : "f1" }
]
} ]
}
58 changes: 58 additions & 0 deletions playwright/process-test-project/processes/market/UserScript.p.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "193E3B0AD20672E7",
"config" : {
"data" : "market.UserScriptData"
},
"elements" : [ {
"id" : "f0",
"type" : "RequestStart",
"name" : "enroll",
"config" : {
"signature" : "start"
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
},
"connect" : [
{ "id" : "f2", "to" : "f3" }
]
}, {
"id" : "f1",
"type" : "TaskEnd",
"visual" : {
"at" : { "x" : 392, "y" : 64 },
"labelOffset" : { "x" : 13, "y" : 33 }
}
}, {
"id" : "f3",
"type" : "Script",
"name" : "lookupErp",
"config" : {
"output" : {
"code" : "// my heavy java lookup"
}
},
"visual" : {
"at" : { "x" : 240, "y" : 63 },
"size" : { "width" : 120, "height" : 63 }
},
"connect" : [
{ "id" : "f4", "to" : "f1", "color" : "default" }
]
}, {
"id" : "f5",
"type" : "ProcessAnnotation",
"name" : [
"Heavy Java Logic:",
"- Connects to ERP",
"- Finds users by ID"
],
"visual" : {
"at" : { "x" : 240, "y" : 160 }
},
"connect" : [
{ "id" : "f6", "to" : "f3" }
]
} ]
}
79 changes: 79 additions & 0 deletions playwright/process-test-project/processes/market/erp.p.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "193E3AEFF2379C85",
"kind" : "CALLABLE_SUB",
"config" : {
"data" : "market.erpData"
},
"elements" : [ {
"id" : "f0",
"type" : "CallSubStart",
"name" : "evalUser(Long)",
"config" : {
"signature" : "evalUser",
"input" : {
"params" : [
{ "name" : "id", "type" : "Long", "desc" : "known unique ERP userID" }
],
"map" : {
"out.user.id" : "param.id"
}
},
"result" : {
"params" : [
{ "name" : "user", "type" : "market.Person", "desc" : "Resolved ERP user" }
],
"map" : {
"result.user" : "in.user"
}
}
},
"tags" : [
"connector"
],
"visual" : {
"at" : { "x" : 96, "y" : 64 },
"icon" : "res:/webContent/icons/Developer.jpg?small"
},
"connect" : [
{ "id" : "f2", "to" : "f3" }
]
}, {
"id" : "f1",
"type" : "CallSubEnd",
"visual" : {
"at" : { "x" : 352, "y" : 64 },
"labelOffset" : { "x" : 13, "y" : 33 }
}
}, {
"id" : "f3",
"type" : "Script",
"name" : "lookupErp",
"config" : {
"output" : {
"code" : "// my heavy java lookup"
}
},
"visual" : {
"at" : { "x" : 224, "y" : 63 },
"size" : { "width" : 120, "height" : 63 }
},
"connect" : [
{ "id" : "f4", "to" : "f1" }
]
}, {
"id" : "f5",
"type" : "ProcessAnnotation",
"name" : [
"Heavy Java Logic:",
"- Connects to ERP",
"- Finds users by ID"
],
"visual" : {
"at" : { "x" : 224, "y" : 160 }
},
"connect" : [
{ "id" : "f6", "to" : "f3" }
]
} ]
}
13 changes: 13 additions & 0 deletions playwright/tests/screenshots/editor/editor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Page } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { ProcessEditor } from '../../page-objects/editor/process-editor';
import { Inscription } from '../../page-objects/inscription/inscription-view';

test.beforeEach(async ({ page }) => {
await page.emulateMedia({ colorScheme: 'light' });
Expand Down Expand Up @@ -40,6 +41,18 @@ test('extensions', async ({ page }) => {
await screenshot(page, 'extensions.png');
});

test('connector-process', async ({ page }) => {
const editor = await ProcessEditor.openProcess(page, { file: '/processes/market/erp.p.json', waitFor: '.sprotty-graph' });
await editor.element('start:callSubStart').inscribe();
const inscription = new Inscription(page);
inscription.waitForView();
const start = inscription.accordion('Start');
await start.toggle();
await start.section('Mapping').close();
await start.section('Input parameters').open();
await screenshot(page, 'connector-process.png');
});

async function screenshot(page: Page, name: string, size?: { width?: number; height?: number }) {
await page.setViewportSize({ width: size?.width ?? 700, height: size?.height ?? 550 });
const dir = process.env.SCREENSHOT_DIR ?? './target';
Expand Down

0 comments on commit 64ef24f

Please sign in to comment.