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
XMI work #1298
base: master
Are you sure you want to change the base?
XMI work #1298
Conversation
I forgot to mention Issue #1294 in the commit message. |
First this adds a stack-based helper class to clean up XML building called net.sourceforge.plantuml.xml.XmlStackBuilderThingy. net.sourceforge.plantuml.xmi.XmiClassDiagramAbstract now uses this in the ctor to build XMI head.
… an unclosed node This may not be necessary since I don't think there are any constraints to when you add a child to it's parent or parent-to-be, but it keeps with the motif of shoving things into a stack and not popping elements until we're done adding everything into it. But this motif also adds the complexity of needing to read it's return value and pop the number of elements off when done.
This commit still needs clean up. We're walking the model hierarchically and adding elements. Probably doesn't fix associations yet.
The code is more stable now, so I think you should move to very last version, and check if it is working. |
@arnaudroques Thank you! I've rebased back to it and it's working! I just need to fix up associations and I'll push and start getting ready to do this seriously. And OMG, the new core layout makes this SO much easier! Now you already have the objects arranged according to their namespace hierarchy. My only other comment would be to try to eventually separate the model code from the presentation code. Thank you! |
Two comments:
|
Hello @arnaudroques !
Well I don't care in the end. It's just an attempt to clean up repetitive code. But now that I've worked with this a bit more, I think I can make it prettier and cleaner than the current thingy (less verbose source code, essentially the same performance).
Well, it didn't work so well for me in Issue #1294 :( I've got support a class that extends another class and implements an interface apparently working! But in order to determine what type of link I'm working with I made final LinkStyle.Type linkStyleType = link.getType().getStyle().getType();
final boolean isExtends = link.getType().getDecor2() == LinkDecor.EXTENDS;
final boolean isRealization = isExtends && linkStyleType == LinkStyle.Type.DASHED;
I would love to just ask if this link is a this or that, but I presume that when I declare a class I shall push shortly! EDIT: Oh, it's only going to correctly support extends and implements for what I'm pushing. I'll need to work out how to properly render all link types. |
Hello. I finally have something I can work with to get my very large Go project modeled! I'll have some more time to go over better ways to do things tomorrow. I see you have a hot log of changes on the grill! |
I think the best option is to add expected results here: https://github.com/plantuml/plantuml/tree/master/test/nonreg/xmi/clazz |
seem to have problems related to namespace expected: <?xml version="1.0" encoding="UTF-8"?><XMI xmlns:UML="href://org.omg/UML/1.3" xmi.version="1.1">
<XMI.header>
<XMI.metamodel xmi.name="UML" xmi.version="1.3"/>
</XMI.header>
<XMI.content>
<UML:Model name="PlantUML" xmi.id="model1">
<UML:Namespace.ownedElement>
<UML:Class name="foo" namespace="model1" visibility="private" xmi.id="cl0002">
<UML:Classifier.feature>
<UML:Attribute name="field1 : type" visibility="protected" xmi.id="att3"/>
</UML:Classifier.feature>
</UML:Class>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
</XMI> actual: <?xml version="1.0" encoding="UTF-8"?><XMI xmlns:UML="org.omg.xmi.namespace.UML" xmi.version="1.2">
<XMI.header>
<XMI.documentation>
<XMI.exporter>PlantUML</XMI.exporter>
<XMI.exporterVersion>PlantUML 1.2022</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name="UML" xmi.version="1.4"/>
</XMI.header>
<XMI.content>
<UML:Model name="PlantUML" xmi.id="model1">
<UML:Namespace.ownedElement>
<UML:Class name="foo" visibility="private" xmi.id="cl0002">
<UML:Classifier.feature>
<UML:Attribute name="field1 : type" visibility="protected" xmi.id="att3"/>
</UML:Classifier.feature>
</UML:Class>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
</XMI> |
Hello! This is based off of v2023.1 but isn't ready. It turned out that the problem I was having was because I can't figure out how to properly run the thing under jdb (to do whatever the manifest is supposed to do) and when I build the jar file, it tries to use a graphical generator and blows up on the file type.
Obviously, this is far from ready, but I haven't yet figured out what's causing it to try to use an image builder and then blow up instead of using net.sourceforge.plantuml.xmi classes.
Once I get it working I'll rebase back onto master and use the new code classes.