-
Notifications
You must be signed in to change notification settings - Fork 3
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
226 implement data exchange with comet #227
base: development
Are you sure you want to change the base?
226 implement data exchange with comet #227
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.
Wow, pretty cool already 🚀 Now we can see and check the model elements to be loaded from COMET!!!
For the selection where to import to, you can probably use our tree wizrad page: https://github.com/virtualsatellite/VirtualSatellite4-Core/blob/development/de.dlr.sc.virsat.uiengine.ui/src/de/dlr/sc/virsat/uiengine/ui/wizard/ATreeViewerPage.java
And the actual import to the configruation tree can then probably done with some EMF comand that recursively creates the element configurations? You can take inspiration how we implemented it with the CAD import command in core:
https://github.com/virtualsatellite/VirtualSatellite4-Core/blob/21c05a97ab73c79bf96aad96807fca7ebbbe0239/de.dlr.sc.virsat.model.extension.mechanical.ui/src/de/dlr/sc/virsat/model/extension/mechanical/ui/wizards/CadImportWizard.java#L99
Sounds good?! :)
id="de.dlr.sc.virsat.model.extension.cefx.ui.importWizards.CometImportWizard" | ||
name="Comet Import Wizards"> | ||
<description> | ||
Import a file from the local file system into the workspace. |
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.
This description is outdated isn't it?
try { | ||
openSession(); | ||
Display.getDefault().asyncExec(() -> populateTreeWithIteration(tree)); | ||
} 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 it would be better to not catch the generic Exception but rather specific ones that can happen at this location?
You can check the Anti-Pattern Chapter at this page for more information:
https://www.baeldung.com/java-exceptions
*/ | ||
private void populateTreeWithIteration(Tree tree) { | ||
var siteDirectory = session.getAssembler().retrieveSiteDirectory(); | ||
var engineeringModelIid = siteDirectory.getModel().get(0).getEngineeringModelIid(); |
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.
What happens if there are more than one model in COMET ? :)
private void populateTreeWithIteration(Tree tree) { | ||
var siteDirectory = session.getAssembler().retrieveSiteDirectory(); | ||
var engineeringModelIid = siteDirectory.getModel().get(0).getEngineeringModelIid(); | ||
var iterationIid = siteDirectory.getModel().get(0).getIterationSetup().get(0).getIterationIid(); |
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 we do actually have multiple iterations in our COMET example...
var siteDirectory = session.getAssembler().retrieveSiteDirectory(); | ||
var engineeringModelIid = siteDirectory.getModel().get(0).getEngineeringModelIid(); | ||
var iterationIid = siteDirectory.getModel().get(0).getIterationSetup().get(0).getIterationIid(); | ||
var domainOfExpertiseIid = siteDirectory.getModel().get(0).getActiveDomain().get(0).getIid(); |
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 we use the first DomainOfExperties here? The domains are System, Power, AOCS and so on, aren't they? What happens if we want to access data of another domain?
|
||
if (openIteration.isPresent()) { | ||
openIteration.get().getElement().stream() | ||
.filter(element -> "Space Segment".equals(element.getName())) |
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 are we focused on the "Space Segement" here? What happens if there is now Space Segement in the COMET model? Maybe filter for the element that has TopLevelElement=true? (In our example that should be the CEFO Mission)
/** | ||
* Recursively adds child elements of a parent ElementDefinition to a TreeItem. | ||
*/ | ||
private void addChildren(TreeItem parentItem, ElementDefinition parentElement) { |
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 we create a option in the wizard for what kind of data we want to import? For CEF interessting values are probably mass, power and temperature?
import cdp4dal.SessionImpl; | ||
import cdp4dal.dal.Credentials; | ||
import cdp4servicesdal.CdpServicesDal; | ||
import org.eclipse.swt.SWT; |
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 it makes sense to separate data fetching and UI? So that we do not have UI classes (SWT) in this one? Then we could move this class to the non-ui part of the plugin and test it? :)
Probably we could do that by replacing the SWT tree class with some UI independent class? Such as either a EMF object / Maybe directly a VirSat model class? Or maybe a plain java object that just accepts children objects? What do you think?
The error handling would then work with Exceptions: If there is an error (Login wrong, no Iteration or whatever) you throw a corresponding exception and catch this exception in the Wizard... Then e.g. showing a warning...
|
||
Button fetchButton = new Button(container, SWT.PUSH); | ||
fetchButton.setText("Fetch Data"); | ||
fetchButton.addSelectionListener(new SelectionAdapter() { |
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.
Could you maybe handle the add event in a dedicated function? There you could then use an eclipse job with progress monitor... So that users get feedback that something is being done in the background?
Maybe take some inspiration from here: https://github.com/virtualsatellite/VirtualSatellite4-Core/blob/21c05a97ab73c79bf96aad96807fca7ebbbe0239/de.dlr.sc.virsat.model.extension.mechanical.ui/src/de/dlr/sc/virsat/model/extension/mechanical/ui/wizards/CadImportWizard.java#L87
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:
![Screenshot 2024-08-16 143456](https://private-user-images.githubusercontent.com/85398210/358592818-234e5469-e786-45c9-a66f-d3637a1d96b7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNTU1ODgsIm5iZiI6MTcyNDA1NTI4OCwicGF0aCI6Ii84NTM5ODIxMC8zNTg1OTI4MTgtMjM0ZTU0NjktZTc4Ni00NWM5LWE2NmYtZDM2MzdhMWQ5NmI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA4MTQ0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlMjBmNWI5OTYxMTNiMGM3OTllOTYwY2U5MjA3NzRjMDZkZjYxMGZmZTFlMDQxMzIzZDgyYWQ3YjU2NzFlY2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Zy0-mLSanmcVJqSe-O-8NcgCo65Q1ZzxLEUZyCIvGV4)
![Screenshot 2024-08-16 143316](https://private-user-images.githubusercontent.com/85398210/358592824-119eba3b-e8a1-4938-b72d-f69749560862.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNTU1ODgsIm5iZiI6MTcyNDA1NTI4OCwicGF0aCI6Ii84NTM5ODIxMC8zNTg1OTI4MjQtMTE5ZWJhM2ItZThhMS00OTM4LWI3MmQtZjY5NzQ5NTYwODYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA4MTQ0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4NGNlYWJkNzJiMGM2Mzk1Yzg3YjhmNjkzMTI0Y2E0NjQwZWFmMzE0NDE0NDBlYzU2NDNmNWYwOThhZjkxOGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CyC4sj97RX9UgmobzkWTupv2SkuxUEGrfJbNUCtCpyQ)
![Screenshot 2024-08-16 143248](https://private-user-images.githubusercontent.com/85398210/358592825-72aebb62-8519-4eff-a1e7-afefaf540f30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNTU1ODgsIm5iZiI6MTcyNDA1NTI4OCwicGF0aCI6Ii84NTM5ODIxMC8zNTg1OTI4MjUtNzJhZWJiNjItODUxOS00ZWZmLWExZTctYWZlZmFmNTQwZjMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA4MTQ0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiNjMyODUxYjY1ZWM3NzdmN2NmMWQ2MDg5NjNlZTI0ZjNiMWQ0NTQyZDBjNzJmOGE5ZTAzNmE5OWEzMzAwNzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TEKZN6ZQThJZuAba1rnH5eqwiZbi47MS394HtPEsZFI)
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.