Issue 10647

Remove the lookup tables from registry db which are enum backed

10647
Reporter: mdoering
Assignee: jcuadra
Type: Improvement
Summary: Remove the lookup tables from registry db which are enum backed
Priority: Critical
Resolution: Fixed
Status: Closed
Created: 2012-01-18 11:01:02.296
Updated: 2013-12-16 17:50:22.432
Resolved: 2012-02-06 16:16:28.008
        
Description: Now that we use an enum that maps directly to the service_type_id is there a need to maintain the lookup table service_type?
Similar for agent_type and contact_type]]>
    


Author: trobertson@gbif.org
Created: 2012-01-23 14:14:20.373
Updated: 2012-01-23 14:14:20.373
        
The original design of the registry was to enable the Admin the means to configure the "type" of various things, such as Agents, Relationships etc.  This enabled a very flexible back end storage "graph model".

The API was designed to be very strongly typed to remove the burden of understanding the flexible graph model on the end user.

Given the data layer (registry-persistence-service) supports the flexible approach, and the registry admin application relies on it, for the time being would it not be better to have a simple transformation class that converts the "magic numbers" into an ENUM?
    


Author: mdoering@gbif.org
Created: 2012-01-23 14:51:24.248
Updated: 2012-01-23 14:51:24.248
        
We make use of such a transformation class already (for example EndpointTypeConverter), similar to how we deal with enums in checklistbank.
The persistence layer now is also strongly typed which simplifies code a lot.

I think the question is whether we really need to maintain a flexible backend when we will have to adapt some code somewhere anywhere and changes are really not expected very often - so we can just update our enums, liquibase files and conversion code? What would happen if we just add another service type in the registry db, but don't adjust our EndpointType enum? It seems to me we can move entirely to enums and remove the db driven lookups.

    


Author: jcuadra@gbif.org
Comment: Fixed. Removed tables and did necessary modifications to rely on the enums.
Created: 2012-02-06 16:16:28.038
Updated: 2012-02-06 16:16:28.038


Author: mdoering@gbif.org
Comment: Im nearly down with a tiny webapp too that shows all enums, their enum and persistence values
Created: 2012-02-06 16:21:56.229
Updated: 2012-02-06 16:21:56.229


Author: mdoering@gbif.org
Created: 2012-02-06 17:20:41.778
Updated: 2012-02-06 17:20:41.778
        
Listing all enumerations that have persistence converters:
http://staging.gbif.org:8080/enum-web