Sample inventory application using simple-jpa 0.8
02 Februari 2015 1 Komentar
As a companion for simple-jpa 0.8, there is a demo application called simple-jpa-demo-inventory. You can find its source code in https://github.com/JockiHendry/simple-jpa-demo-inventory. To run this project, you must have Griffon 1.5 and Groovy 2.3.
This demo application will ask for username and password everytime it is launched:
This feature is enabled by adding the following line in
griffon.simplejpa.auditing.loginService = 'UserService'
UserRepository creates a new user called
admin if it doesn’t exist. The default pasword for
12345. So you can login by entering
admin as user and
12345 as password. You can change default password or creating new user later by using MVC group
User. You can even change which menu is displayed for each user.
See Auditing In simple-jpa Documentation for more information about auditing in simple-jpa 0.8.
After login, main screen will be displayed. This is the startup group which is configured in
simple-jpa 0.8 now uses a tabbed pane to display instances of MVCGroup. You can display more than one instances of the same MVCGroup. For example, you can open two instances of MVC group
Laporan (report), each displaying different report. You easily compare them just by switching tab.
In simple-jpa 0.8, you can add
glazedTable() to add popup menu for that table. For example, in this picture, I can click on Tampilkan Referensi to display related invoice in a new tab:
See View In simple-jpa Documentation for more information about presentation layer in simple-jpa 0.8.
simple-jpa-demo-inventory uses simple-escp to print invoices to dot matrix printer. All invoice layouts are saved in database. They’re handled by
TemplateFakturRepository. User can change or reset existing templates by displaying MVCGroup
TemplateFaktur. This will open JSON editor where user can edit JSON template used by simple-escp.
By taking the advantage of Groovy as dynamic language, simple-jpa-demo-inventory even allows user to run custom code on the fly without redeploying entire application.
You can find unit test cases in
test/unit folder and integration test cases in
test/integration. They’re used to test domain classes, services, and repositories. Beware that running integration tests will take a long time because they need to actually hit database and every test cases always repopulate tables. You’re not limited to use Microsoft Excel 97 format because now simple-jpa 0.8 can read test data in form of Office Open XML format (used by Excel 2007 and later).
See Testing In simple-jpa Documentation for more information about testing in simple-jpa 0.8.