Skip to content

informatici/openhospital-core

Repository files navigation

Open Hospital - Core

Java CI

This is the Core component of Open Hospital: it contains the business logic and the data abstraction layer.
The Core component is used by the Java Swing desktop GUI, and by the web UI (through the API component).

How to build

After having installed Java JDK 17+ and Maven (or using the provided Maven Wrapper mvnw), to build this project issue:

mvn package

To use the Core component in the other projects, you'll need to install it locally with:

mvn install

To run the tests simply issue:

mvn test

Note: tests are run against an in-memory database (H2).

To run tests against a MariaDB instance:

you can change src/test/resources/resources/database.properties

From:

jdbc.class=org.h2.Driver
jdbc.url=jdbc:h2:mem:myDb;MODE=MySQL;IGNORECASE=TRUE;DB_CLOSE_DELAY=-1

hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.hbm2ddl.auto=update
jdbc.username=root
jdbc.password=root

To:

jdbc.url=jdbc:mysql://localhost:3306/oh
jdbc.username=isf
jdbc.password=isf123

Then, run the Docker container in the root folder with:

# clean previous builds
docker compose rm --stop --volumes --force

# build and run a mariadb instance at localhost:3306
docker-compose up

How to run Open Hospital

To run Open Hospital, you'll need a user interface, which is provided in the GUI and in the UI projects.
Please follow the instructions in the documentation of those repositories.

How to contribute

You can find the contribution guidelines in the Open Hospital wiki.
A list of open issues is available on Jira.

Community

You can reach out to the community of contributors by joining our Slack workspace or by subscribing to our mailing list.

Code style

This project uses a consistent code style and provides definitions for use in both IntelliJ and Eclipse IDEs.

IntelliJ IDEA instructions

For IntelliJ IDEA the process for importing the code style is:

  • Select Settings in the File menu
  • Select Editor
  • Select Code Style
  • Expand the menu item and select Java
  • Go to Scheme at the top, click on the setting button by the side of the drop-down list
  • Select Import Scheme
  • Select IntelliJ IDE code style XML
  • Navigate to the location of the file which relative to the project root is: .ide-settings/idea/OpenHospital-code-style-configuration.xml
  • Select OK
  • At this point the code style is stored as part of the IDE and is used for all projects opened in the editor. To restrict the settings to just this project again select the setting button by the side of the Scheme list and select Copy to Project.... If successful a notice appears in the window that reads: For current project.
Eclipse instructions

For Eclipse the process requires loading the formatting style and the import order separately.

  • Select Preferences in the Window menu
  • Select Java
  • Select Code Style and expand the menu
  • Select Formatter
  • Select the Import... button
  • Navigate to the location of the file which relative to the project root is: .ide-settings/eclipse/OpenHospital-Java-CodeStyle-Formatter.xml
  • Select Open
  • At this point the code style is stored and is applicable to all projects opened in the IDE. To restrict the settings just to this project select Configure Project Specific Settings... in the upper right. In the next dialog select the openhospital repository and select OK. In the next dialog select the Enable project specific settings checkbox. Finally select Apply and Close.
  • Back in the Code Style menu area, select Organize Imports
  • Select Import...
  • Navigate to the location of the file which relative to the project root is: .ide-settings/eclipse/OpenHospital.importorder
  • Select Open
  • As with the formatting styles the import order is applicable to all projects. In order to change it just for this project repeat the same steps as above for Configure Project Specific Settings...