From 79516a25da4a60bd1b63bf9480d3e8ca1c050d95 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 28 Feb 2019 11:37:36 +0100 Subject: [PATCH] refactor object relation --- aliasDefinition/Data_alias/Data_alias.aod | 14 ++ .../ObjectRelation_entity.aod | 93 ++++++++++++ .../ab_objectrelationid/valueProcess.js | 2 +- .../children/providertype_param/code.js | 3 + .../anyobjectrowid/displayValueProcess.js | 5 +- .../anyobjectrowid/valueProcess.js | 3 +- .../anyobjecttype/displayValueProcess.js | 5 +- .../anyobjecttype/valueProcess.js | 3 +- .../children/providertype_param/code.js | 3 + .../children/providertype_param/code.js | 3 + .../object1_rowid/displayValueProcess.js | 4 +- .../object1_rowid/stateProcess.js | 6 +- .../object1_rowid/valueProcess.js | 4 +- .../entityfields/object1_type/stateProcess.js | 9 +- .../children/providertype_param/code.js | 3 + .../object2_rowid/stateProcess.js | 5 +- .../entityfields/object2_type/stateProcess.js | 5 +- .../children/providertype_param/code.js | 3 + .../entityfields/providertype_param/code.js | 3 + .../recordcontainers/db/conditionProcess.js | 25 ++-- neonContext/ObjectRelation/ObjectRelation.aod | 4 + .../ObjectRelationTree_view.aod | 16 +++ .../2019.2/add_ObjectRelationKeyword.xml | 132 ++++++++++++++++++ .../data_alias/basic/2019.2/changelog.xml | 1 + 24 files changed, 328 insertions(+), 26 deletions(-) create mode 100644 entity/ObjectRelation_entity/entityfields/anyobject/children/providertype_param/code.js create mode 100644 entity/ObjectRelation_entity/entityfields/bothobjects/children/providertype_param/code.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1/children/providertype_param/code.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2/children/providertype_param/code.js create mode 100644 entity/ObjectRelation_entity/entityfields/objecttree/children/providertype_param/code.js create mode 100644 entity/ObjectRelation_entity/entityfields/providertype_param/code.js create mode 100644 neonView/ObjectRelationTree_view/ObjectRelationTree_view.aod create mode 100644 others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index f92410dc6e..c22e676dc4 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -3791,6 +3791,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod index 7962870d76..dbac00a424 100644 --- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod +++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod @@ -105,6 +105,15 @@ <name>Object1Rowid_param</name> <expose v="true" /> </entityParameter> + <entityParameter> + <name>Object2RowidTitle_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1/children/providertype_param/code.js</code> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -146,6 +155,15 @@ <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>Object2RowidTitle_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2/children/providertype_param/code.js</code> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityProvider> @@ -192,6 +210,15 @@ <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>Object2RowidTitle_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/bothobjects/children/providertype_param/code.js</code> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -277,6 +304,15 @@ <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>Object2RowidTitle_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/anyobject/children/providertype_param/code.js</code> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityConsumer> @@ -341,6 +377,56 @@ <entityField> <name>EMPTY</name> </entityField> + <entityField> + <name>TYPE</name> + </entityField> + <entityProvider> + <name>ObjectTree</name> + <fieldType>DEPENDENCY_IN</fieldType> + <recordContainer>tree_jdito</recordContainer> + <children> + <entityParameter> + <name>Object1Rowid_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Object1Type_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>AnyObjectRowid_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>AnyObjectType_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>Object2Type_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>Object2Rowid_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>Object2RowidTitle_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/objecttree/children/providertype_param/code.js</code> + <expose v="true" /> + </entityParameter> + </children> + </entityProvider> + <entityParameter> + <name>ProviderType_param</name> + <code>%aditoprj%/entity/ObjectRelation_entity/entityfields/providertype_param/code.js</code> + <expose v="true" /> + <mandatory v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -386,7 +472,14 @@ <name>OBJECT1_ROWID.displayValue</name> <expression>%aditoprj%/entity/ObjectRelation_entity/recordcontainers/db/recordfieldmappings/object1_rowid.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TYPE.value</name> + <recordfield>AB_OBJECTRELATION.TYPE</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> + <jDitoRecordContainer> + <name>tree_jdito</name> + </jDitoRecordContainer> </recordContainers> </entity> diff --git a/entity/ObjectRelation_entity/entityfields/ab_objectrelationid/valueProcess.js b/entity/ObjectRelation_entity/entityfields/ab_objectrelationid/valueProcess.js index f763792967..f6b9da922b 100644 --- a/entity/ObjectRelation_entity/entityfields/ab_objectrelationid/valueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/ab_objectrelationid/valueProcess.js @@ -4,4 +4,4 @@ import("system.vars"); import("system.result"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -result.string(util.getNewUUID()); \ No newline at end of file + result.string(util.getNewUUID()); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/anyobject/children/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/anyobject/children/providertype_param/code.js new file mode 100644 index 0000000000..5d1be15ce3 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/anyobject/children/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("any"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/anyobjectrowid/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/anyobjectrowid/displayValueProcess.js index 29b3c356fb..f262c44d34 100644 --- a/entity/ObjectRelation_entity/entityfields/anyobjectrowid/displayValueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/anyobjectrowid/displayValueProcess.js @@ -3,7 +3,10 @@ import("system.result"); import("system.vars"); import("Context_lib"); -if (vars.exists("$field.AnyObjectType") && vars.get("$field.AnyObjectType") && vars.exists("$field.AnyObjectRowid") && vars.get("$field.AnyObjectRowid")) +var providerType = vars.getString("$param.ProviderType_param"); + +// any object +if (providerType == "any") { result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.AnyObjectType"), vars.get("$field.AnyObjectRowid")))); } diff --git a/entity/ObjectRelation_entity/entityfields/anyobjectrowid/valueProcess.js b/entity/ObjectRelation_entity/entityfields/anyobjectrowid/valueProcess.js index 30698cf10e..7b5c62b300 100644 --- a/entity/ObjectRelation_entity/entityfields/anyobjectrowid/valueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/anyobjectrowid/valueProcess.js @@ -3,9 +3,10 @@ import("system.vars"); var openedType; var openedRowid; +var providerType = vars.getString("$param.ProviderType_param"); // any object -if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) +if (providerType == "any") { openedType = vars.get("$param.AnyObjectType_param"); if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) diff --git a/entity/ObjectRelation_entity/entityfields/anyobjecttype/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/anyobjecttype/displayValueProcess.js index ca00da6bc3..24c141470a 100644 --- a/entity/ObjectRelation_entity/entityfields/anyobjecttype/displayValueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/anyobjecttype/displayValueProcess.js @@ -2,7 +2,10 @@ import("system.project"); import("system.result"); import("system.vars"); -if (vars.exists("$field.AnyObjectType") && vars.get("$field.AnyObjectType")) +var providerType = vars.getString("$param.ProviderType_param"); + +// any object +if (providerType == "any") { result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.AnyObjectType"))[1]); } \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/anyobjecttype/valueProcess.js b/entity/ObjectRelation_entity/entityfields/anyobjecttype/valueProcess.js index 8635bcb684..03a9ea0a0f 100644 --- a/entity/ObjectRelation_entity/entityfields/anyobjecttype/valueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/anyobjecttype/valueProcess.js @@ -4,9 +4,10 @@ import("system.vars"); var openedType; var openedRowid; +var providerType = vars.getString("$param.ProviderType_param"); // any object -if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) +if (providerType == "any") { openedType = vars.get("$param.AnyObjectType_param"); if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) diff --git a/entity/ObjectRelation_entity/entityfields/bothobjects/children/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/bothobjects/children/providertype_param/code.js new file mode 100644 index 0000000000..ab42a16d83 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/bothobjects/children/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("both"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1/children/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/object1/children/providertype_param/code.js new file mode 100644 index 0000000000..975bf6435d --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1/children/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("1"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1_rowid/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/object1_rowid/displayValueProcess.js index f82167f8b6..d2f4174974 100644 --- a/entity/ObjectRelation_entity/entityfields/object1_rowid/displayValueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object1_rowid/displayValueProcess.js @@ -7,7 +7,9 @@ import("Context_lib"); var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW) { - if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) + var providerType = vars.getString("$param.ProviderType_param"); + // any object + if (providerType == "any") { result.string(db.cell(ContextUtils.getNameSql(vars.get("$param.AnyObjectType_param"), vars.get("$param.AnyObjectRowid_param")))); } diff --git a/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js index 5f470da0cc..1713cbfdb0 100644 --- a/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js @@ -5,9 +5,9 @@ import("system.vars"); var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { - - if ((vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) - || (vars.exists("$param.Object1Rowid_param") && vars.get("$param.Object1Rowid_param"))) + var providerType = vars.getString("$param.ProviderType_param"); + if (providerType == "any" && vars.get("$param.AnyObjectRowid_param") == vars.get("$field.OBJECT1_ROWID") + || providerType == "1") { result.string(neon.COMPONENTSTATE_READONLY); } diff --git a/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js b/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js index 679db41733..10fdb42a49 100644 --- a/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js @@ -6,7 +6,9 @@ var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { - if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) + var providerType = vars.getString("$param.ProviderType_param"); + // any object + if (providerType == "any") { result.string(vars.get("$param.AnyObjectRowid_param")); } diff --git a/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js index 7cbd5a35ac..251f52b4fb 100644 --- a/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js @@ -5,10 +5,11 @@ import("system.vars"); var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { - if ((vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) - || (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param"))) + var providerType = vars.getString("$param.ProviderType_param"); + + if (providerType == "any" && vars.get("$param.AnyObjectType_param") == vars.get("$field.OBJECT1_TYPE") + || providerType == "1") { result.string(neon.COMPONENTSTATE_READONLY); } -} -result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2/children/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/object2/children/providertype_param/code.js new file mode 100644 index 0000000000..c05919d82d --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2/children/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("2"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js index 51c5fa78a2..55fb759576 100644 --- a/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js @@ -5,6 +5,9 @@ import("system.vars"); var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { - if (vars.exists("$param.Object2Rowid_param") && vars.get("$param.Object2Rowid_param")) + var providerType = vars.getString("$param.ProviderType_param"); + + if (providerType == "any" && vars.get("$param.AnyObjectRowid_param") == vars.get("$field.OBJECT2_ROWID") + || providerType == "2") result.string(neon.COMPONENTSTATE_READONLY); } \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js index 7d99ab991e..a4c722604f 100644 --- a/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js +++ b/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js @@ -5,6 +5,9 @@ import("system.vars"); var recordstate = vars.get("$sys.recordstate"); if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { - if (vars.exists("$param.Object2Type_param") && vars.get("$param.Object2Type_param")) + var providerType = vars.getString("$param.ProviderType_param"); + + if (providerType == "any" && vars.get("$param.AnyObjectType_param") == vars.get("$field.OBJECT2_TYPE") + || providerType == "2") result.string(neon.COMPONENTSTATE_READONLY); } \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/objecttree/children/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/objecttree/children/providertype_param/code.js new file mode 100644 index 0000000000..4a2d2e1c96 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/objecttree/children/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("tree"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/providertype_param/code.js b/entity/ObjectRelation_entity/entityfields/providertype_param/code.js new file mode 100644 index 0000000000..981503eee3 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/providertype_param/code.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("none"); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/recordcontainers/db/conditionProcess.js b/entity/ObjectRelation_entity/recordcontainers/db/conditionProcess.js index fd3608bd87..6ac4ab4010 100644 --- a/entity/ObjectRelation_entity/recordcontainers/db/conditionProcess.js +++ b/entity/ObjectRelation_entity/recordcontainers/db/conditionProcess.js @@ -3,6 +3,8 @@ import("system.result"); import("system.db"); import("Sql_lib"); +var providerType = vars.getString("$param.ProviderType_param"); + var anyObject = SqlCondition.begin() .orSqlCondition(SqlCondition.begin() .andPrepareVars("AB_OBJECTRELATION.OBJECT1_TYPE", "$param.AnyObjectType_param") @@ -21,17 +23,20 @@ var object2 = SqlCondition.begin() var fullCondition = SqlCondition.begin(); -// if all four parameters exist, check for all. else only check 1 or 2 or any -if (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param") && vars.exists("$param.Object2Type_param") && vars.get("$param.Object2Type_param")) -{ - fullCondition.andSqlCondition(object1, "1=2") - .andSqlCondition(object2, "1=2"); -} -else + +switch (providerType) { - fullCondition.orSqlCondition(anyObject) - .orSqlCondition(object1) - .orSqlCondition(object2); + case "both": + fullCondition.andSqlCondition(object1, "1=2") + .andSqlCondition(object2, "1=2"); + break; + case "any": + fullCondition.orSqlCondition(anyObject); + break; + case "1": + fullCondition.orSqlCondition(object1); + case "2": + fullCondition.orSqlCondition(object2); } result.string(db.translateCondition(fullCondition.build("1=2"))); \ No newline at end of file diff --git a/neonContext/ObjectRelation/ObjectRelation.aod b/neonContext/ObjectRelation/ObjectRelation.aod index 763a754b47..dc26829c2b 100644 --- a/neonContext/ObjectRelation/ObjectRelation.aod +++ b/neonContext/ObjectRelation/ObjectRelation.aod @@ -23,5 +23,9 @@ <name>cec4dc52-b38f-4f7c-b8ca-4b81ccda3ac1</name> <view>Object1RelationFilter_view</view> </neonViewReference> + <neonViewReference> + <name>a1efaa32-2313-40b5-9cd0-715b9c635036</name> + <view>ObjectRelationTree_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/ObjectRelationTree_view/ObjectRelationTree_view.aod b/neonView/ObjectRelationTree_view/ObjectRelationTree_view.aod new file mode 100644 index 0000000000..e85a4964fb --- /dev/null +++ b/neonView/ObjectRelationTree_view/ObjectRelationTree_view.aod @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.1"> + <name>ObjectRelationTree_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <treetableViewTemplate> + <name>objectRelations</name> + <entityField>#ENTITY</entityField> + </treetableViewTemplate> + </children> +</neonView> diff --git a/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml b/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml new file mode 100644 index 0000000000..c3ba23a84c --- /dev/null +++ b/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml @@ -0,0 +1,132 @@ +<?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: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/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.hoermann" id="e19fc338-8596-4dbb-81e0-0cb6a1af6bf2"> + <addColumn tableName="AB_OBJECTRELATION"> + <column name="TYPE" type="CHAR(36)"/> + </addColumn> + + <!-- define attributes for the object relation --> + <insert tableName="AB_KEYWORD_ATTRIBUTE"> + <column name="AB_KEYWORD_ATTRIBUTEID" value="6f81d079-d404-4bda-a7c7-b830ed3d80d5"/> + <column name="NAME" value="Object1Title"/> + <column name="TYPE" value="CHAR_VALUE"/> + <column name="CONTAINER" value="ObjectRelationType"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTE"> + <column name="AB_KEYWORD_ATTRIBUTEID" value="e8c85be3-1acb-45f6-aeea-726ba5811ab8"/> + <column name="NAME" value="Object2Title"/> + <column name="TYPE" value="CHAR_VALUE"/> + <column name="CONTAINER" value="ObjectRelationType"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTE"> + <column name="AB_KEYWORD_ATTRIBUTEID" value="c81d7fda-9779-46cc-b170-a1c49300b8c2"/> + <column name="NAME" value="Object1Type"/> + <column name="TYPE" value="CHAR_VALUE"/> + <column name="CONTAINER" value="ObjectRelationType"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTE"> + <column name="AB_KEYWORD_ATTRIBUTEID" value="0b5d7e46-45c2-48f3-a48a-b3d1a0af674c"/> + <column name="NAME" value="Object2Type"/> + <column name="TYPE" value="CHAR_VALUE"/> + <column name="CONTAINER" value="ObjectRelationType"/> + </insert> + + + <!-- insert the possible relations --> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="c9b7ce6b-1100-46f6-8498-2da6ac24189e"/> + <column name="KEYID" value="85ad4578-dce2-49df-a844-d162f1bd9f2f"/> + <column name="TITLE" value="parent company - subsidiary"/> + <column name="CONTAINER" value="ObjectRelationType"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="4e986a5a-2262-4ec0-b421-c2f5d88be018"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="6f81d079-d404-4bda-a7c7-b830ed3d80d5"/> + <column name="AB_KEYWORD_ENTRY_ID" value="c9b7ce6b-1100-46f6-8498-2da6ac24189e"/> + <column name="CHAR_VALUE" value="parent company"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="7b9e8730-b6c8-482a-8a75-aee066a8efe5"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="e8c85be3-1acb-45f6-aeea-726ba5811ab8"/> + <column name="AB_KEYWORD_ENTRY_ID" value="c9b7ce6b-1100-46f6-8498-2da6ac24189e"/> + <column name="CHAR_VALUE" value="subsidiary"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="b6526d57-2ad9-48dc-94a7-689e8d263c16"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="c81d7fda-9779-46cc-b170-a1c49300b8c2"/> + <column name="AB_KEYWORD_ENTRY_ID" value="c9b7ce6b-1100-46f6-8498-2da6ac24189e"/> + <column name="CHAR_VALUE" value="Organisation"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="d9a32354-81a5-4172-bab7-fef08a49ca74"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="0b5d7e46-45c2-48f3-a48a-b3d1a0af674c"/> + <column name="AB_KEYWORD_ENTRY_ID" value="c9b7ce6b-1100-46f6-8498-2da6ac24189e"/> + <column name="CHAR_VALUE" value="Organisation"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="KEYID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="TITLE" value="parent - child"/> + <column name="CONTAINER" value="ObjectRelationType"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="8a59bb48-9a59-44d4-a850-2efe195c86a3"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="6f81d079-d404-4bda-a7c7-b830ed3d80d5"/> + <column name="AB_KEYWORD_ENTRY_ID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="CHAR_VALUE" value="parent"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="df713320-3aa3-4fb0-949d-8d23e03bdcbf"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="e8c85be3-1acb-45f6-aeea-726ba5811ab8"/> + <column name="AB_KEYWORD_ENTRY_ID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="CHAR_VALUE" value="child"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="361a2bbf-2e1b-49fc-8d5d-8926b6ad279f"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="c81d7fda-9779-46cc-b170-a1c49300b8c2"/> + <column name="AB_KEYWORD_ENTRY_ID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="CHAR_VALUE" value="Person"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="f8671437-0f70-406f-bd45-8013709b8b00"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="0b5d7e46-45c2-48f3-a48a-b3d1a0af674c"/> + <column name="AB_KEYWORD_ENTRY_ID" value="727959cf-35ae-4f31-94f0-03f1aa86ce63"/> + <column name="CHAR_VALUE" value="Person"/> + </insert> + + + + <rollback> + <dropColumn tableName="AB_OBJECTRELATION" columnName="TYPE"/> + + <delete tableName="AB_KEYWORD_ATTRIBUTE"> + <where>CONTAINER = ?</where> + <whereParams> + <param value="ObjectRelationType"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ENTRY"> + <where>CONTAINER = ?</where> + <whereParams> + <param value="ObjectRelationType"/> + </whereParams> + </delete> + <delete tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <where>AB_KEYWORD_ATTRIBUTE_ID in (?, ?, ?, ?)</where> + <whereParams> + <param value="6f81d079-d404-4bda-a7c7-b830ed3d80d5"/> + <param value="e8c85be3-1acb-45f6-aeea-726ba5811ab8"/> + <param value="c81d7fda-9779-46cc-b170-a1c49300b8c2"/> + <param value="0b5d7e46-45c2-48f3-a48a-b3d1a0af674c"/> + </whereParams> + </delete> + </rollback> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/others/db_changes/data_alias/basic/2019.2/changelog.xml b/others/db_changes/data_alias/basic/2019.2/changelog.xml index 6677259879..49f4486f0d 100644 --- a/others/db_changes/data_alias/basic/2019.2/changelog.xml +++ b/others/db_changes/data_alias/basic/2019.2/changelog.xml @@ -49,4 +49,5 @@ <include relativeToChangelogFile="true" file="task_add_parent.xml"/> <include relativeToChangelogFile="true" file="drop_estimation_salesproject.xml"/> + <include relativeToChangelogFile="true" file="add_ObjectRelationKeyword.xml"/> </databaseChangeLog> \ No newline at end of file -- GitLab