From 63d65113fa8aa9387c6ee0a972d23f9cd6524f67 Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Tue, 16 Apr 2019 11:04:09 +0200
Subject: [PATCH] Attribute fixes

---
 .../AttributeRelationTree_entity.aod          | 28 +++++++++++++++++++
 .../children/objecttype_param/valueProcess.js |  4 +++
 .../AttributeUsage_entity.aod                 |  8 ++++++
 .../exclusivecontexts_param/valueProcess.js   | 12 ++++++++
 .../useexclusives_param/valueProcess.js       |  2 ++
 entity/Attribute_entity/Attribute_entity.aod  | 19 +++++++++++++
 .../recordcontainers/jdito/onInsert.js        |  2 --
 .../recordcontainers/jdito/onUpdate.js        |  4 +--
 entity/Context_entity/Context_entity.aod      | 19 +++++++++----
 .../valueProcess.js                           |  0
 .../valueProcess.js                           |  0
 .../recordcontainers/jdito/contentProcess.js  |  5 ++--
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |  1 +
 .../AttributeRelationTree.aod                 | 28 +++++++++++--------
 .../AttributeRelationTreeEdit_view.aod        | 28 +++++++++++++++++++
 process/Context_lib/process.js                | 14 ++++++----
 16 files changed, 144 insertions(+), 30 deletions(-)
 create mode 100644 entity/AttributeRelationTree_entity/entityfields/specificattribute/children/objecttype_param/valueProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
 create mode 100644 entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js
 rename entity/Context_entity/entityfields/activitylinkable/children/{excludecontexts_param => exclusivecontexts_param}/valueProcess.js (100%)
 rename entity/Context_entity/entityfields/tasklinkable/children/{excludecontexts_param => exclusivecontexts_param}/valueProcess.js (100%)
 create mode 100644 neonView/AttributeRelationTreeEdit_view/AttributeRelationTreeEdit_view.aod

diff --git a/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod b/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
index c550e092273..9d39900010b 100644
--- a/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
+++ b/entity/AttributeRelationTree_entity/AttributeRelationTree_entity.aod
@@ -80,6 +80,34 @@
         </entityDependency>
       </dependencies>
     </entityProvider>
+    <entityField>
+      <name>AB_ATTRIBUTE_ID</name>
+      <title>Attribute</title>
+      <consumer>SpecificAttribute</consumer>
+    </entityField>
+    <entityField>
+      <name>VALUE</name>
+      <title>Value</title>
+    </entityField>
+    <entityConsumer>
+      <name>SpecificAttribute</name>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Attribute_entity</entityName>
+        <fieldName>SpecificAttribute</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeRelationTree_entity/entityfields/specificattribute/children/objecttype_param/valueProcess.js</valueProcess>
+          <triggerRecalculation v="true" />
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>ATTRIBUTE_TYPE</name>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/AttributeRelationTree_entity/entityfields/specificattribute/children/objecttype_param/valueProcess.js b/entity/AttributeRelationTree_entity/entityfields/specificattribute/children/objecttype_param/valueProcess.js
new file mode 100644
index 00000000000..5c2ba1e99bd
--- /dev/null
+++ b/entity/AttributeRelationTree_entity/entityfields/specificattribute/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.exists("$param.ObjectType_param") ? vars.get("$param.ObjectType_param") : "");
diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod
index 1d04eaa1fad..592e1c543ee 100644
--- a/entity/AttributeUsage_entity/AttributeUsage_entity.aod
+++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod
@@ -75,6 +75,14 @@
           <name>GetAllContexts_param</name>
           <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js</valueProcess>
         </entityParameter>
+        <entityParameter>
+          <name>UseExclusives_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ExclusiveContexts_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js</valueProcess>
+        </entityParameter>
       </children>
     </entityConsumer>
   </entityFields>
diff --git a/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
new file mode 100644
index 00000000000..9ccd8c87e58
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/context/children/exclusivecontexts_param/valueProcess.js
@@ -0,0 +1,12 @@
+import("system.result");
+
+result.object([
+    "Organisation",
+    "Person",
+    "Contract",
+    "Product",
+    "Activity",
+    "Offer",
+    "Employee",
+    "Salesproject"
+]);
\ No newline at end of file
diff --git a/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js
new file mode 100644
index 00000000000..cda204045d2
--- /dev/null
+++ b/entity/AttributeUsage_entity/entityfields/context/children/useexclusives_param/valueProcess.js
@@ -0,0 +1,2 @@
+import("system.result");
+result.string(true);
\ No newline at end of file
diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod
index 48ab217a1dc..c453e2a87ae 100644
--- a/entity/Attribute_entity/Attribute_entity.aod
+++ b/entity/Attribute_entity/Attribute_entity.aod
@@ -183,6 +183,12 @@
           <fieldName>SpecificAttribute</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>ba3b4d47-7385-49df-bf61-54c99f5b2c81</name>
+          <entityName>AttributeRelationTree_entity</entityName>
+          <fieldName>SpecificAttribute</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
       <children>
         <entityParameter>
@@ -197,6 +203,18 @@
           <name>DisplaySimpleName_param</name>
           <expose v="true" />
         </entityParameter>
+        <entityParameter>
+          <name>AttrParentId_param</name>
+          <expose v="false" />
+        </entityParameter>
+        <entityParameter>
+          <name>AttrParentType_param</name>
+          <expose v="false" />
+        </entityParameter>
+        <entityParameter>
+          <name>GetGroups_param</name>
+          <expose v="false" />
+        </entityParameter>
       </children>
     </entityProvider>
     <entityField>
@@ -278,6 +296,7 @@
     </entityField>
     <entityField>
       <name>UID</name>
+      <searchable v="false" />
     </entityField>
   </entityFields>
   <recordContainers>
diff --git a/entity/Attribute_entity/recordcontainers/jdito/onInsert.js b/entity/Attribute_entity/recordcontainers/jdito/onInsert.js
index 87565632d7c..0b179785ecd 100644
--- a/entity/Attribute_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/Attribute_entity/recordcontainers/jdito/onInsert.js
@@ -4,7 +4,6 @@ import("system.vars");
 var columns = [
     "AB_ATTRIBUTEID",
     "ATTRIBUTE_ACTIVE",
-    "ATTRIBUTE_LEVEL",
     "ATTRIBUTE_NAME",
     "ATTRIBUTE_PARENT_ID",
     "ATTRIBUTE_TYPE",
@@ -13,7 +12,6 @@ var columns = [
 var values = [
     vars.get("$field.UID"),
     vars.get("$field.ATTRIBUTE_ACTIVE"),
-    vars.get("$field.ATTRIBUTE_LEVEL"),
     vars.get("$field.ATTRIBUTE_NAME"),
     vars.get("$field.ATTRIBUTE_PARENT_ID"),
     vars.get("$field.ATTRIBUTE_TYPE"),
diff --git a/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js b/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js
index 6740df0d149..152518a6dc3 100644
--- a/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js
@@ -4,7 +4,6 @@ import("system.vars");
 
 var columns = [
     "ATTRIBUTE_ACTIVE",
-    "ATTRIBUTE_LEVEL",
     "ATTRIBUTE_NAME",
     "ATTRIBUTE_PARENT_ID",
     "ATTRIBUTE_TYPE",
@@ -12,7 +11,6 @@ var columns = [
 ];
 var values = [
     vars.get("$field.ATTRIBUTE_ACTIVE"),
-    vars.get("$field.ATTRIBUTE_LEVEL"),
     vars.get("$field.ATTRIBUTE_NAME"),
     vars.get("$field.ATTRIBUTE_PARENT_ID"),
     vars.get("$field.ATTRIBUTE_TYPE"),
@@ -23,4 +21,4 @@ var condition = SqlCondition.begin()
     .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.UID")
     .build("1=2");
 
-db.updateData("AB_ATTRIBUTE", columns, null, values, conditon);
\ No newline at end of file
+db.updateData("AB_ATTRIBUTE", columns, null, values, condition);
\ No newline at end of file
diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod
index ae0b115f7ae..f1169026a4f 100644
--- a/entity/Context_entity/Context_entity.aod
+++ b/entity/Context_entity/Context_entity.aod
@@ -45,13 +45,13 @@
       </dependencies>
       <children>
         <entityParameter>
-          <name>excludeContexts_param</name>
+          <name>ExclusiveContexts_param</name>
           <expose v="false" />
         </entityParameter>
       </children>
     </entityProvider>
     <entityParameter>
-      <name>excludeContexts_param</name>
+      <name>ExclusiveContexts_param</name>
       <expose v="true" />
       <description>PARAMETER</description>
     </entityParameter>
@@ -68,8 +68,9 @@
       </dependencies>
       <children>
         <entityParameter>
-          <name>excludeContexts_param</name>
-          <valueProcess>%aditoprj%/entity/Context_entity/entityfields/activitylinkable/children/excludecontexts_param/valueProcess.js</valueProcess>
+          <name>ExclusiveContexts_param</name>
+          <valueProcess>%aditoprj%/entity/Context_entity/entityfields/activitylinkable/children/exclusivecontexts_param/valueProcess.js</valueProcess>
+          <expose v="false" />
         </entityParameter>
       </children>
     </entityProvider>
@@ -86,8 +87,9 @@
       </dependencies>
       <children>
         <entityParameter>
-          <name>excludeContexts_param</name>
-          <valueProcess>%aditoprj%/entity/Context_entity/entityfields/tasklinkable/children/excludecontexts_param/valueProcess.js</valueProcess>
+          <name>ExclusiveContexts_param</name>
+          <valueProcess>%aditoprj%/entity/Context_entity/entityfields/tasklinkable/children/exclusivecontexts_param/valueProcess.js</valueProcess>
+          <expose v="false" />
         </entityParameter>
       </children>
     </entityProvider>
@@ -96,6 +98,11 @@
       <expose v="true" />
       <description>PARAMETER</description>
     </entityParameter>
+    <entityParameter>
+      <name>UseExclusives_param</name>
+      <expose v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/Context_entity/entityfields/activitylinkable/children/excludecontexts_param/valueProcess.js b/entity/Context_entity/entityfields/activitylinkable/children/exclusivecontexts_param/valueProcess.js
similarity index 100%
rename from entity/Context_entity/entityfields/activitylinkable/children/excludecontexts_param/valueProcess.js
rename to entity/Context_entity/entityfields/activitylinkable/children/exclusivecontexts_param/valueProcess.js
diff --git a/entity/Context_entity/entityfields/tasklinkable/children/excludecontexts_param/valueProcess.js b/entity/Context_entity/entityfields/tasklinkable/children/exclusivecontexts_param/valueProcess.js
similarity index 100%
rename from entity/Context_entity/entityfields/tasklinkable/children/excludecontexts_param/valueProcess.js
rename to entity/Context_entity/entityfields/tasklinkable/children/exclusivecontexts_param/valueProcess.js
diff --git a/entity/Context_entity/recordcontainers/jdito/contentProcess.js b/entity/Context_entity/recordcontainers/jdito/contentProcess.js
index 6ae2f8ad3cb..29391c90234 100644
--- a/entity/Context_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Context_entity/recordcontainers/jdito/contentProcess.js
@@ -2,9 +2,10 @@ import("system.vars");
 import("system.result");
 import("Context_lib");
 
-var excludeContexts = vars.getString("$param.excludeContexts_param");
+var excludeContexts = vars.getString("$param.ExclusiveContexts_param");
 if (excludeContexts)
     excludeContexts = JSON.parse(excludeContexts);
 var filterContexts = !(vars.exists("$param.GetAllContexts_param") && vars.get("$param.GetAllContexts_param") == "true");
+var useExclusives = vars.exists("$param.UseExclusives_param") && vars.get("$param.UseExclusives_param") == "true";
 
-result.object(ContextUtils.getContexts(filterContexts, excludeContexts));
\ No newline at end of file
+result.object(ContextUtils.getContexts(filterContexts, excludeContexts, useExclusives));
\ No newline at end of file
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index 4795b603f10..8f7b2ea57a1 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -3025,6 +3025,7 @@
     </entry>
     <entry>
       <key>Group</key>
+      <value>Gruppe</value>
     </entry>
     <entry>
       <key>Combobox</key>
diff --git a/neonContext/AttributeRelationTree/AttributeRelationTree.aod b/neonContext/AttributeRelationTree/AttributeRelationTree.aod
index bcd7bec8f8c..9acb4ce97d8 100644
--- a/neonContext/AttributeRelationTree/AttributeRelationTree.aod
+++ b/neonContext/AttributeRelationTree/AttributeRelationTree.aod
@@ -1,12 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0">
-  <name>AttributeRelationTree</name>
-  <majorModelMode>DISTRIBUTED</majorModelMode>
-  <entity>AttributeRelationTree_entity</entity>
-  <references>
-    <neonViewReference>
-      <name>55f89863-72b0-4179-8494-b1e320d79de9</name>
-      <view>AttributeRelationTree_view</view>
-    </neonViewReference>
-  </references>
-</neonContext>
+<?xml version="1.0" encoding="UTF-8"?>
+<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0">
+  <name>AttributeRelationTree</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <entity>AttributeRelationTree_entity</entity>
+  <references>
+    <neonViewReference>
+      <name>55f89863-72b0-4179-8494-b1e320d79de9</name>
+      <view>AttributeRelationTree_view</view>
+    </neonViewReference>
+    <neonViewReference>
+      <name>591d27d7-e963-4ff0-9d82-2e24b18e6b5c</name>
+      <view>AttributeRelationTreeEdit_view</view>
+    </neonViewReference>
+  </references>
+</neonContext>
diff --git a/neonView/AttributeRelationTreeEdit_view/AttributeRelationTreeEdit_view.aod b/neonView/AttributeRelationTreeEdit_view/AttributeRelationTreeEdit_view.aod
new file mode 100644
index 00000000000..a08a9caf68e
--- /dev/null
+++ b/neonView/AttributeRelationTreeEdit_view/AttributeRelationTreeEdit_view.aod
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
+  <name>AttributeRelationTreeEdit_view</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <isSmall v="true" />
+  <layout>
+    <boxLayout>
+      <name>layout</name>
+    </boxLayout>
+  </layout>
+  <children>
+    <genericViewTemplate>
+      <name>Generic</name>
+      <editMode v="true" />
+      <entityField>#ENTITY</entityField>
+      <fields>
+        <entityFieldLink>
+          <name>e5635cd6-1a95-455a-af89-5baf4259caa0</name>
+          <entityField>AB_ATTRIBUTE_ID</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>abec86c9-3d77-4129-b34b-d30da0526572</name>
+          <entityField>VALUE</entityField>
+        </entityFieldLink>
+      </fields>
+    </genericViewTemplate>
+  </children>
+</neonView>
diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js
index dcb6054d49d..ee1242dde2f 100644
--- a/process/Context_lib/process.js
+++ b/process/Context_lib/process.js
@@ -42,30 +42,34 @@ ContextUtils.getContextName = function(pContextId)
 /**
  *
  * @param {Boolean} [pFilter=false] filter only for contexts which have a mapping in ContextUtils.getSelectMap 
- * @param {String[]} [pExcludeContexts] contextIds that shall not be included (so this is a additional filter to the pFiler param)
+ * @param {String[]} [pExclusiveContexts] contextIds that shall not be included (so this is a additional filter to the pFilter param)
+ * @param {Boolean} [pUseExclusives=false] decides whether the items in pExclusiveContexts are excluded (false) or
+ *                      everything that is not in pExclusiveContexts is excluded (true)
  *
  * @return {String[][]} the contexts [[contextId, contextName, contextTitle], [... ], ...]
  */
-ContextUtils.getContexts = function(pFilter, pExcludeContexts)
+ContextUtils.getContexts = function(pFilter, pExclusiveContexts, pUseExclusives)
 {
     if (pFilter == undefined)
         pFilter = false;
+    if (pUseExclusives == undefined)
+        pUseExclusives = false;
 
     var contexts = project.getDataModels(project.DATAMODEL_KIND_CONTEXT);
 
     if (pFilter)
     {
         contexts = contexts.filter(function(pContext) {
-            if (pExcludeContexts && pExcludeContexts.indexOf(pContext[0]) > -1)
+            if (pExclusiveContexts && pExclusiveContexts.indexOf(pContext[0]) > -1 != pUseExclusives)
                 return false;
             // filter only contexts which have defined mappings in Context_lib
             return ContextUtils.getSelectMap ()[pContext[0]] != undefined;
         });
     }
-    else if (pExcludeContexts)
+    else if (pExclusiveContexts)
     {
         contexts = contexts.filter(function(pContext) {
-            if (pExcludeContexts && pExcludeContexts.indexOf(pContext[0]) > -1)
+            if (pExclusiveContexts && pExclusiveContexts.indexOf(pContext[0]) > -1 != pUseExclusives)
                 return false;
             return true;
         });
-- 
GitLab