From 7ec2e4de51e28fbb392607cbc8c757b7c7906d0d Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Wed, 9 Sep 2020 07:44:35 +0200
Subject: [PATCH] ScanServices: Classification

---
 aliasDefinition/Data_alias/Data_alias.aod     |  7 -----
 .../ClassificationScore_entity.aod            |  1 -
 .../entityfields/score/onValidation.js        |  0
 .../maxscore.value/expression.js              |  1 -
 process/ClassificationFilter_lib/process.js   | 28 +++++++++++--------
 process/Classification_lib/process.js         |  6 ++--
 6 files changed, 19 insertions(+), 24 deletions(-)
 delete mode 100644 entity/ClassificationScore_entity/entityfields/score/onValidation.js

diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index 402c8e920f..d7ec9b0450 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -9651,13 +9651,6 @@
                 <documentation></documentation>
                 <title></title>
                 <description></description>
-                <dependencies>
-                  <entityDependency>
-                    <name>d9eb29b7-a77c-4b72-b98e-13a87bedfc2b</name>
-                    <entityName>CLASSIFICATIONTYPE</entityName>
-                    <fieldName>CLASSIFICATIONTYPE</fieldName>
-                  </entityDependency>
-                </dependencies>
               </entityFieldDb>
             </entityFields>
           </entityDb>
diff --git a/entity/ClassificationScore_entity/ClassificationScore_entity.aod b/entity/ClassificationScore_entity/ClassificationScore_entity.aod
index 51332fbd2e..b248094981 100644
--- a/entity/ClassificationScore_entity/ClassificationScore_entity.aod
+++ b/entity/ClassificationScore_entity/ClassificationScore_entity.aod
@@ -38,7 +38,6 @@
       <outputFormat>#,##0.00</outputFormat>
       <inputFormat>#,##0.00</inputFormat>
       <mandatory v="true" />
-      <onValidation>%aditoprj%/entity/ClassificationScore_entity/entityfields/score/onValidation.js</onValidation>
     </entityField>
     <entityProvider>
       <name>ClassificationScores</name>
diff --git a/entity/ClassificationScore_entity/entityfields/score/onValidation.js b/entity/ClassificationScore_entity/entityfields/score/onValidation.js
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/entity/ClassificationType_entity/recordcontainers/db/recordfieldmappings/maxscore.value/expression.js b/entity/ClassificationType_entity/recordcontainers/db/recordfieldmappings/maxscore.value/expression.js
index 80e8d7e14a..d8c6a26ee9 100644
--- a/entity/ClassificationType_entity/recordcontainers/db/recordfieldmappings/maxscore.value/expression.js
+++ b/entity/ClassificationType_entity/recordcontainers/db/recordfieldmappings/maxscore.value/expression.js
@@ -6,5 +6,4 @@ var statement = newSelect("max(CLASSIFICATIONSCORE.SCORE)")
         .from("CLASSIFICATIONSCORE")
         .where("CLASSIFICATIONSCORE.CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID");
 
-logging.log("statement.toString()>>" + statement.toString())
 result.string(statement.toString());
\ No newline at end of file
diff --git a/process/ClassificationFilter_lib/process.js b/process/ClassificationFilter_lib/process.js
index 167971780e..35716cdec2 100644
--- a/process/ClassificationFilter_lib/process.js
+++ b/process/ClassificationFilter_lib/process.js
@@ -21,7 +21,7 @@ function ClassificationTypeFilterUtils() {}
 /**
  * fetches classificationtypes and transforms them into filter fields
  * 
- * @param {String} pObjectType       <p/> contextId of the context whoes attributes are used for providing the filter fields
+ * @param {String} pObjectType       <p/> contextId of the context whoes classification types are used for providing the filter fields
  *                                      
  * @return {String}                  <p/> field-definitions (array of objects) that are ready to use for a filterExtensionSet in a stringified form
  *                                   <br/> The object within the array contains the following properties:
@@ -151,7 +151,7 @@ ClassificationTypeFilterUtils.getTranslationSql = function()
 
 /**
  * Procides static methods for en- or decoding classification group filter names
- * AttributeFilter names are shared over several processes and contain therefore various information
+ * ClassifcationGroupFilter names are shared over several processes and contain therefore various information
  * The infomration needs to be encoded to be able to transfer it over the different processes
  * 
  * @class
@@ -162,9 +162,10 @@ function ClassificationGroupFilterNameCoder(){}
 /**
  * encodes several parameters into one string that can be used as classification group filter-name
  * 
- * @param {String} pUid                 <p/> attribute uid of the attribute that has to be encoded
- * @param {String} pAttributeType       <p/> attribute type of the attribute that has to be encoded 
- *                                      <br/> while you may able to specify any string, only values of $AttributeTypes.*** are useful
+ * @param {String} pClassificationGroupId           <p/> uid-value of a classification group
+ * @param {String} pRepresentingSqlExpression       <p/> sql expressions that represents one classification group result, for example an sql 
+ *                                                  expression that returns the Value "B" for the classificationvalue "CBA" when the fielter field 
+ *                                                  for the second level classification group is generated
  *                                      
  * @return {String}                     <p/> an encoded string of the given parametervalues 
  *                                      <br/> this is basically a serialized object which is base64 encoded
@@ -177,17 +178,18 @@ ClassificationGroupFilterNameCoder.encode = function (pClassificationGroupId, pR
         representingSqlExpression: pRepresentingSqlExpression
     };
     res = JSON.stringify(res);
-    res = util.encodeBase64String(res);
+    res = util.encodeBase64String(res);//encode base64 to ensure that there a no problematic characters in the filterfield name
     return res;
 };
 
 /**
- * decodes a string that was encoded with AttributeSearchNameCoder.encode
+ * decodes a string that was encoded with ClassificationGroupFilterNameCoder.encode
  * 
  * 
  * @param {String} pEncodedString       <p/> string that shall be decoded; the origin of the name has to be a filter-object
  *                                      
- * @return {Object}                     <p/> an object that contains all keys and values that have been encoded with AttributeSearchNameCoder.encode
+ * @return {Object}                     <p/> an object that contains all keys and values that have been encoded with 
+ *                                      ClassificationGroupFilterNameCoder.encode
  * @static 
  */
 ClassificationGroupFilterNameCoder.decode = function (pEncodedString)
@@ -210,7 +212,7 @@ function ClassificationGroupFilterUtils() {}
 /**
  * fetches classificationgroups and transforms them into filter fields
  * 
- * @param {String} pObjectType       <p/> contextId of the context whoes attributes are used for providing the filter fields
+ * @param {String} pObjectType       <p/> contextId of the context whoes classification groups are used for providing the filter fields
  *                                      
  * @return {String}                  <p/> field-definitions (array of objects) that are ready to use for a filterExtensionSet in a stringified form
  *                                   <br/> The object within the array contains the following properties:
@@ -241,7 +243,7 @@ ClassificationGroupFilterUtils.getFilterFields = function(pObjectType)
         var classificationGroupTitle = classificationGroup["#CONTENTTITLE"];
         
         var representingSqlExpression = sqlHelper.substring("CLASSIFICATIONVALUE", idx+1, 1);
-        var name = ClassificationGroupFilterNameCoder.encode(classificationGroupId, sqlHelper.substring("CLASSIFICATIONVALUE", idx+1, 1));
+        var name = ClassificationGroupFilterNameCoder.encode(classificationGroupId, representingSqlExpression);
         res.push({
             name: name,
             title: classificationGroupTitle,
@@ -300,7 +302,11 @@ ClassificationGroupFilterUtils.makeFilterValues = function()
 /**
  * Builds a Sql-condition that may be used in a filter extension set and allows to filter for classificationtypes within a db-table
  * 
+ * @param {String} pObjectType          <p/> contextId of the objects thats records 
+ * @param {String} pFilterName          <p/> name of the filter that was prior encoded and contains various information
  * @param {String} pCondition           <p/> a SQL-condition like it is given in the "$local.condition"-variable in filter extension sets
+ * @param {String} pRawValue            <p/> the raw input value that the user has entered for a filter operation
+ * @param {String} pOperatorName        <p/> the operator of the condition (equals, smaller, greater, etc.) as a resolved name; e.g. "IS NOT NULL"
  * @param {String} pIdTableName         <p/> name of the db-table where the data shall be filtered
  * @param {String} pIdColumnName        <p/> name of the primarykey-column of the table that was given via pIdTablename
  * @param {String} pColumnPlaceholder   <p/> name of the placeholder where the columnname should be like it is given in the 
@@ -364,7 +370,7 @@ ClassificationGroupFilterUtils.makeFilterConditionSql = function()
 ClassificationGroupFilterUtils.makeDefaultGroupQuery = function()
 {
     var isCount = vars.get("$local.count");             // TRUE if the count of the records is needed
-    var columns = vars.get("$local.columnlist");        // The column, expected from the querry, see also AttributeFilter_lib
+    var columns = vars.get("$local.columnlist");        // The column, expected from the querry, see the filterFieldsProcess
     var condition = vars.get("$local.condition");       // The Condition that's beeing used, includes the grouphirachy
     var groupedColumns = vars.get("$local.groupedlist") // The coloumns, used for grouping
     var order = vars.get("$local.order");               // The order of the result
diff --git a/process/Classification_lib/process.js b/process/Classification_lib/process.js
index baa8bf0808..c56bb0f4c8 100644
--- a/process/Classification_lib/process.js
+++ b/process/Classification_lib/process.js
@@ -350,10 +350,8 @@ ClassificationUtils.getGradingFromObject = function(pGradingObject, pGroupId, pS
  * Inserts a empty classification data set into Classificationstorage, since every dataset of a classifiable module has to have an entry 
  * because the updateClassifications_serverProcess is only updating instead of inserting.<br>
  * 
- * @param {String or Array} pUid                          <p>
- *                                                          The unique uid('s) of the inserted record
- * @param {String} pObjectType                            <p>
- *                                                          The object type
+ * @param {String|Array} pUids         <p/>The unique uid('s) of the inserted record, string for one element, array for several elements
+ * @param {String} pObjectType         <p>contextId for the passed uids that shall be initialized
  */
 ClassificationUtils.insertEmptyClassification = function(pUids, pObjectType)
 {
-- 
GitLab