MetaBoss
User Guides
Synopsis
Beginner's Guide
Configuration Guide
Design Studio Guide
Programming Model Guide
Testing Framework Guide
'How To ...' Guides
References
Synopsis
Design Model Reference
Design Model UML Profile
Test Schema Reference
MetaBoss design library
Run-time libraries API
Dev-time libraries API
HatMaker Example
Synopsis
Enterprise Model Description
Enterprise Model Reference
SystemTest Example
WebServices Example
Miscellaneous
About MetaBoss
Quality Assurance
Compatibility Notes
Acknowledgments
Glossary
Change Log
Version 1.4.0001
Built on 15 Dec 2005 22:31:47

MetaBoss Beginner's Guide

Using MetaBoss Design Studio to model the system

Before we begin

There are few things about MetaBoss Design Studio which are worth mentioning before we begin modelling with it. MetaBoss Design Studio is a specialised tool tailored for modelling business systems consisting of databases, business logic tier, web services etc. Because Design Studio is tailor made (in fact this is the rationale for having it in the first place) it offers much higher productivity than the generic modelling tools. However, the drawback is that you can not use Studio to model other things like frameworks or algorithms.

The most important productivity booster is the Modelling Assistant feature. The Modelling Assistant allows designer to concentrate on really important parts of the model by always watching over designer's shoulder and helping with routine and predictable tasks:

  • As we enter our model into the Design Studio, the Modelling Assistant constantly validates the model against the large number of the model constraints (note that this behaviour is controlled by the 'automatically validate model' checkbox in Tools->Options dialog and you have to make sure it is on). If it discovers the constraint violation error, it shows it in the 'Errors' tab located in the bottom right part of the Design Studio screen. Simple rule to remember is that you will not be able to generate anything from the model while it has constraint violation errors in it. MetaBoss generators will simply refuse to work.

  • The Modelling Assistant can also try to fix constraint violation errors for us. So, once you see the errors - do not panic - there is a good chance that the Modelling Assistant will be able to help. Just press Attempt to Rectify Model Command Button "Attempt to Rectify Model" button at the main toolbar and see what happens. The errors, which the Modelling Assistant was able to fix, will simply disappear. The ones which it was unable to fix will stay (note that this situation should not occur in course of this example). This is the situation where you'll have to read the error message and try to understand what it means, or alternatively post the question to MetaBoss forum.

  • In order to minimise the number of constraint validation errors in the first place, the Modelling Assistant is also trying to stay one step ahead and 'autocomplete' designer's moves. For example as designer creates the new kind of entity, say Student, the new Error Message 'StudentNotFound' is automatically added to the model. This preempts the 'Entity must have matching NotFound error messaage' constraint violation error ever occurring. This feature is quite advanced and at the time of writing of this guide it does not cater for all preventable constraint violations. It is not a big problem though - all it means that the constraint validation error will be shown to you and you will have to use "Attempt to Rectify Model" command to fix it.

As we move along our modelling exercise you'll see good examples of how Modelling Assistant works. Let's begin.

Step by step guide

  1. Create the directory where all our work will be located. We use ${metaboss_home}/examples/AlmaMater, where the expression '${metaboss_home}' is a placeholder for the path to the MetaBoss installation directory (eg. c:/MetaBoss_1.0)

  2. Open the MetaBoss Design Studio by running the runstudio.bat or runstudio.sh from your ${metaboss_home}/bin directory. Note that if you wish for diagrams created by you to look similar to the ones shown in this guide - you must ensure that the options "show edges captions", "show edges cardinality" and "show edges ends names" are turned on. These and other diagram presentation options are located on the "Diagram" tab of the "Options" dialog box, which you can reach via "Tools->Options" menu item.

  3. From the Design Studio main menu, select "File->New Enterprise Model" menu item and choose ${metaboss_home}/examples/AlmaMater/Model/DesignStudio as your new model directory. Note that you can create subdirectories from within model creation dialog or outside the Design Studio using for example File Explorer.

  4. On the Enterprise properties page enter "AlmaMater" as the enterprise name and "My favorite University" as the description. At this stage your screen should look something like this:

    MetaBoss Design Studio image after University is created.

  5. Select the Systems folder in the model tree at the left hand side and click the right mouse button. Add new system either using "Add New System" menu option or by opening Enterprise Systems Diagram and creating the system visually (We have done this visually via diagram). The name of our system is CRS and the description is "The Course Registration System".

  6. Select the CRS System folder in the model tree at the left hand side and click the right mouse button. Add new service module using "Add New Servicemodule" menu option. The name of our Servicemodule is "Reporting" and the description "The servicemodule provides the services used in building reports based on course registration information".

  7. Select the CRS System folder in the model tree at the left hand side and click the right mouse button. Add new domain using "Add New Domain" menu option. The name of our domain is "Courses" and the description "The course registration information domain". After this is done, your screen should look something like this:

    MetaBoss Design Studio image after Servicemodule and Domain are created.

    Lets have a look at what Modelling Assistant has done. The 'CourseDomainSupport' Servicemodule and 'DataManagement' Service have been created automatically as soon we have created the Domain (Look at the tree path Systems->CRS->Public Interfaces->Service Modules). The 'DataManagement' Service is used for administering data in this domain via simple Create, Read, Update and Delete operations.

  8. We will now create Entities. Select the Courses domain node in the model tree at the left hand side and click the right mouse button. Open the domain class diagram using "Open Domain Class Diagram" menu option. The diagram tool buttons are located at the bottom left corner of the diagram area. Use the New Entity Command Button "New Entity" tool to create following three entities:

    Entity nameEntity plural nameEntity description
    StudentStudentsThe person enrolled in the university to learn things
    CourseCoursesThe regime of study in the university
    TeacherTeachersThe person employed by the university to teach things

    At this stage your screen should look something like this:

    MetaBoss Design Studio image after Entities are created.

    Lets have a look at what Modelling Assistant has done. A number of Data Types have been created in the System Data Dictionary (The tree path is Systems->CRS->Public Interfaces->Data Dictionary->Namespaces->System->Namespaces->Course). These data types are used in special entity attributes. The xxxxxxInstanceId data types (eg. StudentInstanceId or TeacherInstanceId) are created for each and every entity. They represent the unique entity instance identifier - the automatically generated primary key. The xxxxxxVersionId data types (eg. StudentVersionId or TeacherVersionId) are created for editable entities (all entities in this example are editable) They identify the version of the data stored in the entity and used to guard against loss of data due to the concurrent updates.

    A number of Structures have been created in the CourseDomainSupport Servicemodule (The tree path is Systems->CRS->Public Interfaces->Service Modules->CourseDomainSupport->Structures). These structures used to carry entity information in inputs to and outputs from operations. The xxxxxxKey structures (eg. CourseKey or StudentKey) are used to carry the entity identifier information, that is all attributes which can be used to unambiguously identify entity instance. This always includes the autogenerated instance identifier attribute and may in addition include all attributes which are part of the 'natural' primary key, if of course the entity has one.' The xxxxxxDetails structures (eg. CourseDetails or StudentDetails) are used to carry the whole entity information, that is all attributes comprising the entity.

    A number of Messages have been created in the CourseDomainSupport Servicemodule (The tree path is Systems->CRS->Public Interfaces->Service Modules->CourseDomainSupport->Messages). These messages are used to indicate operation outcomes. The xxxxxxInstanceNotFoundError messages (eg. CourseInstanceNotFoundError or StudentInstanceNotFoundError) are returned from operations in case when required entity instance has not been found. The xxxxxxVersionMismatchError messages (eg. CourseVersionMismatchError or StudentVersionMismatchError) are returned from operations in case when update attempt has failed due to concurrent update issues.

    A number of Operations have been created in the DataManagement Servicemodule (The tree path is Systems->CRS->Public Interfaces->Service Modules->CourseDomainSupport->Services->DataManagement). These operations are used to perform simple Create, Read, Update and Delete actions on entities. The Structures and Messages described above are used in operation definitions.

  9. We will now define Associations between Entities. Still in the domain class diagram, use the New Aggregation Command Button "New Aggregation" tool to create following three associations:

    Association nameAssociation descriptionAssociation roles details
    CourseHasSupervisorCourse has the Teacher who is responsible for its administration
    Role A details:
    EntityCourse
    NameSupervisedCourse
    Plural NameSupervisedCourses
    Aggregation TypeAggregation
    CardinalityZeroToMany
    DescriptionZero or more Courses supervised by this Teacher
    Role B details:
    EntityTeacher
    NameSupervisor
    Plural NameSupervisors
    Aggregation TypeNone
    CardinalityOne
    DescriptionOne and only one Teacher responsible for this Course
    CourseHasLecturerCourse is taught by Teachers
    Role A details:
    EntityCourse
    NameLecturedCourse
    Plural NameLecturedCourses
    Aggregation TypeAggregation
    CardinalityZeroToMany
    DescriptionZero or more Courses lectured by this Teacher
    Role B details:
    EntityTeacher
    NameLecturer
    Plural NameLecturers
    Aggregation TypeNone
    CardinalityOneToMany
    DescriptionOne or more Teachers who are lecturing the Course
    StudentEnrollsIntoCourseStudents are enrolled in Courses
    Role A details:
    EntityStudent
    NameAttendee
    Plural NameAttendees
    Aggregation TypeAggregation
    CardinalityZeroToMany
    DescriptionStudents who are attending the Course
    Role B details:
    EntityCourse
    NameCourse
    Plural NameCourses
    Aggregation TypeNone
    CardinalityZeroToMany
    DescriptionCourses which the Student is enrolled into

    While creating above associations, the Modelling Assistant will probably report some constraint violation errors (Look at the Errors tab at the bottom right part of the Design Studion screen). This is because some more complex constraints are not yet catered for by Assistant's autocompletion feature (This is true as of MetaBoss release 1.0.0007). To fix these errors just press "Attempt to Rectify Model" tool bar button. All of the constraint errors should go away after that. At this stage your screen should look something like this:

    MetaBoss Design Studio image after Associations are created.

    Lets have a quick look at what Modelling Assistant has done. The CourseDetails Structure (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupport->Structures) now has SupervisorInstanceId field. This is because the CourseHasSupervisor Association defines that Course may have exactly one Supervisor. 'One' cardinality is a singular cardinality (the only other singular cardinality is 'Zero or One'). Entity details structures always contain identifiers of the associated entities for singular references (the reason is to save on extra service calls when retrieving entity details information).

    The new SupervisorForCourseCanNotBeEmpty message has been added (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupport->Messages). This message can be returned from the createCourse and updateCourse operations in case caller has not specified valid Supervisor Identifier. This is because the CourseHasSupervisor Association defines that Course may have exactly one Supervisor. 'One' cardinality is a mandatory cardinality which makes it illegal to specify the empty association, hence the error message.

  10. We will now create a couple of specialised primitive DataTypes which we need in addition to the ones already provided in the Design Library. Select the Data Dictionary folder under the Design Library (not the one under the CRS System) in the model tree at the left hand side and click the right mouse button. Use "Add New DataType" menu option to create following Data Types:

    DataType nameTypetemplate NameDataType description
    StudentNumberIntegerNumberFieldThe unique id number issued to each student
    PersonNameStringFieldThe first name or family name of the the human being
    CourseCodeStringFieldThe abbreviated name of the course

    For simplicity sake we will leave data types definition right here and will not define any data validation properties. It is worth remembering though that it is possible to define various validation rules such as min length, max length, valid character pattern etc.

  11. We will now go back to our Entities and define their Attributes. There are few ways to add attributes to the Entity. We suggest to select the entity node in the model tree at the left hand side and use the "Add New Atribute" right mouse button menu. Add following attributes:

    Entity NameAttribute
    NameStereotypeDataTypeUsed for orderingDescription
    StudentStudentNoMandatoryStudentNumberNoThe number uniquely identifying the student
    FirstNameMandatoryPersonNameNoStudent's first name
    SecondNameOptionalPersonNameNoStudent's middle name
    FamilyNameMandatoryPersonNameYesStudent's family name
    DateOfBirthOptionalDateFieldYesStudent's date of birth
    CourseCodeMandatoryCourseCodeYesThe code uniquely identifying the course
    NameMandatoryStringFieldYesThe name of the course
    TeacherFirstNameMandatoryPersonNameNoTeacher's first name
    SecondNameOptionalPersonNameNoTeacher's middle name
    FamilyNameMandatoryPersonNameYesTeacher's family name

    The next thing to do is to define natural primary keys for some entities. This is done in the 'Primary Key' tab of the Entity Properties dialog (You can get to this dialog by doubleclicking on the particular entity node in the model tree on the left hand side). Select Code attribute as the natural primary key for the Course entity and the StudentNo attribute as the natural primary key for the Student entity. At this stage your screen should look something like this (note the newly created entity attributes in the tree):

    MetaBoss Design Studio image after Attributes are created.

    Let's have a quick look at what Modelling Assistant has done. The CourseDetails, StudentDetails and TeacherDetails Structures (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupport->Structures) now have fields corresponding to entity attributes we have just created. Entity details structures always contain all attributes from the associated entities.

    The CourseKey and StudentKey Structures (the tree path is Systems->CRS->Public Interfaces->Service Modules->Structures) now have fields corresponding to the primary key attributes we have just nominated. Entity key structures always contain all attributes which can be used to uniquely identify the entity instance. It allows to have alternatives when identifying the instance. Look for example at getStudent operation (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupport->Services->DataManagement->Operations). Caller has a choice to specify either StudentInstanceId - automatically generated instance identifier present in every entity, or StudentNo - the real life unique student number which we have nominated as a natural primary key.

    New error messages CourseCreationDuplicateKeyError and StudentCreationDuplicateKeyError have been created (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupport->Messages). This is because the creation of entities which have the natural primary key could potentially fail because the entity with the same key value already exist (The xxxxxxInstanceId identifier is automatically generated and can never clash with the existing one). The fact that this error can occur have also been reflected in createCourse and the createStudent operations (the tree path is Systems->CRS->Public Interfaces->Service Modules->CoursesDomainSupportServices->DataManagement->Operations) - they now declare that they can return DuplicateKeyError.

  12. We will now go back to our Reporting Servicemodule and create some Services and Operations. We only really missing a few operations since all simple Data Maintenance operations were defined for us by Modelling Assistant. The ones we are missing are some fancy queries like 'Select all Teachers who are not involved with any Course' or 'Select all Teachers and Students who might fe familiar with the particular Student'.

    Usually Operation definition refers to DataTypes, Structures and Messages. These elements are used to define inputs to and outputs from the Operation and therefore they must exist prior to defining Operation itself. Operations we are about to define are no exception. However, the Modelling Assistant have already defined lots of DataTypes, Structures and Messages that we will reuse.

    Select 'Reporting' Servicemodule (the tree path is Systems->CRS->Public Interfaces->Service Modules->Reporting) and use the "Add New Service" right mouse button menu to add the 'MiscellaneousQueries' Service with description 'Various custom made queries'.

    Select 'MiscellaneousQueries' Service we have just created and use the "Add New Operation" right mouse button menu to add following operations (note that you will have to enter data on a number of tabs in the Operation details dialog box):

    Operation NameOperation Details
    findFreeTeachers
    Transaction PolicySupported
    DescriptionFind Teachers who are not assigned to any Course.
    Is QueryYes
    Input Fields None
    Output Fields
    NameFreeTeachers
    DataType(none)
    StructureTypeTeacherDetails
    IsArrayYes
    DescriptionDetails of Teachers who are not associated with any Course
    Output Messages None
    findStudentAcquaintances
    Transaction PolicySupported
    DescriptionFind all Students and Teachers who are familiar with the given Student.
    Is QueryYes
    Input Fields
    NameStudent
    DataType(none)
    StructureTypeStudentKey
    IsArrayNo
    DescriptionIdentifier of the Student to find acquaintances for
    Output Fields
    NameTeachers
    DataType(none)
    StructureTypeTeacherDetails
    IsArrayYes
    DescriptionDetails of Teachers who are familiar with the given Student
    NameStudents
    DataType(none)
    StructureTypeStudentDetails
    IsArrayYes
    DescriptionDetails of Students who are familiar with the given Student
    Output Messages
    NameStudentNotFoundError
    MessageTypeStudentInstanceNotFoundError
    IsArrayNo
    DescriptionContains error message in case if specified Student does not exist.

    At this stage your screen should look something like this (note the newly created operations in the tree):

    MetaBoss Design Studio image after custom Operations are created.

Congratulations ! We have completed the design of our system and are ready to do a system build. Of course you should save the resulting model when prompted during closing down of the Design Studio