From 61272a3fdbfa8185ea69a3c585e9ae043d8d08e4 Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Thu, 25 Apr 2019 16:24:26 +0200
Subject: [PATCH] Attribute: preset attributes with min_count

---
 .../2019.2/AditoBasic/init_AttributeType.xml  | 87 +++++++++++++++++++
 .../data/example_attribute/AttributeUsage.xml | 74 +++++++++++++++-
 .../indexsearchgroups/offer/query.js          |  2 +-
 entity/Activity_entity/afterUiInit.js         |  3 +
 .../AttributeRelationTree_entity.aod          | 12 +++
 .../entityfields/value/mandatoryProcess.js    |  3 +-
 .../AttributeRelation_entity.aod              | 39 +++------
 .../displayValueProcess.js                    |  5 --
 .../attribute_parent_id/dropDownProcess.js    |  5 --
 .../valueproxy/mandatoryProcess.js            |  3 +-
 .../recordcontainers/db/conditionProcess.js   |  3 +-
 .../recordcontainers/db/fromClauseProcess.js  |  3 -
 .../recordcontainers/db/orderClauseProcess.js |  5 --
 .../AttributeUsage_entity.aod                 | 16 ++++
 .../exclusivecontexts_param/valueProcess.js   |  1 +
 .../entityfields/max_count/stateProcess.js    |  8 ++
 .../entityfields/max_count/valueProcess.js    |  5 ++
 .../entityfields/min_count/stateProcess.js    |  8 ++
 .../entityfields/min_count/valueProcess.js    |  5 ++
 entity/AttributeUsage_entity/onValidation.js  |  8 ++
 entity/Attribute_entity/Attribute_entity.aod  | 12 ++-
 .../disablemincount_param/valueProcess.js     |  6 ++
 .../singleselection_param/valueProcess.js     |  6 ++
 .../entityfields/icon/valueProcess.js         | 11 +++
 .../keyword_container/stateProcess.js         |  2 +
 .../entityfields/usagelist/valueProcess.js    |  2 +-
 entity/Contract_entity/Contract_entity.aod    |  1 +
 entity/Contract_entity/afterUiInit.js         |  9 ++
 entity/Employee_entity/Employee_entity.aod    | 14 +--
 entity/Employee_entity/afterUiInit.js         |  9 ++
 .../objectrowid_param/valueProcess.js         |  2 +-
 .../objectrowid_param/valueProcess.js         |  2 +-
 .../entityfields/contact_id/onValidation.js   | 22 ++---
 .../assignmentrowid_param/valueProcess.js     |  2 +-
 .../email_address/onValidation.js             | 24 ++---
 .../entityfields/title/onValidation.js        | 22 ++---
 .../recordcontainers/jdito/contentProcess.js  |  9 +-
 .../recordcontainers/jdito/onUpdate.js        |  2 +-
 entity/Offer_entity/Offer_entity.aod          |  1 +
 entity/Offer_entity/afterUiInit.js            |  9 ++
 entity/Order_entity/Order_entity.aod          | 41 +++++++++
 entity/Order_entity/afterUiInit.js            |  9 ++
 .../objectrowid_param/valueProcess.js         |  4 +
 .../children/objecttype_param/valueProcess.js |  4 +
 .../objectrowid_param/valueProcess.js         |  4 +
 .../children/objecttype_param/valueProcess.js |  4 +
 .../Organisation_entity.aod                   |  1 +
 entity/Organisation_entity/afterUiInit.js     |  9 ++
 entity/Person_entity/Person_entity.aod        |  1 +
 entity/Person_entity/afterUiInit.js           |  9 ++
 entity/Product_entity/Product_entity.aod      |  1 +
 entity/Product_entity/afterUiInit.js          |  9 ++
 .../Salesproject_entity.aod                   | 41 +++++++++
 entity/Salesproject_entity/afterUiInit.js     |  9 ++
 .../objectrowid_param/valueProcess.js         |  4 +
 .../children/objecttype_param/valueProcess.js |  4 +
 .../objectrowid_param/valueProcess.js         |  4 +
 .../children/objecttype_param/valueProcess.js |  4 +
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |  4 +
 .../AttributeFilter_view.aod                  |  9 ++
 .../AttributePreview_view.aod                 | 30 ++-----
 neonView/OfferEdit_view/OfferEdit_view.aod    |  5 ++
 neonView/OfferMain_view/OfferMain_view.aod    |  5 ++
 neonView/OrderEdit_view/OrderEdit_view.aod    |  5 ++
 neonView/OrderMain_view/OrderMain_view.aod    |  5 ++
 .../SalesprojectEdit_view.aod                 |  5 ++
 .../SalesprojectMain_view.aod                 |  5 ++
 process/Attribute_lib/process.js              | 28 ++++++
 68 files changed, 606 insertions(+), 119 deletions(-)
 delete mode 100644 entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js
 delete mode 100644 entity/AttributeRelation_entity/entityfields/attribute_parent_id/dropDownProcess.js
 delete mode 100644 entity/AttributeRelation_entity/recordcontainers/db/fromClauseProcess.js
 delete mode 100644 entity/AttributeRelation_entity/recordcontainers/db/orderClauseProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/max_count/stateProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/max_count/valueProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/min_count/stateProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/min_count/valueProcess.js
 create mode 100644 entity/AttributeUsage_entity/onValidation.js
 create mode 100644 entity/Attribute_entity/entityfields/attributeusages/children/disablemincount_param/valueProcess.js
 create mode 100644 entity/Attribute_entity/entityfields/attributeusages/children/singleselection_param/valueProcess.js
 create mode 100644 entity/Attribute_entity/entityfields/icon/valueProcess.js
 create mode 100644 entity/Contract_entity/afterUiInit.js
 create mode 100644 entity/Employee_entity/afterUiInit.js
 create mode 100644 entity/Offer_entity/afterUiInit.js
 create mode 100644 entity/Order_entity/afterUiInit.js
 create mode 100644 entity/Order_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
 create mode 100644 entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Order_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js
 create mode 100644 entity/Organisation_entity/afterUiInit.js
 create mode 100644 entity/Person_entity/afterUiInit.js
 create mode 100644 entity/Product_entity/afterUiInit.js
 create mode 100644 entity/Salesproject_entity/afterUiInit.js
 create mode 100644 entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Salesproject_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
 create mode 100644 entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Salesproject_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js

diff --git a/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_AttributeType.xml b/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_AttributeType.xml
index 93ebb8ff36..afce4587bc 100644
--- a/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_AttributeType.xml
+++ b/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_AttributeType.xml
@@ -34,6 +34,72 @@
             <column name="SORTING" valueNumeric="9"/>
             <column name="ISACTIVE" valueNumeric="1"/>
             <column name="ISESSENTIAL" valueNumeric="1"/>
+        </insert>
+                <insert tableName="AB_KEYWORD_ATTRIBUTE">
+                <column name="AB_KEYWORD_ATTRIBUTEID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="NAME" value="defaultAvatarRepresentation"/>
+                <column name="CONTAINER" value="AttributeType"/>
+                <column name="TYPE" value="CHAR_VALUE"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="0c537ea0-6ba2-4d9a-a27c-7c6a6920e303"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="972e5eb1-a457-4b75-b966-1183896dac2c"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:INPUT"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="8ada9b1e-2f23-4e07-bbd6-16a3b76c5b62"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="cb7ecaea-b4e6-460e-9006-4a3d059b9857"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:DATE_INPUT"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="2ef73c53-30b4-47f9-94fb-87825e14743a"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="14de196a-aaa6-41b9-b503-3df1d45acc1e"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:CALC"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="c4cdd0dc-fc7e-443c-9c2f-c3d400ce3a1b"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="8a9791c1-655f-4340-91b4-cfdf6372fc75"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:CHECK_SQUARE_O"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="5afb11f5-e0eb-45f2-8018-cdf85078a236"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="1390813c-6b94-4336-9986-9bcaddab69ac"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:COMBOBOX"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="0954628d-e40e-45e0-a808-3194594b431e"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="2c188a17-2961-45df-bd68-34b55352375c"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:FILE_TREE"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="1516db79-6f15-4683-9314-cddebb29f995"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="75a67526-6b7c-400d-b958-e1f8f45466aa"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:DOT_CIRCLE"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="091bf881-e599-4baf-915a-e756ae75c52e"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="9d2f9605-1a5e-47d3-8920-168f5637e37f"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:KEY"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="a85fd75f-7346-41d0-b7fe-6c677bd3f392"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="ee893a1c-d007-46fe-a190-727124c4467b"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:TEXT_INPUT"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="a35c73d5-2719-422b-872b-1c6c1e0707a0"/>
+                <column name="AB_KEYWORD_ENTRY_ID" value="191d7293-3b3f-4dc7-bbe2-9da1a897f7df"/>
+                <column name="AB_KEYWORD_ATTRIBUTE_ID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                <column name="CHAR_VALUE" value="VAADIN:TAG"/>
         </insert>
         <rollback>
             <delete tableName="AB_KEYWORD_ENTRY">
@@ -54,6 +120,27 @@
                     <param value="191d7293-3b3f-4dc7-bbe2-9da1a897f7df"/>
                 </whereParams>
             </delete>
+            <delete tableName="AB_KEYWORD_ATTRIBUTE">
+                <where>AB_KEYWORD_ATTRIBUTEID = ?</where>
+                <whereParams>
+                    <param value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/>
+                </whereParams>
+            </delete>
+            <delete tableName="AB_KEYWORD_ATTRIBUTERELATION">
+                <where>AB_KEYWORD_ATTRIBUTERELATIONID in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</where>
+                <whereParams>
+                    <param value="0c537ea0-6ba2-4d9a-a27c-7c6a6920e303"/>
+                    <param value="8ada9b1e-2f23-4e07-bbd6-16a3b76c5b62"/>
+                    <param value="2ef73c53-30b4-47f9-94fb-87825e14743a"/>
+                    <param value="c4cdd0dc-fc7e-443c-9c2f-c3d400ce3a1b"/>
+                    <param value="5afb11f5-e0eb-45f2-8018-cdf85078a236"/>
+                    <param value="0954628d-e40e-45e0-a808-3194594b431e"/>
+                    <param value="1516db79-6f15-4683-9314-cddebb29f995"/>
+                    <param value="091bf881-e599-4baf-915a-e756ae75c52e"/>
+                    <param value="a85fd75f-7346-41d0-b7fe-6c677bd3f392"/>
+                    <param value="a35c73d5-2719-422b-872b-1c6c1e0707a0"/>
+                </whereParams>
+            </delete>
         </rollback>
     </changeSet>
 </databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2019.2/data/example_attribute/AttributeUsage.xml b/.liquibase/Data_alias/basic/2019.2/data/example_attribute/AttributeUsage.xml
index e0c81c2dcf..2de20c7371 100644
--- a/.liquibase/Data_alias/basic/2019.2/data/example_attribute/AttributeUsage.xml
+++ b/.liquibase/Data_alias/basic/2019.2/data/example_attribute/AttributeUsage.xml
@@ -4,336 +4,409 @@
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="48e9320b-b2b4-4523-bb34-e68749fe1465"/>
     <column name="AB_ATTRIBUTE_ID" value="b4e372c5-da95-4c16-9d10-3be1c6a9eddd"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
+    <column name="OBJECT_TYPE" value="Activity"/>
+</insert>
+<insert tableName="AB_ATTRIBUTEUSAGE">
+    <column name="AB_ATTRIBUTEUSAGEID" value="1d34b5e6-44ca-4577-925e-5b93e96be40a"/>
+    <column name="AB_ATTRIBUTE_ID" value="a6eee141-5ed6-4b87-986f-29e3fdccaf13"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b70e6047-c8d9-4be0-99a9-e8a6b4a07c9b"/>
     <column name="AB_ATTRIBUTE_ID" value="bfc5c9d3-274e-49e9-b8ab-8a4c24987026"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="6fb3f5c0-177e-41ad-88c1-44d096ead1de"/>
     <column name="AB_ATTRIBUTE_ID" value="ae04f4ba-0ddb-4188-9ec1-b9ce2d9b11d8"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="022f3b98-f716-47ca-aaa1-7db53f86b821"/>
     <column name="AB_ATTRIBUTE_ID" value="43a913ce-d73c-48a6-aa4b-ad050e1f1b26"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="aeb00c8d-dbee-4657-b5da-4e7aaa494120"/>
     <column name="AB_ATTRIBUTE_ID" value="96fc2fe2-8424-4ff2-8eb5-0d054e26af9b"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="3ea3348e-bffa-47d9-ac58-cfb9fb7c21e7"/>
     <column name="AB_ATTRIBUTE_ID" value="746bbd1d-344b-487e-adb5-d232aba57c0e"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="570f695f-5fd1-4f5a-b21d-62ab721db1ef"/>
     <column name="AB_ATTRIBUTE_ID" value="40bbf16f-566d-442c-8423-64be0ae40c81"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="c6bb63b2-afdb-4dde-a22a-0022926425d8"/>
     <column name="AB_ATTRIBUTE_ID" value="b8179c49-8ef0-4d8e-bcb2-762f9d05563b"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="924782ab-fc54-432e-aa19-d04a986fb3da"/>
     <column name="AB_ATTRIBUTE_ID" value="4c71d1da-9fff-43fc-b6fd-6fc24696c4bf"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="247a2d0b-dd07-4799-89fc-e85d3ef10947"/>
     <column name="AB_ATTRIBUTE_ID" value="3587a98c-03e4-4acc-af89-13b26ce4d956"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="d890f5d6-0330-457a-8650-9261f494fe9c"/>
     <column name="AB_ATTRIBUTE_ID" value="ddd06ec5-b0f8-4c12-8753-e7333fcf87cf"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="440250fb-033a-4db2-84ec-1f05e90b5d1d"/>
     <column name="AB_ATTRIBUTE_ID" value="4bb88e18-f160-4bf3-b9b2-d1a413dcecf5"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b405df7f-07e3-43c6-b067-c29a083489db"/>
     <column name="AB_ATTRIBUTE_ID" value="e144b3f5-3074-4d92-a645-2b7aa601564c"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="85d90ab9-8b2c-4759-b730-14bdc21bdf0c"/>
     <column name="AB_ATTRIBUTE_ID" value="90578c72-fd3a-4b09-8116-31a017b6c623"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="d1c81512-9e0c-45ae-bf58-7fc025ecbe12"/>
     <column name="AB_ATTRIBUTE_ID" value="de6702e0-9253-4d7a-ab20-b8efb963ee63"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b327f51d-1d52-4db0-96e1-3b1a02af603d"/>
     <column name="AB_ATTRIBUTE_ID" value="2d66c8b6-cf6e-44b2-b663-488f3f4d6647"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="745b9d55-4402-4b0d-95c1-60cc86d753c0"/>
     <column name="AB_ATTRIBUTE_ID" value="620a0903-6fde-4751-aefa-c398d64c13cc"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="fb175158-9a11-49df-9d2d-c5149826db0f"/>
     <column name="AB_ATTRIBUTE_ID" value="6e162c86-3b07-4817-8570-ef5598b4f455"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="a4c52b1c-2a9d-480f-9ed2-266ef94102f2"/>
     <column name="AB_ATTRIBUTE_ID" value="ee8c2bff-92c9-456a-a665-c7ccc3960f8d"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b358d1b5-e3be-4b81-8f68-8b8bfe6084c2"/>
     <column name="AB_ATTRIBUTE_ID" value="33937757-d170-4c4f-bca7-2a687b0c3a8a"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="7aece23a-c0d2-432c-86da-f6b766752062"/>
     <column name="AB_ATTRIBUTE_ID" value="bae6db6b-259a-4f36-9112-4516b7f8cfeb"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="0a32ee8c-3fc7-4412-ab4a-e17668396954"/>
     <column name="AB_ATTRIBUTE_ID" value="ffeeca2a-2349-40dc-9b0c-4a8b3447d3df"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="79133e7e-fd63-4d71-90a2-96a487e5ab42"/>
     <column name="AB_ATTRIBUTE_ID" value="10d2cbd3-9c58-4e9d-9259-d556aba6cf6c"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="fdd04439-6302-41ec-bbf1-5b63e2142cbc"/>
     <column name="AB_ATTRIBUTE_ID" value="6537b5ae-9bfd-455e-8b48-183895b9b461"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="5f8563c1-5467-4655-a42f-72dcf43d184b"/>
     <column name="AB_ATTRIBUTE_ID" value="f5e7449a-f61e-4022-aa93-6b3916ddbed7"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="24f74162-380a-4f9e-bf71-1e8a51275118"/>
     <column name="AB_ATTRIBUTE_ID" value="f7aad2b0-021e-48dd-8286-a364d0ac9fca"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="ddee95f8-21f9-4b6b-850f-79e9f12d3c4c"/>
     <column name="AB_ATTRIBUTE_ID" value="61436f5e-b85a-477e-af8b-5369d12ad742"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="4704a3a1-7762-4863-8dca-6e3ce8b4ba9f"/>
     <column name="AB_ATTRIBUTE_ID" value="913457fc-361c-4af6-ab5a-85a0ad8640e5"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="c37d0b13-468b-4018-802e-a290ccd239b7"/>
     <column name="AB_ATTRIBUTE_ID" value="eaa9aea2-73f3-48f4-909d-81de5e09a75f"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b1df815f-535f-46c6-9df5-0c43bbcc8c47"/>
     <column name="AB_ATTRIBUTE_ID" value="7a4282b8-8461-4486-9362-bc72ceb7b5df"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="f049d2f7-bacf-4b57-b40a-779111a0b944"/>
     <column name="AB_ATTRIBUTE_ID" value="0c86b9ad-1635-46b4-8ac7-3d9b00bc2b01"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="33b8e55d-227c-4a5c-8e92-89e429dc1157"/>
     <column name="AB_ATTRIBUTE_ID" value="14b71577-42d6-40c0-a377-a11df03aa324"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="2057fae3-bea6-4a90-8dcc-b795f677c7ac"/>
     <column name="AB_ATTRIBUTE_ID" value="d3f2348b-fad2-4e4c-9ff6-cb22b0a0cd93"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="c43230d6-984b-4b47-8c39-3fceb126641b"/>
     <column name="AB_ATTRIBUTE_ID" value="fb01b321-ec75-486b-a0ef-3adfe99a33b2"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b3f6e18e-8bdc-4679-aaa5-895c08430532"/>
     <column name="AB_ATTRIBUTE_ID" value="149c1c4c-3742-46b5-9a31-7afe22965df7"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b78f182a-bade-428a-9b12-fd40f52414a9"/>
     <column name="AB_ATTRIBUTE_ID" value="b49852b7-901d-4d6b-b5d8-b20d75678d4b"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="27a518a0-0456-4494-8d9e-a62afb70fd68"/>
     <column name="AB_ATTRIBUTE_ID" value="542ca620-3ad0-49cc-acf9-e31f4542f302"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="3c0a29b2-e98f-4aae-902d-e5ae691537f5"/>
     <column name="AB_ATTRIBUTE_ID" value="3eb8a90f-c17b-441e-9aa8-acde31e4544c"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="7593fe50-00be-42fc-9e75-8eae49fb2b25"/>
     <column name="AB_ATTRIBUTE_ID" value="9d0949b5-7c87-4663-9229-897057e03192"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="202789a8-4d69-43b2-ab38-708938081d68"/>
     <column name="AB_ATTRIBUTE_ID" value="a689a561-d30f-4215-8faa-97b8df3e5b68"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="642ee10a-b516-4fa3-95fc-f402992a0158"/>
     <column name="AB_ATTRIBUTE_ID" value="d0d78243-cc6e-4602-b77c-b3e669da2f01"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="6c6651b6-a8a5-4f89-82a1-3f1c22a8d9b6"/>
     <column name="AB_ATTRIBUTE_ID" value="ec874d78-6231-45d6-a4c2-193756587981"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="b55dd353-cb6b-48a1-8cad-c3e90f63a8b0"/>
     <column name="AB_ATTRIBUTE_ID" value="6d4dd325-7f30-4098-a391-ebae4f27988e"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="d546bc42-e452-4446-a85e-557f6c0bc88b"/>
     <column name="AB_ATTRIBUTE_ID" value="f8d8d58e-9381-4e44-aeae-284116ca3613"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="504487e9-86f8-4ff1-91a2-b364829fa86b"/>
     <column name="AB_ATTRIBUTE_ID" value="d0ae40d2-1a7f-45f6-bb0c-20ce6ae7efe2"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="33d64ce6-e8b4-4acf-ac75-0d99d0092c6c"/>
     <column name="AB_ATTRIBUTE_ID" value="956622a7-03b3-42a4-a7ef-f8936d92cff9"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="07704049-9ae8-4d07-86e3-1042ed104035"/>
     <column name="AB_ATTRIBUTE_ID" value="f0f0b150-ea60-46e5-ba4f-727c78c993d0"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="4757e926-3059-4969-b07a-f04479f6d723"/>
     <column name="AB_ATTRIBUTE_ID" value="c5f8b5f7-ddc0-4c88-bebd-be96fd37bb9c"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="22a31ed9-be4d-45db-ad2a-5777e9a785bf"/>
     <column name="AB_ATTRIBUTE_ID" value="262a8fbe-d6ef-4949-87ce-6202967136d7"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="d8352147-7866-40c2-8f1a-063ccc4b0c04"/>
     <column name="AB_ATTRIBUTE_ID" value="67edd12f-93cc-45d4-b86a-b59d19936442"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="55879930-2f90-44ec-a9b6-fdfe2226a7b0"/>
     <column name="AB_ATTRIBUTE_ID" value="78343572-20fa-454d-ab26-0e1ac0dccc9e"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="cc03ab69-248a-4ee0-9219-120fcc8c69da"/>
     <column name="AB_ATTRIBUTE_ID" value="9b2dd256-fe8e-4edd-9f1e-0a841103a41a"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="925a2fe7-2d7d-425b-b55d-71c3d6cfe554"/>
     <column name="AB_ATTRIBUTE_ID" value="f001e3a8-b888-49a8-89e1-96ecc503e936"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="55eed1d2-086c-4e25-a59e-ec3d1e8c3283"/>
     <column name="AB_ATTRIBUTE_ID" value="9c64aefe-23c0-4e64-ada5-02db5f4bcb85"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="c0f1778b-595f-4e76-831e-0df4b323f711"/>
     <column name="AB_ATTRIBUTE_ID" value="c31d3ee4-3e08-4a3e-acdb-5f5d236e01de"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="a22a9765-637e-4ca4-818a-e3acb8306776"/>
     <column name="AB_ATTRIBUTE_ID" value="15810377-58c8-4e22-8dd1-ed341f7baf0a"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="7e5726f4-16f4-4b18-ae95-a6ad24e49d40"/>
     <column name="AB_ATTRIBUTE_ID" value="3a0843a4-0d43-4b97-9fe5-4d4049ec79d3"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="1310d547-f5d2-4e30-8e30-0deeba7de746"/>
     <column name="AB_ATTRIBUTE_ID" value="685a771b-86d9-4493-80f1-de65fc613ea3"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="6462a324-535a-4978-86f2-e439f581571a"/>
     <column name="AB_ATTRIBUTE_ID" value="c2eb5976-39d0-4098-8e1f-1fff0c910faf"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="8c380566-bab2-4397-a7f7-a88f2c728388"/>
     <column name="AB_ATTRIBUTE_ID" value="fd8cd4b8-a284-4e1d-accd-310b85577c98"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="f6d3a5f3-04bd-4cf1-8057-11a1af4352a4"/>
     <column name="AB_ATTRIBUTE_ID" value="941a02f8-577f-40a9-8e43-0ea4d695f254"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="607b45dc-2a97-4005-9d38-488640665aa1"/>
     <column name="AB_ATTRIBUTE_ID" value="593bd38f-704a-480a-add3-22e0af9e2460"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="63801bc2-a0a2-4a3c-a531-1949ff3041a6"/>
     <column name="AB_ATTRIBUTE_ID" value="8a9ee08c-da32-40b0-93a3-3a388158dd3c"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="5bdf8396-30bb-4fbc-bdbe-304fa7d73fb2"/>
     <column name="AB_ATTRIBUTE_ID" value="a559f36c-768b-4fc4-b4f2-7dfd25fadb4a"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="f71f995d-0022-4144-95a9-88e33468b835"/>
     <column name="AB_ATTRIBUTE_ID" value="5929874c-ab20-4d18-9d75-083e39f8d576"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="d6982ee5-616a-4eb9-adf9-e571658851ea"/>
     <column name="AB_ATTRIBUTE_ID" value="0adcd251-d3d1-4bed-a299-39373c098cad"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
     <column name="AB_ATTRIBUTEUSAGEID" value="717abaf4-3ed3-4754-ba01-3192677ac399"/>
     <column name="AB_ATTRIBUTE_ID" value="786d0154-acec-4281-8ddc-52772d5ea1ea"/>
+    <column name="MAX_COUNT" valueNumeric="1"/>
     <column name="OBJECT_TYPE" value="Activity"/>
 </insert>
 <insert tableName="AB_ATTRIBUTEUSAGE">
@@ -463,7 +536,6 @@
 <insert tableName="AB_ATTRIBUTEUSAGE">
 	<column name="AB_ATTRIBUTEUSAGEID" value="05576033-1bee-4547-ab82-fdfcdd039642"/>
 	<column name="AB_ATTRIBUTE_ID" value="7e9927a4-41e4-426f-bddd-c3e9ee3b093e"/>
-	<column name="MAX_COUNT" valueNumeric="0"/>
 	<column name="MIN_COUNT" valueNumeric="2"/>
 	<column name="OBJECT_TYPE" value="Organisation"/>
 </insert>
diff --git a/aliasDefinition/Data_alias/indexsearchgroups/offer/query.js b/aliasDefinition/Data_alias/indexsearchgroups/offer/query.js
index edc6c63a63..55757887e4 100644
--- a/aliasDefinition/Data_alias/indexsearchgroups/offer/query.js
+++ b/aliasDefinition/Data_alias/indexsearchgroups/offer/query.js
@@ -19,7 +19,7 @@ sqlHelper = new SqlMaskingUtils();
 sqlQuery = "select OFFERID, " 
     + sqlHelper.concat([sqlHelper.cast("OFFERCODE", SQLTYPES.CHAR, 10), KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.offerStatus(), "OFFER.STATUS")], " | ")
     + " as TITLECOLUMN, " 
-    + sqlHelper.concat(["ORGANISATION.NAME"], " | ") // "'" + translate.text("Description") + ":'", sqlHelper.castLob("OFFER.INFO", 256)
+    + sqlHelper.concat(["ORGANISATION.NAME", "'| " + translate.text("Description") + ":'", sqlHelper.castLob("OFFER.INFO", 250)])  
     + " as DESCCOLUMN, OFFERCODE, ORGANISATION.NAME, CUSTOMERCODE " 
     + " from OFFER "
     + " join CONTACT on OFFER.CONTACT_ID = CONTACTID "
diff --git a/entity/Activity_entity/afterUiInit.js b/entity/Activity_entity/afterUiInit.js
index 0f3cf2b053..952cd632d7 100644
--- a/entity/Activity_entity/afterUiInit.js
+++ b/entity/Activity_entity/afterUiInit.js
@@ -1,3 +1,5 @@
+import("Context_lib");
+import("Attribute_lib");
 import("system.neon");
 import("system.vars");
 import("ActivityTask_lib");
@@ -5,4 +7,5 @@ import("ActivityTask_lib");
 if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
 {
     ActivityUtils.addLinkRecords("$param.ObjectId_param", "$param.RowId_param", "$param.PresetLinks_param", "$field.PARENT_CONTEXT", "$field.PARENT_ID");
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
 }
\ No newline at end of file
diff --git a/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod b/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
index 0ec44e9eb9..ff4f424ee8 100644
--- a/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
+++ b/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
@@ -69,6 +69,18 @@
           <fieldName>AttributeTree</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>148faad1-78f6-4ff2-a4d5-9607d919adb9</name>
+          <entityName>Salesproject_entity</entityName>
+          <fieldName>AttributeTree</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>8ed8bae6-c69e-45ce-9fc9-5fb43587a47b</name>
+          <entityName>Order_entity</entityName>
+          <fieldName>AttributeTree</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
     </entityProvider>
     <entityField>
diff --git a/entity/AttributeRelationTree_entity/entityfields/value/mandatoryProcess.js b/entity/AttributeRelationTree_entity/entityfields/value/mandatoryProcess.js
index 564b24d9e7..e60d633a87 100644
--- a/entity/AttributeRelationTree_entity/entityfields/value/mandatoryProcess.js
+++ b/entity/AttributeRelationTree_entity/entityfields/value/mandatoryProcess.js
@@ -3,4 +3,5 @@ import("system.result");
 import("Attribute_lib");
 
 var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"));
-result.string(AttributeTypeUtil.getContentType(attributeType) != null);
\ No newline at end of file
+var contentType = AttributeTypeUtil.getContentType(attributeType);
+result.string(contentType != null && contentType != "BOOLEAN");
\ No newline at end of file
diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
index 5a73fc1c19..e2b4e1f9aa 100644
--- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod
+++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
@@ -106,6 +106,18 @@
           <fieldName>Attributes</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>6e01a982-198c-40ab-ae1b-7f5683d33f07</name>
+          <entityName>Salesproject_entity</entityName>
+          <fieldName>Attributes</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>1d33f00a-203d-4119-9178-c7dc0d087353</name>
+          <entityName>Order_entity</entityName>
+          <fieldName>Attributes</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
     </entityProvider>
     <entityParameter>
@@ -141,18 +153,6 @@
       <name>ID_VALUE</name>
       <searchable v="false" />
     </entityField>
-    <entityField>
-      <name>ATTRIBUTE_PARENT_ID</name>
-      <title>Superordinate Attribute</title>
-      <dropDownProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attribute_parent_id/dropDownProcess.js</dropDownProcess>
-      <searchable v="false" />
-      <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js</displayValueProcess>
-      <onValueChangeTypes>
-        <element>MASK</element>
-        <element>PROCESS</element>
-        <element>PROCESS_SETVALUE</element>
-      </onValueChangeTypes>
-    </entityField>
     <entityConsumer>
       <name>Keywords</name>
       <fieldType>DEPENDENCY_OUT</fieldType>
@@ -227,24 +227,15 @@
     <dbRecordContainer>
       <name>db</name>
       <alias>Data_alias</alias>
-      <fromClauseProcess>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
       <conditionProcess>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
-      <orderClauseProcess>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
       <linkInformation>
         <linkInformation>
-          <name>14697123-47ee-4ff0-8ab2-2b8d1217f637</name>
+          <name>9565b2b1-ace7-4464-ae76-c71bd8f5f676</name>
           <tableName>AB_ATTRIBUTERELATION</tableName>
           <primaryKey>AB_ATTRIBUTERELATIONID</primaryKey>
           <isUIDTable v="true" />
           <readonly v="false" />
         </linkInformation>
-        <linkInformation>
-          <name>a988b754-86b1-4d27-8406-08712d12766c</name>
-          <tableName>AB_ATTRIBUTE</tableName>
-          <primaryKey>AB_ATTRIBUTEID</primaryKey>
-          <isUIDTable v="false" />
-          <readonly v="false" />
-        </linkInformation>
       </linkInformation>
       <recordFieldMappings>
         <dbRecordFieldMapping>
@@ -279,10 +270,6 @@
           <name>ID_VALUE.value</name>
           <recordfield>AB_ATTRIBUTERELATION.ID_VALUE</recordfield>
         </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>ATTRIBUTE_PARENT_ID.value</name>
-          <recordfield>AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID</recordfield>
-        </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>USER_NEW.value</name>
           <recordfield>AB_ATTRIBUTERELATION.USER_NEW</recordfield>
diff --git a/entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js b/entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js
deleted file mode 100644
index b853103366..0000000000
--- a/entity/AttributeRelation_entity/entityfields/attribute_parent_id/displayValueProcess.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import("system.vars");
-import("system.result");
-import("Attribute_lib");
-
-result.string(AttributeUtil.getFullAttributeName(vars.get("$field.ATTRIBUTE_PARENT_ID")));
\ No newline at end of file
diff --git a/entity/AttributeRelation_entity/entityfields/attribute_parent_id/dropDownProcess.js b/entity/AttributeRelation_entity/entityfields/attribute_parent_id/dropDownProcess.js
deleted file mode 100644
index 816f528b0c..0000000000
--- a/entity/AttributeRelation_entity/entityfields/attribute_parent_id/dropDownProcess.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import("system.vars");
-import("system.result");
-import("Attribute_lib");
-        
-result.object(AttributeUtil.getPossibleAttributes(vars.get("$param.ObjectType_param"), true));
diff --git a/entity/AttributeRelation_entity/entityfields/valueproxy/mandatoryProcess.js b/entity/AttributeRelation_entity/entityfields/valueproxy/mandatoryProcess.js
index 564b24d9e7..e60d633a87 100644
--- a/entity/AttributeRelation_entity/entityfields/valueproxy/mandatoryProcess.js
+++ b/entity/AttributeRelation_entity/entityfields/valueproxy/mandatoryProcess.js
@@ -3,4 +3,5 @@ import("system.result");
 import("Attribute_lib");
 
 var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"));
-result.string(AttributeTypeUtil.getContentType(attributeType) != null);
\ No newline at end of file
+var contentType = AttributeTypeUtil.getContentType(attributeType);
+result.string(contentType != null && contentType != "BOOLEAN");
\ No newline at end of file
diff --git a/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js b/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js
index d2b6666319..89514328ab 100644
--- a/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js
@@ -4,7 +4,8 @@ import("system.result");
 import("Sql_lib");
 
 var cond = SqlCondition.begin()
-                   .andPrepareVars("AB_ATTRIBUTERELATION.OBJECT_ROWID", "$param.ObjectRowId_param");
+                   .andPrepareVars("AB_ATTRIBUTERELATION.OBJECT_ROWID", "$param.ObjectRowId_param")
+                   .andPrepareVars("AB_ATTRIBUTERELATION.OBJECT_TYPE", "$param.ObjectType_param");
 
 if (vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")
     && vars.exists("$param.FilteredAttributeIds_param") && vars.get("$param.FilteredAttributeIds_param"))
diff --git a/entity/AttributeRelation_entity/recordcontainers/db/fromClauseProcess.js b/entity/AttributeRelation_entity/recordcontainers/db/fromClauseProcess.js
deleted file mode 100644
index db1937db74..0000000000
--- a/entity/AttributeRelation_entity/recordcontainers/db/fromClauseProcess.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import("system.result");
-
-result.string("AB_ATTRIBUTERELATION join AB_ATTRIBUTE on (AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID)");
\ No newline at end of file
diff --git a/entity/AttributeRelation_entity/recordcontainers/db/orderClauseProcess.js b/entity/AttributeRelation_entity/recordcontainers/db/orderClauseProcess.js
deleted file mode 100644
index b70300ec1e..0000000000
--- a/entity/AttributeRelation_entity/recordcontainers/db/orderClauseProcess.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import("system.db");
-import("system.result");
-result.object({
-    "AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID" : db.ASCENDING
-});
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod
index f341a9ea32..dadfdcc483 100644
--- a/entity/AttributeUsage_entity/AttributeUsage_entity.aod
+++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod
@@ -4,6 +4,7 @@
   <title>Attribute Usage</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/AttributeUsage_entity/documentation.adoc</documentation>
+  <onValidation>%aditoprj%/entity/AttributeUsage_entity/onValidation.js</onValidation>
   <recordContainer>db</recordContainer>
   <entityFields>
     <entityProvider>
@@ -53,6 +54,8 @@
       <title>Minimal Count</title>
       <contentType>NUMBER</contentType>
       <searchable v="false" />
+      <stateProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/min_count/stateProcess.js</stateProcess>
+      <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/min_count/valueProcess.js</valueProcess>
       <onValidation>%aditoprj%/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js</onValidation>
     </entityField>
     <entityField>
@@ -60,6 +63,8 @@
       <title>Maximal Count</title>
       <contentType>NUMBER</contentType>
       <searchable v="false" />
+      <stateProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/max_count/stateProcess.js</stateProcess>
+      <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/max_count/valueProcess.js</valueProcess>
       <onValidation>%aditoprj%/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js</onValidation>
     </entityField>
     <entityConsumer>
@@ -85,6 +90,17 @@
         </entityParameter>
       </children>
     </entityConsumer>
+    <entityParameter>
+      <name>SingleSelection_param</name>
+      <expose v="true" />
+      <triggerRecalculation v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
+    <entityParameter>
+      <name>DisableMinCount_param</name>
+      <expose v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
index 9ccd8c87e5..5a8e7eb9fe 100644
--- a/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
+++ b/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
@@ -7,6 +7,7 @@ result.object([
     "Product",
     "Activity",
     "Offer",
+    "Order",
     "Employee",
     "Salesproject"
 ]);
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/entityfields/max_count/stateProcess.js b/entity/AttributeUsage_entity/entityfields/max_count/stateProcess.js
new file mode 100644
index 0000000000..8afb53a332
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/max_count/stateProcess.js
@@ -0,0 +1,8 @@
+import("system.neon");
+import("system.result");
+import("system.vars");
+
+if (vars.exists("$param.SingleSelection_param") && vars.get("$param.SingleSelection_param") == "true")
+    result.string(neon.COMPONENTSTATE_READONLY);
+else
+    result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/entityfields/max_count/valueProcess.js b/entity/AttributeUsage_entity/entityfields/max_count/valueProcess.js
new file mode 100644
index 0000000000..420c9cb713
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/max_count/valueProcess.js
@@ -0,0 +1,5 @@
+import("system.result");
+import("system.vars");
+
+if (vars.exists("$param.SingleSelection_param") && vars.get("$param.SingleSelection_param") == "true")
+    result.string("1");
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/entityfields/min_count/stateProcess.js b/entity/AttributeUsage_entity/entityfields/min_count/stateProcess.js
new file mode 100644
index 0000000000..d140eb741f
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/min_count/stateProcess.js
@@ -0,0 +1,8 @@
+import("system.neon");
+import("system.result");
+import("system.vars");
+
+if (vars.exists("$param.DisableMinCount_param") && vars.get("$param.DisableMinCount_param") == "true")
+    result.string(neon.COMPONENTSTATE_READONLY);
+else
+    result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/entityfields/min_count/valueProcess.js b/entity/AttributeUsage_entity/entityfields/min_count/valueProcess.js
new file mode 100644
index 0000000000..99e89c3d9b
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/min_count/valueProcess.js
@@ -0,0 +1,5 @@
+import("system.result");
+import("system.vars");
+
+if (vars.exists("$param.DisableMinCount_param") && vars.get("$param.DisableMinCount_param") == "true")
+    result.string("");
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/onValidation.js b/entity/AttributeUsage_entity/onValidation.js
new file mode 100644
index 0000000000..5e04425573
--- /dev/null
+++ b/entity/AttributeUsage_entity/onValidation.js
@@ -0,0 +1,8 @@
+import("system.translate");
+import("system.vars");
+import("system.result");
+
+var minCount = vars.getString("$field.MIN_COUNT");
+var maxCount = vars.getString("$field.MAX_COUNT");
+if (minCount != "" && maxCount != "" && minCount > maxCount)
+    result.string(translate.text("The minimal count can't be larger than the maximal count!"));
\ No newline at end of file
diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod
index 687bb7a6d0..43d35a9cb3 100644
--- a/entity/Attribute_entity/Attribute_entity.aod
+++ b/entity/Attribute_entity/Attribute_entity.aod
@@ -118,6 +118,14 @@
           <expose v="false" />
           <triggerRecalculation v="true" />
         </entityParameter>
+        <entityParameter>
+          <name>SingleSelection_param</name>
+          <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attributeusages/children/singleselection_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>DisableMinCount_param</name>
+          <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attributeusages/children/disablemincount_param/valueProcess.js</valueProcess>
+        </entityParameter>
       </children>
     </entityConsumer>
     <entityField>
@@ -150,7 +158,6 @@
       <title>Keyword</title>
       <dropDownProcess>%aditoprj%/entity/Attribute_entity/entityfields/keyword_container/dropDownProcess.js</dropDownProcess>
       <searchable v="false" />
-      <state>AUTO</state>
       <stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js</stateProcess>
     </entityField>
     <entityParameter>
@@ -282,8 +289,9 @@
       </children>
     </entityConsumer>
     <entityField>
-      <name>IMAGE</name>
+      <name>ICON</name>
       <contentType>IMAGE</contentType>
+      <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/icon/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
       <name>UID</name>
diff --git a/entity/Attribute_entity/entityfields/attributeusages/children/disablemincount_param/valueProcess.js b/entity/Attribute_entity/entityfields/attributeusages/children/disablemincount_param/valueProcess.js
new file mode 100644
index 0000000000..0a2e896371
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/attributeusages/children/disablemincount_param/valueProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("Attribute_lib")
+
+var type = vars.get("$field.ATTRIBUTE_TYPE").trim();
+result.string(type == $AttributeTypes.VOID);
\ No newline at end of file
diff --git a/entity/Attribute_entity/entityfields/attributeusages/children/singleselection_param/valueProcess.js b/entity/Attribute_entity/entityfields/attributeusages/children/singleselection_param/valueProcess.js
new file mode 100644
index 0000000000..64160d1948
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/attributeusages/children/singleselection_param/valueProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("Attribute_lib")
+
+var type = vars.get("$field.ATTRIBUTE_TYPE").trim();
+result.string(type == $AttributeTypes.VOID || type == $AttributeTypes.BOOLEAN); //using a boolean/void attribute twice wouldn't make sense
\ No newline at end of file
diff --git a/entity/Attribute_entity/entityfields/icon/valueProcess.js b/entity/Attribute_entity/entityfields/icon/valueProcess.js
new file mode 100644
index 0000000000..74e82fd764
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/icon/valueProcess.js
@@ -0,0 +1,11 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+
+var type = vars.getString("$field.ATTRIBUTE_TYPE");
+var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(type, $KeywordRegistry.attributeType())
+var icon = keywordAttributes.defaultAvatarRepresentation;
+
+result.string(icon);
diff --git a/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js b/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js
index b72e57d775..1ba0d0dfae 100644
--- a/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js
+++ b/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js
@@ -6,6 +6,8 @@ import("Attribute_lib");
 var fieldState;
 if (vars.get("$field.ATTRIBUTE_TYPE").trim() == $AttributeTypes.KEYWORD && !AttributeUtil.hasRelations(vars.get("$field.UID")))
     fieldState = neon.COMPONENTSTATE_EDITABLE;
+else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW)
+    fieldState = neon.COMPONENTSTATE_INVISIBLE;
 else
     fieldState = neon.COMPONENTSTATE_READONLY;
 
diff --git a/entity/Attribute_entity/entityfields/usagelist/valueProcess.js b/entity/Attribute_entity/entityfields/usagelist/valueProcess.js
index 130b4cc5a1..e0677d8f83 100644
--- a/entity/Attribute_entity/entityfields/usagelist/valueProcess.js
+++ b/entity/Attribute_entity/entityfields/usagelist/valueProcess.js
@@ -5,7 +5,7 @@ import("system.vars");
 import("Sql_lib");
 import("Attribute_lib");
 
-var retStr = "\u00A0"; // \u00A0 -> space character that doesn't get trimmed 
+var retStr = ""; 
 if (vars.get("$field.ATTRIBUTE_TYPE").trim() != $AttributeTypes.COMBOVALUE)
 {
     var usages = db.array(db.COLUMN, SqlCondition.begin()
diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod
index 9b98cff547..5d170ecd64 100644
--- a/entity/Contract_entity/Contract_entity.aod
+++ b/entity/Contract_entity/Contract_entity.aod
@@ -4,6 +4,7 @@
   <title>Contract</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Contract_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Contract_entity/afterUiInit.js</afterUiInit>
   <iconId>VAADIN:FILE_TEXT</iconId>
   <titleProcess>%aditoprj%/entity/Contract_entity/titleProcess.js</titleProcess>
   <recordContainer>db</recordContainer>
diff --git a/entity/Contract_entity/afterUiInit.js b/entity/Contract_entity/afterUiInit.js
new file mode 100644
index 0000000000..031b635db2
--- /dev/null
+++ b/entity/Contract_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod
index 50241620f1..69043649be 100644
--- a/entity/Employee_entity/Employee_entity.aod
+++ b/entity/Employee_entity/Employee_entity.aod
@@ -3,6 +3,7 @@
   <name>Employee_entity</name>
   <title>Employee</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <afterUiInit>%aditoprj%/entity/Employee_entity/afterUiInit.js</afterUiInit>
   <onValidation>%aditoprj%/entity/Employee_entity/onValidation.js</onValidation>
   <afterOperatingState>%aditoprj%/entity/Employee_entity/afterOperatingState.js</afterOperatingState>
   <iconId>VAADIN:GROUP</iconId>
@@ -255,10 +256,6 @@
         </entityParameter>
       </children>
     </entityProvider>
-    <entityField>
-      <name>TITLE_ORIGINAL</name>
-      <searchable v="false" />
-    </entityField>
     <entityConsumer>
       <name>Departments</name>
       <fieldType>DEPENDENCY_OUT</fieldType>
@@ -278,6 +275,12 @@
         </entityParameter>
       </children>
     </entityConsumer>
+    <entityField>
+      <name>USERID</name>
+    </entityField>
+    <entityField>
+      <name>USERID_SMALL</name>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
@@ -290,7 +293,6 @@
       <recordFields>
         <element>UID.value</element>
         <element>TITLE.value</element>
-        <element>TITLE_ORIGINAL.value</element>
         <element>ISACTIVE.value</element>
         <element>FIRSTNAME.value</element>
         <element>LASTNAME.value</element>
@@ -300,6 +302,8 @@
         <element>CONTACT_ID.value</element>
         <element>CONTACT_ID.displayValue</element>
         <element>DEPARTMENT.value</element>
+        <element>USERID.value</element>
+        <element>USERID_SMALL.value</element>
       </recordFields>
     </jDitoRecordContainer>
   </recordContainers>
diff --git a/entity/Employee_entity/afterUiInit.js b/entity/Employee_entity/afterUiInit.js
new file mode 100644
index 0000000000..031b635db2
--- /dev/null
+++ b/entity/Employee_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Employee_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js b/entity/Employee_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
index 16c85500b5..4efd08e3fe 100644
--- a/entity/Employee_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
+++ b/entity/Employee_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
@@ -1,4 +1,4 @@
 import("system.vars");
 import("system.result");
 
-result.string(vars.get("$field.UID"));
\ No newline at end of file
+result.string(vars.get("$field.USERID_SMALL"));
\ No newline at end of file
diff --git a/entity/Employee_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js b/entity/Employee_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
index 16c85500b5..4efd08e3fe 100644
--- a/entity/Employee_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
+++ b/entity/Employee_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
@@ -1,4 +1,4 @@
 import("system.vars");
 import("system.result");
 
-result.string(vars.get("$field.UID"));
\ No newline at end of file
+result.string(vars.get("$field.USERID_SMALL"));
\ No newline at end of file
diff --git a/entity/Employee_entity/entityfields/contact_id/onValidation.js b/entity/Employee_entity/entityfields/contact_id/onValidation.js
index 35de5d935e..46842576f4 100644
--- a/entity/Employee_entity/entityfields/contact_id/onValidation.js
+++ b/entity/Employee_entity/entityfields/contact_id/onValidation.js
@@ -1,12 +1,12 @@
-import("system.result");
-import("system.vars");
-import("system.tools");
-import("system.translate");
-
-var contactId = vars.get("$field.CONTACT_ID");
-var isTaken = tools.getUserByAttribute(tools.CONTACTID, [contactId]);
-isTaken = isTaken 
-    ? isTaken[tools.TITLE] != vars.get("$field.TITLE_ORIGINAL")
-    : false;
-if (contactId && isTaken)
+import("system.result");
+import("system.vars");
+import("system.tools");
+import("system.translate");
+
+var contactId = vars.get("$field.CONTACT_ID");
+var isTaken = tools.getUserByAttribute(tools.CONTACTID, [contactId]);
+isTaken = isTaken 
+    ? isTaken[tools.NAME] != vars.get("$field.USERID")
+    : false;
+if (contactId && isTaken)
     result.string(translate.text("The person is already associated with another employee!"));
\ No newline at end of file
diff --git a/entity/Employee_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js b/entity/Employee_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js
index 16c85500b5..4efd08e3fe 100644
--- a/entity/Employee_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js
+++ b/entity/Employee_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js
@@ -1,4 +1,4 @@
 import("system.vars");
 import("system.result");
 
-result.string(vars.get("$field.UID"));
\ No newline at end of file
+result.string(vars.get("$field.USERID_SMALL"));
\ No newline at end of file
diff --git a/entity/Employee_entity/entityfields/email_address/onValidation.js b/entity/Employee_entity/entityfields/email_address/onValidation.js
index 35d65102d1..9525ada052 100644
--- a/entity/Employee_entity/entityfields/email_address/onValidation.js
+++ b/entity/Employee_entity/entityfields/email_address/onValidation.js
@@ -1,13 +1,13 @@
-import("Entity_lib");
-import("system.result");
-import("system.vars");
-import("system.tools");
-import("system.translate");
-
-var email = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.EMAIL_ADDRESS"));
-var isTaken = tools.getUserByAttribute(tools.EMAIL, [email]);
-isTaken = isTaken 
-    ? isTaken[tools.TITLE] != vars.get("$field.TITLE_ORIGINAL")
-    : false;
-if (email && isTaken)
+import("Entity_lib");
+import("system.result");
+import("system.vars");
+import("system.tools");
+import("system.translate");
+
+var email = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.EMAIL_ADDRESS"));
+var isTaken = tools.getUserByAttribute(tools.EMAIL, [email]);
+isTaken = isTaken 
+    ? isTaken[tools.NAME] != vars.get("$field.USERID")
+    : false;
+if (email && isTaken)
     result.string(translate.text("Email must be unique!"));
\ No newline at end of file
diff --git a/entity/Employee_entity/entityfields/title/onValidation.js b/entity/Employee_entity/entityfields/title/onValidation.js
index b7a2177b02..9c3a98b9d7 100644
--- a/entity/Employee_entity/entityfields/title/onValidation.js
+++ b/entity/Employee_entity/entityfields/title/onValidation.js
@@ -1,11 +1,13 @@
-import("system.translate");
-import("system.neon");
-import("system.result");
-import("system.vars");
-import("system.tools");
-import("Entity_lib");
-
-var title = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.TITLE"));
-if (!(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && title == vars.get("$field.TITLE_ORIGINAL")) 
-    && title != "" && tools.existUsers(title))
+import("system.translate");
+import("system.neon");
+import("system.result");
+import("system.vars");
+import("system.tools");
+import("Entity_lib");
+
+var title = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.TITLE"));
+var oldTitle = tools.getUserByAttribute(tools.NAME, vars.get("$field.USERID"), tools.PROFILE_TITLE);
+oldTitle = oldTitle && oldTitle[tools.TITLE];
+if (!(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && title == oldTitle) 
+    && title != "" && tools.existUsers(title))
         result.string(translate.text("Username already exists!"));
\ No newline at end of file
diff --git a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
index ecccde702a..9599787650 100644
--- a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
@@ -5,6 +5,8 @@ import("system.tools");
 import("Util_lib");
 import("Contact_lib");
 import("JditoFilter_lib");
+import("Employee_lib");
+
 var users;
 if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
     users = [tools.getUser(vars.get("$local.idvalues"), tools.PROFILE_FULL)];
@@ -19,7 +21,6 @@ else
 users = users.map(function (user)
 {
     return [
-        user[tools.TITLE],
         user[tools.TITLE],
         user[tools.TITLE],
         user[tools.PARAMS][tools.ISACTIVE],
@@ -30,14 +31,16 @@ users = users.map(function (user)
         user[tools.DESCRIPTION],
         user[tools.PARAMS][tools.CONTACTID],
         ContactUtils.getTitleByContactId(user[tools.PARAMS][tools.CONTACTID]), //TODO: get the names more efficiently
-        user[tools.PARAMS].department
+        user[tools.PARAMS].department,
+        user[tools.NAME],
+        EmployeeUtils.sliceUserId(user[tools.NAME])
     ];
 });
 
 var filter = vars.exists("$local.filter") && vars.get("$local.filter"); 
 
 //TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method
-users = JditoFilterUtils.filterRecords(["UID", "TITLE", "TITLE_ORIGINAL", "ISACTIVE", "FIRSTNAME", "LASTNAME", "EMAIL_ADDRESS", "DESCRIPTION", "CONTACT_ID", "", "DEPARTMENT"], users, filter);
+users = JditoFilterUtils.filterRecords(["UID", "TITLE", "ISACTIVE", "FIRSTNAME", "LASTNAME", "EMAIL_ADDRESS", "DESCRIPTION", "CONTACT_ID", "", "DEPARTMENT"], users, filter);
 
 
 ArrayUtils.sort2d(users, 0, true, false); //sort by username
diff --git a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
index ccc3af0949..825985279c 100644
--- a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
@@ -17,7 +17,7 @@ FieldChanges.assimilateChangeAndDispose("$field.IMAGE", function (state, value)
         PersUtils.removeImage(personId);
 });
 
-var user = tools.getUser(vars.get("$field.TITLE_ORIGINAL"));
+var user = tools.getUserByAttribute(tools.NAME, vars.get("$field.USERID"));
 
 user[tools.TITLE] = vars.get("$field.TITLE");
 user[tools.PARAMS][tools.ISACTIVE] = vars.get("$field.ISACTIVE");
diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 32bcd06f2d..d8d4f2b4d1 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -4,6 +4,7 @@
   <title>Offer</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Offer_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Offer_entity/afterUiInit.js</afterUiInit>
   <iconId>VAADIN:CART</iconId>
   <titleProcess>%aditoprj%/entity/Offer_entity/titleProcess.js</titleProcess>
   <recordContainer>db</recordContainer>
diff --git a/entity/Offer_entity/afterUiInit.js b/entity/Offer_entity/afterUiInit.js
new file mode 100644
index 0000000000..ac1ce38fae
--- /dev/null
+++ b/entity/Offer_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod
index 5276e8dd94..197dad83f6 100644
--- a/entity/Order_entity/Order_entity.aod
+++ b/entity/Order_entity/Order_entity.aod
@@ -4,6 +4,7 @@
   <title>Receipt</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Order_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Order_entity/afterUiInit.js</afterUiInit>
   <iconId>VAADIN:DOLLAR</iconId>
   <titleProcess>%aditoprj%/entity/Order_entity/titleProcess.js</titleProcess>
   <recordContainer>db</recordContainer>
@@ -435,6 +436,46 @@
         </entityParameter>
       </children>
     </entityConsumer>
+    <entityConsumer>
+      <name>Attributes</name>
+      <title>Attributes</title>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelation_entity</entityName>
+        <fieldName>RelationsForSpecificObject</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityConsumer>
+      <name>AttributeTree</name>
+      <title>Attributes</title>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelationTree_entity</entityName>
+        <fieldName>TreeProvider</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Order_entity/afterUiInit.js b/entity/Order_entity/afterUiInit.js
new file mode 100644
index 0000000000..ac1ce38fae
--- /dev/null
+++ b/entity/Order_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Order_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js b/entity/Order_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
new file mode 100644
index 0000000000..2d458f3d3e
--- /dev/null
+++ b/entity/Order_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.SALESORDERID"));
\ No newline at end of file
diff --git a/entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js b/entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
new file mode 100644
index 0000000000..008915f61d
--- /dev/null
+++ b/entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string(ContextUtils.getCurrentContextId());
\ No newline at end of file
diff --git a/entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js b/entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
new file mode 100644
index 0000000000..2d458f3d3e
--- /dev/null
+++ b/entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.SALESORDERID"));
\ No newline at end of file
diff --git a/entity/Order_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js b/entity/Order_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js
new file mode 100644
index 0000000000..008915f61d
--- /dev/null
+++ b/entity/Order_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string(ContextUtils.getCurrentContextId());
\ No newline at end of file
diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod
index 4f8480dde6..ef084b9935 100644
--- a/entity/Organisation_entity/Organisation_entity.aod
+++ b/entity/Organisation_entity/Organisation_entity.aod
@@ -5,6 +5,7 @@
   <description>former Org</description>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Organisation_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Organisation_entity/afterUiInit.js</afterUiInit>
   <iconId>VAADIN:BUILDING</iconId>
   <imageProcess>%aditoprj%/entity/Organisation_entity/imageProcess.js</imageProcess>
   <titleProcess>%aditoprj%/entity/Organisation_entity/titleProcess.js</titleProcess>
diff --git a/entity/Organisation_entity/afterUiInit.js b/entity/Organisation_entity/afterUiInit.js
new file mode 100644
index 0000000000..031b635db2
--- /dev/null
+++ b/entity/Organisation_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod
index f4638b66ba..154c827845 100644
--- a/entity/Person_entity/Person_entity.aod
+++ b/entity/Person_entity/Person_entity.aod
@@ -5,6 +5,7 @@
   <description>former Pers</description>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Person_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Person_entity/afterUiInit.js</afterUiInit>
   <onValidation>%aditoprj%/entity/Person_entity/onValidation.js</onValidation>
   <iconId>VAADIN:USERS</iconId>
   <imageProcess>%aditoprj%/entity/Person_entity/imageProcess.js</imageProcess>
diff --git a/entity/Person_entity/afterUiInit.js b/entity/Person_entity/afterUiInit.js
new file mode 100644
index 0000000000..031b635db2
--- /dev/null
+++ b/entity/Person_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Product_entity/Product_entity.aod b/entity/Product_entity/Product_entity.aod
index 010fc23042..d90fa0affa 100644
--- a/entity/Product_entity/Product_entity.aod
+++ b/entity/Product_entity/Product_entity.aod
@@ -4,6 +4,7 @@
   <title>Product</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Product_entity/documentation.adoc</documentation>
+  <afterUiInit>%aditoprj%/entity/Product_entity/afterUiInit.js</afterUiInit>
   <iconId>VAADIN:HAMMER</iconId>
   <titleProcess>%aditoprj%/entity/Product_entity/titleProcess.js</titleProcess>
   <recordContainer>db</recordContainer>
diff --git a/entity/Product_entity/afterUiInit.js b/entity/Product_entity/afterUiInit.js
new file mode 100644
index 0000000000..031b635db2
--- /dev/null
+++ b/entity/Product_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod
index d0183a1589..5a37d4e83b 100644
--- a/entity/Salesproject_entity/Salesproject_entity.aod
+++ b/entity/Salesproject_entity/Salesproject_entity.aod
@@ -3,6 +3,7 @@
   <name>Salesproject_entity</name>
   <title>Salesproject</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <afterUiInit>%aditoprj%/entity/Salesproject_entity/afterUiInit.js</afterUiInit>
   <afterOperatingState>%aditoprj%/entity/Salesproject_entity/afterOperatingState.js</afterOperatingState>
   <iconId>VAADIN:BOOK_DOLLAR</iconId>
   <titleProcess>%aditoprj%/entity/Salesproject_entity/titleProcess.js</titleProcess>
@@ -556,6 +557,46 @@
         <fieldName>StateMilestones</fieldName>
       </dependency>
     </entityConsumer>
+    <entityConsumer>
+      <name>Attributes</name>
+      <title>Attributes</title>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelation_entity</entityName>
+        <fieldName>RelationsForSpecificObject</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityConsumer>
+      <name>AttributeTree</name>
+      <title>Attributes</title>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelationTree_entity</entityName>
+        <fieldName>TreeProvider</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Salesproject_entity/afterUiInit.js b/entity/Salesproject_entity/afterUiInit.js
new file mode 100644
index 0000000000..ac1ce38fae
--- /dev/null
+++ b/entity/Salesproject_entity/afterUiInit.js
@@ -0,0 +1,9 @@
+import("system.neon");
+import("system.vars");
+import("Context_lib");
+import("Attribute_lib");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes");
+}
diff --git a/entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
new file mode 100644
index 0000000000..2b119ebfa1
--- /dev/null
+++ b/entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.SALESPROJECTID"));
\ No newline at end of file
diff --git a/entity/Salesproject_entity/entityfields/attributes/children/objecttype_param/valueProcess.js b/entity/Salesproject_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
new file mode 100644
index 0000000000..e8b4e72e74
--- /dev/null
+++ b/entity/Salesproject_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string(ContextUtils.getCurrentContextId());
diff --git a/entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
new file mode 100644
index 0000000000..2b119ebfa1
--- /dev/null
+++ b/entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.SALESPROJECTID"));
\ No newline at end of file
diff --git a/entity/Salesproject_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js b/entity/Salesproject_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js
new file mode 100644
index 0000000000..e8b4e72e74
--- /dev/null
+++ b/entity/Salesproject_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string(ContextUtils.getCurrentContextId());
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index d62906560f..087647df9d 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -2465,6 +2465,10 @@
       <key>Yemen</key>
       <value>Jemen</value>
     </entry>
+    <entry>
+      <key>The minimal count can't be larger than the maximal count!</key>
+      <value>Die minimale Anzahl darf nicht größer als die maximale Anzahl sein!</value>
+    </entry>
     <entry>
       <key>Aruba</key>
       <value>Aruba</value>
diff --git a/neonView/AttributeFilter_view/AttributeFilter_view.aod b/neonView/AttributeFilter_view/AttributeFilter_view.aod
index cadb8afc80..3a1c298e1c 100644
--- a/neonView/AttributeFilter_view/AttributeFilter_view.aod
+++ b/neonView/AttributeFilter_view/AttributeFilter_view.aod
@@ -17,6 +17,11 @@
       <showChildrenCount v="false" />
       <entityField>#ENTITY</entityField>
       <columns>
+        <neonTableColumn>
+          <name>169aceb2-2ff8-42de-ab89-4d3cc15d5747</name>
+          <entityField>ICON</entityField>
+          <width v="75" />
+        </neonTableColumn>
         <neonTableColumn>
           <name>a776a053-6712-44f9-943f-da26d1ce11ee</name>
           <entityField>ATTRIBUTE_NAME</entityField>
@@ -35,6 +40,10 @@
       <name>AttributesTable</name>
       <entityField>#ENTITY</entityField>
       <columns>
+        <neonTableColumn>
+          <name>c1ee431e-e4d2-4744-ad8c-2bf2c2eed8d6</name>
+          <entityField>ICON</entityField>
+        </neonTableColumn>
         <neonTableColumn>
           <name>4dae1a23-8798-42ff-998c-7f5fedc7dcc5</name>
           <entityField>FULL_ATTRIBUTE_NAME</entityField>
diff --git a/neonView/AttributePreview_view/AttributePreview_view.aod b/neonView/AttributePreview_view/AttributePreview_view.aod
index 5a8e785eb7..812510e36b 100644
--- a/neonView/AttributePreview_view/AttributePreview_view.aod
+++ b/neonView/AttributePreview_view/AttributePreview_view.aod
@@ -18,37 +18,23 @@
     <genericViewTemplate>
       <name>Details</name>
       <showDrawer v="true" />
-      <drawerCaption>Details</drawerCaption>
       <entityField>#ENTITY</entityField>
       <fields>
         <entityFieldLink>
-          <name>70953962-9472-484b-ac95-567d2249f42e</name>
-          <entityField>ATTRIBUTE_ACTIVE</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>1b1cfdcb-fcab-4ca9-b0e0-b69fe88b65f0</name>
-          <entityField>SORTING</entityField>
-        </entityFieldLink>
-      </fields>
-    </genericViewTemplate>
-    <genericViewTemplate>
-      <name>Info</name>
-      <editMode v="false" />
-      <showDrawer v="true" />
-      <entityField>#ENTITY</entityField>
-      <title></title>
-      <fields>
-        <entityFieldLink>
-          <name>5f20a5d4-0343-4b8c-92bf-15eeb2483ba9</name>
+          <name>3de869e9-936b-4215-86de-b1e24f6bfd78</name>
           <entityField>ATTRIBUTE_PARENT_ID</entityField>
         </entityFieldLink>
         <entityFieldLink>
-          <name>7e64cd02-e91e-4845-bc77-256a4945670e</name>
+          <name>39cf159f-2c34-41a1-bf6d-210d2d1f8df9</name>
           <entityField>KEYWORD_CONTAINER</entityField>
         </entityFieldLink>
         <entityFieldLink>
-          <name>00a51564-0eca-43f9-8235-b811df1dbafd</name>
-          <entityField>ATTRIBUTE_LEVEL</entityField>
+          <name>70953962-9472-484b-ac95-567d2249f42e</name>
+          <entityField>ATTRIBUTE_ACTIVE</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>1b1cfdcb-fcab-4ca9-b0e0-b69fe88b65f0</name>
+          <entityField>SORTING</entityField>
         </entityFieldLink>
       </fields>
     </genericViewTemplate>
diff --git a/neonView/OfferEdit_view/OfferEdit_view.aod b/neonView/OfferEdit_view/OfferEdit_view.aod
index 60e014f44a..ba2428898b 100644
--- a/neonView/OfferEdit_view/OfferEdit_view.aod
+++ b/neonView/OfferEdit_view/OfferEdit_view.aod
@@ -70,5 +70,10 @@
         </entityFieldLink>
       </fields>
     </genericViewTemplate>
+    <neonViewReference>
+      <name>52f93604-4ec3-427f-b220-27ab63a30560</name>
+      <entityField>Attributes</entityField>
+      <view>AttributeRelationEdit_view</view>
+    </neonViewReference>
   </children>
 </neonView>
diff --git a/neonView/OfferMain_view/OfferMain_view.aod b/neonView/OfferMain_view/OfferMain_view.aod
index ea4a89a448..47f2a91194 100644
--- a/neonView/OfferMain_view/OfferMain_view.aod
+++ b/neonView/OfferMain_view/OfferMain_view.aod
@@ -34,6 +34,11 @@
       <entityField>Tasks</entityField>
       <view>TaskFilter_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>bc335644-c046-4362-9c7f-db6baa0b7394</name>
+      <entityField>AttributeTree</entityField>
+      <view>AttributeRelationTree_view</view>
+    </neonViewReference>
     <neonViewReference>
       <name>e96f2fec-1a98-4380-895a-82ab78ba408a</name>
       <entityField>Documents</entityField>
diff --git a/neonView/OrderEdit_view/OrderEdit_view.aod b/neonView/OrderEdit_view/OrderEdit_view.aod
index 8ab4459538..2132b51603 100644
--- a/neonView/OrderEdit_view/OrderEdit_view.aod
+++ b/neonView/OrderEdit_view/OrderEdit_view.aod
@@ -54,5 +54,10 @@
         </entityFieldLink>
       </fields>
     </genericViewTemplate>
+    <neonViewReference>
+      <name>72e2cb25-23e0-4f52-87a3-7c1bd80e99ec</name>
+      <entityField>Attributes</entityField>
+      <view>AttributeRelationEdit_view</view>
+    </neonViewReference>
   </children>
 </neonView>
diff --git a/neonView/OrderMain_view/OrderMain_view.aod b/neonView/OrderMain_view/OrderMain_view.aod
index 77bbd6830b..bc76e90e06 100644
--- a/neonView/OrderMain_view/OrderMain_view.aod
+++ b/neonView/OrderMain_view/OrderMain_view.aod
@@ -34,6 +34,11 @@
       <entityField>#ENTITY</entityField>
       <view>OrderDetail_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>1e0af6a9-9bb6-47b5-944b-636d21ac74d2</name>
+      <entityField>AttributeTree</entityField>
+      <view>AttributeRelationTree_view</view>
+    </neonViewReference>
     <neonViewReference>
       <name>b3014999-da86-45ae-86ae-feb738d62906</name>
       <entityField>Documents</entityField>
diff --git a/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod b/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod
index 5c2db6962a..c047336f19 100644
--- a/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod
+++ b/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod
@@ -62,5 +62,10 @@
         </entityFieldLink>
       </fields>
     </genericViewTemplate>
+    <neonViewReference>
+      <name>fc97f8c8-ffd0-4d67-b331-eab37ef1dc2b</name>
+      <entityField>Attributes</entityField>
+      <view>AttributeRelationEdit_view</view>
+    </neonViewReference>
   </children>
 </neonView>
diff --git a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod
index 2ac8547b5b..649798e536 100644
--- a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod
+++ b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod
@@ -59,6 +59,11 @@
       <entityField>Timetrackings</entityField>
       <view>TimetrackingFilter_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>9c98cef0-f9dd-40a7-a9c9-eb4e741286d2</name>
+      <entityField>AttributeTree</entityField>
+      <view>AttributeRelationTree_view</view>
+    </neonViewReference>
     <neonViewReference>
       <name>0a3f2444-8d91-41e3-8f4d-19a6013c29c5</name>
       <entityField>Documents</entityField>
diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js
index e7007a1a0d..a547b808eb 100644
--- a/process/Attribute_lib/process.js
+++ b/process/Attribute_lib/process.js
@@ -320,6 +320,34 @@ AttributeRelationUtils.setAttribute = function ()
     //TODO: implement
 }
 
+/**
+ * adds rows for attributes with min_count > 0
+ * 
+ * @param {String} pObjectType the object type
+ * @param {String} pConsumer the name of the attribute relation consumer
+ */
+AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsumer)
+{
+    var mandatoryAttributes = db.table(
+        SqlCondition.begin()
+            .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType)
+            .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# <> ?")
+            .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# <> ?")
+            .and("ATTRIBUTE_ACTIVE = 1")
+            .and("MIN_COUNT > 0")
+            .buildSql("select AB_ATTRIBUTE_ID, MIN_COUNT from AB_ATTRIBUTEUSAGE "
+                + "join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTEID")
+    );
+    mandatoryAttributes.forEach(function (usage)
+    {
+        //adding an attribute more than 20 times would be too much (having a min_count > 20 is very unlikely)
+        for (let i = 0; i < usage[1] && i < 20; i++)
+            neon.addRecord(null, pConsumer, {
+                "AB_ATTRIBUTE_ID" : usage[0]
+            });
+    });
+}
+
 /*********************************************************************************************************************/
 
 
-- 
GitLab