Commit 2f5fcb4d authored by Thomas Huster's avatar Thomas Huster

[11322] updated technical documentation

parent 85e1265b
Pipeline #11431 passed with stages
in 4 minutes and 23 seconds
h2. Persistence Model
It represents the Implementation of the business model interfaces defined in this bundle. Implementation bundles are.
Represents the implementation of the business model interfaces defined in this bundle. It is represented by the following bundles.
* **ch.elexis.core.jpa** contains the actual database table definition, an logic to initialize and update it (based on liquibase). Also contains an **ch.elexis.core.jpa.entitymanager.IElexisEntityManager** implementation for managed (ThreadLocal) JPA EntityManager access.
* **ch.elexis.core.jpa.entities** the elexis JPA persistence unit containing all known entities is defined in this bundle.
* **ch.elexis.core.jpa** contains the actual database table definition, and logic to initialize and update the database (based on liquibase). Also contains an **ch.elexis.core.jpa.entitymanager.IElexisEntityManager** implementation for managed (ThreadLocal) JPA EntityManager access.
* **ch.elexis.core.jpa.entities** the elexis JPA persistence unit definition, **all** known entities are defined in this bundle.
* **ch.elexis.core.jpa.datasource** provides the configured database connection (JDBC connection pool) for the JPA Implementation.
The JPA persistence is based on the following interfaces and classes.
......@@ -16,7 +16,7 @@ h3. Service Interfaces
h3. Abstract Classes
* **ch.elexis.core.jpa.model.adapter.AbstractModelService**, service implementation for load, query and save model objects. Helps with creation of *ch.elexis.core.services.IModelService* services. Implementations are made public as OSGi Services.
* **ch.elexis.core.jpa.model.adapter.AbstractModelService**, service implementation for load, query and save model objects. Helps with creation of *ch.elexis.core.services.IModelService* services. Implementations are made public as OSGi services.
* **ch.elexis.core.jpa.model.adapter.AbstractModelAdapterFactory**, model factory implementation used to create new model instances. Maps the public model to the model implementation and the JPA Entity definition. It is used within the model service implementation an should not be made public.
* **ch.elexis.core.jpa.model.adapter.AbstractModelQuery**, JPA based query implementation for building complex queries on model objects. It is used within the model service implementation an should not be made public.
......@@ -26,7 +26,7 @@ h3. Model and JPA Entity
The persistence bundle contains the model service implementations, and has a public API for usage of the model. It is best practice that the public API is mostly interfaces defining the model. The actual implementation should be internal. All JPA entities need to be implemented and registered (META-INF/persistence.xml) in the *ch.elexis.core.jpa.entities* bundle.
The model interfaces can be coded, or or generated via an EMF model. If the model is generated, the resulting interfaces shall be plain Java without dependencies on EObject.
The model interfaces can be coded, or generated via an EMF model. If the model is generated, the resulting interfaces shall be plain Java without dependencies on EObject.
The benefits of using a EMF model to specify the public API are.
* model property literals can be used on queries
......@@ -42,3 +42,9 @@ If a EMF model is used to specify the model, the following settings of the genmo
The actual model implementation will typically extend the *ch.elexis.core.jpa.model.adapter.AbstractIdModelAdapter* or one of its sub classes. This makes the implementation an adapter class, which adapts the JPA Entity to the model interface.
h2. Query
The **ch.elexis.core.services.IModelService** implementations provide access to queries on their model. There are different query implementations available for executing specific queries.
* **ch.elexis.core.services.IQuery** used to build queries with dynamic constraints.
* **ch.elexis.core.services.INamedQuery** used to create named queries that are defined on the entity implementation. Used for queries with static constraints.
* **ch.elexis.core.services.INativeQuery** used to create complex native queries.
\ No newline at end of file
......@@ -2,7 +2,11 @@ h2. Business Model
The business model interfaces defined as EMF ecore model (model/model.ecore) of this bundle. Additionally service interfaces that provide additional functionality to those model objects are defined.
The JPA based implementation of this model is provided in other bundles. See <a href="../ch.elexis.core.jpa/readme.textile">ch.elexis.core.jpa</a>.
The following diagram shows the basic components using the lab importer as example.
<img src="core_model_example.png" alt="" height="60%"/>
The JPA based implementation of this model is provided in other bundles. See <a href="../ch.elexis.core.jpa/readme.textile">ch.elexis.core.jpa</a>. **For hints on usage of the model taking a look at the test fragments is recommended.**
h3. Code Elements
......@@ -15,13 +19,13 @@ h4. Service Interfaces
h3. Billing
Code Elements for billing must implement the interface *ch.elexis.core.model.IBillable*.
Code Elements for billing must implement the interface *ch.elexis.core.model.IBillable*. Typical implementations are articles or health care services.
h4. Optifier
The *ch.elexis.core.model.IBillableOptifier* implementation contains the logic how a *ch.elexis.core.model.IBilled* instance is created representing the billed amount of the *ch.elexis.core.model.IBillable*.
The *ch.elexis.core.model.billable.AbstractOptifier* provides the method to add the *ch.elexis.core.model.IBillable* to the billed of an *ch.elexis.core.model.IEncounter*. If it was billed before that information will be updated. Sub classes need to implement the *setPrice* method to apply the price of the *ch.elexis.core.model.IBillable* to an *ch.elexis.core.model.IBilled* instance.
The *ch.elexis.core.model.billable.AbstractOptifier* provides the method to add the *ch.elexis.core.model.IBillable* to the list of billed of an *ch.elexis.core.model.IEncounter*. If the same IBillable was billed before that information will be updated. Sub classes need to implement the *setPrice* method to apply the price of the *ch.elexis.core.model.IBillable* to an *ch.elexis.core.model.IBilled* instance.
h4. Verifier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment