diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 8672e15c2837cc586414f877b1588c7294f9eeeb..13a0974c5c644ec17856688a6ce4c8bee90c7854 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -50,6 +50,12 @@ <fieldName>Attributes</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>236a52d8-830d-4e46-bf9b-7ffaeef25477</name> + <entityName>Attribute_entity</entityName> + <fieldName>AttributeChildren</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityParameter> diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index e95bbe7da57a4f4285d84a7c2648efc132a85207..78bf584f6a1129b21d805f2e4141b7166ea4a1f4 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -14,6 +14,7 @@ <name>ATTRIBUTE_NAME</name> <title>Name</title> <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>ATTRIBUTE_TYPE</name> @@ -23,26 +24,47 @@ </entityField> <entityField> <name>AB_ATTRIBUTEID</name> - <searchable v="false" /> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/ab_attributeid/valueProcess.js</valueProcess> </entityField> <entityField> <name>ATTRIBUTE_PARENT_ID</name> <title>Parent Attribute</title> + <consumer>AttributeChildren</consumer> + <linkedContext>Attribute_context</linkedContext> <groupable v="true" /> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>AttributeChildren</name> + <title>Attributes</title> <fieldType>DEPENDENCY_OUT</fieldType> <dependency> <name>dependency</name> - <fieldName></fieldName> + <entityName>Attribute_entity</entityName> + <fieldName>AttributeParent</fieldName> </dependency> + <children> + <entityParameter> + <name>attrParentId_param</name> + <code>%aditoprj%/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js</code> + <triggerRecalculation v="true" /> + <mandatory v="false" /> + </entityParameter> + </children> </entityConsumer> <entityProvider> <name>AttributeParent</name> <fieldType>DEPENDENCY_IN</fieldType> <recordContainer>db</recordContainer> + <dependencies> + <entityDependency> + <name>18bd148d-bed3-429f-ba54-c5eac76c5083</name> + <entityName>Attribute_entity</entityName> + <fieldName>AttributeChildren</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> <entityParameter> <name>attrParentId_param</name> @@ -108,10 +130,6 @@ <name>AB_ATTRIBUTEID.value</name> <recordfield>AB_ATTRIBUTE.AB_ATTRIBUTEID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ATTRIBUTE_NAME.value</name> - <recordfield>AB_ATTRIBUTE.ATTRIBUTE_NAME</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ATTRIBUTE_PARENT_ID.value</name> <recordfield>AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID</recordfield> @@ -128,6 +146,10 @@ <name>ATTRIBUTE_TYPE.displayValue</name> <expression>%aditoprj%/entity/Attribute_entity/recordcontainers/db/recordfieldmappings/attribute_type.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ATTRIBUTE_NAME.value</name> + <recordfield>AB_ATTRIBUTE.ATTRIBUTE_NAME</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js b/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fda65f2e1d81122225a9237f0738c2d3824fe58b --- /dev/null +++ b/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +result.string(AttributeUtil.getAttributeNameById(vars.get("$field.AB_ATTRIBUTEID"))); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js b/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..490576bdd212bd187654aa7d9ee4f04011a5be33 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param")) + result.string(AttributeUtil.getAttributeNameById(vars.get("$param.attrParentId_param"))); diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4577feb68f61c4c5f6eb955e1a2b8f3be4161fc2 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.logging"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param")) + result.string(vars.get("$param.attrParentId_param")); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js b/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..8ab4e3f8c3ff494e56f4617c5a004388b5cdc589 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.getString("$field.AB_ATTRIBUTEID")); \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/db/conditionProcess.js b/entity/Attribute_entity/recordcontainers/db/conditionProcess.js index 2c2d8e0a101e1051fb616a6b74bf859065b787cb..e9da10cf919b6044f3fd76a89e4be23741837ad1 100644 --- a/entity/Attribute_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Attribute_entity/recordcontainers/db/conditionProcess.js @@ -2,5 +2,7 @@ import("system.vars"); import("system.result"); import("Sql_lib"); -//if (vars.exists("$field.AB_ATTRIBUTEID") && vars.get("$field.AB_ATTRIBUTEID") != "") -// result.string(SqlCondition.begin().andPrepare("ATTRIBUTE_PARENT_ID", vars.get("$field.AB_ATTRIBUTEID"))); \ No newline at end of file +if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param")) + result.string("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID = '" + vars.getString("$param.attrParentId_param") + "'"); +else + result.string("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID is null"); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contractcode_display_fieldgroup/valueProcess.js b/entity/Contract_entity/entityfields/contractcode_display_fieldgroup/valueProcess.js index 97ab0469059592de24d761ea6e0ac338f2b42564..3b3d5b96c09bae19240fbc0866f31943de579664 100644 --- a/entity/Contract_entity/entityfields/contractcode_display_fieldgroup/valueProcess.js +++ b/entity/Contract_entity/entityfields/contractcode_display_fieldgroup/valueProcess.js @@ -5,4 +5,4 @@ import("Keyword_lib"); var cType = vars.get("$field.CONTRACTTYPE"); var cCode = vars.get("$field.CONTRACTCODE"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.get.ContractType, cType) + " : " + cCode); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.get.ContractType, cType) + " " + cCode); \ No newline at end of file diff --git a/neonContext/Attribute_context/Attribute_context.aod b/neonContext/Attribute_context/Attribute_context.aod index 63209dcd4c959033893c525a167ee46d0967c84a..e252ccf047d1ca7e695c1642d35dc31beb22229a 100644 --- a/neonContext/Attribute_context/Attribute_context.aod +++ b/neonContext/Attribute_context/Attribute_context.aod @@ -8,6 +8,7 @@ <filterview>AttributeFilter_view</filterview> <editview>AttributeEdit_view</editview> <preview>AttributePreview_view</preview> + <lookupview>AttributeFilter_view</lookupview> <entity>Attribute_entity</entity> <references> <neonViewReference> @@ -26,5 +27,9 @@ <name>05d998e7-7364-4425-aefe-3cf284933d52</name> <view>AttributeMain_view</view> </neonViewReference> + <neonViewReference> + <name>6ab8d733-544c-4e48-ade9-b5210a5e5355</name> + <view>AttributeTree_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/AttributeEdit_view/AttributeEdit_view.aod b/neonView/AttributeEdit_view/AttributeEdit_view.aod index 6662e966bccccb1b1e1f04cd2cb9fd4d81595ad9..e68bf0bc073627df37ef7548b26597b685bc879a 100644 --- a/neonView/AttributeEdit_view/AttributeEdit_view.aod +++ b/neonView/AttributeEdit_view/AttributeEdit_view.aod @@ -13,6 +13,10 @@ <editMode v="true" /> <entityField>#ENTITY</entityField> <fields> + <entityFieldLink> + <name>2d269ed7-a664-40c3-aadb-f274f7c00a66</name> + <entityField>ATTRIBUTE_PARENT_ID</entityField> + </entityFieldLink> <entityFieldLink> <name>0c6cd7c6-cced-4719-b0c5-08f8e3d13f2f</name> <entityField>ATTRIBUTE_NAME</entityField> diff --git a/neonView/AttributeMain_view/AttributeMain_view.aod b/neonView/AttributeMain_view/AttributeMain_view.aod index 3e3b69fbba6fa6eb521067884c38357530389024..657bbd1e9b0995bdcc9a05b76b51e69da409ce36 100644 --- a/neonView/AttributeMain_view/AttributeMain_view.aod +++ b/neonView/AttributeMain_view/AttributeMain_view.aod @@ -15,9 +15,9 @@ <view>AttributePreview_view</view> </neonViewReference> <neonViewReference> - <name>d8009eea-f473-4f65-8796-a1ab48ef3b49</name> - <entityField>#ENTITY</entityField> - <view>AttributeFilter_view</view> + <name>634c58b7-74db-42d3-a90c-029678e4fed4</name> + <entityField>AttributeChildren</entityField> + <view>AttributeTree_view</view> </neonViewReference> <neonViewReference> <name>5dee1c0b-c670-4eb9-bd95-6f6474709aa2</name> diff --git a/neonView/AttributePreview_view/AttributePreview_view.aod b/neonView/AttributePreview_view/AttributePreview_view.aod index 39928da62cb424594ac8ab1cd284a8743a01ccbf..bcf16f07c694083818309d56f0ce92cbb61f7b60 100644 --- a/neonView/AttributePreview_view/AttributePreview_view.aod +++ b/neonView/AttributePreview_view/AttributePreview_view.aod @@ -11,7 +11,7 @@ <cardViewTemplate> <name>Attr_template</name> <titleField>ATTRIBUTE_NAME</titleField> - <descriptionField>ATTRIBUTE_TYPE</descriptionField> + <subtitleField>ATTRIBUTE_TYPE</subtitleField> <entityField>#ENTITY</entityField> </cardViewTemplate> </children> diff --git a/neonView/AttributeTree_view/AttributeTree_view.aod b/neonView/AttributeTree_view/AttributeTree_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..7da227dabbb30c689bff63f545ef4518d6126076 --- /dev/null +++ b/neonView/AttributeTree_view/AttributeTree_view.aod @@ -0,0 +1,19 @@ +<?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>AttributeTree_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <treetableViewTemplate> + <name>Treetable</name> + <parentField>ATTRIBUTE_PARENT_ID</parentField> + <titleField>ATTRIBUTE_NAME</titleField> + <descriptionField>ATTRIBUTE_TYPE</descriptionField> + <entityField>#ENTITY</entityField> + </treetableViewTemplate> + </children> +</neonView> diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index d8692505d9e5f89e7db063fa7b57e491e450bf1b..bb03b95f164fbbacc77ed981a1d7f4e40efc4718 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -36,6 +36,34 @@ AttributeUtil.getPossibleAttributes = function (pObjectType) return db.table(attrSql); } +/** + * returns the name of an attribute + * + * @param {String} pAttributeId the id of the attribute + * + * @return {String} the name of the attribute + */ +AttributeUtil.getAttributeNameById = function (pAttributeId) +{ + var attributeNames = []; + var attribute; + do { + attribute = db.array(db.ROW, SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) + .buildSql("select ATTRIBUTE_NAME, ATTRIBUTE_PARENT_ID from AB_ATTRIBUTE") + ); + if (attribute.length > 0) + { + attributeNames.push(attribute[0]); + pAttributeId = attribute[1]; + } + else + pAttributeId = ""; + } while (pAttributeId); + + return attributeNames.reverse().join(" / "); +} + /** * gets the value of an attribute for one dataset (e. g. a person) */