From 4f9ca553efe74d9d501a8f704b744172ddc0e381 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Thu, 4 Apr 2019 16:09:25 +0200
Subject: [PATCH] object relation add description

---
 aliasDefinition/Data_alias/Data_alias.aod          | 14 ++++++++++++++
 .../ObjectRelation_entity.aod                      |  8 ++++++++
 entity/ObjectTree_entity/ObjectTree_entity.aod     | 10 +++++-----
 .../entityfields/description/valueProcess.js       |  1 -
 .../recordcontainers/jdito/contentProcess.js       |  9 ++++-----
 .../ObjectRelationEdit_view.aod                    |  4 ++++
 .../ObjectRelationFilter_view.aod                  |  4 ++++
 neonView/ObjectTree_view/ObjectTree_view.aod       |  2 +-
 .../basic/2019.2/add_ObjectRelation_type.xml       |  1 +
 9 files changed, 41 insertions(+), 12 deletions(-)
 delete mode 100644 entity/ObjectTree_entity/entityfields/description/valueProcess.js

diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index 0c33b0d95f..89e097db34 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -4309,6 +4309,20 @@
                 <title></title>
                 <description></description>
               </entityFieldDb>
+              <entityFieldDb>
+                <name>INFO</name>
+                <dbName></dbName>
+                <primaryKey v="false" />
+                <columnType v="2005" />
+                <size v="2147483647" />
+                <scale v="0" />
+                <notNull v="false" />
+                <isUnique v="false" />
+                <index v="false" />
+                <documentation></documentation>
+                <title></title>
+                <description></description>
+              </entityFieldDb>
             </entityFields>
           </entityDb>
           <entityDb>
diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod
index f495721eb1..1a3854b659 100644
--- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod
+++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod
@@ -160,6 +160,10 @@
     <entityField>
       <name>OBJECT2_TYPE</name>
     </entityField>
+    <entityField>
+      <name>INFO</name>
+      <title>Description</title>
+    </entityField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
@@ -213,6 +217,10 @@
           <name>OBJECT1_TYPE.value</name>
           <expression>%aditoprj%/entity/ObjectRelation_entity/recordcontainers/db/recordfieldmappings/object1_type.value/expression.js</expression>
         </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>INFO.value</name>
+          <recordfield>AB_OBJECTRELATION.INFO</recordfield>
+        </dbRecordFieldMapping>
       </recordFieldMappings>
     </dbRecordContainer>
   </recordContainers>
diff --git a/entity/ObjectTree_entity/ObjectTree_entity.aod b/entity/ObjectTree_entity/ObjectTree_entity.aod
index abb4084655..02de3b4ff6 100644
--- a/entity/ObjectTree_entity/ObjectTree_entity.aod
+++ b/entity/ObjectTree_entity/ObjectTree_entity.aod
@@ -63,11 +63,6 @@
       <searchable v="false" />
       <valueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/icon/valueProcess.js</valueProcess>
     </entityField>
-    <entityField>
-      <name>DESCRIPTION</name>
-      <searchable v="false" />
-      <valueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/description/valueProcess.js</valueProcess>
-    </entityField>
     <entityField>
       <name>Selector</name>
       <title>Relationtype</title>
@@ -113,6 +108,10 @@
       <name>TARGET_CONTEXT</name>
       <searchable v="false" />
     </entityField>
+    <entityField>
+      <name>INFO</name>
+      <title>Description</title>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
@@ -126,6 +125,7 @@
         <element>EXPANDED.value</element>
         <element>TARGET_ID.value</element>
         <element>TARGET_CONTEXT.value</element>
+        <element>INFO.value</element>
         <element>Selector.value</element>
       </recordFields>
     </jDitoRecordContainer>
diff --git a/entity/ObjectTree_entity/entityfields/description/valueProcess.js b/entity/ObjectTree_entity/entityfields/description/valueProcess.js
deleted file mode 100644
index 552c76f974..0000000000
--- a/entity/ObjectTree_entity/entityfields/description/valueProcess.js
+++ /dev/null
@@ -1 +0,0 @@
-import("system.result");
diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
index c4a65d74fb..2496696dde 100644
--- a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
@@ -54,7 +54,7 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
                     currentObjectId = _getRootID(currentObjectId, relationTypeData);
                 }
                 
-                let uids = _insertEntry(tree, [[currentObjectId, "", "", "", ""]], pNodeId, pLayer, pObjectType)
+                let uids = _insertEntry(tree, [[currentObjectId, "", "", "", "", ""]], pNodeId, pLayer, pObjectType)
                 for (let i = 0; i < uids.length; i++) 
                 {                    
                     _loadObjectRelationTree(uids[i][0], uids[i][3], relationTypeData[0], uids[i], pLayer+1, relationTypeData);
@@ -75,7 +75,7 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
                         // TODO: Icons, BINDATA
                         // var icon = getIcon...
                         let uid = [currentObjectId, i, relationTypes[i]];
-                        tree.push([JSON.stringify(uid), translate.text(relationTypes[i][1]), JSON.stringify(pNodeId), true, null, null, ""]);
+                        tree.push([JSON.stringify(uid), translate.text(relationTypes[i][1]), JSON.stringify(pNodeId), true, null, null, "", ""]);
                         
                         _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId, uid, pLayer+1, relationTypeData);
                     }
@@ -180,9 +180,8 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
     // TODO: BINDATA?
     // var image = getImageObject("Beziehung");
 
-    // TODO: RELDESC gibts noch nicht
     var data = db.table(cond.buildSql(
-                "select OBJECT" + otherNum + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE \n\
+                "select OBJECT" + otherNum + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO \n\
                  from AB_OBJECTRELATION \n\
                  join AB_OBJECTRELATIONTYPE on AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum + " and ","1=2", "", false));
 
@@ -228,7 +227,7 @@ function _insertEntry(pTree, pEntryData, pNodeId, pLayer, pObjectType, pNum)
         if (pNum)
             uid.push(pNum);
         uids.push(uid);
-        pTree.push([JSON.stringify(uid), display, JSON.stringify(pNodeId), expanded, pEntryData[i][0], pObjectType, ""]);
+        pTree.push([JSON.stringify(uid), display, JSON.stringify(pNodeId), expanded, pEntryData[i][0], pObjectType, pEntryData[i][4], ""]);
     }
     return uids;
 }
diff --git a/neonView/ObjectRelationEdit_view/ObjectRelationEdit_view.aod b/neonView/ObjectRelationEdit_view/ObjectRelationEdit_view.aod
index 83e9082f7f..7f3ae6c820 100644
--- a/neonView/ObjectRelationEdit_view/ObjectRelationEdit_view.aod
+++ b/neonView/ObjectRelationEdit_view/ObjectRelationEdit_view.aod
@@ -21,6 +21,10 @@
           <name>f60a0e0d-c3a9-4ab7-9b52-b33f5bb61d31</name>
           <entityField>rowIdProxy</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>04579da5-0609-4a43-97dd-9e773ec1a29b</name>
+          <entityField>INFO</entityField>
+        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
diff --git a/neonView/ObjectRelationFilter_view/ObjectRelationFilter_view.aod b/neonView/ObjectRelationFilter_view/ObjectRelationFilter_view.aod
index d0895c5772..0199c5d9ca 100644
--- a/neonView/ObjectRelationFilter_view/ObjectRelationFilter_view.aod
+++ b/neonView/ObjectRelationFilter_view/ObjectRelationFilter_view.aod
@@ -22,6 +22,10 @@
           <name>ab25081c-cb63-4d28-87d0-e4c022aac878</name>
           <entityField>rowIdProxy</entityField>
         </neonTableColumn>
+        <neonTableColumn>
+          <name>a5e8b3d6-ff83-461a-ba28-d67e0df5d93d</name>
+          <entityField>INFO</entityField>
+        </neonTableColumn>
       </columns>
     </tableViewTemplate>
   </children>
diff --git a/neonView/ObjectTree_view/ObjectTree_view.aod b/neonView/ObjectTree_view/ObjectTree_view.aod
index a6e80e32a7..2917cacd09 100644
--- a/neonView/ObjectTree_view/ObjectTree_view.aod
+++ b/neonView/ObjectTree_view/ObjectTree_view.aod
@@ -14,7 +14,7 @@
       <parentField>PARENT_ID</parentField>
       <nodeExpandedField>EXPANDED</nodeExpandedField>
       <titleField>TITLE</titleField>
-      <descriptionField>DESCRIPTION</descriptionField>
+      <descriptionField>INFO</descriptionField>
       <iconField>ICON</iconField>
       <entityField>#ENTITY</entityField>
     </treeViewTemplate>
diff --git a/others/db_changes/Data_alias/basic/2019.2/add_ObjectRelation_type.xml b/others/db_changes/Data_alias/basic/2019.2/add_ObjectRelation_type.xml
index 89d9e3cf4a..a4cd984291 100644
--- a/others/db_changes/Data_alias/basic/2019.2/add_ObjectRelation_type.xml
+++ b/others/db_changes/Data_alias/basic/2019.2/add_ObjectRelation_type.xml
@@ -25,6 +25,7 @@
         <addColumn tableName="AB_OBJECTRELATION">
             <column name="AB_OBJECTRELATIONTYPE1" type="CHAR(36)"/>
             <column name="AB_OBJECTRELATIONTYPE2" type="CHAR(36)"/>
+            <column name="INFO" type="NCLOB"/>
         </addColumn>
         
         <dropIndex tableName="AB_OBJECTRELATION" indexName="IDX_AB_OBJECTRELATION_OBJECT1"/>
-- 
GitLab