(Web API) General-purpose data store

Registered by Lars Helge Øverland on 2013-09-14

The system needs a general purpose key-value data store. The stored values should support JSON format.

This is useful for apps which have persistence requirements, and for DHIS for storing arbitrary data.

The store should provide the following properties:

- A namespace (per app)
- A property key
- A value in JSON format

The store could potentially take advantage of the JSON/JSONB data type in PostgreSQL.

A new "namespace" property must be added to the manifest. When uploading the app there should be a check for namespace uniqueness.

Re security, for all requests, the authority of the app should be checked against the app namespace for authorization.

The controller should read and serialize the string-based content (no parsing).

Add a 4th field to connect data to a spesific user? (User-based customization for apps, etc)

Blueprint information

Status:
Complete
Approver:
Lars Helge Øverland
Priority:
Low
Drafter:
None
Direction:
Approved
Assignee:
Stian Sandvold
Definition:
Approved
Series goal:
Accepted for trunk
Implementation:
Implemented
Milestone target:
milestone icon 2.21
Started by
Lars Helge Øverland on 2015-10-03
Completed by
Lars Helge Øverland on 2015-10-12

Sprints

Whiteboard

Introduce a new domain object KeyJsonValue which must extend BaseIdentifiableObject.

Create a new store HibernateKeyJsonValueStore + interface which extends HibernateIdentifiableObjectStore.

Create a new Hibernate mapping file KeyJsonValue.hbm.xml and place under core > src/main/resources. Include columns namespace (varchar 255), key (varchar 255), value (text).

Create a new service DefaultKeyJsonValueService + interface which uses KeyJsonValueStore.

Create a new controller KeyJsonValueController which extends AbstractCrudController.

(?)

Work Items

Work items:
Json stored as a string, including newlines and spaces. Should be processed as json at some point: POSTPONED
Add checks to see if user has access to namespace: DONE
Find a good way to associate apps with namespaces (What is unique to an app in the system, or do we need to add something?): DONE
Take advantage of JSONB in postgresql: POSTPONED
User-associated keys: POSTPONED
Include or ignore AbstractCrudController? Creates some conflict in different scenarios: DONE
Serve the route to list namespaces directly at /dataStore, not dataStore/: DONE
Add own property to manifest ("activities.dhis.namespace"): DONE
Create HashMap for looking up <namespace, app> in appManager: DONE
Check during installation of app if namespace is already installed.: DONE
Rebuild HashMap<namespace, app> during ReloadApp(): DONE
Check if namespace is protected in KeyJsonValueController: INPROGRESS
Restrict access is namespace is protected: INPROGRESS

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.