360 likes | 571 Views
Develop a Simple CRUD Application in Minutes with CUBA Platform. Ob j e c t i v es.
E N D
Develop a Simple CRUD Application in Minutes with CUBA Platform
Objectives • This documentwillguideyouthroughsomekey featuresoftheCUBAPlatformframeworkandshowhowyoucanrapidly create a Full Stack CRUD application from an existing database. • It is presented as a Hands-on-Lab. • Estimated time to complete this lab is 15 minutes. • Actual development time is less than 5 minutes. • The audience is assumed to have a basicknowledgeof an RDBMS
WhatisCUBAPlatform? AhighlevelJavaframework forrapidenterprisesoftwaredevelopment.The platformprovidesarichsetoffeatures: Richweb/desktopUI CRUD Role basedandrowlevelsecurity Reporting Charts Fulltextsearch REST-API Scalabledeployment ● ● ● ● ● ● ● ●
Why the CUBAPlatform? Reduces code that a developer must write
Whtearegingtoutomate What wearegoingtoautomate
What we are going to automate • Generation of a data model, mapped to the legacy DB • The database update to match the CUBA Platform requirements • Generation of standard CRUD UI
Whatwearegoingtoautomate Applicationfeatures Ourapplication will: HaveRichWebUI, withAjax communicationPerformbasic CRUDoperations Provide web application access from desktop or mobile devices Allowustocreate mobileapplications orwebsite usingREST-API ● ● ● ● ● ● ● Just5 minutes of development time - andwearereadydemo!
Environmentand tools Developmentenvironment CUBAStudiohttps://www.cuba-platform.com/download Existing PostgreSQL database called world
WhatisCUBAStudio? Gettingstarted CUBAStudio–aweb baseddevelopmenttoolthat Offersaquickwaytoconfigureaprojectand describe data model Manages DBscripts Enablesscaffoldingand visualdesignforthe userinterfaceWorks in parallelwithyour favoriteIDE: IntelliJIDEAorEclipse ● ● ● ●
Createanewproject Gettingstarted ClickCreate Newonwelcomescreen Fillupprojectname:workshop ClickOKand you’llgetinto theCUBAStudio workspace
CUBAStudioworkspace Gettingstarted UsingCUBAStudio youcaneasily createEntities, Screensand stubs forServices. Youcan hide/showtheHelp panelusing menuHelp - Show helppanel 1. ClickEditintheProjectPropertiessection
Projectproperties screen Gettingstarted This isa pagewhereweconfigureourproject. TheCUBAPlatformsupportsPostgreSQL,MSSQL, OracleandHSQL databases.
Database We Already Have a Database PostgreSQL database PostgreSQL version of MySQL World database
Database UI Connection to the Database Using JPA and the Data Model The User Interface does not communicate directly with the database. Instead JAVA Classes are created for each table or view in the database and the programs communicate with those classes via a REST API In CUBA Studio we specify which tables or views we need to access and create a Data Model for each table or view. CUBA Automatically creates REST API’s when it generates the data model. We then specify the type ofuser interface we need to access the REST APIs that represent the Data Model.
Database Database Access with JPA in CUBA Platform CUBA Studio reverse engineers the database to create JAVA CRUD Classes that correspond to each table These CRUD classes also implement REST APIs JAVA Classes are used by the application as proxies in conjunction with the Eclipselink JPA framework to access tables in the database We call these JAVA classes the Data Model or entities Our next step is to generate the Data Model
Generation of Data Model and UI’s Data model Press Data Model
Generation of Data Model and UI’s Data model Press Show tables
Generation of Data Model and UI’s Data model Press Select All Press Next
Screensscaffolding UserInterface Now let’screatestandardbrowserand editorscreens for theSparePartentity. SelectSparePartin thenavigationpanel ClickontheCreatestandard screenslink ClickCreate Onthisscreenwecan specifywhereto placethescreensand whichmenuitem willbeusedtoopenthebrowserscreen. Thefollowing terminologyis used: Browserscreen —screenwithlistof records Editorscreen —simple editformforrecord ● ●
Generate UI from Data Model UserInterface
Generate UI from Data Model UserInterface
Generate UI from Data Model UserInterface
UI UserInterface Let'stest it Ourapplicationisdone,of course,to afirstapproximation. Let’s compileand launchit! InvoketheRun - Startapplicationactionfromthe menu. Studio willdeploy alocalTomcatinstancein theprojectsubdirectory, deploy thecompiledapplicationthereandlaunchit. Opentheapplication by clickingalinkinthebottompartof theStudio.
Loginscreen Firstlaunchand CRUD Thesystem loginscreenhas appeared. This isastandardCUBAscreen,whichcanbecustomized, aseverything inCUBA, tomeetspecificrequirements. 1. ClickSubmitto login
Orderbrowser Firstlaunch Firstlaunchand CRUD Sincewehavenotchangedtheapplicationmenu, our items aredisplayedbydefaultunder theApplication menu. 1. OpenApplication— Ordersfromthemenu This isastandardbrowserscreenwithafilterontopand atablebelow.
Ordereditscreen UI Firstlaunch Firstlaunchand CRUD ClickCreateand enter thedescription SelectStatus:New Clickbutton[…]to selectaclientfor theorder
CRUD application UI Firstlaunch Firstlaunchand CRUD 1. ClickOKto savetheorder This isasmallworkingCRUD applicationthatwrites datato thedatabaseandallows youtosimplykeeptrackof orders. Wecansearch for ordersusingour Filter. Tablecomponentenables ustohideandchangewidthofcolumns.Alsoourtableis sortable.
Questions? Visitourforum https://www.cuba-platform.com/support