Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xrm-modules/xrm-platform/workflow
1 result
Show changes
Showing
with 347 additions and 240 deletions
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<!--Structure changesets-->
<!--<include relativeToChangelogFile="true" file="struct/release_TICKETNR_action_title.xml"/>-->
<include relativeToChangelogFile="true" file="struct/init_create_workflowsignal.xml"/>
<!--Data changesets-->
<!--<include relativeToChangelogFile="true" file="data/release_TICKETNR_action_title.xml"/>-->
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="L.Werner (generated)" id="5837f668-d30c-4ad4-bcfc-c8b915279fe6">
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<changeSet author="(generated)" id="9d7478c3-e3dd-4e73-ba96-fc0aec8f240e">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="workflowsignal"/>
<tableExists tableName="WORKFLOWSIGNAL"/>
</not>
</preConditions>
<createTable tableName="workflowsignal">
<createTable tableName="WORKFLOWSIGNAL">
<column name="WORKFLOWSIGNALID" type="CHAR(36)">
<constraints nullable="false" primaryKey="true"/>
</column>
......@@ -18,4 +20,5 @@
<column name="VARIABLES" type="VARCHAR(512)"/>
</createTable>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<!--Structure changesets-->
<!--<include relativeToChangelogFile="true" file="struct/release_TICKETNR_action_title.xml"/>-->
<include relativeToChangelogFile="true" file="struct/init_create_workflowstartconfig.xml"/>
<!--Data changesets-->
<!--<include relativeToChangelogFile="true" file="data/release_TICKETNR_action_title.xml"/>-->
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="L.Werner (generated)" id="18ac9323-d7d6-4480-9106-53f9feed29e4">
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<changeSet author="(generated)" id="29858aa9-b12a-4bad-9fd4-eb590e7fd403">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="workflowstartconfig"/>
<tableExists tableName="WORKFLOWSTARTCONFIG"/>
</not>
</preConditions>
<createTable tableName="workflowstartconfig">
<createTable tableName="WORKFLOWSTARTCONFIG">
<column name="WORKFLOWSTARTCONFIGID" type="CHAR(36)">
<constraints nullable="false" primaryKey="true"/>
</column>
......@@ -15,4 +17,5 @@
<column name="PROCESSDEFINITION_KEY" type="VARCHAR(255)"/>
</createTable>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
\ No newline at end of file
......@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.0.0] - Unreleased
### Removed
- Temporary sales implementations
### Added
- WorkflowSignal_entity: workflowContextWhitelist_service
### Changed
- Updated liquibase structure
## [2.0.3]
### Fixed
......@@ -44,4 +59,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Updated and merged content from the basic-base project
\ No newline at end of file
- Updated and merged content from the basic-base project
<?xml version="1.0" encoding="UTF-8"?>
<aliasDefinition xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/aliasDefinition/1.3.1">
<name>Workflow_System_alias</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<datasourceType v="0" />
<aliasDefinitionSub>
<aliasDefDb>
<targetAliasName>_____SYSTEMALIAS</targetAliasName>
<entityGroup>
<name>entityGroup</name>
</entityGroup>
</aliasDefDb>
</aliasDefinitionSub>
</aliasDefinition>
......@@ -15,7 +15,6 @@
<idColumn>WORKFLOWSTARTCONFIGID</idColumn>
<idGeneratorType v="0" />
<idGeneratorInterval v="1" />
<documentation></documentation>
<title></title>
<description></description>
<auditSyncConfig>
......@@ -24,7 +23,6 @@
<syncActive v="false" />
<syncComplete v="true" />
<syncDirection v="1" />
<syncIds></syncIds>
</auditSyncConfig>
<entityFields>
<entityFieldDb>
......@@ -37,7 +35,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -51,7 +48,6 @@
<notNull v="true" />
<isUnique v="true" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -65,7 +61,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -79,7 +74,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -91,7 +85,6 @@
<idColumn>WORKFLOWSIGNALID</idColumn>
<idGeneratorType v="0" />
<idGeneratorInterval v="1" />
<documentation></documentation>
<title></title>
<description></description>
<auditSyncConfig>
......@@ -100,7 +93,6 @@
<syncActive v="false" />
<syncComplete v="true" />
<syncDirection v="1" />
<syncIds></syncIds>
</auditSyncConfig>
<entityFields>
<entityFieldDb>
......@@ -113,7 +105,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -127,7 +118,6 @@
<notNull v="true" />
<isUnique v="true" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -141,7 +131,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -155,7 +144,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -169,7 +157,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -183,7 +170,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -197,7 +183,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -209,7 +194,6 @@
<idColumn>STANDARD_WORKFLOWID</idColumn>
<idGeneratorType v="0" />
<idGeneratorInterval v="1" />
<documentation></documentation>
<title></title>
<description></description>
<auditSyncConfig>
......@@ -218,7 +202,6 @@
<syncActive v="false" />
<syncComplete v="true" />
<syncDirection v="1" />
<syncIds></syncIds>
</auditSyncConfig>
<entityFields>
<entityFieldDb>
......@@ -231,7 +214,6 @@
<notNull v="true" />
<isUnique v="true" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -245,7 +227,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -259,7 +240,6 @@
<notNull v="true" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -273,7 +253,6 @@
<notNull v="true" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -287,7 +266,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......@@ -301,7 +279,6 @@
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
......
......@@ -105,6 +105,10 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityServiceDefinition>
<name>workflowContextWhitelist_service</name>
<documentation>%aditoprj%/entity/WorkflowSignal_entity/entityfields/workflowcontextwhitelist_service/documentation.adoc</documentation>
</entityServiceDefinition>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import { result } from "@aditosoftware/jdito-types";
import { modules, result } from "@aditosoftware/jdito-types";
result.object([
let contexts = [
"Activity",
"BulkMail",
"BulkMailRecipient",
"Campaign",
"CampaignStep",
"Contract",
"DocumentTemplate",
"Employee",
"LetterRecipient",
"Offer",
"Order",
"Organisation",
"Person",
"Product",
"Salesproject",
"SerialLetter",
"SupportTicket",
"Task",
"Advertising",
"AdvertisingItem"
]);
\ No newline at end of file
"Task"
];
modules.loadService("workflowContextWhitelist_service")
.forEach(implementation => contexts = contexts.concat(implementation()));
result.object(contexts);
\ No newline at end of file
Expects the implementation to return an array with contexts.
Example:
[source, javascript]
----
//@ts-ignore
return [
"Context",
//...
];
----
\ No newline at end of file
This diff is collapsed.
{
"name": "@aditosoftware/workflow",
"version": "2.0.3",
"version": "3.0.0-beta.2",
"adito": {
"type": "module"
},
......@@ -11,22 +11,13 @@
"@aditosoftware/utility": "^2.0.0"
},
"devDependencies": {
"@aditosoftware/devtools": "^1.0.6",
"@aditosoftware/devtools": "^2.0.0",
"@aditosoftware/eslint-config-adito": "^3.3.0",
"@aditosoftware/jdito-types": "^2024.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"eslint": "^8.40.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^46.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-unused-imports": "^2.0.0",
"@aditosoftware/jdito-types": ">=2024.1.2-RC <2024.1.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
},
"scripts": {
"gen-Initial-Liquibase": "ts-node ./scripts/genInitLiquibaseFiles.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
......
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs"
import { randomUUID } from "crypto"
import { GenerateChangeLogCommandAttributes, Liquibase, LiquibaseConfig } from "liquibase"
const path = require('path');
//Alias und Tabellen anpassen!
let database = "adito_data";
let targetAlias = "Workflow_alias";
let tables = [
"standard_workflow",
"workflowsignal",
"workflowstartconfig"
];
let classpath = path.join(__dirname, '..', 'node_modules', 'liquibase', 'dist', 'drivers', 'mariadb-java-client-2.5.3.jar')
let url = "jdbc:mariadb://localhost:3306/" + database;
let pathToAlias = path.join(__dirname, "..", '.liquibase', targetAlias)
let pathToChangelog = path.join(pathToAlias, "1.0.0")
let pathToAliasInAliasDefinition = path.join(__dirname, "..", 'aliasDefinition', targetAlias);
if(!existsSync(pathToAliasInAliasDefinition))
throw Error("Alias does not exist: " + pathToAliasInAliasDefinition);
mkdirSync(pathToAlias, {recursive: true})
mkdirSync(path.join(pathToChangelog, "csv"), {recursive: true})
const createTablePrecondition: string = `\t\t<preConditions onFail="MARK_RAN">
\t\t\t<not>
\t\t\t\t<tableExists tableName="$2"/>
\t\t\t</not>
\t\t</preConditions>
\t\t$1`.replace(/\t/g, " ")
const createIndexPrecondition = `\t\t<preConditions onFail="MARK_RAN">
\t\t\t<not>
\t\t\t\t<indexExists indexName="$2"/>
\t\t\t</not>
\t\t</preConditions>
\t\t$1`.replace(/\t/g, " ")
function createLoadDataPrecondition(tableName: string, columns: string[]): string{
let loadDataPreconditionColumns = columns.map(column => `\t\t\t\t<columnExists tableName="${tableName}" columnName="${column}"/>`).join("\r\n");
let loadDataPrecondition = `<preConditions onFail="MARK_RAN">
\t\t\t<and>
\t\t\t\t<tableExists tableName="${tableName}"/>
\t\t\t\t<sqlCheck expectedResult="0">
\t\t\t\t\tSELECT COUNT(1) FROM ${tableName}
\t\t\t\t</sqlCheck>
${loadDataPreconditionColumns}
\t\t\t</and>
\t\t</preConditions>`.replace(/\t/g, " ")
return loadDataPrecondition;
}
generateChangesets().then(() => generateChangelogXMLs());
async function generateChangesets(){
//@ts-ignore Missing parameter changeLogFile is set in for loop
let config: LiquibaseConfig = {
classpath: classpath,
url: url,
username: "adito",
password: "adito"
}
//@ts-ignore Missing mandatory parameter causes error
const changeLogParams: GenerateChangeLogCommandAttributes = {
dataOutputDirectory: path.join(pathToChangelog, "csv")
}
const liquibase = new Liquibase(config);
for(const table of tables)
{
let changelogFilename: string = "create_"+ table +".xml";
let changelogFilePath: string = path.join(pathToChangelog, changelogFilename)
//Ignoring enclosure so we don't need to create a new Liquibase Object for every table, also the includedObjects param is currently missing for the config
//@ts-ignore
liquibase.config.changeLogFile = path.join(pathToChangelog, "create_"+ table +".xml");
//@ts-ignore
liquibase.config.includeObjects = table;
console.log("Generating ", changelogFilename)
await liquibase.generateChangeLog(changeLogParams)
.then(() => {
let file = readFileSync(changelogFilePath, "utf-8");
file = file.replace(/.*(<createTable tableName="(.*?)">).*/g, createTablePrecondition);
file = file.replace(/.*(<createIndex indexName="(.*?)" tableName="(.*?)">).*/g, createIndexPrecondition);
let loadDatas: RegExpMatchArray[] = Array.from(file.matchAll(/<loadData.*?>(.*?)<\/loadData>/gms))
for(let i =0; i<loadDatas.length; i++)
{
let tableName: string | null = (loadDatas[i][0].match(/tableName="(.*?)"/) ?? [ , null])[1]
let columnsMatches = loadDatas[i][0].matchAll(/<column header="(.*?)"/g);
let columnNames: string[] = Array.from(columnsMatches).map(column => column[1]);
if(!tableName)
{
throw new Error("Tablename not found!")
}
let precondition: string = createLoadDataPrecondition(tableName, columnNames);
file = file.replace(loadDatas[i][0], precondition + '\r\n\t' + loadDatas[i][0])
}
file = file.replace(/(<loadData.*?file=").*?(".*?tableName="(.*?)".*?>)/g, '$1csv/$3.csv" relativeToChangelogFile="true$2')
file = file.replace(/id=".*?"/g, () => 'id="' + randomUUID() + '"')
writeFileSync(changelogFilePath, file, {encoding: "utf-8", flag: "w"});
})
.catch((err: Error) => {
if(err.message.indexOf("existiert bereits") != -1)
console.warn(changelogFilePath, " already exists! -> Skipped");
else
throw err;
});
};
}
function generateChangelogXMLs(){
let rootChangelog: string = `<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
\txmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
\txsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
\t<include relativeToChangelogFile="true" file="1.0.0/changelog.xml"/>
</databaseChangeLog>`
let changelogFilenames: string[] = tables.map(table => `create_${table}.xml`);
let changesets: string = changelogFilenames.map(changesetFilename => `\t<include relativeToChangelogFile="true" file="${changesetFilename}"/>`).join('\r\n')
let initChangelog: string = `<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
\txmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
\txsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
${changesets}
</databaseChangeLog>`
writeFileSync(path.join(pathToAlias, "changelog.xml"), rootChangelog, {encoding: "utf-8", flag: "w"})
writeFileSync(path.join(pathToChangelog, "changelog.xml"), initChangelog, {encoding: "utf-8", flag: "w"})
}
\ No newline at end of file