Modify registry-persistence to support deleteLogicalByExample() and updateByUuid()
10900
Reporter: jcuadra
Assignee: jcuadra
Type: Improvement
Summary: Modify registry-persistence to support deleteLogicalByExample() and updateByUuid()
Priority: Major
Resolution: Fixed
Status: Closed
Created: 2012-02-20 12:33:54.894
Updated: 2013-12-16 17:50:21.938
Resolved: 2012-03-02 14:14:33.568
Author: jcuadra@gbif.org
Created: 2012-02-27 18:41:05.239
Updated: 2012-02-27 18:41:05.239
TagMapper has now a method called logicalDeleteByExampleAndAgent which deletes given either a namespace, name and/or value.
All components (identifiers, contacts, tags, services) have a updateSelectiveByPrimaryKey() and deleteLogicalByPrimaryKey() which will do the job needed at the persistence layer.
Author: jcuadra@gbif.org
Comment: Just found createByUUID() needs to be supported.
Created: 2012-02-29 17:12:44.229
Updated: 2012-02-29 17:12:44.229
Author: mdoering@gbif.org
Comment: out of curiosity, what does createByUUID do and where is it needed?
Created: 2012-03-01 10:31:39.712
Updated: 2012-03-01 10:31:39.712
Author: jcuadra@gbif.org
Created: 2012-03-01 10:44:44.128
Updated: 2012-03-01 10:44:44.128
createByUUID will receive a Contact object (persistence) and an Agent UUID, and will save the contact object with its corresponding agent_id.
Somewhere along the lines of
insert into contact(type, position, salutation, agent_id) (select 15000, 'Programmer', 'Mr.', a.id from agent a where a.uuid='3a9a7db1-988f-4d90-99ee-b4dbe868a27c')
Author: jcuadra@gbif.org
Created: 2012-03-01 10:51:43.492
Updated: 2012-03-01 10:51:43.492
For more:
I am trying to avoid
making this "not nice" approach and go directly to the persistence with a common "createByUUID" method
http://code.google.com/p/gbif-registry/source/browse/trunk/registry-service/src/main/java/org/gbif/registry/service/ContactSupport.java#46
Author: mdoering@gbif.org
Comment: Ah, I see. But you will have to have 2 statements also in the persistence layer, don't you?
Created: 2012-03-01 11:44:52.785
Updated: 2012-03-01 11:44:52.785
Author: jcuadra@gbif.org
Created: 2012-03-01 11:48:06.886
Updated: 2012-03-01 11:48:06.886
It would just be 1 SQL statement (INSERT into SELECT) doing two things at a time