hbz / gokb-phase1

Phase 1 - Rules Collection
Other
0 stars 0 forks source link

Implementing a global UID Hash for GOKb Objects #29

Open darupp opened 6 years ago

darupp commented 6 years ago

Referencing GOKb objects by external systems like LAS:eR is done by referencing the domain class and the internal database primary key. This causes problems after synchronizing different GOKb instances, as this primary key changes with the synchronization. A Global UID would solve this problem and related issues regarding the identification of GOKb objects.

This would require:

Also for existing objects:

A model of a global UUID is implemented in LAS:eR and can be adopted: https://github.com/hbz/laser/blob/hbz-dev/app/src/groovy/de/laser/domain/BaseDomainComponent.groovy

darupp commented 6 years ago

The originEditURL has also to be changed. At the moment, it refers also to the internal database id:

https://gokb.openlibraryfoundaton.org/gokb/resource/show/org.gokb.cred.JournalInstance:567

Here the use of UUID would also be necessary.

In OAI export, the id is an attribute to the object:

<title id="567">

The new UUID should be exported in the same way.

philboeselager commented 6 years ago

@hornmo Please have a look at this issue for the general requirement of a UUID. Can you maybe quickly name possible pitfalls? Otherwise, let's talk about on monday.

philboeselager commented 6 years ago

Would we generally like to query by:

  1. ?id=<myuuid>
  2. ?uuid=<myuuid>

and if we go for B), then would we like to keep the possibility to query for id?

darupp commented 6 years ago

I personally would go for B), so we maintain backwards compatibility or at least a clear distinction between the different namespaces. For this reason I would also keep the possibility to query fo rid.

darupp commented 6 years ago

Testing on phaeton-dev: Error on each object.

URI
    /gokb/resource/show/org.gokb.cred.JournalInstance:2766645
Class
    groovy.lang.MissingPropertyException
Message
    No such property: KBComponent for class: org.gokb.GenericOIDService    
philboeselager commented 6 years ago

Fixed. Please document further problems here.

philboeselager commented 6 years ago

TODO: solve this logged error (found in catalina.out):

2018-06-05 10:56:01,864 [http-nio-8080-exec-2] ERROR errors.GrailsExceptionResolver  - MissingPropertyException occurred when processing request: [GET] /gokb/api/find
No such property: uuid for class: org.elasticsearch.search.internal.InternalSearchHit
Possible solutions: id. Stacktrace follows:
groovy.lang.MissingPropertyException: No such property: uuid for class: org.elasticsearch.search.internal.InternalSearchHit
Possible solutions: id
    at org.gokb.ApiController$_find_closure17.doCall(ApiController.groovy:1114)
    at org.gokb.ApiController.find(ApiController.groovy:1111)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:150)
    at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:285)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:202)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:180)
    at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
    at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.java:59)
    at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:82)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)