In this section you will create your first entity using AndroMDA. We will create an entity called Timecard that will represent a timecard in the application. We will associate it with the User object, which will be the person that submitted the timecard. Our finished entity diagram will look like this:
Note that we have marked the Timecard class with a stereotype of Entity. This tells AndroMDA that Timecard is an Entity as opposed to other type of model elements such as Enumeration or EmbeddedValue. Stereotypes determine what pattern of code AndroMDA will generate for a model element. More specifically, they determine which AndroMDA code generation templates will be triggered.
Also nte that we have marked the attributes to be of type Date andString. These are not .NET types, but rather in model driven architecture the model is kept independent of technology and hence all model elements are defined in terms of platform independent types. So Date and String in this context are platform independent types. When we run AndroMDA to generate code, it will translate platform independent types into platform dependent types such as System.String and System.DateTime . If we were to use the same model to generate a Java application, AndroMDA will translate String intojava.lang.String, which is the Java equivalent ofSystem.String. As you can see, a key advantage of the model driven approach is that your investment in the business models is preserved even as technologies come and go.
Now lets add the Timecard entity to the model:
in the toolbar and make a new class on the diagram surface. Double click on the
class, name itTimecard, and add the
Entity
stereotype
to it.
and draw an association between the
Timecard
class and the
User
class.