IBM RSA: Code Generation out of which diagram types? - code-generation

Can only Class Diagrams be transformed?
Or can other diagram types be put to good use, too?
For a university project we are forced to put the Rational Software Architect to good use.
I was not able to find reliable information on that topic by myself for hours, that is why I am asking here for help.

Code generation is only from class diagram.
If you export your model to xmi serialization then after a long and painful job you could be able to generate code but this code generation is not integrated in the tool.

Out of the box RSA generates code for Classes and Associations etc., if you have a version/cartridge supporting that.
But RSA uses the org.eclipse.uml model, which is EMF based. This means you can use any generator like XPand or JET to generate custom code for any UML model element.

Related

UML / API : How to model a RESTful API

I need to create a UML class diagram and a use case diagram for a RESTFul API that I developed using API Platform and Symfony 3.2 (backend) and Ionic 2 (frontend).
But i dont exactly know how to describe the structure of my backend API through the class diagram.
If anyone has any idea or could be of any help, i'd truly appreciate it. Thank you!
So the solution to my problem was a bit of all of the following :
https://www.ibm.com/developerworks/rational/library/design-implement-restful-web-services/ :
I concluded from this that, although it's difficult to model a restful api in a class diagram (since it's basically just a bunch of methods), consider the classes like "Resources", add the methods (basically the HTTP methods), and the paths to each resource.
This was also of huge help:
https://firstinfinity.wordpress.com/modeling_rest_web_services/
Another (simpler) way was to use tools like Pikturr, which transform your Swagger into a UML diagram.
Softwares for designing REST APIs :
Visual Paradigm
IBM Rational Software Architect
I hope this helps.
Api Platform automatically generates a Swagger documentation for your API at the URL http://localhost/docs.json.
You can generate an UML diagram from the Swagger documentation using tools like https://github.com/nrekretep/pikturr
It is too late, but this is another approach.
If you do not know about Visual Paradigm you can give it a try.
You can use this content, Visual Paradigm - How to Design REST API with UML?. It is easy, to represent your REST API. I prefer Postman Collections BTW (it is not UML).
But if you are doing some other kinds UML artifacts for documentation purposes. Well, Visual Paradigm gives you a bunch of UML diagrams to do that. So you keep that ecosystem of diagrams.
See ya.
The real answer for the question is to use an UML Component Diagram, since its very purpose is to model architectures based on services. Check this link for more info: https://diagramasuml.com/componentes/

Code Generation for Deployment Diagrams

I know that there are tools which can be used to generate code for Class Diagrams and Statechart Diagrams but I wanted to know whether there is any tool that can be used to generate code for deployment diagrams as well.
No, there is no such tool. And the obvious reason is that a deployment diagram does not describe code, it describes a deployment structure, servers, components etc. Even though usually there are some scripts relevant with any deployment, several other actions are required as well when you deploy something (setting up servers, copying resources etc).
On the other hand, class diagrams and sequence diagrams describe structure and interactions of code artifacts. A class diagram describes class definitions. A sequence diagram describes a method of a class. This is why you can find tools that generate code from those types of diagrams.
There are also tools that generate code from state diagrams, but this is not a generic functionality. You can't generate code from any state diagram, because the elements of a state diagram do not correspond to specific code artifacts by definition. Only if a state diagram is defined in a specific context and then you have tools for code generation specific to this context.
Example: You describe the flow of screens in a UI as a state diagram with each screen represented by a state, and you have a tool that can convert this type of diagram to some type of UI code as web forms or JFrames.

easy to use framework for using GWT MVP with minimal coding

I am looking for a framework/library that generates most/all of the generic MVP code itself, so that I can then extend that code. In default GWT-Eclipse IDE setup, I have to write every bit of code by hand.
I have seen a few frameworks like Tessell which aim at generating a large part of the boiler plate code...Which framework do you recommend for this purpose, so that I can create new MVP-GWT apps with minimal effort/fuss?
Take a look at Tessell:
Tessell is a GWT application framework
Follows a Model View Presenter architecture
Less boilerplate (10x less LOC than hand-coded MVP)
Features
View generation of the MVP/UiBinder interfaces/implementations that allow for fast, DOM-decoupled unit tests but that suck to code by hand
Rich models to make your application's presenter/business logic more declarative and have less spaghetti/inner class code
Dispatch-style server/client AJAX communication
Stubs for awesome, out-of-the-box tests
Conventions for forms, row tables, and cell tables
I know people who have used mvp4g on some large projects effectively.
I used gwtp in two projects and it worked really well.
It has the concept of nested presenters/views which might come handy if you want to create reusable MVP components.
The GPE (Google Plugin for Eclipse) and Google Window Builder together will generate most of what you need for MVP code using the GWT libraries. You go to New ->Window Builder->GWT UIBindder->MVP->MVP View. The Wizard will generate the uibinder code, a UI interface, a UI implementation, a place, and an activity. It will also use a client factory if you are using one. If you have a client.place and/or a client.activity package(s) it will also put the places and activities in those packages for you.

Generation of Entity Framework classes from a WSDL

Good morning,
I am taking over from someone who has been using the Entity Framework to communicate with a database. How this has appears to have been done is that there is a WSDL that describes all of the objects that we use created in Enterprise Architect. This is then imported as a Service Reference in Visual Studio.
I am a bit confused by this so was wondering if it is a sensible approach. The WSDL has a sample port, binding and service that appears to be not used at all in the code. Do these exist in order that the WSDL gets imported properly?
I looked on Google and couldn't see any examples of people creating from WSDLs in this way so wasn't sure it was a common approach.
So when this is done you have the representations of the data as classes. Then it seems you add them to a class inheriting from a DbContext which creates the tables in the database. Is this correct?
If you are using WSDL just to get data from EA to VS it is of course completely wrong. WSDL describes web service - port and binding are mandatory for service description.
EA Professional edition and above has direct support for code generation from the model. You just have to set which language you want to use (in Project browser select folder containing your classes and interfaces and set language in properties) and then you can use Tools > Source Code Engineering > Generate Package Source Code.

Dynamically Loading EMF Models

I have a backend system which i access via a REST based API and i am returned a resource. This is an EMF resource (an XMI representation). The problem is that i cannot, at design time, assume the metamodel for this resource - as the metamodel in the backend system can change without notice.
I am wondering if i can, first, read the metamodel (the .ecore file) from the backend, generate the code and then, read the models. This will, admittedly, be slower, but i will have to read the metamodel only once per session and this will not make me commit to a fixed metamodel. Will this work? Or is there a better way to achieve what i want?
Also, will this work for the UI? Can i generate the editor code at runtime (EMF.Edit), just before reading the model from the backend and display the model with the appropriate visualization?
Would Dynamic EMF help solve my problem?
Using EMF to generate code from models on the fly sounds hairy. Especially when you turn around and run it. But I guess it would work provided that you run it in a new Eclipse instance.
Dynamic EMF is a possible alternative. However applications that use the dynamic approach are more difficult to write and tend to require more debugging. (By using dynamic EMF you sacrifice a lot of static type safety.) And I'm not sure about the model editor issue.
Actually, I'm a little bit puzzled how you would use the generated Java classes for an in-memory model instance. If the metamodel is changing, then so are the signatures of the generated classes. How can you write code to work against an API that changes all the time? If you say "I generate it" consider that your generator has to use dynamic EMF.
If I were you, I'd ask on the EMF mailing lists. In my experience, if you ask sensible questions (i.e. that are not too vague and/or speculative) you'll get reasonable answers.