Follow sidelabs on Twitter

Documentation:User:GettingStarted:Data

From SIDE-Labs.org

Contents

Data Modeling and Generation

Usually, the first one to create is the content type model which describes the structure of the data which will be used by the application. For Alfresco-based application, data is composed of content types and their metadata including attributes and associations. Note that this structure may already exist and may be reversed in a model using SIDE reversing mechanisms. The following paragraphs gives for beginners a basic overview of data modeling and generation and for users more familiar a quick solution for the need at hand. For additional information, Refer to the SIDE Data user guide.

Model Creation

First create a new project: 'File / New / Project'SIDE / Side project'Click on Next'Set your Project name 'GTYaMma' / Click on Finish

Figure 1.1.  Creation of a full SIDE Project

10000000000002B0000001F319E22C68.jpg

Note that by clicking on finish your SIDE project will contain all seven directories of possible models: application, data, form, portal, requirement, view, workflow.


Figure 1.2.  Folders of the full SIDE Project

10000000000000BE00000159ABED3916.jpg

For a specialized project, if you need to create only two or three folders as 'Data Model' and 'Form Model' 'Set your Project name 'GTYaMma' / Click on Next'Then, choose the model you need / Tick it them

Figure 1.3.  Creation of a specialized SIDE Project

10000000000002B0000001F2C45AD1E4.jpg

Let's create a Data Model: 'Open your GTYaMma project'Open your 'src' folder'Open your 'models' folder'Right click on 'data' folder'File / New / Other...'Open 'SIDE' folder'Select 'Side Data Diagram''Click on Next

Figure 1.4.  Data Model Creation Pane

100000000000020D000002EAB43FB8A3.jpg

Enter the name of your model, for instanceDigitization, the type of diagram 'Data Diagram' is selected and click on Finish. Two files are created in your project:

  • 'Digitization.dt' is the data model containing all the designed data structure;
  • 'Digitization.dtdi' is synchronized with the data model and contains the designed data structure complemented with the graphical information necessary to position the data elements in the SIDE Data modeler.

The 'Digitization.dtdi' model is automatically opened in the SIDE data modeler. SIDE Modeler Layout

Package and diagram Creation

For all models, a good practice is to initially create the package structure in order to organize your design (like for Java program development), especially when you work in a team. For instance, we will design the data structure of the Digitization data model under the package configuration org/myCompany/YaMma (replace myCompany with the name of your company). First click on 'Model' and in the properties pane, set the Name 'Digitization'. 'Next, right click on 'Model Digitization''Select Create Child / Class Package'Click on Class Package'In the properties pane, set the Name 'org'Proceed the same way to create 'myCompany' and 'yamma' packages.


Figure 1.5.  Class Package Properties View

10000000000003CF000000A6EEC77E22.jpg

In order to put the data elements under the yamma package, right click on it in the outline view to open the contextual menu and select Add diagram / Data Diagram


Figure 1.6.  Data Diagram Creation

Click on the newly created diagram and change its name Digitization in the properties view. We are ready to design the data structure of our application in the 'Main' pane of the SIDE modeler.

Data structure design

Data Toolbar Modeling

The toolbar's modelers differ depending on the objects and the links require for their design. Here is the which one you need to model the data diagram.


Figure 1.7.  Objects Data Toolbar

1000000000000084000000B48E2470CF.jpg

Class (or Data): a class defines a category of instance of objects which shares exactly the same set of properties. In ECM applications, a class relates to a content type. SIDE Data model describes data structure for persistence through class and property. Aspect: an aspect allows to group attributes in order to isolate a specific characteristic of a data; an aspect may be associated to many different class or content type. Property (or Attribute): a class property describes a characteristic of the concerned class. For example, the property 'title' of the class 'book' gives the title of the book. Comment: the comments may be used to describe class. Enumeration: an enumeration represents a list of values which may be associated to a class property. For example, the list of languages associated to the property 'language' of a book. Enumeration literal: an enumeration contains an enumeration literal. It distinguishes by the nature of values which can be describe as instances of other enumeration's values. For example, if the enumeration is 'car brand', the enumeration literal values could be 'Nissan', 'Ford', 'Audi', 'Peugeot', 'Renault' ...


Figure 1.8.  Links Data Toolbar

1000000000000085000000980DB03521.jpg

Association: an association allows to link data sharing particular relationships. For example, an association may be created between a content type and a working contract content. Generalization: a generalization is a relationship between a specialized class and a more general class where objects of the more specialized class (the subtype) are automatically also instances of the more general type. Is commented: an IsCommented is a relationship between a comment and a class, to indicate what comment explains what class. hasAspect: an hasAspect is a relationship between an aspect and a class. Depends of: a Dependsof is a relationship prioritizing and defining an inheritance between two or more enumerations. For example, to indicate that a department is associated to a region.

Data Model design

Click on the 'Class' item in the objects list of the left panel. Then click in the white part at the right on the name of the newly created Data box. Set the name to 'Document' and double click on it:


Figure 1.9.  Data element creation

100000000000049E000001E002E4C79C.jpg

Set the Title to 'Document' and click OK. On the left part, click on Property in the Object list and then click on the data element 'Document': a property 'Attribute' is added. Double click on the property to open a dialog box and set the name and the title to 'name' and set the type to 'String'. Proceed the same way to create a String attribute 'Author' and a DateTime attribute 'digitizationDate'. Note: you can also use the Property view to update the data element properties.


Figure 1.10.  Properties of Data element creation

1000000000000305000002DDF280FE34.jpg

Click on 'Class' in the Object list and create three new data elements 'InboxMail' with a String and Date properties 'destinationService', 'otherDestination' and 'dateOfArrivalInService'. Click again on 'Class' in the Object list and create two new data elements 'OutboxMail' with a Date and String properties 'date' and 'sendingService'. Click on Association in the link list, then click on the 'InboxMail' element and finally click on the 'OutboxMail' element. Double click on the newly created association:

10000000000004D7000002F8C3A5831B.jpg

Figure 1.11.  Association of Data element creation

[[Image:|thumb|600px|center]]

Rename the association 'answer'. In the Association first end and association second end, conserve the same cardinality [0 *] to indicate that for one mail in the Inbox, there is only one in the Outbox. Next, remove the default R2 role and check 'isNavigable' if not already done to indicate that from a Inbox or Outbox mail, both can create or update the associated mail. Click on 'Generalization' in the link list, then click on the 'InboxMail' element and finally click on the 'Document' element. Do the same thing from 'OutboxMail' to 'Document'. For this model, 'Document' class is central, that's why other classes inherit from 'Document' class and his properties, which is resulting in terms of modeling by a link called 'Generalization'.

Activate/Deactivate SIDE Builder

Activate or deactivate the SIDE builder enables to control the dependency between different models. In case of creation, extinction, modification, transfer or another action, the builder traces information, control and indicate dependencies in the 'Problems' pane near the 'Properties' tab. 'Right click on your project 'GTYaMma''Go to SIDE / Click on Activate/Deactivate SIDE builderThe SIDE blue circle icon turns green. A .metadata folder is created. If a problems occurs, a red arrow appears in the Problems pane indicating the resource concerned by the error (for example the .form), the path where to find, and the type of the error, whether this is an SIDE, EMF error. The error occurs only when the models are recorded. This basic data model indicates that three new content types have been created: one to declare specific content type associated to a document, others to declare an Inbox and Outbox mails contents. We will now proceed to the generation of the data elements on a targeted framework like Alfresco.

Application

Creation

Prior to generate the data model, we must create an Application model which will store the description of our application and its components. Right click on 'models' in the Navigation pane and select: New / Other / SIDE / Side Application Model

Figure 1.12.  Application Model Creation

100000000000020D000002563F2615BB.jpg

Enter the File name 'Digitization.application' and click on Finish. The application model 'Digitization.application' is created in your project. Select this file and right click to open the contextual menu; select the menu item SIDE / Manage configurationto start the panel in which we will declare the steps of generation of your application:


Figure 1.13.  Application Models List Configuration

1000000000000319000002806D7F1871.jpg

The application generation configuration is divided in 4 main parts.

Configuration List

The List of configurations allows defining several generation configurations. The first time there is no configuration and you must click on the green circle (with the little white arrow inside) to create the first configuration labeled by default 'New Configuration'. Click on the item representing a white page (with a little pen), to change the name of the configuration: Enter 'Main' in the name of the configuration input view. You may create several configurations all along your project: for instance, after finalizing a functional layer of your application, it is no more necessary to generate and deploy it all the times with the models you are working on.

Configuration 'Models' tab

The 'Models' tab allows to declare the models you want to generate on the targeted frameworks.Click on 'Add Models' and select 'Digitization.dt' under 'myProject/src/models/data'. You can add as many models as you need for your application.

Configuration Generation tab

The 'Generation' tab allows selecting the generators you want to use on top of the models you declare in the 'Models' tab : the selected generators produce the artifacts on specific frameworks they are associated to.This pane proposes, in the upper part, common options to set up:

  • 'Log path' must be set up to indicate where to store the log of the generations; enter /GTYaMa/build/logs.
  • 'Generation path' must be set up to indicate where to store the result of the generations; enter /GTYaMa/build/generated.
  • Click on 'Skip validation' if you do not want to perform model validation before generation. Model validation is by default automatically performed to avoid generating on incorrect or inconsistent models. But, if you are sure that your models are valid (use 'Validate' to perform a direct validation), select this option.
  • Click on 'Documentation generation' if you want to generate the documentation associated to your models. This feature will generate an .odt file that you can find under

GTYaMma / build / logs / Main(name of your configuration) / doc / Digitization-dt.odt It proposes, in the lower part, a structured tree where each branch is conforming to the following schema:

  • The first level indicates the type of metamodel.Note that if you select a meta-model but you do not have declared under the models tab at least a model conform to this metamodel, obviously no generation will be performed.
  • The second level indicates the targeted technology: this is the kind of framework on which a part or all the application must be deployed. For instance, 'Alfresco' is a technology.
  • The third level indicates the version of the targeted technology.
  • The fourth level indicates the generator to use: it may exist several generators for a metamodel, a framework and a release.
  • The fifth level gives the generation options.

Click on the label of each level to have description in the upper right part of the window.


Figure 1.14.  Application Generation Configuration

10000000000003180000027E40DBD434.jpg

To select a particular generator to apply on your models, first click on the circle checkbox of the metamodel first level, then on the technology second level, then on the version third level and then on the generator. Click on: KSR500 Data / Alfresco / Alfresco 3.x Labs and Enterprise / SIDE Content Model Generator for AlfrescoThen select the options of the generator. Click on (if not automatically tick): Alfresco Share ExtensionSome parameters of the generator must be set up on the right lower table of the window. For instance, for the SIDE Alfresco Content Model Generator it is necessary to set up the Module Version if you want to keep an historic of the generated artifacts. Click on: Save [Enregistrer]to save the generation configuration.

Configuration Deployer tab

The 'Deployer' tab contains a single tree similar to the generation one but without the first metamodel level. The purpose of the deployer tree is to select installed framework instance to install generated artifacts on them. Let's suppose that you follow the SIDE Installation guide and that you installed Alfresco 3.2 Enterprise. In the deployment tree, you can select: Alfresco / Alfresco 3.x Labs and Enterprise / SIDE Content Model Generator for Alfrescoto indicate that you want to deploy the generated artifacts on this special instance of Alfresco: in this case, all the models which have been generated using generators on the technology 'Alfresco' and the release '3.x' will be deployed on this Alfresco instance through the SIDE Alfresco deployer. SIDE is now compatible with Alfresco 3.2 r2.


Figure 1.15.  Application Deployer Configuration

100000000000031A0000028053DFFF9E.jpg

It is important to note that deployers are independent of meta-model; for instance, the SIDE Alfresco Deployer will deploy on the same Alfresco instance artifacts generated with a Data model and a Workflow model. Deployers are based on the deployment technique of the targeted framework. The SIDE Alfresco Deployer uses AMP Alfresco Module Package and WAR files to deploy the generated artifacts on Alfresco instance. On selection of a deployer, you usually have to set up some parameters which indicate where is installed the framework instance: for instance, for the 'SIDE Alfresco deployer'. If you previously install Alfresco on your machine, you can set up the Tomcat Installation directory to point on the 'tomcat' directory of Alfresco. You need to stop Alfresco before running the generation & deployment to avoid conflicts during deployment. Click on Save [Enregistrer]

Data structure generation & deployment

At this point we can launch the generation of our 'Digitization.dt' model. Click on'LaunchNote: you can also launch the generation of one specific application configuration directly by right clicking the application model file and selecting 'Launch Generation':


Figure 1.16.  Quick launch of generation

1000000000000190000000C6446342A9.png

A generation window is opened and displayed the generation steps. Click on 'Background' if you want the generation to be done as a background job in order to let you continue with other tasks. At the end of the generation, it indicates if the generation is complete with or without errors: In case, there is error, errors are listed in the window and in the log files (one per generator) under the log paths. In case of no errors, the generation path will contain all the generated artifacts. Moreover, the 'side_report.xml' page has been generated in the logs path and gives information on the generation process. You can load this page directly in a browser:

  • 'Stats' gives a consolidated view of the generation for all the generators and deployers and per generator and deployer.
  • 'Generators' gives a detailed view of the generated artifacts per generator: you have access through this view to all the generated artifacts.
  • 'Deployers' gives a detailed view of the deployed package per deployer: you have access through this view to the package the deployer has deployed on the targeted frameworks. These packages may be deployed on other instances of the framework on other machines.
  • 'Documentation' gives access to the generated documentation for all the models declared in the application configuration.
  • 'Services' gives entry points to load per generator all the services which have been generated and deployed on the targeted framework instances.
  • 'Console' is an exact copy of the logs displayed in the generation console.


Figure 1.17.  SIDE : MDA report procedure

10000000000003120000023781E008B6.jpg

The SIDE Alfresco deployer deployed the generated artifacts on the Alfresco instance. In order to check that the new content type has been created, connect to the Alfresco Explorer and create a new content: in the content type list, you will see Document, InboxMail, OutboxMail; create one of each of them to access metadata form.