diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod index 43d1265c5635d3f1c2614d8023cc6a59250ff62e..6ebf46863e02427b134749532cb2e6e56b053a84 100644 --- a/entity/AttributeUsage_entity/AttributeUsage_entity.aod +++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod @@ -14,7 +14,6 @@ <name>OBJECT_TYPE</name> <title>Module</title> <consumer>Context</consumer> - <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/object_type/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess> <onValueChangeTypes> <element>MASK</element> @@ -46,6 +45,7 @@ <entityParameter> <name>AttributeId_param</name> <expose v="true" /> + <mandatory v="true" /> <description>PARAMETER</description> </entityParameter> <entityField> diff --git a/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js index 37bcaa77b0db79fa17fea2c66c834500bec6d8c9..11723fd793b70a8531845f38815279af34ab4e7e 100644 --- a/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js +++ b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js @@ -2,7 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") != null) - result.string(vars.get("$param.AttributeId_param")); -else if (vars.get("$this.value")) - result.string(vars.get("$this.value")); \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(vars.get("$param.AttributeId_param")); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js b/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js index 703c8341b77f9a59751aaffcb89c5beae5e0b5a1..84204be06fa6c446fc7449a4450461f39d413e9f 100644 --- a/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js +++ b/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js @@ -3,7 +3,11 @@ import("system.neon"); import("system.vars"); import("system.project"); -if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) +if (vars.get("$field.OBJECT_TYPE")) { + //this is a workaround to get the old value in the onDBUpdate process + //@TODO replace this when it's possible to get the old value in onDBUpdate + vars.set("$context.originalObjectType", vars.get("$field.OBJECT_TYPE")); + result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.OBJECT_TYPE"))[1]); } \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/object_type/valueProcess.js b/entity/AttributeUsage_entity/entityfields/object_type/valueProcess.js deleted file mode 100644 index 40b7c76fc5515aeb4d2e88c54f0bbe9daf403618..0000000000000000000000000000000000000000 --- a/entity/AttributeUsage_entity/entityfields/object_type/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); - -//this is a workaround to get the old value in the onDBUpdate process -//@TODO replace this when it's possible to get the old value in onDBUpdate -vars.set("$context.originalObjectType", vars.get("$field.OBJECT_TYPE")); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js index c3a22ddade799d36cd601b8c6651923aeb730984..3cf3c0ecbed88ed455f41ef96aa2b833f7f9cc94 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js @@ -2,6 +2,6 @@ import("system.vars"); import("Attribute_lib"); var data = vars.get("$local.rowdata"); -var objectType = data["OBJECT_TYPE.value"]; +var objectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"]; -AttributeUsageUtil.deleteChildrenUsages(attributeId, objectType); \ No newline at end of file +AttributeUsageUtil.deleteChildrenUsages(vars.get("$field.AB_ATTRIBUTE_ID"), objectType); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js index cb887e053582826c07d856e0371c4cee9c7d91ec..63832c618ef4f8204a9c60a4b15ab56d6994c95d 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js @@ -2,8 +2,8 @@ import("system.vars"); import("Attribute_lib"); var data = vars.get("$local.rowdata"); -var attributeId = data["AB_ATTRIBUTE_ID.value"]; -var objectType = data["OBJECT_TYPE.value"]; +var attributeId = data["AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID"]; +var objectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"]; AttributeUsageUtil.insertChildrenUsages(attributeId, objectType); AttributeUsageUtil.removeDuplicates(attributeId); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js index c32017dd3c683d7cb23b3da231eda5adeb7423cd..1915602ab9e2f4c201c05532768e89b61c0000a1 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js @@ -1,10 +1,13 @@ import("system.vars"); import("Attribute_lib"); -var data = vars.get("$local.rowdata"); -var attributeId = data["AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID"]; -var oldObjectType = vars.get("$context.originalObjectType"); -var newObjectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"]; - -AttributeUsageUtil.updateChildrenUsages(attributeId, oldObjectType, newObjectType); +if (vars.get("$local.changed").indexOf("AB_ATTRIBUTEUSAGE.OBJECT_TYPE") != -1) +{ + var data = vars.get("$local.rowdata"); + var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); + var oldObjectType = vars.get("$context.originalObjectType"); + var newObjectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"]; + + AttributeUsageUtil.updateChildrenUsages(attributeId, oldObjectType, newObjectType); +} AttributeUsageUtil.removeDuplicates(attributeId); \ No newline at end of file