diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index e19f6645d2b98ebb33e7c1567ba8c77ea7aada54..33ed911d36e6c3012a6e0e311acdc615689e15af 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -218,25 +218,6 @@ <element>PROCESS</element> </onValueChangeTypes> </entityField> - <entityOutgoingField> - <name>ActivityObjectRelation_dfo</name> - <fieldType>DEPENDENCY_OUT</fieldType> - <dependency> - <name>dependency</name> - <entityName>ObjectRelation_entity</entityName> - <fieldName>ObjectRelationById_dfi</fieldName> - </dependency> - <children> - <entityParameter> - <name>ObjectRelatonId_param</name> - <code>%aditoprj%/entity/Activity_entity/entityfields/activityobjectrelation_dfo/children/objectrelatonid_param/code.js</code> - <triggerRecalculation v="true" /> - </entityParameter> - </children> - </entityOutgoingField> - <entityField> - <name>AB_OBJECTRELATION_AB_OBJECTRELATIONID</name> - </entityField> <entityIncomingField> <name>ActivityById_dfi</name> <fieldType>DEPENDENCY_IN</fieldType> @@ -265,39 +246,23 @@ <mandatory v="false" /> <description>PARAMETER</description> </entityParameter> - <entityField> - <name>AB_OBJECTRELATION_OBJECT2_TYPE</name> - <title>Object type</title> - </entityField> - <entityField> - <name>AB_OBJECTRELATION_OBJECT2_ROWID</name> - <title>Object</title> - </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> - <fromClauseProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBDelete>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> - <name>f28ac44d-9586-4d5d-881a-d7a850fb85e7</name> + <name>4d4e82f5-fd0d-48e0-805a-c713d73dfae0</name> <tableName>ACTIVITY</tableName> <primaryKey>ACTIVITYID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> - <linkInformation> - <name>b9f755e6-c68e-4562-a602-4d45101c2b0c</name> - <tableName>AB_OBJECTRELATION</tableName> - <primaryKey>AB_OBJECTRELATIONID</primaryKey> - <isUIDTable v="false" /> - <readonly v="true" /> - </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -332,18 +297,6 @@ <name>CATEGORY.value</name> <recordfield>ACTIVITY.CATEGORY</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>AB_OBJECTRELATION_AB_OBJECTRELATIONID.value</name> - <recordfield>AB_OBJECTRELATION.AB_OBJECTRELATIONID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>AB_OBJECTRELATION_OBJECT2_ROWID.value</name> - <recordfield>AB_OBJECTRELATION.OBJECT2_ROWID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>AB_OBJECTRELATION_OBJECT2_TYPE.value</name> - <recordfield>AB_OBJECTRELATION.OBJECT2_TYPE</recordfield> - </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Activity_entity/entityfields/activityobjectrelation_dfo/children/objectrelatonid_param/code.js b/entity/Activity_entity/entityfields/activityobjectrelation_dfo/children/objectrelatonid_param/code.js deleted file mode 100644 index 4e20be99f02efc740fa51d208cd053774455b946..0000000000000000000000000000000000000000 --- a/entity/Activity_entity/entityfields/activityobjectrelation_dfo/children/objectrelatonid_param/code.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.logging"); -import("system.vars"); -import("system.result"); - -logging.log("set " + vars.get("$field.AB_OBJECTRELATION_AB_OBJECTRELATIONID")) -result.string(vars.get("$field.AB_OBJECTRELATION_AB_OBJECTRELATIONID")); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/conditionProcess.js b/entity/Activity_entity/recordcontainers/db/conditionProcess.js index fbaa41996f839738d6ea25911d31149121372a97..2ac98d5394e8e4b7582c942222e76c23c15cd48a 100644 --- a/entity/Activity_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Activity_entity/recordcontainers/db/conditionProcess.js @@ -3,10 +3,18 @@ import("system.db"); import("system.result"); import("Sql_lib"); import("ObjectRelation_lib"); +import("Context_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("AB_OBJECTRELATION.OBJECT2_ROWID", "$param.RowId_param"); + +var objectRelationCond = SqlCondition.begin() + .andPrepare("AB_OBJECTRELATION.OBJECT1_TYPE", ContextUtils.getCurrentContextId()) + .and("AB_OBJECTRELATION.OBJECT1_ROWID = ACTIVITY.ACTIVITYID") + .andPrepareVars("AB_OBJECTRELATION.OBJECT2_TYPE" , "$param.ObjectId_param") + .andPrepareVars("AB_OBJECTRELATION.OBJECT2_ROWID" , "$param.RowId_param"); + +cond.and(db.translateStatement(objectRelationCond.buildSql("exists (select 1 from AB_OBJECTRELATION", "1=2", ")"))); cond.andPrepareVars("ACTIVITY.ACTIVITYID", "$param.ActivityId_param"); if(vars.exists("$param.OnlyInnate_param") && vars.get("$param.OnlyInnate_param")) diff --git a/entity/Activity_entity/recordcontainers/db/fromClauseProcess.js b/entity/Activity_entity/recordcontainers/db/fromClauseProcess.js deleted file mode 100644 index 7a771ce99e46167483f5ad1b87d42097f5055c2b..0000000000000000000000000000000000000000 --- a/entity/Activity_entity/recordcontainers/db/fromClauseProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.vars"); -import("system.result"); -import("system.db"); -import("ObjectRelation_lib"); - -var objectId = (vars.exists("$param.ObjectId_param") ? vars.get("$param.ObjectId_param") : undefined); -result.string("ACTIVITY " + db.translateStatement(ObjectRelationUtils.getJoin("ACTIVITY.ACTIVITYID", objectId))); \ No newline at end of file diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod index ea3788afa51ecab59f8cda405cf571789371116c..52aac5e6a29c9683389465b35d54af3201914889 100644 --- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod +++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod @@ -62,14 +62,6 @@ <name>ObjectRelationById_dfi</name> <fieldType>DEPENDENCY_IN</fieldType> <recordContainer>db</recordContainer> - <dependencies> - <entityDependency> - <name>59707c94-621c-427d-a465-2a08ae268bbb</name> - <entityName>Activity_entity</entityName> - <fieldName>ActivityObjectRelation_dfo</fieldName> - <isOutgoing v="false" /> - </entityDependency> - </dependencies> </entityIncomingField> </entityFields> <recordContainers> diff --git a/neonView/ActivityPreview_view/ActivityPreview_view.aod b/neonView/ActivityPreview_view/ActivityPreview_view.aod index 09ac0660648e3472e5f2c33e311f47e48988b28c..eaa45e929fc6184e171a216cc0ad63b6ed15cace 100644 --- a/neonView/ActivityPreview_view/ActivityPreview_view.aod +++ b/neonView/ActivityPreview_view/ActivityPreview_view.aod @@ -32,14 +32,6 @@ <name>b0673d1d-af3d-4daa-b6ec-511f18367e7f</name> <entityField>INFO</entityField> </entityFieldLink> - <entityFieldLink> - <name>d57cbf7c-f590-4166-a232-60a43affb9d0</name> - <entityField>AB_OBJECTRELATION_OBJECT2_TYPE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>1347066e-16d1-47ba-92e9-8f4aa30326b2</name> - <entityField>AB_OBJECTRELATION_OBJECT2_ROWID</entityField> - </entityFieldLink> </fields> </genericViewTemplate> <neonViewReference> diff --git a/others/db_changes/data_alias/data/example_activity/example_activity_gfk.xml b/others/db_changes/data_alias/data/example_activity/example_activity_gfk.xml index e0e2a2846e2cf7d880fa50c0a59100d82083ec42..5e8d87cc869b37565ac13a59f94a1e899a57e210 100644 --- a/others/db_changes/data_alias/data/example_activity/example_activity_gfk.xml +++ b/others/db_changes/data_alias/data/example_activity/example_activity_gfk.xml @@ -20,6 +20,15 @@ <column name="USER_NEW" value="Admin"/> <column name="DATE_NEW" valueDate="2018-08-03T12:02:52"/> </insert> + <insert tableName="AB_OBJECTRELATION"> + <column name="AB_OBJECTRELATIONID" value="83337967-5d58-4b17-88c2-2aeefa130c21"/> + <column name="OBJECT1_TYPE" value="Activity_context"/> + <column name="OBJECT1_ROWID" value="661a7b87-68ae-4d52-bc22-6bf96184e6fe"/> + <column name="OBJECT2_TYPE" value="Pers_context"/> + <column name="OBJECT2_ROWID" value="6be18a7e-e7fa-11e8-9f32-f2801f1b9fd1"/> + <column name="USER_NEW" value="Admin"/> + <column name="DATE_NEW" valueDate="2018-08-03T12:02:52"/> + </insert> <insert tableName="ACTIVITY"> <column name="ACTIVITYID" value="9dda39bf-966c-4560-be03-5ddbbc1da84a"/> <column name="SUBJECT" value="Webinar-Aufzeichnung"/> diff --git a/others/db_changes/data_alias/data/example_org/ORG_gfk.xml b/others/db_changes/data_alias/data/example_org/ORG_gfk.xml index 6090a887fa8a45a2d31629d7347405a1b781ad03..b3c8c49ca9218a155e7161293fec640eb03484b6 100644 --- a/others/db_changes/data_alias/data/example_org/ORG_gfk.xml +++ b/others/db_changes/data_alias/data/example_org/ORG_gfk.xml @@ -65,16 +65,6 @@ <column name="ADDRESS" value="Wilhelm-Straße"/> <column name="DISTRICT" value="Oberbayern"/> </insert> - <insert tableName="ACTIVITY"> - <column name="ACTIVITYID" value="de410a35-bcab-407e-9d60-7a65f028159b"/> - <column name="USER_NEW" value="admin"/> - <column name="DATE_NEW" valueDate="2018-08-03T12:02:52"/> - <column name="SUBJECT" value="Produktpalette"/> - <column name="INFO" value="seit November neuer Einkäufer bei Schulz. Herr Traum wird unsere Spezifikation aber in jedem Fall auch 1997 festschreiben. Dennoch Vorsicht: Besuch"/> - <column name="CATEGORY" valueNumeric="2"/> - <column name="DIRECTION" value="i"/> - <column name="ENTRYDATE" valueDate="2018-08-03T12:41:22"/> - </insert> <insert tableName="ACTIVITY"> <column name="ACTIVITYID" value="de110a33-bcab-407e-9d60-7a65f028159b"/> <column name="USER_NEW" value="admin"/> @@ -134,12 +124,6 @@ <param value="de110a33-bcab-407e-9d60-7a65f028159b" /> </whereParams> </delete> - <delete tableName="ACTIVITY"> - <where>ACTIVITYID = ?</where> - <whereParams> - <param value="de410a35-bcab-407e-9d60-7a65f028159b" /> - </whereParams> - </delete> <delete tableName="ADDRESS"> <where>ADDRESSID = ?</where> <whereParams> diff --git a/process/ObjectRelation_lib/process.js b/process/ObjectRelation_lib/process.js index a86e5e08c9838eb1cd19d66b2f9f1dcf60abd8a1..9a4604f1bfbf6988c22afb972b8237a9fa02bcfa 100644 --- a/process/ObjectRelation_lib/process.js +++ b/process/ObjectRelation_lib/process.js @@ -11,41 +11,4 @@ import("Sql_lib"); */ function ObjectRelationUtils() {} -/** - * Returns a join as prepared sql for joining something with the Objectrelation table. - * (Note that the pObjectType2 comes before pObjectType1 because pObjectType1 is the default value most times. -> less needed undefined in method call -> cleaner code) - * - * @param {String} pDbRowIdField1 the DB-Field of the rowid to join with. Provide it as: "TABLENAME.COLNAME"<br>Be carefull! No SQL will be escaped. Do not pass strings which can be altered by an user! (SQL-injection) - * @param {String} [pObjectType2=undefined] the SECOND object type. - * @param {String} [pObjectType1=ContextUtils.getCurrentContextId()] The FIRST object type. if not provided the current context will be used - * - * @return {Array} prepared adito-sql statement ["SQL", [[param, type], [param, type], ...] - * - * @example - * var objectId = (vars.exists("$param.ObjectId_param") ? vars.get("$param.ObjectId_param") : undefined);<br> - * result.string("ACTIVITY " + db.translateStatement(ObjectRelationUtils.getJoin("ACTIVITY.ACTIVITYID", objectId))); - */ -ObjectRelationUtils.getJoin = function(pDbRowIdField1, pObjectType2, pObjectType1) -{ - // use current context as first context, if not defined - if (pObjectType1 == undefined) - pObjectType1 = ContextUtils.getCurrentContextId(); - - var joinCondition = SqlCondition.begin().andPrepare("AB_OBJECTRELATION.OBJECT1_TYPE", pObjectType1); - - if (pDbRowIdField1 != undefined && pDbRowIdField1) - { - joinCondition.and("AB_OBJECTRELATION.OBJECT1_ROWID = " + pDbRowIdField1); - } - else - { - throw new Error("ObjectRelationUtils.getRecordJoin: No pDbIdField1 given.") - } - - if (pObjectType2 != undefined && pObjectType2) - { - joinCondition.andPrepare("AB_OBJECTRELATION.OBJECT2_TYPE", pObjectType2); - } - - return joinCondition.buildSql(" join AB_OBJECTRELATION on " , "1=2", undefined, false); -} +// TODO \ No newline at end of file