yesamer commented on code in PR #2628:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2628#discussion_r1799571690


##########
packages/scesim-editor/src/store/computed/computeTestScenarioDataObjects.ts:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Computed, State, TestScenarioDataObject } from 
"../TestScenarioEditorStore";
+
+export function computeTestScenarioDataObjects(
+  factMappings: 
State["scesim"]["model"]["ScenarioSimulationModel"]["simulation"]["scesimModelDescriptor"]["factMappings"]["FactMapping"]
+) {
+  /* To create the Data Object arrays we need an external source, in details: 
*/
+  /* DMN Data: Retrieving DMN type from linked DMN file */
+  /* Java classes: Retrieving Java classes info from the user projects */
+  /* At this time, none of the above are supported */
+  /* Therefore, it tries to retrieve these info from the SCESIM file, if are 
present */
+
+  /* Retriving Data Object from the scesim file.       
+       That makes sense for previously created scesim files */
+
+  const factsMappings = factMappings ?? [];
+  const dataObjects: TestScenarioDataObject[] = [];
+
+  /* The first two FactMapping are related to the "Number" and "Description" 
columns. 
+        If those columns only are present, no Data Objects can be detected in 
the scesim file */
+  for (let i = 2; i < factsMappings.length; i++) {
+    if (factsMappings[i].className!.__$$text === "java.lang.Void") {
+      continue;
+    }
+    const factID = 
factsMappings[i].expressionElements!.ExpressionElement![0].step.__$$text;
+    const dataObject = dataObjects.find((value) => value.id === factID);
+    const isSimpleTypeFact = 
factsMappings[i].expressionElements!.ExpressionElement!.length == 1;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to