Sample inventory application using simple-jpa 0.8


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:

Login dialog

Login dialog

This feature is enabled by adding the following line in Config.groovy:

griffon.simplejpa.auditing.loginService = 'UserService'

UserRepository creates a new user called admin if it doesn’t exist. The default pasword for admin is 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 Application.groovy.

The startup MVC group

The startup MVC group

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.

Multiple tabs in `Main` MVC group

Multiple tabs in `Main` MVC group

In simple-jpa 0.8, you can add menuItem() to 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:

Popup menu in table

Popup menu in table

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.

Using simple-escp to print invoice

Using simple-escp to print invoice

Edit or reset invoice layout in JSON format

Edit or reset invoice layout in JSON format

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.

Launch Groovy Console from running application

Launch Groovy Console from running 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.

Perihal Solid Snake
I'm nothing...

One Response to Sample inventory application using simple-jpa 0.8

  1. Ping-balik: Belajar Menerapkan Domain Driven Design Pada Aplikasi Inventory | The Solid Snake

Apa komentar Anda?

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: