QxOrm Windows Linux Macintosh C++

Home Download Quick sample Tutorial (4)
Manual (2)
Forum Our customers

QxOrm >> Manual - QxEntityEditor application user guide
Current version :  QxOrm 1.4.3 - QxOrm library online class documentation
QxEntityEditor 1.2.1
Version française du site Web site english version
Select a manual : QxOrm user guide QxEntityEditor user guide


QxEntityEditor application manual - Table of Contents

  1. Introduction
    1. QxEntityEditor : graphic editor for QxOrm library
    2. Download and installation
    3. QxEntityEditor videos
  2. Main features
    1. Main screen views
      1. Zoom on entities diagram
      2. "Splitter" view mode
    2. QxEntityEditor application settings
    3. Register a license key
    4. Create/open a *.qxee project
      1. Architecture of a *.qxee project file (SQLite database)
    5. Project settings
    6. Manage entities
      1. Create a new entity
      2. Modify an entity
      3. Delete an entity
      4. Clone an entity
      5. Entity settings
      6. Colors associated to an entity
    7. Manage list of properties of an entity
      1. Add/modify/delete a property
      2. Property settings
    8. Manage relationships between entities
      1. Add/modify/delete a relationship
      2. Relationship settings
    9. Manage enumerations
      1. Add/modify/delete/clone an enumeration
      2. Enumeration settings
      3. Colors associated to an enumeration
    10. Manage namespaces
      1. Rename a namespace
      2. Manage colors of a namespace
    11. Manage post-it/comments
      1. Add/modify/delete/clone a post-it
      2. Colors associated to a post-it
    12. Organize diagram layout
    13. Project historic (tag project state)
    14. C++ source code preview
    15. Naming convention (snake_case, camelCase)
    16. List of available plugins
  3. Import plugins
    1. Import project based on JSON file
    2. Import from MySQL or MariaDB database
    3. Import from PostgreSQL database
    4. Import from SQLite database
    5. Import from database using ODBC driver (Oracle, MS SQL Server, etc.)
  4. Export plugins
    1. Export to C++ project
      1. C++ export settings
      2. Overview of generated C++ project
      3. Build generated C++ project (using qmake or cmake)
      4. Example : how to use generated C++ project
    2. Export to C++ model/view project
      1. Export settings
      2. Overview of generated project
    3. Export to C++ services project
      1. Export settings
      2. Overview of generated project
      3. Generic application server to provide services
    4. Export SQL DDL database schema
    5. Print entities diagram
    6. Export project to XML or JSON format
  5. Javascript engine to customize export
    1. Architecture and workflow of Javascript engine
      1. Input parameters of Javascript engine
    2. Available functions in Javascript
      1. Get entity details
      2. Iterate over list of properties of an entity
      3. Get property details
      4. Get enumeration details
      5. Get meta-data of entity/property/enumeration
      6. Get environment variable
      7. Read and write to files
      8. Get list of entities/enumerations of a project
    3. Add a custom action (placeholder) in C++ export template
    4. Script example : add automatically Q_PROPERTY definition on all generated C++ properties
    5. Enable Javascript debugger editor
  6. Execute custom scripts (shell/bat) before/after plugin execution
  7. QxEntityEditor command-line interface
qt_ambassador
QxOrm library has been accepted into the Qt Ambassador Program


Introduction

The goal of this documentation is to provide a user guide to learn how to work with QxEntityEditor application features (the graphic editor for QxOrm library). This manual is intended for developers and software architects who are looking for a solution to manage a persistent data layer in C++/Qt. Technical skills in C++ and databases are required to understand this document.

Note : another documentation dedicated to QxOrm library is available.

QxEntityEditor : graphic editor for QxOrm library

QxEntityEditor is a graphic editor for QxOrm library : QxEntityEditor provides a graphic way to manage the data model.
QxEntityEditor is multi-platform (available for Windows, Linux and Mac OS X) and generates native code for all environments : desktop (Windows, Linux, Mac OS X), embedded and mobile (Android, iOS, Windows Phone, Raspberry Pi, etc.).

QxEntityEditor is based on plugins and provides many ways to import/export your data model :
QxEntityEditor on Windows QxEntityEditor on Linux QxEntityEditor on Mac OS X
QxEntityEditor on Windows QxEntityEditor on Linux QxEntityEditor on Mac OS X


QxEntityEditor application is developed by Lionel Marty, a software development engineer since 2003.


Download and installation

QxEntityEditor application can be downloaded on QxOrm web site, « Download » web page. Several QxEntityEditor versions are available :
  • Windows (from Windows XP to Windows 10) 32bits and 64bits mode ;
  • Linux (Ubuntu, Fedora, etc...) 32bits and 64bits mode ;
  • Mac OS X (64bits only).
For Windows, QxEntityEditor is available with an installation setup or a portable ZIP file.
For Linux and Mac OS X, QxEntityEditor is available only with a portable ZIP file.
No extra dependency is required, QxEntityEditor installation is very easy : you just have to unzip downloaded file and run QxEntityEditor executable.

QxEntityEditor videos

Here is a quick overview of QxEntityEditor features :



Video presentation step by step :
  • Download and install QxOrm library (10s) ;
  • Download and install QxEntityEditor (56s) ;
  • Create a QxEntityEditor project (1m 46s) ;
  • Export entities to a C++/Qt project (8m 26s) ;
  • Export entities to a DDL SQL database script (10m 22s) ;
  • Create a client/server application to transfer entities over network (12m 31s) ;
  • Export QxEntityEditor project to a XML or JSON file (17m 13s) ;
  • Execute QxEntityEditor with command line (no GUI) (18m 07s).



Here is another video of QxEntityEditor application to show how to import an existing database structure (MySQL Workbench project) :



Video step by step :
  • MySQL Workbench project - Sakila sample database (10s) ;
  • Create a DSN to connect to MySQL by ODBC (46s) ;
  • Import database structure in a QxEntityEditor project (1m 15s) ;
  • Export QxEntityEditor project to a C++ Qt project (3m 10s) ;
  • Build the generated C++ Qt project (4m 22s).

Main features

QxEntityEditor is a graphic editor to manage : entities, properties, relationships between entities, enumerations, namespaces. To link database and C++ source code :
  • an entity is a table on database side, and a class on C++ source code side ;
  • a property is a column of a table on database side, and a data member of a class on C++ source code side ;
  • a relationship (1-n, n-1, 1-1 or n-n) is a link between 2 tables (foreign key) on database side, and a link between 2 classes on C++ source code side ;
  • an enumeration is a list of values available on C++ source code side (for now, this is just a converted numeric value on database side) ;
  • a namespace is a database schema, and where classes are located on C++ source code side.

Main screen views

Here is a screenshot which shows all areas of QxEntityEditor main view :

All views

  • Area 1 : main menu and toolbar of QxEntityEditor application ==> all actions are available with these buttons ;
  • Area 2 : listbox to load quickly recent projects ;
  • Area 3 : treeview to display all project items (entities, properties, relationships, enumerations, namespaces) ;
  • Area 4 : "Navigator" view to move quickly on entities diagram (useful for large projects) ;
  • Area 5 : entities diagram to display all project items on a graphical view ;
  • Area 6 : settings screen (with tabs) for entities, properties, relationships, enumerations + C++ source code preview ;
  • Area 7 : zoom on entities diagram.

Zoom on entities diagram

QxEntityEditor application provides several ways to zoom on entities diagram :
  • using the main menu : View >> Zoom view to XX% ;
  • using the slider at the bottom-right of the screen ;
  • using a contextual menu, right-click on entities diagram, sub-menu : View >> Zoom view to XX% ;
  • using left-click + mouse wheel on entities diagram.

Zoom

"Splitter" view mode

View >> Show/hide splitter mode menu switches tabs settings (entities, properties, relationships, enumerations + C++ source code preview) :
  • on the right part of the screen to provide a quick access on selected item settings ;
  • hidden to display entities diagram on full screen (default value).

Splitter mode

QxEntityEditor application settings

QxEntityEditor application global parameters (for all projects) are accessible via main menu Tools >> Global settings :

Global settings
  • Field « QxOrm library path » : define where QxOrm library is located. This parameter is required to run a C++ export process to find QxOrm.pri (or QxOrm.cmake) configuration file. You can put an absolute path, or use an environment variable, for example : $$(QXORM_DIR) ;
  • Field « Auto load last opened project at startup » : run QxEntityEditor application loading automatically the last opened project ;
  • Field « Display property type in entities viewer » : if option enabled, then each property type is displayed on entities diagram ;
  • Field « Use old style to draw relationships » : simplify relationships display (1-n, n-1, 1-1 or n-n) on entities diagram ;
  • Field « Disable undo/redo feature » : can be useful to optimize performance with large projects ;
  • Fields « Entity/Enum/Comment width » : define default items width on entities diagram.

Register a license key

Without a valid license key, a QxEntityEditor project is limited to 5 entities per project. To remove this limitation, you can register a license key via main menu Help >> License information :

License

Just copy/past your license key in the field License key, then push the Save button. A web access is required to register a license key. If no error occurred, then the license key is registered and QxEntityEditor application can be used without any limitation until Expiration date field.

Note : if a web access error occurred during registration, you could try to enable « If you are behind a proxy... » option.

Other note : to get a valid license key, please contact us at : contact@qxorm.com

Create/open a *.qxee project

A new QxEntityEditor project is created via main menu File >> New project :

Project new
  • Field « Project name » : the QxEntityEditor project name. Project file has the same name with *.qxee extension ;
  • Field « Project location » : define where QxEntityEditor project is located. You can use the "..." button to select a directory.

An existing QxEntityEditor project can be opened via main menu File >> Open project : then just select a project file with *.qxee extension. Under the main toolbar of QxEntityEditor application, a list of recent projects is available to switch quickly from a project to another :

Project list

Architecture of a *.qxee project file (SQLite database)

A *.qxee project file of QxEntityEditor application is a SQLite database.
A same QxEntityEditor project can be shared on all environments : Windows, Linux and Mac OS X.
A *.qxee project file can be opened by a SQLite database manager tool : for example, the free Firefox plugin SQLite Manager :

Project database

Note : using the Execute custom scripts (shell/bat) before/after plugin execution feature, it is possible for example to apply a script (.bat or .sh) to modify some imported data in the *.qxee SQLite database file after an import process.

Project settings

QxEntityEditor *.qxee project parameters are accessible via main menu Tools >> Project settings :

Project settings tab 1

  • Field « Default entity namespace » : default namespace when an entity is created (it is possible to define another namespace in Entity settings screen) ;
  • Field « Table name prefix » : prefix used to set table name associated to entity ;
  • Field « Table name suffix » : suffix used to set table name associated to entity ;
  • Field « Primary key prefix » : prefix used to set primary key name associated to entity ;
  • Field « Primary key suffix » : suffix used to set primary key name associated to entity ;
  • Field « Default primary key type » : default C++ type for primary keys ;
  • Field « Default property type » : default C++ type for properties.

The second tab of project parameters screen provides a way to manage items colors in the entities diagram at a project level :

Project settings tab 2

Note : items colors in the entities diagram can be defined at several levels (from the more global level to the more specific level) :

Manage entities

An entity in QxEntityEditor application is a table from a database point of view, and is a persistent class (registered in QxOrm context) in C++ source code. QxEntityEditor application provides features to create, modify, delete and clone entity.

Create a new entity

A new entity can be created via :
  • Main menu : Actions >> New entity ;
  • Right-click contextual menu on entities diagram : Entity >> New entity ;
  • The « Create a new entity » button on entity parameters screen when no entity is selected.

Entity new

Note : these actions open the entity parameters screen in creation context. The entity will be really created and added to the *.qxee project after saving it in the entity parameters screen.

Modify an entity

An entity can be modified via :
  • Main menu : Actions >> Modify entity ;
  • Right-click contextual menu on entities diagram : Entity >> Modify entity ;
  • A double-click on entity name in the entities diagram.

Entity modify

Note : these actions open the entity parameters screen in change context. All entity changes will be really applied to the *.qxee project after saving it in the entity parameters screen.

Delete an entity

An entity (or several entities) can be deleted via :
  • Main menu : Actions >> Delete entity ;
  • Right-click contextual menu on entities diagram : Entity >> Delete entity ;
  • The "Del" keyboard shortcut when 1 or several entities are selected.

Entity delete

Clone an entity

An entity can be cloned via :
  • Main menu : Actions >> Clone entity ;
  • Right-click contextual menu on entities diagram : Entity >> Clone entity ;

Entity clone

Note : a cloned entity has all properties from source entity. Relationships are not cloned.

Entity settings

Entity parameters are accessible via Entity settings tab :

Entity settings

This parameters screen is divided in several sections :

-- Section Entity information (version XX) : entity version is incremented by each project historic.
  • Field « Name » : entity name and generated C++ class name ;
  • Field « Table name » : database table name mapped to the entity (uses default prefix/suffix defined in project settings) ;
  • Field « Namespace » : namespace where entity and generated C++ class are located, each sub-namespace must be separated by :: characters, for example : ns1::ns2::ns3 ;
  • Field « Description » : entity description (displayed in generated C++ source code) ;
  • Field « Inherit from » : parent entity (or C++ base class) : child entity gets automatically primary key and all properties defined in parent entity ;
  • Field « Read only » : if enabled, then entity is in read-only mode : QxOrm library only allows SQL queries of type SELECT (qx::dao fetch functions of QxOrm). if enabled, then SQL queries of type INSERT, UPDATE and DELETE are not available. This parameter can be used for example to map an entity to a database view (read-only) ;
  • Field « Abstract » : an abstract entity is not mapped to a database table, and generated C++ class cannot be instantiated (abstract class) : this parameter can be used for example to create parent entities which contain a list of common properties to share with all other entities ;
  • Field « Soft delete column » : if empty, then remove an entity from database means delete physically the row from database. If not empty, this field defines the database column used to process a soft delete behaviour (or logical delete) : the entity is not physically removed in database.
  • Field « Validator method name » : validation function name (for example : IsValid) used to validate an entity before inserting or updating it in database. Validation method implementation must be written by the developper in its own *.cpp file : see QxOrm library QxValidator module for more details.

-- Section Entity triggers :
  • Checkbox « Before fetch, After fetch, Before insert, etc... » : if checked, add C++ triggers methods definition onBeforeFetch(), onAfterFetch(), onBeforeInsert(), etc... Trigger method implementation must be written by the developper in its own *.cpp file : see QxOrm library user manual for more details.

-- Section Primary key property : fast definition of primary key (detailled settings of primary key is available).
-- Section List of properties : fast definition of list of properties (detailled settings for each property is available). This list can be manually sorted using arrow up and arrow down buttons.
  • Column « Name » : property name, and data member name in C++ source code ;
  • Column « Type » : C++ property type (default type can be defined in project settings screen) ;
  • Column « Decoration » : C++ decoration type (for example boost::optional to manage database NULL value) ;
  • Column « Collection » : if property is a list of, then define C++ list type ;
  • Column « Default value » : property default value ;
  • Column « Index » : define a database index to optimize SELECT SQL queries ;
  • Column « Transient » : if enabled, then C++ data member is not mapped to a database column (property is registered in QxOrm context but is not persistent) ;
  • Button « Delete » : remove property from the list.

-- Section List of relationships : fast definition of list of relationships (detailled settings for each relationship is available). This list can be manually sorted using arrow up and arrow down buttons.
  • Column « Name » : relationship name, and data member name in C++ source code ;
  • Column « Target » : target entity ;
  • Column « n-1 » : relationship of type many-to-one ;
  • Column « 1-n » : relationship of type one-to-many ;
  • Column « n-n » : relationship of type many-to-many ;
  • Column « 1-1 » : relationship of type one-to-one ;
  • Column « Decoration » : C++ decoration type (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Column « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;
  • Column « Foreign key » : relationship foreign key : property name of target entity ;
  • Button « Delete » : remove relationship from the list.

-- Section List of meta-data : meta-data provides a way to add and manage extra-parameters and are available in C++ source code (QxOrm introspection engine) and Javascript engine to customize QxEntityEditor export process.
  • Column « Key » : meta-data key ;
  • Column « Value » : meta-data value ;
  • Button « Delete » : remove meta-data from the list.

Colors associated to an entity

Entity colors can be defined via right-click contextual menu Define entity colors :

Entity colors

Note : items colors in the entities diagram can be defined at several levels (from the more global level to the more specific level) :

Manage list of properties of an entity

A property in QxEntityEditor application is a column (of a table) from a database point of view, and is a data member in a C++ class (registered in QxOrm context). QxEntityEditor application provides features to create, modify, delete and sort properties of an entity.

Add/modify/delete a property

Add and delete a property is done via entity parameters screen : the List of properties section of this settings screen provides a way to add/remove properties. It is also possible to sort manually this list of properties.

Modify a property is accessible via a button which is displayed on entities diagram when the mouse is closed to a property :

Property settings access

Property settings

Detailled property parameters are accessible via Property settings tab :

Property settings

This parameters screen is divided in several sections :

-- Section Property information (version XX) : property version depends on project historic.
  • Field « Name » : property name, and data member name in C++ source code ;
  • Field « Column name » : database column name (if empty, then Column name == Name) ;
  • Field « Description » : property description (displayed in generated C++ source code) ;
  • Field « Index » : define a database index to optimize SELECT SQL queries ;
  • Field « Transient » : if enabled, then C++ data member is not mapped to a database column (property is registered in QxOrm context but is not persistent) ;
  • Field « Serializable » : if enabled, property is managed by serialization engine of QxOrm library ;
  • Field « Obsolete » : enable this option to remove a property without breaking ascendant compatibility of serialization engine of QxOrm library : property becomes private without Get/Set accessors.

-- Section Property type :
-- Section Property validation : validate a property before inserting/updating in database using QxValidator module of QxOrm library.
  • Field « Min value » : minimal value allowed for a property (numeric type) ;
  • Field « Max value » : maximal value allowed for a property (numeric type) ;
  • Field « Min length » : minimal length allowed for a property (string type) ;
  • Field « Max length » : maximal length allowed for a property (string type) ;
  • Field « Regular expression » : regular expression used to validate a property value (for example, an e-mail regular expression to check if property contains a valid e-mail address) ;
  • Field « Not NULL » : check if property value is not NULL ;
  • Field « Unique » : unique value in database, 2 rows in a same table cannot have the same value in the column mapped to current property.

-- Section Advanced :
  • Field « Accessibility », values « public, protected or private » : a public property is accessible without Get/Set methods, a protected property is only accessible by inherited classes, a private property is only accessible via Get/Set methods ;
  • Field « SQL type » : QxOrm library provides a default mapping SQL type / C++ type, it is possible to override default SQL type with this parameter ;
  • Field « SQL alias » : force a SQL alias to database column used by QxOrm library to build SQL queries ;
  • Field « Format » : define property format (printf syntax) for database storage (can be useful to manage dates and times for example) ;
  • Field « Get/Set accessors » : if enabled, Get/Set accessors are generated in C++ source code to access and modify property value ;
  • Field « Read only » : if enabled, only Get accessor is generated in C++ source code, so property becomes read-only ;
  • Field « Get method implementation » : provides a way to override default Get method implementation in C++ source code to access property value ;
  • Field « Set method implementation » : provides a way to override default Set method implementation in C++ source code to modify property value.

-- Section List of meta-data : meta-data provides a way to add and manage extra-parameters and are available in C++ source code (QxOrm introspection engine) and Javascript engine to customize QxEntityEditor export process.
  • Column « Key » : meta-data key ;
  • Column « Value » : meta-data value ;
  • Button « Delete » : remove meta-data from the list.

Manage relationships between entities

A relationship between 2 entities (1-n, n-1, 1-1 or n-n) in QxEntityEditor application links 2 tables in database, and links 2 classes in C++ source code. QxEntityEditor application provides features to create, modify, delete and sort relationships of an entity.

Add/modify/delete a relationship

Add and delete a relationship is done via entity parameters screen : the List of relationships section of this settings screen provides a way to add/remove relationships. It is also possible to sort manually this list of relationships.

Modify a relationship is accessible via a button which is displayed on entities diagram when the mouse is closed to a relationship :

Relation settings access

Relationship settings

Detailled relationship parameters are accessible via Relationship settings tab :

Relation settings

This parameters screen is divided in several sections :

-- Section Relationship information (version XX) : relationship version depends on project historic.
  • Field « Name » : relationship name, and data member name in C++ source code ;
  • Field « Target » : target entity ;
  • Field « Description » : relationship description (displayed in generated C++ source code) ;
  • Fields « 1-n, n-1, 1-1 or n-n » : relationship type, depending on selected option, some other fields are enabled or disabled ;
  • Field « Column name » : enabled only for relationships of type n-1, column name in database (if empty, then Column name == Name) ;
  • Field « Decoration » : C++ decoration type (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Field « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;
  • Field « Foreign key » : relationship foreign key : property name of target entity ;
  • Field « FK owner » : used only by n-n relationships ;
  • Field « Extra-table » : used only by n-n relationships, extra-table name which links source and target entities ;
  • Field « Index » : define a database index to optimize SELECT SQL queries ;
  • Field « Serializable » : if enabled, relationship is managed by serialization engine of QxOrm library ;
  • Field « Obsolete » : enable this option to remove a relationship without breaking ascendant compatibility of serialization engine of QxOrm library : relationship becomes private without Get/Set accessors.

-- Section Advanced :
  • Field « Accessibility », values « public, protected or private » : a public relationship is accessible without Get/Set methods, a protected relationship is only accessible by inherited classes, a private relationship is only accessible via Get/Set methods ;
  • Field « Get/Set accessors » : if enabled, Get/Set accessors are generated in C++ source code to access and modify relationship value ;
  • Field « Read only » : if enabled, only Get accessor is generated in C++ source code, so relationship becomes read-only ;
  • Field « Get method implementation » : provides a way to override default Get method implementation in C++ source code to access relationship value ;
  • Field « Set method implementation » : provides a way to override default Set method implementation in C++ source code to modify relationship value.

-- Section List of meta-data : meta-data provides a way to add and manage extra-parameters and are available in C++ source code (QxOrm introspection engine) and Javascript engine to customize QxEntityEditor export process.
  • Column « Key » : meta-data key ;
  • Column « Value » : meta-data value ;
  • Button « Delete » : remove meta-data from the list.

Manage enumerations

An enumeration in QxEntityEditor application is a list of values available in C++ source code (converted to a numeric value in database). QxEntityEditor application provides features to create, modify, delete and clone enumeration.

Add/modify/delete/clone an enumeration

Add, modify, delete and clone an enumeration is done via equivalent menu for an entity (just replace entity word by enumeration).
So QxEntityEditor application provides exactly same menus as an entity to manage enumeration.

Enumeration settings

Enumeration parameters are accessible via Enumeration settings tab :

Enumeration settings

This parameters screen is divided in several sections :

-- Section Enumeration information (version XX) : enumeration version is incremented by each project historic.
  • Field « Name » : enumeration name and generated C++ class name ;
  • Field « Description » : enumeration description (displayed in generated C++ source code) ;
  • Field « Namespace » : namespace where enumeration and generated C++ class are located, each sub-namespace must be separated by :: characters, for example : ns1::ns2::ns3 ;
  • Field « Use Qt macro Q_ENUM » : uses Q_ENUM macro provided by Qt framework to define an enumeration compatible with Qt introspection engine ;

-- Section List of values :
  • Column « Key » : value key ;
  • Column « Value » : value ;
  • Button « Delete » : remove value from the list.

-- Section List of meta-data : meta-data provides a way to add and manage extra-parameters and are available in C++ source code (QxOrm introspection engine) and Javascript engine to customize QxEntityEditor export process.
  • Column « Key » : meta-data key ;
  • Column « Value » : meta-data value ;
  • Button « Delete » : remove meta-data from the list.

Colors associated to an enumeration

Enumeration colors can be defined via right-click contextual menu Define enumeration colors :

Enumeration colors

Note : items colors in the entities diagram can be defined at several levels (from the more global level to the more specific level) :

Manage namespaces

A namespace in QxEntityEditor application is used to group several items (entities and enumerations) in a same area. From a database point of view, a namespace is generally a schema. In C++ source code, a namespace defines where classes and functions are located (to group them).

Namespaces are used by the following QxEntityEditor feature : Organize diagram layout (to group items automatically).

The QxEntityEditor application treeview (which displays all loaded items in a project) provides some menus to manage namespaces :

Namespace menu

Rename a namespace

To rename a namespace, just do a right-click on project treeview, then contextual menu Move entities to another namespace :

Namespace rename

Manage colors of a namespace

To define items colors at a namespace level, just do a right-click on project treeview, then contextual menu Define colors by namespace :

Namespace colors

The left part of this screen displays all namespaces available in *.qxee project.
The right part of this screen provides a way to manage colors for all items located in the selected namespace. It is also possible to define a background color (generally a light color) to group all items in entities diagram.

Note : items colors in the entities diagram can be defined at several levels (from the more global level to the more specific level) :

Manage post-it/comments

A comment (or post-it) in QxEntityEditor application is a tag displayed on entities diagram to provide some details about data model or *.qxee project. A post-it can be moved everywhere in the entities diagram. A post-it has a title and a free text area. It is possible to write some text using HTML format to add colors, put text in bold, italic, etc...

QxEntityEditor application provides features to create, modify, delete and clone comment/post-it.

Post-it / comments

Add/modify/delete/clone a post-it

Add, modify, delete and clone a post-it is done via equivalent menu for an entity (just replace entity word by comment).
So QxEntityEditor application provides exactly same menus as an entity to manage post-it.

Colors associated to a post-it

Post-it colors can be defined via right-click contextual menu Define comment colors :

Post-it colors

Note : items colors in the entities diagram can be defined at several levels (from the more global level to the more specific level) :

Organize diagram layout

A feature is available in QxEntityEditor application to group automatically all items in entities diagram depending on namespace, and depending on relationships between entities : main menu View >> Organize diagram layout. This feature can be useful for example to organize entities diagram after executing an import process.

Organize diagram layout

Project historic (tag project state)

A QxEntityEditor project can have several versions/historics : main menu Actions >> Tag project state.

Each project historic changes project items version number (entities, properties, relationships, etc...). Version number is used to manage ascendant compatibility with serialization engine of QxOrm library. Project historic is also used by database DDL SQL export plugin : manage database schema evolution (add a table, remove a column, add an index, etc...).

Tag project state tab 1

The first tab of this historic screen provides a way to create a new historic title (for example : date/time, project version number, etc...) and a comment in free text.

Tag project state tab 2

The second tab of this historic screen displays the list of all project historics already saved. This list of historics provides buttons to restore a project state in several formats (XML, JSON or QxEntityEditor *.qxee project file).

C++ source code preview

It is possible to display a preview of generated C++ source code (header *.h and source *.cpp files) for the selected item in entities diagram (entity or enumeration). This C++ source code can be generated by C++ export plugin of QxEntityEditor. C++ preview is accessible after selecting an item in entities diagram, then go to C++ preview tab :

C++ preview

Naming convention (snake_case, camelCase)

QxEntityEditor application provides a feature to apply quickly a naming convention on all project items (entities, properties, relationships, etc...). This feature keeps (doesn't break) mapping with database. This feature is available via main menu : Naming convention. 3 styles of naming convention are provided : snake_case, camelCase and PascalCase.

Naming convention

Note : this feature can be useful for example after executing an import process to harmonize generated C++ source code.

List of available plugins

QxEntityEditor application is based on plugins to manage import/export process. A list of available plugins with version number and description is available via main menu : Help >> About plugins.

List of plugins

Import plugins

All import process in QxEntityEditor application are accessible via main menu Import :

Import plugins

Import project based on JSON file

A QxEntityEditor project can be managed with a text file in JSON format : main menu Import >> Import from JSON file.
To know the JSON structure of a *.qxee project, it is recommended to do a first export process to JSON file.

Import JSON

The JSON import screen is simple and has only 1 field to define : the JSON file to import.

Warning : a JSON import process removes all items from current project (entities, properties, relationships, etc...).

Note : QxEntityEditor application can be executed with a command-line to load automatically a JSON file at startup.

Here is a command-line example :
QxEntityEditor --project="<path_to_your_qxee_project_file>" --plugin=QxEEJsonImport --QxEEJsonImport_file="<path_to_your_json_file>"

Here is a JSON file example (deployed in ./samples/qxBlog.json directory of QxEntityEditor package) :
{
    "app_version": 0,
    "description": "",
    "dt_creation": "20131206221737",
    "dt_modification": "20131206221737",
    "id": 1,
    "list_all_entities": [
        {
            "app_version": 0,
            "description": "",
            "dt_creation": "20131206221810",
            "dt_modification": "20140617214144",
            "id": 1,
            "is_abstract": false,
            "is_read_only": false,
            "key": "",
            "list_functions": null,
            "list_functions_static": null,
            "list_meta_data": null,
            "list_properties": [
                {
                    "accessibility": "protected",
                    "allow_null": false,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 1,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": true,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "author_id",
                    "order_level": 0,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221810",
                        "dt_modification": "20140617214144",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 1,
                        "list_meta_data": null,
                        "primitive_type": "long",
                        "property_id": {
                            "id": 1
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 2,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "firstname",
                    "order_level": 1,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221810",
                        "dt_modification": "20140617214144",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 2,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 2
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 3,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "lastname",
                    "order_level": 2,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221810",
                        "dt_modification": "20140617214144",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 3,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 3
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 4,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "birthdate",
                    "order_level": 3,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221810",
                        "dt_modification": "20140617214144",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 4,
                        "list_meta_data": null,
                        "primitive_type": "QDateTime",
                        "property_id": {
                            "id": 4
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 5,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "sex",
                    "order_level": 4,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221810",
                        "dt_modification": "20140617214144",
                        "entity_id": null,
                        "enumeration_id": {
                            "id": 1
                        },
                        "id": 5,
                        "list_meta_data": null,
                        "primitive_type": "sex::enum_sex",
                        "property_id": {
                            "id": 5
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214144",
                    "entity_id": {
                        "id": 1
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 18,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "list_of_blog",
                    "order_level": 17,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214144",
                        "entity_id": {
                            "id": 4
                        },
                        "enumeration_id": null,
                        "id": 18,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 18
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214144",
                        "extra_table": "",
                        "foreign_key": "author",
                        "foreign_key_owner": "",
                        "id": 2,
                        "inverse_property_id": {
                            "id": 15
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 18
                        },
                        "type_relation": "one-to-many",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                }
            ],
            "name": "author",
            "namespace": "",
            "parent_id": null,
            "project_id": {
                "id": 1
            },
            "project_version": 0,
            "property_id": {
                "accessibility": "protected",
                "allow_null": false,
                "app_version": 0,
                "column_name": "",
                "description": "",
                "dt_creation": "20131206221810",
                "dt_modification": "20140617214144",
                "entity_id": {
                    "id": 1
                },
                "force_sql_alias": "",
                "force_sql_type": "",
                "format": "",
                "get_method": "",
                "id": 1,
                "is_index": true,
                "is_obsolete": false,
                "is_primary_key": true,
                "is_read_only": false,
                "is_serializable": true,
                "is_transient": false,
                "is_unique": false,
                "key": "",
                "list_meta_data": null,
                "max_length": "",
                "max_value": "",
                "min_length": "",
                "min_value": "",
                "name": "author_id",
                "order_level": 0,
                "project_version": 0,
                "property_type_id": {
                    "app_version": 0,
                    "collection": "",
                    "decoration": "",
                    "default_value": "",
                    "dt_creation": "20131206221810",
                    "dt_modification": "20140617214144",
                    "entity_id": null,
                    "enumeration_id": null,
                    "id": 1,
                    "list_meta_data": null,
                    "primitive_type": "long",
                    "property_id": {
                        "id": 1
                    },
                    "user_id_creation": 0,
                    "user_id_modification": 0
                },
                "qt_property": "",
                "reg_exp": "",
                "relation_id": null,
                "set_method": "",
                "user_id_creation": 0,
                "user_id_modification": 0,
                "version": 0,
                "write_accessors": true
            },
            "soft_delete_column": "",
            "table_name": "t_author",
            "trigger_after_delete": false,
            "trigger_after_fetch": false,
            "trigger_after_insert": false,
            "trigger_after_update": false,
            "trigger_before_delete": false,
            "trigger_before_fetch": false,
            "trigger_before_insert": false,
            "trigger_before_update": false,
            "user_id_creation": 0,
            "user_id_modification": 0,
            "validator_method": "",
            "version": 0
        },
        {
            "app_version": 0,
            "description": "",
            "dt_creation": "20131206222031",
            "dt_modification": "20140617214043",
            "id": 4,
            "is_abstract": false,
            "is_read_only": false,
            "key": "",
            "list_functions": null,
            "list_functions_static": null,
            "list_meta_data": null,
            "list_properties": [
                {
                    "accessibility": "protected",
                    "allow_null": false,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 12,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": true,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "blog_id",
                    "order_level": 11,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 12,
                        "list_meta_data": null,
                        "primitive_type": "long",
                        "property_id": {
                            "id": 12
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": false,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 13,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "title",
                    "order_level": 12,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 13,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 13
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 14,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "text",
                    "order_level": 13,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 14,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 14
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 15,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "author",
                    "order_level": 14,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": {
                            "id": 1
                        },
                        "enumeration_id": null,
                        "id": 15,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 15
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "extra_table": "",
                        "foreign_key": "",
                        "foreign_key_owner": "",
                        "id": 1,
                        "inverse_property_id": {
                            "id": 18
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 15
                        },
                        "type_relation": "many-to-one",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 16,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "list_of_comment",
                    "order_level": 15,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": {
                            "id": 3
                        },
                        "enumeration_id": null,
                        "id": 16,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 16
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "extra_table": "",
                        "foreign_key": "blog_id",
                        "foreign_key_owner": "",
                        "id": 3,
                        "inverse_property_id": {
                            "id": 19
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 16
                        },
                        "type_relation": "one-to-many",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": {
                        "id": 4
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 17,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "list_of_category",
                    "order_level": 16,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "entity_id": {
                            "id": 2
                        },
                        "enumeration_id": null,
                        "id": 17,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 17
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214043",
                        "extra_table": "t_qxee_blog_category",
                        "foreign_key": "blog_id",
                        "foreign_key_owner": "category_id",
                        "id": 5,
                        "inverse_property_id": {
                            "id": 20
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 17
                        },
                        "type_relation": "many-to-many",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                }
            ],
            "name": "blog",
            "namespace": "",
            "parent_id": null,
            "project_id": {
                "id": 1
            },
            "project_version": 0,
            "property_id": {
                "accessibility": "protected",
                "allow_null": false,
                "app_version": 0,
                "column_name": "",
                "description": "",
                "dt_creation": "20131206222031",
                "dt_modification": "20140617214043",
                "entity_id": {
                    "id": 4
                },
                "force_sql_alias": "",
                "force_sql_type": "",
                "format": "",
                "get_method": "",
                "id": 12,
                "is_index": true,
                "is_obsolete": false,
                "is_primary_key": true,
                "is_read_only": false,
                "is_serializable": true,
                "is_transient": false,
                "is_unique": false,
                "key": "",
                "list_meta_data": null,
                "max_length": "",
                "max_value": "",
                "min_length": "",
                "min_value": "",
                "name": "blog_id",
                "order_level": 11,
                "project_version": 0,
                "property_type_id": {
                    "app_version": 0,
                    "collection": "",
                    "decoration": "",
                    "default_value": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214043",
                    "entity_id": null,
                    "enumeration_id": null,
                    "id": 12,
                    "list_meta_data": null,
                    "primitive_type": "long",
                    "property_id": {
                        "id": 12
                    },
                    "user_id_creation": 0,
                    "user_id_modification": 0
                },
                "qt_property": "",
                "reg_exp": "",
                "relation_id": null,
                "set_method": "",
                "user_id_creation": 0,
                "user_id_modification": 0,
                "version": 0,
                "write_accessors": true
            },
            "soft_delete_column": "",
            "table_name": "t_blog",
            "trigger_after_delete": false,
            "trigger_after_fetch": false,
            "trigger_after_insert": false,
            "trigger_after_update": false,
            "trigger_before_delete": false,
            "trigger_before_fetch": false,
            "trigger_before_insert": false,
            "trigger_before_update": false,
            "user_id_creation": 0,
            "user_id_modification": 0,
            "validator_method": "",
            "version": 0
        },
        {
            "app_version": 0,
            "description": "",
            "dt_creation": "20131206221933",
            "dt_modification": "20140617214115",
            "id": 2,
            "is_abstract": false,
            "is_read_only": false,
            "key": "",
            "list_functions": null,
            "list_functions_static": null,
            "list_meta_data": null,
            "list_properties": [
                {
                    "accessibility": "protected",
                    "allow_null": false,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221933",
                    "dt_modification": "20140617214115",
                    "entity_id": {
                        "id": 2
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 6,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": true,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "category_id",
                    "order_level": 5,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221933",
                        "dt_modification": "20140617214115",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 6,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 6
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221933",
                    "dt_modification": "20140617214115",
                    "entity_id": {
                        "id": 2
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 7,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "name",
                    "order_level": 6,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221933",
                        "dt_modification": "20140617214115",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 7,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 7
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221933",
                    "dt_modification": "20140617214115",
                    "entity_id": {
                        "id": 2
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 8,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "description",
                    "order_level": 7,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221933",
                        "dt_modification": "20140617214115",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 8,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 8
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20140617214115",
                    "entity_id": {
                        "id": 2
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 20,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "list_of_blog",
                    "order_level": 19,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214115",
                        "entity_id": {
                            "id": 4
                        },
                        "enumeration_id": null,
                        "id": 20,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 20
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20140617214115",
                        "extra_table": "t_qxee_blog_category",
                        "foreign_key": "category_id",
                        "foreign_key_owner": "blog_id",
                        "id": 6,
                        "inverse_property_id": {
                            "id": 17
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 20
                        },
                        "type_relation": "many-to-many",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                }
            ],
            "name": "category",
            "namespace": "",
            "parent_id": null,
            "project_id": {
                "id": 1
            },
            "project_version": 0,
            "property_id": {
                "accessibility": "protected",
                "allow_null": false,
                "app_version": 0,
                "column_name": "",
                "description": "",
                "dt_creation": "20131206221933",
                "dt_modification": "20140617214115",
                "entity_id": {
                    "id": 2
                },
                "force_sql_alias": "",
                "force_sql_type": "",
                "format": "",
                "get_method": "",
                "id": 6,
                "is_index": true,
                "is_obsolete": false,
                "is_primary_key": true,
                "is_read_only": false,
                "is_serializable": true,
                "is_transient": false,
                "is_unique": false,
                "key": "",
                "list_meta_data": null,
                "max_length": "",
                "max_value": "",
                "min_length": "",
                "min_value": "",
                "name": "category_id",
                "order_level": 5,
                "project_version": 0,
                "property_type_id": {
                    "app_version": 0,
                    "collection": "",
                    "decoration": "",
                    "default_value": "",
                    "dt_creation": "20131206221933",
                    "dt_modification": "20140617214115",
                    "entity_id": null,
                    "enumeration_id": null,
                    "id": 6,
                    "list_meta_data": null,
                    "primitive_type": "QString",
                    "property_id": {
                        "id": 6
                    },
                    "user_id_creation": 0,
                    "user_id_modification": 0
                },
                "qt_property": "",
                "reg_exp": "",
                "relation_id": null,
                "set_method": "",
                "user_id_creation": 0,
                "user_id_modification": 0,
                "version": 0,
                "write_accessors": true
            },
            "soft_delete_column": "",
            "table_name": "t_category",
            "trigger_after_delete": false,
            "trigger_after_fetch": false,
            "trigger_after_insert": false,
            "trigger_after_update": false,
            "trigger_before_delete": false,
            "trigger_before_fetch": false,
            "trigger_before_insert": false,
            "trigger_before_update": false,
            "user_id_creation": 0,
            "user_id_modification": 0,
            "validator_method": "",
            "version": 0
        },
        {
            "app_version": 0,
            "description": "",
            "dt_creation": "20131206221951",
            "dt_modification": "20131206221951",
            "id": 3,
            "is_abstract": false,
            "is_read_only": false,
            "key": "",
            "list_functions": null,
            "list_functions_static": null,
            "list_meta_data": null,
            "list_properties": [
                {
                    "accessibility": "protected",
                    "allow_null": false,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221951",
                    "dt_modification": "20131206221951",
                    "entity_id": {
                        "id": 3
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 9,
                    "is_index": true,
                    "is_obsolete": false,
                    "is_primary_key": true,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "comment_id",
                    "order_level": 8,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221951",
                        "dt_modification": "20131206221951",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 9,
                        "list_meta_data": null,
                        "primitive_type": "long",
                        "property_id": {
                            "id": 9
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221951",
                    "dt_modification": "20131206221951",
                    "entity_id": {
                        "id": 3
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 10,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "title",
                    "order_level": 9,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221951",
                        "dt_modification": "20131206221951",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 10,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 10
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206221951",
                    "dt_modification": "20131206221951",
                    "entity_id": {
                        "id": 3
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 11,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "text",
                    "order_level": 10,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "",
                        "decoration": "",
                        "default_value": "",
                        "dt_creation": "20131206221951",
                        "dt_modification": "20131206221951",
                        "entity_id": null,
                        "enumeration_id": null,
                        "id": 11,
                        "list_meta_data": null,
                        "primitive_type": "QString",
                        "property_id": {
                            "id": 11
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": null,
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                },
                {
                    "accessibility": "protected",
                    "allow_null": true,
                    "app_version": 0,
                    "column_name": "",
                    "description": "",
                    "dt_creation": "20131206222031",
                    "dt_modification": "20131206222031",
                    "entity_id": {
                        "id": 3
                    },
                    "force_sql_alias": "",
                    "force_sql_type": "",
                    "format": "",
                    "get_method": "",
                    "id": 19,
                    "is_index": false,
                    "is_obsolete": false,
                    "is_primary_key": false,
                    "is_read_only": false,
                    "is_serializable": true,
                    "is_transient": false,
                    "is_unique": false,
                    "key": "",
                    "list_meta_data": null,
                    "max_length": "",
                    "max_value": "",
                    "min_length": "",
                    "min_value": "",
                    "name": "blog_id",
                    "order_level": 18,
                    "project_version": 0,
                    "property_type_id": {
                        "app_version": 0,
                        "collection": "qx::QxCollection",
                        "decoration": "boost::shared_ptr",
                        "default_value": "",
                        "dt_creation": "20131206222031",
                        "dt_modification": "20131206222031",
                        "entity_id": {
                            "id": 4
                        },
                        "enumeration_id": null,
                        "id": 19,
                        "list_meta_data": null,
                        "primitive_type": "",
                        "property_id": {
                            "id": 19
                        },
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "qt_property": "",
                    "reg_exp": "",
                    "relation_id": {
                        "app_version": 0,
                        "dt_creation": "20131206222031",
                        "dt_modification": "20131206222031",
                        "extra_table": "",
                        "foreign_key": "",
                        "foreign_key_owner": "",
                        "id": 4,
                        "inverse_property_id": {
                            "id": 16
                        },
                        "list_meta_data": null,
                        "property_id": {
                            "id": 19
                        },
                        "type_relation": "many-to-one",
                        "user_id_creation": 0,
                        "user_id_modification": 0
                    },
                    "set_method": "",
                    "user_id_creation": 0,
                    "user_id_modification": 0,
                    "version": 0,
                    "write_accessors": true
                }
            ],
            "name": "comment",
            "namespace": "",
            "parent_id": null,
            "project_id": {
                "id": 1
            },
            "project_version": 0,
            "property_id": {
                "accessibility": "protected",
                "allow_null": false,
                "app_version": 0,
                "column_name": "",
                "description": "",
                "dt_creation": "20131206221951",
                "dt_modification": "20131206221951",
                "entity_id": {
                    "id": 3
                },
                "force_sql_alias": "",
                "force_sql_type": "",
                "format": "",
                "get_method": "",
                "id": 9,
                "is_index": true,
                "is_obsolete": false,
                "is_primary_key": true,
                "is_read_only": false,
                "is_serializable": true,
                "is_transient": false,
                "is_unique": false,
                "key": "",
                "list_meta_data": null,
                "max_length": "",
                "max_value": "",
                "min_length": "",
                "min_value": "",
                "name": "comment_id",
                "order_level": 8,
                "project_version": 0,
                "property_type_id": {
                    "app_version": 0,
                    "collection": "",
                    "decoration": "",
                    "default_value": "",
                    "dt_creation": "20131206221951",
                    "dt_modification": "20131206221951",
                    "entity_id": null,
                    "enumeration_id": null,
                    "id": 9,
                    "list_meta_data": null,
                    "primitive_type": "long",
                    "property_id": {
                        "id": 9
                    },
                    "user_id_creation": 0,
                    "user_id_modification": 0
                },
                "qt_property": "",
                "reg_exp": "",
                "relation_id": null,
                "set_method": "",
                "user_id_creation": 0,
                "user_id_modification": 0,
                "version": 0,
                "write_accessors": true
            },
            "soft_delete_column": "",
            "table_name": "t_comment",
            "trigger_after_delete": false,
            "trigger_after_fetch": false,
            "trigger_after_insert": false,
            "trigger_after_update": false,
            "trigger_before_delete": false,
            "trigger_before_fetch": false,
            "trigger_before_insert": false,
            "trigger_before_update": false,
            "user_id_creation": 0,
            "user_id_modification": 0,
            "validator_method": "",
            "version": 0
        }
    ],
    "list_comments": [
        {
            "app_version": 0,
            "comment_text": "- Design the entity model in few minutes\n\n- Generate C++ persistent classes automatically\n\n- Generate DDL SQL script automatically\n\n- Manage schema evolution for each project version\n\n- Compile C++ native code everywhere : Windows, Linux, MacOSX, Android, iOS, etc...\n\n- Transfer your data model over network and create quickly client/server applications",
            "comment_text_html": false,
            "comment_title": "qxBlog project",
            "dt_creation": "20131206222130",
            "dt_modification": "20140107093142",
            "id": 1,
            "list_meta_data": null,
            "user_id_creation": 0,
            "user_id_modification": 0
        }
    ],
    "list_enumerations": [
        {
            "app_version": 0,
            "description": "",
            "dt_creation": "20131206221840",
            "dt_modification": "20131210205552",
            "id": 1,
            "key": "",
            "list_meta_data": null,
            "list_of_key_value": {
                "female": 2,
                "male": 1,
                "unknown": 3
            },
            "name": "sex",
            "namespace": "",
            "project_id": {
                "id": 1
            },
            "project_version": 0,
            "qt_enum": false,
            "user_id_creation": 0,
            "user_id_modification": 0,
            "version": 0
        }
    ],
    "list_groups": null,
    "list_meta_data": null,
    "list_namespaces": null,
    "location": "C:/Temp/qxee",
    "name": "qxBlog",
    "project_guid": "{16335d56-73ac-48cf-8fcd-f74cc7d97201}",
    "project_parameters": {
        "app_version": 0,
        "default_entity_namespace": "",
        "default_primary_key_type": "long",
        "default_property_type": "QString",
        "dt_creation": "20131206221737",
        "dt_modification": "20131206221737",
        "id": 1,
        "list_meta_data": null,
        "lst_plugin_script": {
        },
        "primary_key_prefix": "",
        "primary_key_suffix": "_id",
        "project_id": {
            "id": 1
        },
        "table_name_prefix": "t_",
        "table_name_suffix": "",
        "user_id_creation": 0,
        "user_id_modification": 0
    },
    "user_id_creation": 0,
    "user_id_modification": 0,
    "version": 0
}


Import from MySQL or MariaDB database

A MySQL (or MariaDB) database structure can be imported in QxEntityEditor application via main menu : Import >> Import from MySQL (or MariaDB) database :

Import MySQL or MariaDB

This import parameters screen is divided in several sections :

-- Section MySQL (or MariaDB) database connection :
  • Field « Database server address (IP) » : the MySQL server name or IP address ;
  • Field « Database port » : MySQL server port number to connect to database ;
  • Field « Database name » : database name to import ;
  • Field « Database login » : user name to connect to database ;
  • Field « Database password » : password to connect to database ;
  • Button « Connect to database » : if an error occurred, a warning message is displayed, otherwise all database tables and columns are displayed in « Database items to import to QxEntityEditor project » section (treeview).

-- Section Import settings :
  • Field « Namespace » : namespace used to group all imported items in current project ;
  • Field « Delete all entities in the namespace before importing » : remove all entities from above namespace before running import from database process ;
  • Field « Import tables/columns comment to entities/properties description » : import tables and columns description defined in database ;
  • Field « Add boost::optional<T> decoration if a column definition allows NULL value » : add automatically boost::optional decoration to manage NULL value ;
  • Field « Import columns default value » : import default values defined in database columns ;
  • Field « Organize diagram layout after import process » : run automatically the organize entities diagram feature after executing import process.

-- Section Relationship import settings :
  • Field « Decoration » : default relationship C++ type decoration (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Field « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;

-- Section Mapping database SQL type to C++ type : QxEntityEditor provides a default mapping SQL type / C++ type. You can use this list to override default behaviour :
  • Column « SQL type » : SQL type to map. SQL type search is case insensitive, and is applied on first characters (STARTS WITH behaviour) : for example, varchar matches VARCHAR(255) ;
  • Column « C++ type » : C++ type to use when SQL type is found ;
  • Button « Delete » : remove SQL type / C++ type mapping.

-- Section Database items to import to QxEntityEditor project : when QxEntityEditor is connected to database, all items (tables, columns, primary keys, relationships, views, etc...) are displayed in this section. By default, there is no item selected. You can select all items to import with 1 click on the treeview root item. It is also possible to select quickly items from a specific schema. Once items to import are selected, the « Ok » button becomes enabled to run import process.


Note : all import parameters (database connection, import settings and relationships, SQL type / C++ type mapping, etc...) are automatically saved when closing the import screen. All import parameters are automatically re-loaded when opening the import screen.

Other note : a QxEntityEditor video is available to show how to import the MySQL database sample named sakila.

Import from PostgreSQL database

A PostgreSQL database structure can be imported in QxEntityEditor application via main menu : Import >> Import from PostgreSQL database :

Import PostgreSQL

This import parameters screen is divided in several sections :

-- Section PostgreSQL database connection :
  • Field « Database server address (IP) » : the PostgreSQL server name or IP address ;
  • Field « Database port » : PostgreSQL server port number to connect to database ;
  • Field « Database name » : database name to import ;
  • Field « Database login » : user name to connect to database ;
  • Field « Database password » : password to connect to database ;
  • Button « Connect to database » : if an error occurred, a warning message is displayed, otherwise all database tables and columns are displayed in « Database items to import to QxEntityEditor project » section (treeview).

-- Section Import settings :
  • Field « Namespace » : namespace used to group all imported items in current project ;
  • Field « Delete all entities in the namespace before importing » : remove all entities from above namespace before running import from database process ;
  • Field « Import tables/columns comment to entities/properties description » : import tables and columns description defined in database ;
  • Field « Add boost::optional<T> decoration if a column definition allows NULL value » : add automatically boost::optional decoration to manage NULL value ;
  • Field « Import columns default value » : import default values defined in database columns ;
  • Field « Organize diagram layout after import process » : run automatically the organize entities diagram feature after executing import process.

-- Section Relationship import settings :
  • Field « Decoration » : default relationship C++ type decoration (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Field « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;

-- Section Mapping database SQL type to C++ type : QxEntityEditor provides a default mapping SQL type / C++ type. You can use this list to override default behaviour :
  • Column « SQL type » : SQL type to map. SQL type search is case insensitive, and is applied on first characters (STARTS WITH behaviour) : for example, varchar matches VARCHAR(255) ;
  • Column « C++ type » : C++ type to use when SQL type is found ;
  • Button « Delete » : remove SQL type / C++ type mapping.

-- Section Database items to import to QxEntityEditor project : when QxEntityEditor is connected to database, all items (tables, columns, primary keys, relationships, views, etc...) are displayed in this section. By default, there is no item selected. You can select all items to import with 1 click on the treeview root item. It is also possible to select quickly items from a specific schema. Once items to import are selected, the « Ok » button becomes enabled to run import process.


Note : all import parameters (database connection, import settings and relationships, SQL type / C++ type mapping, etc...) are automatically saved when closing the import screen. All import parameters are automatically re-loaded when opening the import screen.

Other note : a QxEntityEditor video is available to show how to import the MySQL database sample named sakila.

Import from SQLite database

A SQLite database structure can be imported in QxEntityEditor application via main menu : Import >> Import from SQLite database :

Import SQLite

This import parameters screen is divided in several sections :

-- Section Database connection :
  • Field « Database path » : SQLite database file path ;
  • Button « Connect to database » : if an error occurred, a warning message is displayed, otherwise all database tables and columns are displayed in « Database items to import to QxEntityEditor project » section (treeview).

-- Section Import settings :
  • Field « Namespace » : namespace used to group all imported items in current project ;
  • Field « Delete all entities in the namespace before importing » : remove all entities from above namespace before running import from database process ;
  • Field « Import tables/columns comment to entities/properties description » : import tables and columns description defined in database ;
  • Field « Add boost::optional<T> decoration if a column definition allows NULL value » : add automatically boost::optional decoration to manage NULL value ;
  • Field « Import columns default value » : import default values defined in database columns ;
  • Field « Organize diagram layout after import process » : run automatically the organize entities diagram feature after executing import process.

-- Section Relationship import settings :
  • Field « Decoration » : default relationship C++ type decoration (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Field « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;

-- Section Mapping database SQL type to C++ type : QxEntityEditor provides a default mapping SQL type / C++ type. You can use this list to override default behaviour :
  • Column « SQL type » : SQL type to map. SQL type search is case insensitive, and is applied on first characters (STARTS WITH behaviour) : for example, varchar matches VARCHAR(255) ;
  • Column « C++ type » : C++ type to use when SQL type is found ;
  • Button « Delete » : remove SQL type / C++ type mapping.

-- Section Database items to import to QxEntityEditor project : when QxEntityEditor is connected to database, all items (tables, columns, primary keys, relationships, views, etc...) are displayed in this section. By default, there is no item selected. You can select all items to import with 1 click on the treeview root item. It is also possible to select quickly items from a specific schema. Once items to import are selected, the « Ok » button becomes enabled to run import process.


Note : all import parameters (database connection, import settings and relationships, SQL type / C++ type mapping, etc...) are automatically saved when closing the import screen. All import parameters are automatically re-loaded when opening the import screen.

Other note : a QxEntityEditor video is available to show how to import the MySQL database sample named sakila.

Import from database using ODBC driver (Oracle, MS SQL Server, etc.)

QxEntityEditor application provides a generic database import using ODBC drivers : main menu Import >> Import from database using ODBC driver. This kind of import process requires a DSN (Data Source Name) defined on the environment. Import by ODBC process is able to manage following databases : Oracle, Microsoft SQL Server, SQLite, MySQL/MariaDB, PostgreSQL, etc...

Import ODBC

This import parameters screen is divided in several sections :

-- Section Database connection :
  • Field « DSN or connection string » : DSN (Data Source Name) defined on the environment to be able to connect to database using an ODBC driver ;
  • Field « Login » : user name to connect to database (optional depending on DSN) ;
  • Field « Password » : password to connect to database (optional depending on DSN) ;
  • Field « Database type » : Generic type is able to connect to all databases but with some limitations (no relationship, no composite key). So you should select the real database type before connecting to database (Oracle, Microsoft SQL Server, SQLite, MySQL/MariaDB, PostgreSQL) ;
  • Button « Connect to database » : if an error occurred, a warning message is displayed, otherwise all database tables and columns are displayed in « Database items to import to QxEntityEditor project » section (treeview).

-- Section Import settings :
  • Field « Namespace » : namespace used to group all imported items in current project ;
  • Field « Delete all entities in the namespace before importing » : remove all entities from above namespace before running import from database process ;
  • Field « Import tables/columns comment to entities/properties description » : import tables and columns description defined in database ;
  • Field « Add boost::optional<T> decoration if a column definition allows NULL value » : add automatically boost::optional decoration to manage NULL value ;
  • Field « Import columns default value » : import default values defined in database columns ;
  • Field « Organize diagram layout after import process » : run automatically the organize entities diagram feature after executing import process.

-- Section Relationship import settings :
  • Field « Decoration » : default relationship C++ type decoration (for relationships, QxOrm library recommends smart-pointer : boost::shared_ptr, std::shared_ptr or QSharedPointer) ;
  • Field « Collection » : if relationship is a list of (1-n and n-n), then define C++ list type ;

-- Section Mapping database SQL type to C++ type : QxEntityEditor provides a default mapping SQL type / C++ type. You can use this list to override default behaviour :
  • Column « SQL type » : SQL type to map. SQL type search is case insensitive, and is applied on first characters (STARTS WITH behaviour) : for example, varchar matches VARCHAR(255) ;
  • Column « C++ type » : C++ type to use when SQL type is found ;
  • Button « Delete » : remove SQL type / C++ type mapping.

-- Section Database items to import to QxEntityEditor project : when QxEntityEditor is connected to database, all items (tables, columns, primary keys, relationships, views, etc...) are displayed in this section. By default, there is no item selected. You can select all items to import with 1 click on the treeview root item. It is also possible to select quickly items from a specific schema. Once items to import are selected, the « Ok » button becomes enabled to run import process.


Note : all import parameters (database connection, import settings and relationships, SQL type / C++ type mapping, etc...) are automatically saved when closing the import screen. All import parameters are automatically re-loaded when opening the import screen.

Other note : a QxEntityEditor video is available to show how to import the MySQL database sample named sakila.

Export plugins

All export process in QxEntityEditor application are accessible via main menu Export :

Export plugins

Export to C++ project

C++ export generates a full C++ project ready to be built (using qmake and/or cmake) which contains all entities/properties/relationships/enumerations registered in QxOrm context. All QxOrm library features (persistence, serialization, introspection, etc...) are available for all items inside generated C++ project.

C++ export settings

C++ export parameters are accessible via main menu : Tools >> Export to C++ project (settings). Export parameters screen is displayed automatically when the first export is launched if no setting is saved in *.qxee project. When a C++ export process has already been executed, then export parameters screen is only accessible via : Tools >> Export to C++ project (settings) :

Export C++

This export parameters screen is divided in several sections :

-- Section C++ export settings :
  • Field « C++ project location » : define where generated C++ project is located (output directory). You can define in this field a relative path to your *.qxee project file ;
  • Field « Relative path to QxOrm library » : if enabled, QxOrm library dependency is managed using a relative path, otherwise it is managed using an absolute path. You should define an environment variable in QxEntityEditor application settings (for example : $$(QXORM_DIR)) instead of using this option ;
  • Field « Generate a custom directory with custom files for each entity » : if enabled, generated C++ project contains a custom file per entity. By default, these custom files are empty and will never be removed or erased by another export. These custom files can be used for example to implement validation methods, or trigger functions.

-- Section Custom script (Javascript file) to change the default behaviour of the export process : settings for export custom engine.
  • Field « Custom script file » : Javascript file location to customize C++ export process. If empty, no customization is applied (default behaviour of export process). You can define in this field a relative path to *.qxee project file, for example ./my_script.js if my_script.js file is in the same directory as *.qxee file ;
  • Button « Debug custom Javascript file » : if a Javascript file is defined, a click on this button will enable Javascript debugging mode for the next C++ export process. Instead of using this button, you can also enable Javascript debugging mode pressing SHIFT keyboard shortcut when starting an export process.

-- Section C++ template files : this section defines entities C++ source code for Header *.h and Source *.cpp files. Export engine is based on placeholders (@@ACTION@@ format) to replace code by calculated value. Placeholder is the most important part to understand how Javascript customization engine works. Please note that you can define your own custom placeholder with @@CUSTOM_ prefix, for example : @@CUSTOM_MY_ACTION@@.
  • Option « No inheritance » : if enabled (default option), C++ class doesn't have any inheritance (no base class) ;
  • Option « qx::IxPersistable » : if enabled, each generated C++ class inherit from qx::IxPersistable interface (which provides a common interface for persistence actions to database). Please note that this option increases compilation times to build your C++ project ;
  • Option « qx::IxPersistable + QObject » : if enabled, each generated C++ class inherit from qx::IxPersistable interface and from QObject Qt class. Please note that this option increases compilation times to build your C++ project ;
  • Option « Custom » : if enabled, you can provide your own C++ template files (you should begin to copy/past Header *.h and Source *.cpp from another option to get a list of placeholders to use).

Overview of generated C++ project

Output directory of generated C++ project looks like :

Export C++ output

  • « bin » folder is empty by default, and will contain output binary (shared library *.dll on Windows, *.so on Linux, etc...) ;
  • « build » folder is empty by default, it can be used to manage CMake configuration files ;
  • « custom » folder is filled if the « Generate a custom directory with custom files for each entity » option is enabled. These custom files can be used for example to implement validation methods, or trigger functions ;
  • « include » folder contains all classes definitions for entities and enumerations ;
  • « src » folder contains all classes implementations for entities and enumerations ;
  • « CMakeLists.txt » file can be used to build project with CMake ;
  • « *.gen.pri » and « *.gen.pro » files can be used to build project with qmake ;

Build generated C++ project (using qmake or cmake)

Generated C++ project can be built using CMake or qmake.
QxOrm library provides some documented compilation options in QxOrm.pri (and QxOrm.cmake) configuration files (you can keep default compilation options).
QxOrm library user manual has a topic about how to build a QxOrm project.
A tutorial is also available to explain how to setup an development environment on Windows with MSVC.
Once C++ project is built, then output binary is available in the « bin » directory of exported project (*.dll on Windows, *.so on Linux, etc...).

Example : how to use generated C++ project

The ./samples/ directory of QxEntityEditor package provides a sample project : qxBlog.qxee. This qxBlog.qxee project can be opened in QxEntityEditor application without any valid license key. Once C++ project is exported by QxEntityEditor, you can build the project to get a qxBlog.dll shared library (or qxBlog.so on Linux). This shared library registers all entities, properties and enumerations in QxOrm context : so all QxOrm library features are available.

The ./samples/ directory of QxEntityEditor package also provides a C++ sample project which depends on qxBlog.qxee exported project : qxBlogExec.zip. Once qxBlogExec.zip is unzipped, the readme.txt file in the root folder contains instructions to build this sample project :

--------------------------------------------
-- To build qxBlogExec project with qmake --
--------------------------------------------

1- Export the 'qxBlog.qxee' project as a C++ project with QxEntityEditor and build it
2- Open the 'qxBlogExec.pro' file
3- Replace '$$(QXORM_DIR)' by your QxOrm library installation path
4- Replace 'C:/Temp/qxee/cpp/' by the path where you have exported the 'qxBlog.qxee' project as a C++ project
5- run command line : qmake
6- run command line : make debug (or make release)


--------------------------------------------
-- To build qxBlogExec project with CMake --
--------------------------------------------

1- Export the 'qxBlog.qxee' project as a C++ project with QxEntityEditor and build it
2- Open the 'CMakeLists.txt' file
3- Replace '$ENV{QXORM_DIR}' by your QxOrm library installation path
4- Replace 'C:/Temp/qxee/cpp/' by the path where you have exported the 'qxBlog.qxee' project as a C++ project
5- run cmake or cmake-gui to configure and generate your make files


Here is the commented content of main() function (close to qxBlog tutorial) :

int main(int argc, char * argv[])
{
   // Qt application
   QCoreApplication app(argc, argv);
   QFile::remove("./qxBlog.sqlite");

   // Parameters to connect to database
   qx::QxSqlDatabase::getSingleton()->setDriverName("QSQLITE");
   qx::QxSqlDatabase::getSingleton()->setDatabaseName("./qxBlog.sqlite");
   qx::QxSqlDatabase::getSingleton()->setHostName("localhost");
   qx::QxSqlDatabase::getSingleton()->setUserName("root");
   qx::QxSqlDatabase::getSingleton()->setPassword("");

   // Only for debug purpose : assert if invalid offset detected fetching a relation
   qx::QxSqlDatabase::getSingleton()->setVerifyOffsetRelation(true);

   // !!! TO CREATE TABLES, PLEASE USE THE C++ DDL SQL EXPORT PLUGIN OF QXENTITYEDITOR !!!
   // Create all tables in database (you should not use 'qx::dao::create_table<T>()' function in a production software, use it just for prototypes or samples)
   QSqlError daoError = qx::dao::create_table<author>();
   daoError = qx::dao::create_table<comment>();
   daoError = qx::dao::create_table<category>();
   daoError = qx::dao::create_table<blog>();

   // Create a list of 3 author
   author_ptr author_1; author_1.reset(new author());
   author_ptr author_2; author_2.reset(new author());
   author_ptr author_3; author_3.reset(new author());

   author_1->setlastname("author_1");
   author_1->setsex(sex::male);
   author_1->setbirthdate(QDateTime::currentDateTime());
   author_2->setlastname("author_2");
   author_2->setsex(sex::female);
   author_2->setbirthdate(QDateTime::currentDateTime());
   author_3->setlastname("author_3");
   author_3->setsex(sex::female);
   author_3->setbirthdate(QDateTime::currentDateTime());

   list_of_author authorX;
   authorX.insert(1, author_1);
   authorX.insert(2, author_2);
   authorX.insert(3, author_3);

   // Insert list of 3 author into database
   daoError = qx::dao::insert(authorX);
   qAssert(qx::dao::count<author>() == 3);

   // Clone author n°2 : 'author_id_2'
   author_ptr author_clone = qx::clone(* author_2);
   qAssert(author_clone->getauthor_id() == author_2->getauthor_id());
   qAssert(author_clone->getsex() == sex::female);

   // Create a query to fetch only female author : 'author_id_2' and 'author_id_3'
   qx::QxSqlQuery query("WHERE t_author.sex = :sex");
   query.bind(":sex", sex::female);

   list_of_author list_of_female_author;
   daoError = qx::dao::fetch_by_query(query, list_of_female_author);
   qAssert(list_of_female_author.count() == 2);

   // Dump list of female author (xml serialization)
   qx::dump(list_of_female_author);

   // Create 3 categories
   category_ptr category_1 = category_ptr(new category("cat_1"));
   category_ptr category_2 = category_ptr(new category("cat_2"));
   category_ptr category_3 = category_ptr(new category("cat_3"));

   category_1->setname("category_1"); category_1->setdescription("desc_1");
   category_2->setname("category_2"); category_2->setdescription("desc_2");
   category_3->setname("category_3"); category_3->setdescription("desc_3");

   { // Create a scope to destroy temporary connexion to database

   // Open a transaction to database
   QSqlDatabase db = qx::QxSqlDatabase::getDatabase();
   bool bCommit = db.transaction();

   // Insert 3 categories into database, use 'db' parameter for the transaction
   daoError = qx::dao::insert(category_1, (& db));    bCommit = (bCommit && ! daoError.isValid());
   daoError = qx::dao::insert(category_2, (& db));    bCommit = (bCommit && ! daoError.isValid());
   daoError = qx::dao::insert(category_3, (& db));    bCommit = (bCommit && ! daoError.isValid());

   qAssert(bCommit);
   qAssert(category_1->getcategory_id() != "");
   qAssert(category_2->getcategory_id() != "");
   qAssert(category_3->getcategory_id() != "");

   // Terminate transaction => commit or rollback if there is error
   if (bCommit) { db.commit(); }
   else { db.rollback(); }

   } // End of scope : 'db' is destroyed

   // Create a blog with the class name (factory)
   boost::any blog_any = qx::create("blog");
   blog_ptr blog_1;
   try { blog_1 = boost::any_cast<blog_ptr>(blog_any); }
   catch (...) { blog_1.reset(new blog()); }
   blog_1->settext("blog_text_1");
   blog_1->settitle("blog_title_1");
   blog_1->setauthor(author_1);

   // Insert 'blog_1' into database with 'save()' method
   daoError = qx::dao::save(blog_1);

   // Modify 'blog_1' properties and save into database
   blog_1->settext("update blog_text_1");
   blog_1->setauthor(author_2);
   daoError = qx::dao::save(blog_1);

   // Add 2 comments to 'blog_1'
   comment_ptr comment_1; comment_1.reset(new comment());
   comment_ptr comment_2; comment_2.reset(new comment());

   comment_1->settext("comment_1 text");
   comment_1->setblog_id(blog_1);
   comment_2->settext("comment_2 text");
   comment_2->setblog_id(blog_1);

   daoError = qx::dao::insert(comment_1);
   daoError = qx::dao::insert(comment_2);
   qAssert(qx::dao::count<comment>() == 2);

   // Add 2 categories to 'blog_1' => must insert into extra-table 'category_blog'
   blog::type_list_of_category lst_category;
   lst_category.insert(category_1->getcategory_id(), category_1);
   lst_category.insert(category_3->getcategory_id(), category_3);
   blog_1->setlist_of_category(lst_category);
   daoError = qx::dao::save_with_relation("list_of_category", blog_1);

   // Fetch blog into a new variable with all relation : 'author', 'comment' and 'category'
   blog_ptr blog_tmp; blog_tmp.reset(new blog());
   blog_tmp->setblog_id(blog_1->getblog_id());
   daoError = qx::dao::fetch_by_id_with_all_relation(blog_tmp);

   qAssert(blog_tmp->list_of_comment().count() == 2);
   qAssert(blog_tmp->list_of_category().count() == 2);
   qAssert(blog_tmp->gettext() == "update blog_text_1");
   qAssert(blog_tmp->getauthor() && blog_tmp->getauthor()->getauthor_id() == author_2->getauthor_id());

   // Fetch blog into a new variable with many relations using "*->*->*->*" (4 levels of relationships)
   blog_tmp.reset(new blog());
   blog_tmp->setblog_id(blog_1->getblog_id());
   daoError = qx::dao::fetch_by_id_with_relation("*->*->*->*", blog_tmp);

   qAssert(blog_tmp->list_of_comment().count() == 2);
   qAssert(blog_tmp->list_of_category().count() == 2);
   qAssert(blog_tmp->gettext() == "update blog_text_1");
   qAssert(blog_tmp->getauthor() && blog_tmp->getauthor()->getauthor_id() == author_2->getauthor_id());

   // Dump 'blog_tmp' result from database (xml serialization)
   qx::dump(blog_tmp);

   // Check qx::dao::save_with_relation_recursive() function
   daoError = qx::dao::save_with_relation_recursive(blog_tmp);
   qAssert(! daoError.isValid());
   daoError = qx::dao::save_with_relation_recursive(blog_tmp, qx::dao::save_mode::e_update_only);
   qAssert(! daoError.isValid());

   // Call 'age()' method with class name and method name (reflexion)
   //qx_bool bInvokeOk = qx::QxClassX::invoke("author", "age", author_1);
   //qAssert(bInvokeOk);

   // Test 'isDirty()' method
   qx::dao::ptr<blog> blog_isdirty = qx::dao::ptr<blog>(new blog());
   blog_isdirty->setblog_id(blog_1->getblog_id());
   daoError = qx::dao::fetch_by_id(blog_isdirty);
   qAssert(! daoError.isValid() && ! blog_isdirty.isDirty());

   blog_isdirty->settext("blog property 'text' modified => blog is dirty !!!");
   QStringList lstDiff; bool bDirty = blog_isdirty.isDirty(lstDiff);
   qAssert(bDirty && (lstDiff.count() == 1) && (lstDiff.at(0) == "text"));
   if (bDirty) { qDebug("[QxOrm] test dirty 1 : blog is dirty => '%s'", qPrintable(lstDiff.join("|"))); }

   // Update only property 'm_text' of 'blog_isdirty'
   daoError = qx::dao::update_optimized(blog_isdirty);
   qAssert(! daoError.isValid() && ! blog_isdirty.isDirty());
   qx::dump(blog_isdirty);

   // Test 'isDirty()' method with a container
   typedef qx::dao::ptr< QList<author_ptr> > type_lst_author_test_is_dirty;
   type_lst_author_test_is_dirty container_isdirty = type_lst_author_test_is_dirty(new QList<author_ptr>());
   daoError = qx::dao::fetch_all(container_isdirty);
   qAssert(! daoError.isValid() && ! container_isdirty.isDirty() && (container_isdirty->count() == 3));

   author_ptr author_ptr_dirty = container_isdirty->at(1);
   author_ptr_dirty->setlastname("author name modified at index 1 => container is dirty !!!");
   bDirty = container_isdirty.isDirty(lstDiff);
   qAssert(bDirty && (lstDiff.count() == 1));
   if (bDirty) { qDebug("[QxOrm] test dirty 2 : container is dirty => '%s'", qPrintable(lstDiff.join("|"))); }

   author_ptr_dirty = container_isdirty->at(2);
   author_ptr_dirty->setfirstname("firstname changed");
   bDirty = container_isdirty.isDirty(lstDiff);
   qAssert(bDirty && (lstDiff.count() == 2));
   if (bDirty) { qDebug("[QxOrm] test dirty 3 : container is dirty => '%s'", qPrintable(lstDiff.join("|"))); }

   // Update only property 'm_name' at position 1, only property 'm_birthdate' at position 2 and nothing at position 0
   daoError = qx::dao::update_optimized(container_isdirty);
   qAssert(! daoError.isValid() && ! container_isdirty.isDirty());
   qx::dump(container_isdirty);

   // Fetch only property 'm_text' of blog
   QStringList lstColumns = QStringList() << "text";
   QList<blog_ptr> lst_blog_with_only_text;
   daoError = qx::dao::fetch_all(lst_blog_with_only_text, NULL, lstColumns);
   qAssert(! daoError.isValid() && (lst_blog_with_only_text.size() > 0));
   if ((lst_blog_with_only_text.size() > 0) && (lst_blog_with_only_text[0].get() != NULL))
   { qAssert(lst_blog_with_only_text[0]->gettitle().isEmpty()); }
   qx::dump(lst_blog_with_only_text);

   // Dump all registered classes into QxOrm context (introspection engine)
   qx::QxClassX::dumpAllClasses();

   // Call a custom SQL query or a stored procedure
   qx_query testStoredProc("SELECT * FROM t_author");
   daoError = qx::dao::call_query(testStoredProc);
   qAssert(! daoError.isValid());
   testStoredProc.dumpSqlResult();

   // Call a custom SQL query or a stored procedure and fetch automatically properties (with a collection of items)
   qx_query testStoredProcBis("SELECT * FROM t_author");
   authorX.clear();
   daoError = qx::dao::execute_query(testStoredProcBis, authorX);
   qAssert(! daoError.isValid()); qAssert(authorX.count() > 0);
   qx::dump(authorX);

   // Call a custom SQL query or a stored procedure and fetch automatically properties
   qx_query testStoredProcThird("SELECT name, category_id FROM t_category");
   category_ptr category_tmp = category_ptr(new category());
   daoError = qx::dao::execute_query(testStoredProcThird, category_tmp);
   qAssert(! daoError.isValid()); qAssert(category_tmp->getcategory_id() != "");
   qx::dump(category_tmp);

   return 0;
}


Export to C++ model/view project

QxOrm library provides QxModelView module. A documentation about QxModelView module is available in the QxOrm library user manual. QxModelView module provides a way to work with Qt model/view engine with all classes registered in QxOrm context :
  • QML : each property defined in QxOrm context is exposed to QML engine : QxModelView module makes easier integration between QML and databases ;
  • Qt widgets : QTableView or QListView for example to display/modify a database table content.

QxEntityEditor application is able to generate a full C++ model/view project ready to be built : so all entities and their relationships are accessible in QML views.

Export settings

C++ model/view export parameters are accessible via main menu : Tools >> Export to C++ model/view project (settings). Export parameters screen is displayed automatically when the first export is launched if no setting is saved in *.qxee project. When a C++ model/view export process has already been executed, then export parameters screen is only accessible via : Tools >> Export to C++ model/view project (settings) :

Export C++ model/view

This export parameters screen is divided in several sections :

-- Section C++ model/view export settings :
  • Field « C++ model/view project location » : output directory which contains C++ model/view project files. You can define in this field a relative path to your *.qxee project file ;
  • Field « C++ entities project location » : read-only, displays the C++ project location (entities registered in QxOrm context) whose depends C++ model/view project ;
  • Field « Namespace for model/view » : namespace used to group all C++ model/view classes (these classes implement qx::IxModel interface) ;
  • Field « Generate custom files » : if enabled, generated C++ project contains a custom file per entity. By default, these custom files are empty and will never be removed or erased by another export.

-- Section Custom script (Javascript file) to change the default behaviour of the export process : settings for export custom engine.
  • Field « Custom script file » : Javascript file location to customize C++ export process. If empty, no customization is applied (default behaviour of export process). You can define in this field a relative path to *.qxee project file, for example ./my_script.js if my_script.js file is in the same directory as *.qxee file ;
  • Button « Debug custom Javascript file » : if a Javascript file is defined, a click on this button will enable Javascript debugging mode for the next C++ export process. Instead of using this button, you can also enable Javascript debugging mode pressing SHIFT keyboard shortcut when starting an export process.

-- Section C++ model/view template files : this section defines model/view C++ source code for Header *.h and Source *.cpp files. Export engine is based on placeholders (@@ACTION@@ format) to replace code by calculated value. Placeholder is the most important part to understand how Javascript customization engine works. Please note that you can define your own custom placeholder with @@CUSTOM_ prefix, for example : @@CUSTOM_MY_ACTION@@.

Overview of generated project

Output directory of generated C++ model/view project looks like :

Export C++ model/view output

  • « bin » folder is empty by default, and will contain output binary (shared library *.dll on Windows, *.so on Linux, etc...) ;
  • « build » folder is empty by default, it can be used to manage CMake configuration files ;
  • « custom » folder is filled if the « Generate custom files » option is enabled ;
  • « include » folder contains all models definitions for entities and their relationships ;
  • « src » folder contains all models implementations for entities and their relationships ;
  • « CMakeLists.txt » file can be used to build model/view project with CMake ;
  • « *.gen.pri » and « *.gen.pro » files can be used to build model/view project with qmake ;

Export to C++ services project

QxOrm library provides QxService module. A documentation about QxService module is available in QxOrm library user manual. QxService module of QxOrm library provides a way to create quickly a powerful C++ applications server (based on services with request from client and response from server). A tutorial is available on QxOrm website to explain how to work with QxService module.

QxEntityEditor application is able to generate a full C++ services project ready to be built (a C++ project to manage client layer and a C++ project to publish services on server side) : so all entities and their relationships can be transfered over network (client/server application).

Export settings

C++ services export parameters are accessible via main menu : Tools >> Export to C++ services project (settings). Export parameters screen is displayed automatically when the first export is launched if no setting is saved in *.qxee project. When a C++ services export process has already been executed, then export parameters screen is only accessible via : Tools >> Export to C++ services project (settings) :

Export C++ services

This export parameters screen is divided in several sections :

-- Section C++ services export settings :
  • Field « C++ services project location » : output directory which contains all C++ services project files. You can define in this field a relative path to your *.qxee project file ;
  • Field « C++ entities project location » : read-only, displays the C++ project location (entities registered in QxOrm context) whose depends C++ services project ;
  • Field « Namespace for services » : namespace used to group all C++ services classes (these classes provide a way to transfer entities over network, client layer and server layer) ;
  • Field « Generate custom files » : if enabled, generated C++ project contains a custom file per entity. By default, these custom files are empty and will never be removed or erased by another export. These custom files can be used for example to implement and publish new services ;
  • Field « Generate server application » : if enabled, a sample C++ applications server project is generated and is able to load and publish services on server side based on plugins ;
  • Field « Server application location » : if « Generate server application » option is enabled, then define output directory of sample C++ applications server project.

-- Section Custom script (Javascript file) to change the default behaviour of the export process : settings for export custom engine.
  • Field « Custom script file » : Javascript file location to customize C++ export process. If empty, no customization is applied (default behaviour of export process). You can define in this field a relative path to *.qxee project file, for example ./my_script.js if my_script.js file is in the same directory as *.qxee file ;
  • Button « Debug custom Javascript file » : if a Javascript file is defined, a click on this button will enable Javascript debugging mode for the next C++ export process. Instead of using this button, you can also enable Javascript debugging mode pressing SHIFT keyboard shortcut when starting an export process.

-- Section C++ services template files : this section defines services C++ source code for Header *.h and Source *.cpp files (client and server). Export engine is based on placeholders (@@ACTION@@ format) to replace code by calculated value. Placeholder is the most important part to understand how Javascript customization engine works. Please note that you can define your own custom placeholder with @@CUSTOM_ prefix, for example : @@CUSTOM_MY_ACTION@@.
  • Option « Default » : if enabled (default option), generate default services (client layer and server layer) : entities and their relationships can be transfered over network and CRUD operations on database are supported ;
  • Option « Custom » : if enabled, you can provide your own C++ services template files (you should begin to copy/past Header *.h and Source *.cpp from another option to get a list of placeholders to use).

Overview of generated project

Output directory of generated C++ services project (client and server) looks like :

Export C++ services output

  • « bin » folder is empty by default, and will contain output client and server binaries (shared library *.dll on Windows, *.so on Linux, etc...) ;
  • « build » folder is empty by default, it can be used to manage CMake configuration files ;
  • « client » folder contains qmake and CMake files to build project (client layer) ;
  • « custom » folder is filled if the « Generate custom files » option is enabled ;
  • « include » folder contains all services definitions for entities and their relationships ;
  • « server » folder contains qmake and CMake files to build project (server layer) ;
  • « src » folder contains all services implementations for entities and their relationships ;
  • « CMakeLists.txt » file can be used to build services project (client and server) with CMake ;
  • « *.gen.pri » and « *.gen.pro » files can be used to build services project (client and server) with qmake ;
  • « *.gen.json » file is used by the server project to build a plugin which can be loaded by the applications server to publish services.

Generic application server to provide services

If « Generate server application » option is enabled, then C++ services export process generates also a generic applications server. This sample applications server is able to publish services loading plugins. Like all other C++ projects generated by QxEntityEditor, the generic applications server can be built with qmake and CMake. Output directory of the generic applications server project looks like :

Export C++ services server app output

Once project is built, an executable is available in the « bin » directory. Open the executable will launch following window :

Export C++ services server app

This screen is divided in several sections :

-- Section Plugins services :
  • Field « Plugins path » : required to define where to find services plugins. These plugins are built using C++ services server project. Once loaded, all plugins publish their services which can be called by clients applications. If no plugin loaded after selecting the plugins path, then it is possible to define QT_DEBUG_PLUGINS environment variable to log some loading errors and help you to understand why plugins are not loaded (generally, a plugin dependency not found).

-- Section Database connection parameters :
  • This section contains all required parameters to initialize a database connection used by services (see qx::QxSqlDatabase class for more details).

-- Section Server parameters :
  • Field « Port number » : define port number opened by the applications server to publish services. Clients applications have to connect to this port number to send requests to server ;
  • Field « Thread count » : number of threads used by server to manage client requests ;
  • Field « Serialization type » : serialization type used to send responses from server to client ;
  • Field « Compress data » : if enabled, all responses from server to client are compressed ;
  • Field « Encrypt data » : if enabled, all responses from server to client are encrypted (possibility to define your own encryption key) ;
  • Button « Start server » : button to start and stop server.

-- Section Log last client-server reply-request transaction :
  • Display in XML or JSON format all details about the last client-server transaction managed by the applications server.

-- Section Log last server error :
  • If an error occurred on applications server, it is automatically logged in this section.

Export SQL DDL database schema

QxEntityEditor application is able to generate a database schema (structure) in a DDL SQL format. QxEntityEditor application support most commonly used databases : SQLite, MySQL, MariaDB, PostgreSQL, Oracle and Microsoft SQL Server. Generated DDL SQL script can be imported in database to create automatically all tables, columns, primary keys, relationships, index, etc... DDL SQL parameters are accessible via main menu : Tools >> Export to DDL SQL script file (settings) :

Export SQL DDL

This export parameters screen is divided in several sections :

-- Section DDL export settings :
  • Field « File location » : output directory which will contain the generated DDL SQL script ;
  • Field « Database type » : select DDL SQL script format (SQLite, MySQL, MariaDB, PostgreSQL, Oracle or Microsoft SQL Server) ;
  • Field « Relationships » : if enabled, then foreign keys are created to manage relationships between entities ;
  • Field « Schema » : define DDL export type : 1 script which contains all *.qxee items, or 1 script per *.qxee project version (database schema evolution).

-- Section Mapping C++ type to database SQL type :
  • List to map C++ type (defined in all *.qxee project properties) to SQL type.

-- Section Custom script (Javascript file) to change the default behaviour of the export process : settings for export custom engine.
  • Field « Custom script file » : Javascript file location to customize export process. If empty, no customization is applied (default behaviour of export process). You can define in this field a relative path to *.qxee project file, for example ./my_script.js if my_script.js file is in the same directory as *.qxee file ;
  • Button « Debug custom Javascript file » : if a Javascript file is defined, a click on this button will enable Javascript debugging mode for the next export process. Instead of using this button, you can also enable Javascript debugging mode pressing SHIFT keyboard shortcut when starting an export process.

Print entities diagram

QxEntityEditor application is able to print entities diagram to PNG and/or PDF format. Print parameters are accessible via main menu : Tools >> Print the entities diagram (settings) :

Export print PNG/PDF

Export project to XML or JSON format

QxEntityEditor application can export a *.qxee project to XML or JSON format. XML/JSON export parameters are accessible via main menu : Tools >> Export to XML or JSON file (settings) :

Export XML/JSON

Note : a XML file cannot be used to import items in a *.qxee project. On the other hand, a JSON file can be used to import items in a *.qxee project using the import plugin : Import project based on JSON file.

Javascript engine to customize export

QxEntityEditor application provides a powerful export customization engine. This engine is based on Javascript language to write scripts to customize QxEntityEditor exports. These Javascript scripts can access to all parameters and items of a *.qxee project, and a QxEntityEditor native debugger can be enabled to help you to develop and fix your scripts. It is also possible to write your own files during export process.

Note : the ./samples/ directory of QxEntityEditor package provides 2 documented samples scripts : custom_script.js and q_property.js.

Architecture and workflow of Javascript engine

All QxEntityEditor export plugins provide following settings : Custom script (Javascript file) to change the default behaviour of the export process. This is where you can define a Javascript file to use to customize your exports. Export engine is based on placeholders (@@ACTION@@ format) to replace code by calculated value. Placeholder is the most important part to understand how Javascript customization engine works. Please note that you can define your own custom placeholder with @@CUSTOM_ prefix, for example : @@CUSTOM_MY_ACTION@@. During an export process, QxEntityEditor application iterates over all entities and enumerations defined in *.qxee project. Each time a placeholder is read by export engine (@@ACTION@@ format), the Javascript script is called with all input parameters required to customize output files.

Here is a minimal Javascript file example. This script does nothing, it just shows what is a valid QxEntityEditor Javascript file :
({

// Here is the entry point of the QxEntityEditor javascript engine
// This function is called for each placeholder defined in the C++ template section
customProcess : function(params)
{
   try
   {
      // quit with 'params[0]' means : doesn't change the default export behaviour
      return params[0];
   }
   catch (err)
   { return ("[CustomScriptError] an unexpected error occurred : " + err); }
}

});


Input parameters of Javascript engine

customProcess() function input parameter (named params) is an array which contain a list of values (this is the call context of the script). Here is a sample function which can be used in your own scripts to list and to give meaning to all input values :

function printParams(params)
{
   var log = "";
   log = log + "\n - default_value = " + params[0];
   log = log + "\n - project_name = " + params[1];
   log = log + "\n - project_file = " + params[2];
   log = log + "\n - plugin_name = " + params[3];
   log = log + "\n - current_file = " + params[4];
   log = log + "\n - action (or placeholder) = " + params[5];
   log = log + "\n - entity_name = " + params[6];
   log = log + "\n - entity_table_name = " + params[7];
   log = log + "\n - property_name = " + params[8];
   log = log + "\n - property_type = " + params[9];
   log = log + "\n - property_column_name = " + params[10];
   log = log + "\n - property_is_primary_key = " + params[11];
   log = log + "\n - enumeration_name = " + params[12];
   log = log + "\n - entity_id = " + params[13];
   log = log + "\n - property_id = " + params[14];
   log = log + "\n - enumeration_id = " + params[15];
   log = log + "\n - output_location = " + params[16];

   print(log); // print value to the custom script debugger window
   helper.print(log); // print value to the standard output (for example, on Windows, use the 'DebugView' application to see all logs)
   return log;
}


Available functions in Javascript

QxEntityEditor export customization engine support all Javascript language features (ECMAScript 5). QxEntityEditor application provides also a global instance of object named helper which can be used in your own scripts to access to more features. We will list in this chapter the most commonly used features to customize output files.

Get entity details

Here is an example to get all current entity parameters, helper.getEntityDetails(entity_id) :

var entity_id = params[13];
printEntityDetails(entity_id);

//...

function printEntityDetails(entity_id)
{
   var details = helper.getEntityDetails(entity_id);
   if (details.length == 0) { return details; }

   var log = "";
   log = log + "\n - entity_id = " + details[0];
   log = log + "\n - entity_key = " + details[1];
   log = log + "\n - entity_name = " + details[2];
   log = log + "\n - entity_namespace = " + details[3];
   log = log + "\n - entity_tablename = " + details[4];
   log = log + "\n - entity_description = " + details[5];
   log = log + "\n - entity_is_read_only = " + details[6];
   log = log + "\n - entity_is_abstract = " + details[7];
   log = log + "\n - entity_version = " + details[8];
   log = log + "\n - entity_primary_key_property_id = " + details[9];
   log = log + "\n - entity_list_of_properties_id = " + details[10];
   log = log + "\n - entity_has_triggers = " + details[11];
   log = log + "\n - entity_trigger_on_before_fetch = " + details[12];
   log = log + "\n - entity_trigger_on_after_fetch = " + details[13];
   log = log + "\n - entity_trigger_on_before_insert = " + details[14];
   log = log + "\n - entity_trigger_on_after_insert = " + details[15];
   log = log + "\n - entity_trigger_on_before_update = " + details[16];
   log = log + "\n - entity_trigger_on_after_update = " + details[17];
   log = log + "\n - entity_trigger_on_before_delete = " + details[18];
   log = log + "\n - entity_trigger_on_after_delete = " + details[19];
   log = log + "\n - entity_parent_id = " + details[20];
   log = log + "\n - entity_soft_delete_column = " + details[21];
   log = log + "\n - entity_validator_method = " + details[22];

   print(log); // print value to the custom script debugger window
   helper.print(log); // print value to the standard output (for example, on Windows, use the 'DebugView' application to see all logs)
   return details;
}


Iterate over list of properties of an entity

Here is an example to iterate over all properties defined in current entity :

var entity_id = params[13];
var entity_details = helper.getEntityDetails(entity_id);
var entity_list_of_properties_id = ((entity_details.length > 0) ? entity_details[10] : "");
var entity_list_of_properties_array = entity_list_of_properties_id.split("|");
for (var idx = 0; idx < entity_list_of_properties_array.length; idx++)
{
   var property_id = entity_list_of_properties_array[idx];
   var property_details = helper.getPropertyDetails(property_id);
   // ...
}


Get property details

Here is an example to get all property parameters, helper.getPropertyDetails(property_id) :

function printPropertyDetails(property_id)
{
   var details = helper.getPropertyDetails(property_id);
   if (details.length == 0) { return details; }

   var log = "";
   log = log + "\n - property_id = " + details[0];
   log = log + "\n - property_key = " + details[1];
   log = log + "\n - property_name = " + details[2];
   log = log + "\n - property_column_name = " + details[3];
   log = log + "\n - property_description = " + details[4];
   log = log + "\n - property_type = " + details[5];
   log = log + "\n - property_version = " + details[6];
   log = log + "\n - property_entity_id = " + details[7];
   log = log + "\n - property_is_read_only = " + details[8];
   log = log + "\n - property_is_primary_key = " + details[9];
   log = log + "\n - property_is_serializable = " + details[10];
   log = log + "\n - property_is_transient = " + details[11];
   log = log + "\n - property_is_obsolete = " + details[12];
   log = log + "\n - property_is_index = " + details[13];
   log = log + "\n - property_is_unique = " + details[14];
   log = log + "\n - property_allow_null = " + details[15];
   log = log + "\n - property_order_level = " + details[16];
   log = log + "\n - property_default_value = " + details[17];
   log = log + "\n - property_format = " + details[18];
   log = log + "\n - property_force_sql_type = " + details[19];
   log = log + "\n - property_force_sql_alias = " + details[20];
   log = log + "\n - property_min_value = " + details[21];
   log = log + "\n - property_max_value = " + details[22];
   log = log + "\n - property_min_length = " + details[23];
   log = log + "\n - property_max_length = " + details[24];
   log = log + "\n - property_reg_exp = " + details[25];
   log = log + "\n - property_accessibility = " + details[26];
   log = log + "\n - property_is_relationship = " + details[27];
   log = log + "\n - property_relation_type = " + details[28];
   log = log + "\n - property_relation_entity_target_id = " + details[29];
   log = log + "\n - property_relation_inverse_property_id = " + details[30];
   log = log + "\n - property_relation_foreign_key = " + details[31];
   log = log + "\n - property_relation_foreign_key_owner = " + details[32];
   log = log + "\n - property_relation_extra_table = " + details[33];
   log = log + "\n - property_relation_type_desc = " + details[34];

   print(log); // print value to the custom script debugger window
   helper.print(log); // print value to the standard output (for example, on Windows, use the 'DebugView' application to see all logs)
   return details;
}


Get enumeration details

Here is an example to get all current enumeration parameters, helper.getEnumerationDetails(enumeration_id) :

var enumeration_id = params[15];
printEnumerationDetails(enumeration_id);

//...

function printEnumerationDetails(enumeration_id)
{
   var details = helper.getEnumerationDetails(enumeration_id);
   if (details.length == 0) { return details; }

   var log = "";
   log = log + "\n - enumeration_id = " + details[0];
   log = log + "\n - enumeration_key = " + details[1];
   log = log + "\n - enumeration_name = " + details[2];
   log = log + "\n - enumeration_namespace = " + details[3];
   log = log + "\n - enumeration_description = " + details[4];
   log = log + "\n - enumeration_version = " + details[5];
   log = log + "\n - enumeration_use_qt_enum_macro = " + details[6];
   log = log + "\n - enumeration_list_of_keys = " + details[7];
   log = log + "\n - enumeration_list_of_values = " + details[8];

   print(log); // print value to the custom script debugger window
   helper.print(log); // print value to the standard output (for example, on Windows, use the 'DebugView' application to see all logs)
   return details;
}


Get meta-data of entity/property/enumeration

QxEntityEditor application provides a feature to define some meta-data linked to entity, property or enumeration. These meta-data can be used for example to define extra-parameters not provided by default by QxEntityEditor application. These meta-data are available in generated C++ code (introspection engine of QxOrm library), and are also available in QxEntityEditor Javascript engine. Here is an example to get meta-data values in Javascript :

var entity_id = params[13];
var entity_meta_data = helper.getEntityMetaData(entity_id, "MY_ENTITY_META_DATA_KEY");

// ...

var property_meta_data = helper.getPropertyMetaData(property_id, "MY_PROPERTY_META_DATA_KEY");

// ...

var enumeration_id = params[15];
var enumeration_meta_data = helper.getEnumerationMetaData(enumeration_id, "MY_ENUM_META_DATA_KEY");


Get environment variable

Here is an example to get/set environment variables in Javascript, helper.getEnvironmentVariable() and helper.setEnvironmentVariable() :

var env_var = helper.getEnvironmentVariable("QT_DIR");
var set_env_var_ok = helper.setEnvironmentVariable("MY_ENV_VAR", "my_value");


Read and write to files

Javascript engine of QxEntityEditor application is able to read and write to files (whatever files on your system, not only exported files). Javascript classes file and dir are available to instantiate Javascript objects and to provide functions to manage files and directories.

The Javascript file class provides the same definition as QFile Qt class :

/*
   --- 'file' class methods available by script (QFile wrapper : http://doc.qt.io/qt-5/qfile.html) ---

   bool copy(string fileName, string newName);
   bool exists(string fileName);
   bool link(string fileName, string linkName);
   bool remove(string fileName);
   bool rename(string oldName, string newName);
   string readAll(string fileName);

   void setFileName(string name);
   string fileName();
   bool open(int mode); // enum QIODevice::OpenMode, for example : 26 = (QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text) = (2 + 8 + 16)
   int error(); // enum QFile::FileError
   void close();
   bool atEnd();
   string readLine();
   void write(string text);
*/


The Javascript dir class provides the same definition as QDir Qt class :

/*
   --- 'dir' class methods available by script (QDir wrapper : http://doc.qt.io/qt-5/qdir.html) ---

   void setPath(string path);
   string path();
   string appPath();
   string homePath();
   string rootPath();
   string tempPath();

   string fromNativeSeparators(string pathName);
   string toNativeSeparators(string pathName);

   string cleanPath(string path);
   bool isAbsolutePath(string path);
   bool isRelativePath(string path);
   bool match(string filter, string fileName);

   bool mkdir(string dirName);
   bool mkpath(string dirPath);
   bool rmdir(string dirName);
   bool rmpath(string dirPath);
   bool exists(string name);

   bool cdUp();
   bool cd(string dirName);
   string absoluteFilePath(string fileName);
   string absolutePath();
   string canonicalPath();
   string dirName();
   string filePath(string fileName);
   void refresh();
   string relativeFilePath(string fileName);

   bool isAbsolute();
   bool isReadable();
   bool isRelative();
   bool isRoot();
*/


Example : read a file content :

var f1 = new file();
var f1_content = f1.readAll("C:\\Temp\\my_file.txt");


Other example : write to a file :

var f2 = new file();
f2.setFileName("C:\\Temp\\file_generated_by_script.txt");
f2.open(26); // (QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text) = (2 + 8 + 16)
f2.write("aaa");
f2.write("bbb");
f2.close();


Get list of entities/enumerations of a project

Here is how to get all entities and enumerations of a *.qxee project :

var listOfAllEntities = helper.getListOfAllEntities(); // 'listOfAllEntities' variable is an array, each item of this array contains : <entity_id>|<entity_name>
var listOfAllEnums = helper.getListOfAllEnums(); // 'listOfAllEnums' variable is an array, each item of this array contains : <enum_id>|<enum_name>


Add a custom action (placeholder) in C++ export template

C++ export plugins provide a setting to define template files to use during export : Header *.h and Source *.cpp. QxEntityEditor application provides several C++ templates by default, and it is possible to define your own C++ template (option « Custom »). Header *.h and Source *.cpp C++ templates contain some placeholders (@@ACTION@@ format) to replace code by calculated value. Placeholder is the most important part to understand how Javascript customization engine works. Please note that you can define your own custom placeholder with @@CUSTOM_ prefix, for example : @@CUSTOM_MY_ACTION@@.

Here is an example to test current action code (so current placeholder inside call context) with the Javascript engine :

/* you can define your own placeholder in the template, it must start with @@CUSTOM_, for example : @@CUSTOM_MY_ACTION@@ ==> then, in the custom script, check if you are processing your custom action with this code : */
var action = params[5];
if (action == "CUSTOM_MY_ACTION")
{
   return "quit with my custom code here";
}


Script example : add automatically Q_PROPERTY definition on all generated C++ properties

Here is a documented script (deployed with QxEntityEditor package in ./samples/q_property.js file) to add automatically Q_PROPERTY macro definition to all properties of a *.qxee project :

({

/* ----------------------------------------------------------------------------------------
   ----------------------------------------------------------------------------------------
   'q_property.js' : custom javascript file to customize QxEntityEditor C++ export process.
   This script is an example to show how to use QxEntityEditor javascript engine to add a Q_PROPERTY definition for each property generated by QxEntityEditor.
   More details about Q_PROPERTY macro on Qt web site : http://doc.qt.io/qt-5/properties.html

   To use this javascript file :
      1- go to the main menu of QxEntityEditor 'Tools >> Export to C++ project (settings)' ;
      2- select the C++ template 'qx::IxPersistable + QObject' : now generated entities will inherit from QObject, which is required to use the Qt Q_PROPERTY macro ;
      3- in the field 'Custom script file' : put the location of this 'q_property.js' custom javascript file ;
      4- save the settings and start the C++ export process ;
      5- check generated files : Q_PROPERTY should be added automatically by the export process.
   ----------------------------------------------------------------------------------------
   ---------------------------------------------------------------------------------------- */

// Here is the entry point of the QxEntityEditor javascript engine
// This function is called for each placeholder defined in the C++ template section
customProcess : function(params)
{
   try
   {
      // We use here the @@MACRO_QX_PERSISTABLE_HPP@@ placeholder which is present in the default C++ template 'qx::IxPersistable + QObject'
      // You could also create your own custom C++ template (based on 'qx::IxPersistable + QObject' template), and create your own placeholder (which must be prefixed by @@CUSTOM_), for example : @@CUSTOM_Q_PROPERTY@@
      var action = params[5];
      if (action != "MACRO_QX_PERSISTABLE_HPP") { return params[0]; } // quit with 'params[0]' means : doesn't change the default export behaviour

      // Check if we have an entity
      var entity_id = params[13];
      if ((entity_id == "") || (entity_id == "0")) { return params[0]; } // quit with 'params[0]' means : doesn't change the default export behaviour

      // Get the list of properties
      var entity_details = helper.getEntityDetails(entity_id);
      var entity_list_of_properties_id = ((entity_details.length > 0) ? entity_details[10] : "");
      var entity_list_of_properties_array = entity_list_of_properties_id.split("|");
      if (entity_list_of_properties_array.length <= 0) { return params[0]; } // quit with 'params[0]' means : doesn't change the default export behaviour

      // Prepare output string
      var output = params[0] + "\n";

      // Iterate over each property
      for (var idx = 0; idx < entity_list_of_properties_array.length; idx++)
      {
         // Get property details
         var property_id = entity_list_of_properties_array[idx];
         var property_details = helper.getPropertyDetails(property_id);

         // Here you could also get property meta-data that you can define in QxEntityEditor, property parameters screen, section 'List of meta-data'
         // This is a way to manage your own property parameters which are not a part of QxEntityEditor
         // It could be useful for example to manage some Q_PROPERTY settings like : RESET, NOTIFY, REVISION, DESIGNABLE, SCRIPTABLE, FINAL, etc...
         // To get a property meta-data value, just write this code : var my_meta_data = helper.getPropertyMetaData(property_id, "MY_META_DATA_KEY");

         // Get property type and name
         var property_type = property_details[5];
         var property_name = property_details[2];

         // Check if property type can be used with Q_PROPERTY macro
         if (list_of_compatible_property_type.indexOf(property_type) == -1) { continue; }

         // Create Q_PROPERTY definition
         output += "\n   Q_PROPERTY(" + property_type + " " + property_name + " READ get" + property_name + " WRITE set" + property_name + ")";
      }

      return output;
   }
   catch (err)
   { return ("[CustomScriptError] an unexpected error occurred : " + err); }
}

});

// Here is a list of C++ types compatible with Qt Q_PROPERTY macro (C++ type can be converted to/from QVariant)
// You can of course register your own C++ types to be able to use them with Q_PROPERTY macro (using Qt Q_DECLARE_METATYPE() macro)
// So the following array is not fixed : you can add all C++ types you want...
var list_of_compatible_property_type = [ "QBitArray", "QBitmap", "bool", "QBrush", "QByteArray", "QChar", "QColor", "QDate", "QDateTime", "double", 
                                         "QUuid", "QFont", "QVariantHash", "QIcon", "QImage", "int", "QLine", "QLineF", "QVariantList", "qlonglong", 
                                         "QVariantMap", "QMatrix", "QMatrix4x4", "QPixmap", "QPoint", "QPointF", "QPolygon", "QPolygonF", "QRect", "QRectF", 
                                         "QRegExp", "QRegion", "QSize", "QSizeF", "QString", "QStringList", "QTime", "uint", "qulonglong", "QUrl", 
                                         "QVector2D", "QVector3D", "QVector4D" ];


Enable Javascript debugger editor

Javascript engine of QxEntityEditor application provides a native Javascript debugger. This debug environment provides all required features to help you to develop and fix your custom scripts :
  • define breakpoints ;
  • step-by-step mode to go from a code line to another code line during export execution ;
  • display all variables and their values during export execution ;
  • display logs window.

By default, QxEntityEditor Javascript debugger is disabled during an export. To enable it and show the debug editor, you can :
  • go to export settings, define a script to use, then click on « Debug custom Javascript file » button ;
  • or press the SHIFT keyboard shortcut before starting an export process.

JS debug

Execute custom scripts (shell/bat) before/after plugin execution

QxEntityEditor application provides a way to define some custom scripts *.bat (Windows), *.sh (Linux) or even executables to run before and/or after a QxEntityEditor plugin execution. Each script (or process) is called with 1 input parameter : the current *.qxee project location. This feature can be used for example to :
  • put generated files to a source control (Git, Perforce, CVS, etc...) ;
  • run compilation process for a generated C++ project ;
  • execute unitary tests or start an automation server like Jenkins for example ;
  • modify some values in the *.qxee SQLite database project file after importing from a database structure.

To define these scripts or executables to run before and/or after a QxEntityEditor plugin execution, just go to the main menu : Tools >> Plugins scripts.

Plugin scripts

Note : you can put in this list an absolute path to your script, or a relative path to *.qxee project file. For example, ./my_script.sh means that my_script.sh file must be located in the same directory as *.qxee project file.

QxEntityEditor command-line interface

QxEntityEditor provides a command-line interface to run the application with some parameters. We will detail in this chapter some QxEntityEditor calling examples :


-- Example n°1 : run QxEntityEditor defining a *.qxee project to load at startup (--project parameter) :
QxEntityEditor --project="c:\test\qxBlog.qxee"


-- Example n°2 : run QxEntityEditor without displaying the user interface (--no_gui parameter), defining a *.qxee project to load (--project parameter) and executing automatically a C++ export process (--plugin parameter) :
QxEntityEditor --no_gui --project="c:\test\qxBlog.qxee" --plugin=QxEECppExport


-- Example n°3 : run QxEntityEditor in read-only mode (--viewer_mode parameter), this parameter can be used to open large *.qxee projects without any registered license key :
QxEntityEditor --viewer_mode


-- Example n°4 : run QxEntityEditor tracing all SQL logs (--log_sql parameter), this parameter logs all SQL queries executed to *.qxee SQLite database :
QxEntityEditor --log_sql


-- Example n°5 : run QxEntityEditor loading a *.qxee project from a JSON file :
QxEntityEditor --project="<path_to_your_qxee_project_file>" --plugin=QxEEJsonImport --QxEEJsonImport_file="<path_to_your_json_file>"




QxOrm © 2017 Lionel Marty - contact@qxorm.com