Problem reconstructing components' object from DB #2

Closed
opened 2024-04-08 15:20:43 +02:00 by pb · 1 comment
Owner

In graph.GetWorkflowComponents we try to reconstruct the object corresponding to a component type and component id using componentModel and componentNEWModel. However the attributes of the objects are only added to the base object if they are strings. Hence we can't construct the attribute of type int, float, etc.. but also the structs in structs

This is mainly the cause of trying to make the object retrieval as generic as possible (1 method for all component's type)

In `graph.GetWorkflowComponents` we try to reconstruct the object corresponding to a component type and component id using *component*Model and *component*NEWModel. However the attributes of the objects are only added to the base object if they are strings. Hence we can't construct the attribute of type int, float, etc.. but also the structs in structs This is mainly the cause of trying to make the object retrieval as generic as possible (1 method for all component's type)
Author
Owner

Removed componentParser and changed the logic of component reconstruction, with json.Unmarshall rather than mapstructure. This library was over-complexifying things, creating maps from JSON data, while we already add the JSON data that could create these objects, supporting nested structs.

6bbb2a0b4092b852c90e39e896e8d8ba6bbfb110 updated AddComponentModel to take the user input stored in the DB as a parameter and adding it to the constructed object with json.Unmarshall.

Simpliefied the code and produced the expected reconstruction from DB data and models :

image

Removed `componentParser` and changed the logic of component reconstruction, with json.Unmarshall rather than mapstructure. This library was over-complexifying things, creating maps from JSON data, while we already add the JSON data that could create these objects, supporting nested structs. `6bbb2a0b4092b852c90e39e896e8d8ba6bbfb110` updated Add**Component**Model to take the user input stored in the DB as a parameter and adding it to the constructed object with json.Unmarshall. Simpliefied the code and produced the expected reconstruction from DB data and models : ![image](/attachments/27964a65-26f5-477d-aad9-4f99e5abc299)
102 KiB
root added this to the OpenCloud project 2024-06-28 15:39:17 +02:00
root closed this issue 2024-06-28 15:43:11 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: core/oc-schedulerd#2
No description provided.