Application Re-generation
During the course of development, the data model of the application undergoes constant changes. For example, new tables may be added, existing tables may be deleted, existing tables’ fields may be updated, new relationships may be added among tables and existing relationships among tables may change.
Additionally, you may want to add new add-ons or remove already added add-ons to the generated application. Similarly, you may want to change the settings (ex: default sort fields) used in the previous application generation.
To accommodate these changes, fastCode provides a mechanism to seamlessly update an application from the application portal. Note that we are currently not allowing updates to the sample DVD Rental application as this application is supposed to be used to understand how fastCode application generation works.
Application Generator
The application generator can be used to not only to generate the initial application, but to also update the generated application. The initial application generation and the subsequent update process involves the following steps:
-
Generate the application the first time from the application portal using the application generator
-
Update the application from the application portal
-
The application update performs the following steps:
(a) Checks that there are no uncommitted changes in your current application master branch
(b) Re-generates the application and checks it into a new git branch named upgrade_application
(c) Automatically merges the code in your application master branch with the code in the upgrade branch
(d) Displays the list of merge conflicts that you may need to resolve manually
Extension mechanisms
The following entity-related artifacts have corresponding extension class files:
-
Repository Interface
-
Application Service Interface
-
Application Service Implementation Class
-
Rest Controller
We haven’t provided extension classes for entities because whatever changes you make to entities will be reflected in the database, and during the code re-generation on an update, entities will be re-generated from the database, preserving your entity changes.
Any changes you make to the above-mentioned artifacts need to be made to the corresponding extension artifacts that override the core artifacts.
During the update, the extension artifacts are not re-generated. Therefore, the changes you have made in these extension artifacts will be preserved.
Manual code changes after an Update
In some cases, after an update, you may need to make manual changes to the updated application in order to make it work. Specifically:
The Navigation Bar component related files
When we update an app, any changes (for example, adding navigation because we added scheduler add-on) to the application's navigation are made in the base navigation component because only the base component is updated. These changes need to be copied over to the extended Navigation Bar component related files. Specifically, the following two files need to be manually updated:
src/app/extended/core/main-nav/ main-nav.component.ts
src/app/extended/core/main-nav/ main-nav.component.html
Entity Relationship related files
Prior to the update, if a table is removed and it had relationships with existing tables, we need to remove the import statements and the constructor parameter for the (removed) table from related entities' extended AppService and extended controllers.
Similarly, if a table is added, and it had relationships with existing tables, we need to add the import statements and the constructor parameter for the (added) table to the related entities' extended AppService and extended controllers.
Reporting module related file changes
When we remove the reporting module during an update, in addition to updating the navigation component related files as previously mentioned, we also need to also remove the import statements and constructor parameter in the UserAppserviceExtended class.
Similarly, when we add the reporting module during an update, we need to add the import statements and the constructor parameter in the UserAppserviceExtended class.
Entity history module related file changes
When we add Entity History add-on during an update, in addition to updating the navigation component related files as previously mentioned, we also need to add the import statements and the annotation @JaversDataAuditable to all the repository extended classes. For the front-end, we also need to update the following two files and add the EntityHistoryComponent:
src/app/extended/admin/admin.module.ts
src/app/extended/admin/admin.routing.ts
Similarly, when we remove the Entity History add-on during an update, in addition to updating the navigation component related files as previously mentioned, we also need to remove the import statements and the annotation @JaversDataAudditable from all the repository extended classes. For the front-end, we also need to update the following two files and remove the EntityHistoryComponent:
src/app/extended/admin/admin.module.ts
src/app/extended/admin/admin.routing.ts
Updated over 2 years ago