Migrating Legacy Databases to CUBA Platform
Hello, everyone, and welcome to our video devoted, to me greats and legacy databases, to Cuba platform. Sometimes. It appears that the underlined, stack of technologies, used for an application, is no longer appropriate for, the further software, development, and support, it may, happen for a big variety of reasons, you. Know technology is old it's not supported anymore, legacy, application, doesn't meet new technical, or customer, requirements, that are hardly implementable, using the old stack or, finally. You have to support an application. Developed, by a third-party company, but don't have enough experience and confidence, in the use of technology, today we are going to create two applications. Based on legacy databases, we. Will use cubes to do a specialized. Repeat application, development tool for cube applications, its, built-in migration, tool utilizes. The well-known reverse engineering, approach, during. The migration met. Information, extracted, from the legacy database, will, be used to complete the following steps automatically. Generate. A data model mapped, to the legacy database. Updated. Database to, match the Cuba platform requirements. Generate. Standard criteria as a result most, routine operations will, be hunted by cubes to do. For, the first example women, great world database based, on the my scale world sample it, has a list of cities countries, and what language they speak. Now. We are going to generate application. Based on this database. Let's. Create a new project click. Create new button on the welcome screen set. The project name to Warhawk, for. The remaining fields leave the default values, click. OK. Now. We need to make our application up, and running on PostgreSQL. Press. Edit on the project, properties panel. Said, that a base type to PostgreSQL. Make. Sure that that the base name is world, press. Okay. Now. Let's move on to model generating, from legacy database, open. The data model section on the left hand side navigation, panel, click. Generate model link Cuba. Will ask you to update the database, in order to create new tables required, for the generic platform functionality. Such, as security management, audit. Dynamic, attributes, and so on confirm. The update. Now, that the great model from database, window appears here, we will configure the mapping of the database, tables and de columns to entities and Dave fields, clicks all tables, as. A. Result the tables existent, in the database, appear, click. Select all, press. The next button at.
This. Stage we can make a fine grind mapping tune on the ladder of separate entities and de fields select. The country language table, click, the Edit mapping button, the. Table mapping editor dialog, is opened here we, can change class name package. Name entity. Name another. Thing we can adjust at this stage is instance name this, is a string representation of an entity that will be displayed in UI for example in the table cell or a drop-down, list using. These checkboxes you can add an implementation. Of some system interfaces. Tick. Creatable. Updatable. Soft. Delete and version. Checkboxes click. OK. Select. The country table, click. The edit mapping button. Tick. Creatable. Updatable. Solve, delete and versions, checkboxes, click. OK, select. The city table, click. The Edit mapping button. To, creatable. Updatable. Solve, the lid and version. Checkboxes, click. Ok click the, next button as a, stage we can automatically, generate crud, screens for the entities, to be able to manipulate with data for. Each entity we can choose the type of standard, screens not, only. Browser only editor. Both. Of them or single, screen if, the screen should not be created, during the model generation process, they. Might be created later by studio means and check, rate standard screens. Click. Next. Then, the database is important, cause for new system attributes should be added to tables, so. The Chris Poland Update scripts are generated, click, the run all scripts button studio. Works us that the new model classes and screens will be created in the project and all, input scripts will be saved to the corresponding, subdirectory and launched, click. OK. Click. Close. Our application. Is done let's, compile, and launch it in, were clear on start, application action. From the menu video, we'll deploy a local tomcat instance in the project subdirectory the. Political, part application, there and launch it open, the application by, clicking a link in the bottom part of the studio.
After, Successful login let's offer you our auto-generated. Current application, open, application. Cities. Here. You can see a list of cities with values, from our imported, database, we, can create new cities and edit existing ones. Open. Application, countries, here. You can see list of countries with values from our imported database, open. Application, country languages. Here. We can see list of country languages, with values from our imported, database. Let's, have a short overview of the victim application, we are going great, we. Have picked the initial sample project, for a fictional Museum clinic publish it on the Microsoft, website application. Is based on the Microsoft, light switch which, was officially abandoned. By Microsoft, the. Sample is a standard, free tier application, you. Must raise the major features, of light switch crates. And data model, screen. Scarf alden had calculated, attributing, entities, cubic. System tables, will be created in the same database as well as these, changes will not affect the tables used by the light switch application. The, outline switch application, will retain the ability to run on the same database let's. Have a look at the user interface of the light switch application. The. Application has, a classical, layout for enterprise, software there. Is the main menu of the application, screens. Are opening as tabs in the same window. You. So, let's, create a new project, click. Create new button on the welcome screen set. The project name to vision clinic for. The remaining fields leave the default values click. OK. Now, we need to set up the connection to the vision key in the database, press. Edit on the project properties panel. Set. Database, type to Microsoft. SQL Server 2012. Make, sure the database, name is vision, clinic set, password for your s8 account. Click. Test connection if. You get the connection successful, message click, OK to save the changes now. Let's move on to mono generating, open, the data model section, click. The generate, model, link click, the setting button on the top panel to configure, the global mapping options in our, example, both frameworks track, who and then created, or updated records, in the database so, model, predefined, cubic fields to the current polling system columns, in the existing, database, which, exist in most tables. Raw. Version is another system : yield by light switch for optimistic, locking, unfortunately. It can be mapped to the version column, you look by the platform for the same purpose, because, the types of those fields do not match we. Could add another field to support optimistic, locking for the cube application, but, as we have decided to avoid change at the structure, of the existing tables, we, will globally, exclude this column from weapon click. The plus button to, add a new exclude, mapping, enter, name pro version and click OK to save the settings, click. Show tables. Click. Select all press. The next button. By. A collection of images in cuba should be name it in singular form mainly. Because you do auto generates, default strings use it in the user interface, for example, in menu, items, and screen, names so. We will modify entities, to be caught in the singular form. Till. The appointments. Table click, the edit mapping button edit, the class name appointment. Into. The name vision. Clinic appointment. Click, OK, let's, do the same mappings, for the rest entities name it in pure invoice. Details, invoices. And patients. Click. The invoice details table, click. The Edit mapping button edit, the class name invoice. Detail click. OK, select. The invoices, table click. The Edit mapping button edit. The class name invoice, click. OK, select. The patient's table click. The Edit mapping button edit, the. Class name patient. Click. OK. Select, the product table click. Edit mapping sell the product name field in the instance name column, combo box click. OK click the, next button. For. Invoice and product select non for standard screens as we will turn this entities, a bit for. In one detail and product rebate we, need only editor as they, will be used between invoices. And products, respectively. For, appointments. Select single screen. Click. Next.
Update Scripts have been generated for the existing tables, just as planned click, Save to proceed. Click. OK. Click. Close. Now. We need to configure our entities, to marginalise, of each application, select, the invoice entity, click, Edit. Analysis. I want to money relation, to invoice details, so, let's add this relation, click. The new button under. The attributes, table set. Name details. Attribute. Type composition. Type. In waste detail. My, pepper field is filled automatically. As in worse detail has linked to the invoice, entity, click, Add, now. Pay attention that invoice status attribute, has, integer type let's, have a look on how this attribute, is represented, in the light switch application. We, can see that this attribute, is represented, as an enumeration, so, let's create the invoice status enumeration. Click, OK to save the entity. Click. New enumeration. That, classname invoice. Status click. Add. Set. Name active. Set. IG 0, click. Add set. Name paid, set. I see one, click, Add set. Name overdue. Set, ID to. Click. OK. Now, let's change type of invoice date from, integer to invoice status, send. The invoice entity, click. Edit tilt. Invoice status attribute, change. Attribute, type to UNAM, set. Type invoice, status, click. OK to stop the entity. Now. Let's configure the appointment. Entity select. The appointment entity, click. Edit. Pay, attention that appointment. Type attribute, has integer type in the, last each application this attribute, presented, as an enumeration, so, let's create the appointment, type enumeration. Click. OK to save the entity, click. New enumeration. That, classname appointment. Type click. Add, set. Name annual. Set. ID 0. Click, Add set. Name follow-up. Set. ID 1, click, Add, set. Name emergency. Set, ID to, click. OK. Now, let's change type of appointment, type attribute, from integer, to appointment, type say. The appointment, entity, click. Edit, select. Appointment, type attribute, change. Attribute, type to Anam set, type appointment. Type click, OK to save the entity. Now, let's, configure the product entity, select. The product entity click, Edit. Products. Have one to money relation, to product rebates so, let's add this relation, is a new button under the attributes, table set, name rebates. Attribute. Type composition. Type. Product, rebate. Method. By field is filled automatically. As product, rebate has linked to the product entity click. Add. Click. OK to save the entity. Let's. Have a look at the light switch application, one more time. For. Products i see current price attribute. For. Invoices, tax subtotal. Total, attributes, but, I don't see such attributes in, the data model this, is because these attributes, are calculated. Now, we are going to add this attribute to, our application. Silca, the invoice detail entity, click. The idea button, the. Studio will generate product files and open the product in the IDE. Here. We can see the source code of the invoice detail entity, let's, add method, for calculating subtotal. Value. You. Our method, is annotated, with meta property annotation. This annotation, indicates, that metadata, should include, the annotated attribute, this notation can be set for a field or for a getter method, if there is no corresponding field meta, property is mainly used for defining, non-precision. Attributes, of the entities open. The source code of the invoice entity. Let's add methods, for calculating tax, subtotal. And total, values. You. Open. The source code of the product entity. Let's, add method, for calculating current, price where you. You. Now, we need to add the localization, keys for our meta properties. Open. The message properties, file inside entity, package and add the following localization. Keys. You. Now, we're ready to create standard screens for invoice and product, entities, select. The invoice entity. Click. New generic, UI screen, select. Entity browser editor and. The voices have relation, to the invoice detail, and patient, entities, so our, data source should lower these fields along with the simple fields of the invoice entity, for. That purpose cube use we use an XML, description of, what entity attribute, should be loaded from the database, click. The plus button to create a new view specify. The name invoice, browse, select. Invoiced, patient, attribute, and specify the minimal, system view for it select. Details attribute. And specify, the local, system view for it, select. Product Product ID attribute, and specified, the local system view for it, select. Subtotal, attribute. Also. Select subtotal, tax and total attributes. Click. OK to save the view. Specify. The same view for the Edit view field, click. Create click. Close. Select. The product entity, click. New generic, US screen, select. Enter browser editor.
Specify. The minimum view for Browse view field. Similarly. To what we did for the invoice entity, click the plus button to create an extended edit view for the product entity. Rename. The view to product edit select. Rebates attribute, and specify the local system view for it. Select. Current price attribute, click. OK to save the view, to. Create click. Close. Let's compile, and launch our application. To see what we have for now in. Work the run start application action. From the menu. Open, the application by clicking a link in the bottom part of the studio. Open. Application, appointments. Here. We see the master detail screen, with appointments. Appointment. Type is represented, with enumeration. Application. Patience. Here. We see the list of patients. Open. Application, invoices. Here. We see the matter details screen with invoices, the. Way status, is represented, with enumeration. The detail part of the screen is represented, with two tabs the first, tab is for mining formation, the. Second tab is a list of related entities. Application, products. Here we see the masa details screen with products, the detail part of the screen is represented. With two tabs the, first stop is from my information. The second tab is a list of related entities. The product screen is missing the similar products, table and the product image with, cuba platform and studio we can easily polish, it up to look similarly, to the original, screen from the light switch application. Go. To the studio. Open. The generic UI section, select. Product, browse and click Edit. Then, you group both to the main top. You. That ID related. Products box. Set. Caption, related. Products, select. The main tab, set. Another product box for the expand field, at. A new table to the related products box. That. ID reloaded. Products, table. Set. Hey. 100%. Said. It's 100%. Go, to the data sources tab click. The new button set. Type collection. Data source. Classname. Product. I see. Related. Products ETS. View. Product. Edit and change. Square. You. Select. Annually, create a data source for the righted products table. Now, we need to add the components, for displaying product image text. Film group. Open. Context, menu and walk, up into each box. Select. Horizontal box. Sets, passing, through a new. Embedded component. To the horizontal box. Set. ID product, image. Align. Middle. Center. Hey, 250. Pixels and a new file upload, field component, to the horizontal box. So, tidy image. Upload a line, middle, center. Except. The, packet PNG, files, file. Size limit. Show. Clear button through select. Embedded, and file upload, field components. In whoa crap into deep, box. Select. Vertical box such. Passing, through click. OK to save the screen. Now we need to add water to convert byte array to image and vice versa, click, the ID button. Go. To the ID open. The screen controller. At. The, fall and methods. You. Now, we need to add invocation. Of these methods, and some logic for handling in which applaud. You. We, need to add generator, for product image column in the related products, table go. To the screen descriptor. A generator. Generated. Product image sell attribute, to the product image column. Additionally. At max, text length 32, the description, column. Now. Let's reopen the product screen and see our changes. You. The, main goal of our video is reached we created two applications, based on legacy databases, of that purpose, we use cuba studio at is built in migration tool as a, result we generated, a data model method, to the legacy database, updated. The database to imagine the queue applause from requirements, generated. Standard crud UI and editor business logic to merge the original, acacia thanks. For watching.