diff --git a/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod b/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod index 3c1336f58bb89beb5882d3d227165b7145289271..ac1185cf4bfd2c46ca3757b28ac12aed8472efb0 100644 --- a/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod +++ b/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/KeywordAttribute_entity/documentation.adoc</documentation> <title>Keyword Attribute</title> + <grantDeleteProcess>%aditoprj%/entity/KeywordAttribute_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/KeywordAttribute_entity/contentTitleProcess.js</contentTitleProcess> <iconId>VAADIN:KEY_O</iconId> <iconIdProcess>%aditoprj%/entity/KeywordAttribute_entity/iconIdProcess.js</iconIdProcess> diff --git a/entity/KeywordAttribute_entity/grantDeleteProcess.js b/entity/KeywordAttribute_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d7194ae0db833587f4d58bfd766d04995394af74 --- /dev/null +++ b/entity/KeywordAttribute_entity/grantDeleteProcess.js @@ -0,0 +1,18 @@ +import("system.result"); +import("Attribute_lib"); +import("system.vars"); +import("Sql_lib"); +import("Entity_lib"); + +var id = vars.get("$field.AB_KEYWORD_ATTRIBUTEID"); + +var countSql = newSelect("count(*)") + .from("AB_KEYWORD_ATTRIBUTERELATION") + .where("AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ATTRIBUTE_ID", id) + +var canDelete = new HasLinkedObjectTester() + .andSqlYieldsZero(countSql) + .andNoEntityRows("KeywordAttributeRelation_entity", "AttributesForKeywordEntry", {KeywordEntryId_param: id}) + .validate(); + +result.string(canDelete);