Sparx Enterprise Architect: Show programming language in component diagram - uml

I am using Sparx Enterprise Architect and am somehow confused that I did not find any hint on the internet regarding the following question: How can I show the programming language of a component in the component diagram?
It is clear to me that I could use custom stereotypes but this is not a good idea as it prevents me from using "real" stereotypes later on.

The reason is simply that you can not show it using EA's GUI. You would need to stereotype the element and come up with a shape script to display the language with a
print("#language#");
somewhere.
To assign a shape script to a stereotype there are two ways, the quick and dirty and the difficult one. Here's the q&d one:
Under Configure/UML Types you can add a new 'wild' stereotype. That is one with no profile. EA will show that as <none> when applied. Think of a fitting name and choose Edit with the shape script:
Here can enter the new shape script (since this depends very much here's a simple one):
shape main {
Rectangle(0, 0, 100, 100);
println("#name#");
println("#language#");
}
Save the edit and close the dialog. Once you assign the stereotype to an element it will render like this:
I know this is not pretty and you need to dig into shape scripts to make it useful, but that can't be avoided.
So the difficult, but better and preferred, way is to create your own profile containing the stereotype along with the shape script. The above would just be a way of testing it but finally you would need to create your profile and put it in a MDG. Since this is a quite complex task it won't go here into this answer (no, I'm not Fermat, but you need quite some effort to get that far).

There is no standardized way to show the programming language of a component in UML. There are several ways you can do it, for example:
Stereotype. This will not prevent you from adding other stereotypes in the future. Multiple stereotypes are shown comma separated: «stereotype1, stereotype2»
Generalization. You can define a component called 'JavaComponent' and let all Java components inherit from this base component.
Note. You can attach a note to the component specifying the language.

Related

Output UML element Enterprise Architect

In Enterprise Architect I'm trying to model my Business Process through the Eriksson-Penker Business Modelling Profile which looks like this:
Everything goes well except for the Output element on the bottom right.
For some reason it doesn't exist in the Toolbox:
How can I get this Output Element here? I'm searching and searching in different toolboxes but I can't find it. Some help would be much appreciated!
This is a simple Object. Choose Other/UML/Object/Object from the toolbox and name it Output. It will appear underlined as in your diagram.
P.S. I see that the EP toolbox has an Object already. Use that in you're done.
Just found out that if you choose 'New Model from Pattern' in the project browser, browse to 'Business' and then select the Eriksson-Penker Diagram that it makes the entire diagram for you and you only have to change the descriptions. So case closed!

visio 2010 UML Change shape from Class to Interface

*edit: I understand that stackoverflow has banned all questions regarding using Microsoft's Visio. I'm a bit surprised by that, but if someone would bend the rules and help me out I'd greatly appreciate it.
I already tried looking at microsoft's website and other forums on the internet and I'm not finding what I'm looking for. Perhaps there is someone here who knows about Visio 2010.
I dragged and dropped a static structure shape for a UML Class onto my drawing area, and I filled out all the data in it. I then realized that I needed to change it from a class to interface shape. I thought I could simply right click and change this, but no. I tried going to drawing options, but all that does is change it for the future so that it will automatically create an interface shape when I drag and drop.
Isn't there any way to take data from these shapes so I can reuse it again without having to retype it all over in the data fields?
I tried creating a shape data set like msdn blog talks about. I chose to "create from an existing set"---thinking that this means creating from my already existing data from my class shape. Unfortunately this wasn't this case, and it ended up being completely empty....for some reason.
I would think it would be silly that someone would have to manually recreate all the class info all over again, simply because they wanted to change the shape of a UML static structure.
You are not changing the shape, you are changing the meaning of the model entity - their meaning is different therefore the shape cannot be changed.
If you are only using your diagram for display purposes, you can add a new <<interface>> stereotype that can be applied to classes, and apply this stereotype to the classes you want to refactor. Otherwise, sadly, you'll have to write it all again.
You can try the following (worked for me):
Create a new interface and name it whatever you like
In the Model Explorer drag and drop all methods, etc. from your class to your interface.
Drag the interface you just created from the Model Explorer to the actual document (You'll get the interface in a lollipop representation)
Add the interface to your class (the line end of the lollipop has to be attached to class)
By doing this you can quickly create an interface and move the methods from the class to the interface. Also, when the lollipop interface is attached to the class, all methods are added to the class, too.

Generate Tomcat web.xml configuration from UML digram

I would like to find the best way to parse an UML Diagram that detail the security tomcat configuration for a web application, then generate the concerned file (web.xml).
For the beginning, I have a Metamodel and his instance created with Magic Draw, I have to export them and use them in a kind of java application (plugin? API?) then parse and validate them against some constraint (OCL?) finally I have to generate the Web.xml file.
So, I made some research and I found that I can use EMF to catch my models, but its not so clear and handily to create a peace of java code that can handle my model remotely from an URI then validate em.
Do you have any suggestions/advises to made this please? Do I must use EMF? or there is another framework?
Thanks
web.xml from UML? Sorry, I don't think it's a useful idea. It doesn't take long to hand edit such a thing. The effort it would take to automate such a thing wouldn't be worth it. I'd open up a text editor, create the web.xml, and spend the time you save doing more useful things.
But, if you must, I'd find a way to export your object model into an XML document. I'd parse that into a DOM tree, walk the tree, and emit the elements I needed into a web.xml.
I know that Magic Draw has the capability to export UML as XML. See if that helps you.
But there's no way to do it directly from the Magic Draw tool that I know of. You'll have to write this Java post-process and run it on the command line using the exported model XML as input.

Specifying attribute types in Papyrus

I recently installed Papyrus and attempted to follow the tutorial for creating a model and generating Java code off it.
Unfortunately, I'm pretty much stuck right at the beginning. In the class definition, I added a static operation for main, and I'm able to specify its argument as an array:
in args: <Undefined> [*]
Unfortunately, it does not allow me to specify the type to be String. That is, I would like to specify it as follows:
in args: String [*]
No matter how I enter the type (or any type for that matter), the type reverts back to <Undefined>. I suspect something is wrong or missing with a profile it is supposed to use. Unfortunately, the documentation for this tool is rather sparse, and I cannot find an answer or solution to this.
Anyone has run into this same problem as well???
Have you imported the UML Primitive types package? This should allow you to define the type of the argument to Integer, String or Boolean.
In the model explorer, right click on your model, then choose 'Import package from registered library'
In the window that pops up pick 'UMLPrimitiveTypes' (or the Java ones, if you prefer that).
After this, it should work.
In the latest version of Papyrus, you have to go to model explorer, right click on your model and then choose Import. After that select "Import Registered Package." That will bring up a dialog with a list of registered packages. From that you can select either "UMLPrimitiveTypes" or "JavaPrimitiveTypes"
Papyrus consider that modeling is independent of languages and therefore no java type are usually possible. This is fully logical in a MDA approach but not in the real life :-)
There is an accelero plugin which is supposed to generate code from a diagram but it doesn't work with the latest Helios build so.....
The best is to do you class diagram and then manually code the related code. I am sure that your code will be better than the one you could get from accelero :-)
It's very simple, you can do it by just clicking on the attribute properties, then select type option, In the menu bar select Tree, then Primitive Types.
The String class is not able to see in java primitive types, you need import a package from java core library.
There is a java profile and library/package in Papyrus Software Designer extention.
You may install it via the market place.
More details: https://wiki.eclipse.org/Java_Code_Generation

How to use a class defined in another .uml file using Papyrus UML?

I'm Using Papyrus UML and I have to use in my diagram, a class which is defined in another .uml file. HowI can do it?
Thank you
You need to create a shortcut but for me this is not usable because I prefer to mix usecase and class diagram elements inside the same model and sometimes even the same diagram.
You can do it with RSA IBM or Omondo EclipseUML.
I do not know particularly about Papyrus, but in UML in general, you should have a Model-element at the top-level, and in there, you create a PackageImport. Now you should be able to set the ``Imported Package'' reference---but the other UML must be loaded from the workspace first:
This is where things become interesting! in the plain Eclipse UML editor, you have to load the resource first using the 'UML Editor' menu or the ``Additional Resources'' sub-tree in the model-outline. I guess Papyrus offers at least the same way through the outline.

Resources