Commit 03e26d9a authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Cleanups and documentation.

parent 0290550d
# DB-based persistence of domain data
DB-based persistence is provided by (an implementation of) the **IDbAccess** interface. It includes life-cycle methods corresponding to CRUD operations, so by using these methods, the corresponding DB operations may be performed to keep the DB in sync with the local domain model object structure.
The implementation is split in three:
* **AbstractDbAccessImpl**: Implements the DB-independent logic, i.e. life-cycle of collections of linked domain objects.
* **DbAccessImpl**: Inherits from **AbstractDbAccessImpl** and adds DB logic using SQL.
* **DbAccessHelper**: Helper class for the DB access.
Note that identifiers are not part of the domain model and are handled by the **IdMap** class, which provides a pair of maps from a String identifier to/from domain objects of some type.
A class diagram of the main classes related to db-based persistence is shown below.
<img src="db-persistence-classes.png" alt="DB-based persistence" style="width: 800px;"/>
# JSON-based persistence of domain data
A class diagram of the main classes related to JSON-based persistence is shown below.
<img src="json-persistence-classes.png" alt="JSON-based persistence" style="width: 800px;"/>
JSON support is provided by means of the [Jackson library](https://github.com/FasterXML/jackson), and uses its technique for serializing/deserializing domain objects.
......@@ -9,32 +9,99 @@ import tdt4140.gr1800.app.core.GeoLocations;
import tdt4140.gr1800.app.core.Person;
/*
* CRUD interface for our domain:
* class diagram:
*
* @startuml
* class GeoLocationsOwner {
* String id
* }
*
* class Person {
* String name
* String email
* }
*
* class TimedTaggedImpl {
* LocalDate date
* LocalTime time
* ZoneId zone
* String[] tags
* }
*
* GeoLocationsOwner <|-- Person
*
* GeoLocationsOwner *-- GeoLocations: owner
*
* class GeoLocations {
* String name
* String description
* LocalDate date
* LocalTime time
* ZoneId zone
* String[] tags
* }
* GeoLocationsOwner *-- GeoLocations: owner
*
* GeoLocations --|> TimedTaggedImpl
*
* class GeoLocation {
* int elevation
* LocalTime time
* String name
* String description
* }
* GeoLocation --|> TimedTaggedImpl
*
* GeoLocations *-- GeoLocation
* GeoLocation *-- LatLong
* @enduml
*/
/*
* ER diagram interface for our domain:
*
* @startuml
* entity person {
* * id INTEGER GENERATED
* * name varchar(80)
* * email varchar(80)
* }
*
* entity geoLocations {
* * id INTEGER GENERATED
* path boolean
* name varchar(80)
* description varchar(200)
* date date
* time time
* zone varchar(20)
* }
*
* person --{ geoLocations: ownerId
*
* entity geoLocation {
* * id INTEGER GENERATED
* name varchar(80)
* description varchar(200)
* * latitude decimal
* * longitude decimal
* elevation int
* date date
* time time
* zone varchar(20)
* }
*
* geoLocations --{ geoLocation: ownerId
*
* entity tags {
* * ownerType char(3)
* * tag varchar(15)
* }
*
* geoLocations --{ tags: ownerId
* geoLocation --{ tags: ownerId
*
* @enduml
*/
public interface IDbAccess {
public IdProvider<Person> getPersonIdProvider();
......
Supports Markdown
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