-
Notifications
You must be signed in to change notification settings - Fork 3
Implementation of data exchange with Comet #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Implementation of data exchange with Comet #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're on a good way! The main problem with the parameters seems to be that you're using the wrong concept when creating the beans...
And other than that we will probably need some code clean up before merging... :)
* A top-level element is typically not referenced by any other elements. | ||
*/ | ||
private boolean isTopLevelElement(ElementDefinition element) { | ||
return element.referencingElementUsages().isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least the API also has an attribute "topLevel" -> I guess the SDK should also have it than? That would be more robust I guess?
http://sc-010266l.intra.dlr.de:5000/EngineeringModel/33edade4-698c-4a91-8413-b9d192214c21/iteration/54bd5c12-3f03-420a-8ac1-07cad2de5bf4
if (valueSet.getValueSwitch() == ParameterSwitchKind.MANUAL) { | ||
return valueSet.getManual().get(0); | ||
} | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe don't catch Exceptions here? But the specified exception that is thrown here?
// Retrieve selected source tree items from the first page | ||
List<TreeNode> selectedItems = mainPage.getCheckedTreeNodes(); | ||
if (selectedItems == null || selectedItems.isEmpty()) { | ||
System.out.println("No items selected. Aborting operation."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use println... That will not show up in our logs... Either use the plugin's log or UI to show this error
for (TreeNode item : selectedItems) { | ||
createElementConfigurationHierarchy(item, targetInstance, editingDomain); | ||
} | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here please don't catch Exceptions...
createElementConfigurationHierarchy(item, targetInstance, editingDomain); | ||
} | ||
} catch (Exception e) { | ||
System.err.println("Error occurred while creating configuration hierarchy: " + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And don't use println please
* Recursively collects checked items from a TreeItem structure and constructs a hierarchical TreeNode structure. | ||
*/ | ||
private TreeNode collectCheckedItemsRecursively(TreeItem item) { | ||
System.out.println("Checking item: " + item.getText() + ", isChecked: " + item.getChecked()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println
TreeNode childNode = collectCheckedItemsRecursively(child); | ||
if (childNode != null) { | ||
node.addChild(childNode); | ||
System.out.println("Added child: " + childNode.getCleanedName() + " to parent: " + node.getCleanedName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println
throw new IllegalStateException("Root name of the selected item is null or empty."); | ||
} | ||
|
||
ConfigurationTree newCT = new ConfigurationTree(activeConceptPs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you always creating a new CT? I thought you can also select one?
} | ||
}); | ||
|
||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exception + println
/** | ||
* Helper method to create a StructuralElementInstance using a factory. | ||
*/ | ||
private StructuralElementInstance createStructuralElementInstance(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you create a SEI here with the factory? We usually use Beans for that... And why do you do it here and in the CometDataFetcher? And maybe in the Command aswell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the old implementation. I will provide to day the actual implementation with the update based on your comments.
This branch introduces the ability to connect to a Comet server, fetch engineering model data, and display it in a hierarchical tree within the application.
Key Features:
Comet Server Configuration Wizard: Easily connect to a Comet server by entering the server URL, login, and password.
Data Fetching and Visualization: Fetched data is displayed in a tree structure, showing key elements and attributes like mass.
Tree Item Selection: Supports multi-selection of items with checkboxes for efficient data handling.
How to Use:
Navigate to File > Import..., select Comet Import Wizards, and configure your server details.
Click Fetch Data to retrieve and display the data.