Skip to content

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

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

DimitriDiantos
Copy link
Contributor

@DimitriDiantos DimitriDiantos commented Oct 8, 2024

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.

358592818-234e5469-e786-45c9-a66f-d3637a1d96b7 358592825-72aebb62-8519-4eff-a1e7-afefaf540f30

Copy link
Member

@franzTobiasDLR franzTobiasDLR left a 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();
Copy link
Member

@franzTobiasDLR franzTobiasDLR Jan 16, 2025

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) {
Copy link
Member

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.");
Copy link
Member

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) {
Copy link
Member

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());
Copy link
Member

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());
Copy link
Member

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());
Copy link
Member

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);
Copy link
Member

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) {
Copy link
Member

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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants