Loading EntityLinks via the Kettle Loader
Submitted by Ascot_Vet_Surgery on Tue, 29/03/2016 - 00:10
I am having trouble working out how to load entityLinks via Kettle...If i attempt to load a customer with no practice defined I get
2016/03/28 23:05:15 - customerPerson.0 - Failed to process row 2986: Factory org.openvpms.component.business.service.archetype.JXPathGenericObjectCreationFactory@361f4240 could not create an object for path: /entityLinks
The loader looks like (you get the idea)
Field name Map to Exclude null Value Remove default objects active <party.customerperson>active N Y adName <party.customerperson>companyName Y Y createdDate <party.customerperson>createdDate Y Y FirstName <party.customerperson>firstName Y Y LastName <party.customerperson>lastName Y Y Title <party.customerperson>title Y Y ACCTYPE <party.customerperson>type[0] Y <lookup.customerAccountType>code=$value Y oCIDdescr <party.customerperson>identities[0]<entityIdentity.code>description Y Y oCID <party.customerperson>identities[0]<entityIdentity.code>code Y Y
I had assumed it would assign the default.
I have tried
with the value set as the entity_id of the practice I want to assign.
<party.customerperson>practice[0]<entityLink.organisationLocation>target
I also tried
<party.customerperson>practice and set the Value to <party.organisationLocatin>entity_id=$value
Anyone have any ideas.
Re: Loading EntityLinks via the Kettle Loader
I have not used Kettle in anger for a couple of years - and in those days it was all entityRelationships. I just has a look at how I glued patients to customers.
First I loaded all the customers and all the patients, then I ran another transform to glue the patients to the customers - and the OpenVPMS step for this was:
So in your case, I would load the customers without setting the practice location and then add a step to link the customers with the practice - by creating the entityLink.customerLocation records.
I just looked at how I loaded products - and that was done the same way - ie load the raw product data, then run separate steps to link to productType, supplier, etc
Regards, Tim G
Re: Loading EntityLinks via the Kettle Loader
You should be able to do it in a single transform. If CustomerID is your "Id Field Name":
That said, I've used Kettle less recently than Tim G.
Re: Loading EntityLinks via the Kettle Loader
I think the problem is that the loader appears to require the entityLink be populated when the customer is created....if I leave the practice field blank it basically throws the error I reported above - my solution was to revert the archetype in the database to a version with no entitylink and then upload the customers - then basically change it back once I was done.
This worked but its a pretty bad fudge
I dont think you can create the entityLink at the same time as the party because it would appear to create a circular dependency.
ie CustomerID isnt in the etl Log until the customer is loaded.
The other issue I mentioned on Dev forum is the ANYTHING with a derived value is failing validation using the loader. on version 1.8.1
ie
Failed to validate Description of Patient (Pet): Failed to get value
Unticking the derive value checkbox and reloading kettle solves this..
Am I correct in saying that as soon as the Kettle OpenVPMS loader plugin gets a database connection it loads the archetypes once - you actually have to unload kettle altogether to refresh archetypes in the loader?
Re: Loading EntityLinks via the Kettle Loader
You can't do a partial population of the entityLink as the source and target nodes are both required.
You can do it in the same transform as the customer information; the loader will take care of the source so long as you use the same Id as the "Id Field Name" in the mapping.
The plugin caches archetypes, so if you change them you'll need to restart Kettle.
Re: Loading EntityLinks via the Kettle Loader
Ill try loading it the same loader cheers Tim
Re: Loading EntityLinks via the Kettle Loader
I would say this might be the issue
THis is using 1.8.1 and I confirmed the jars in the loader and the webapp were the same
Re: Loading EntityLinks via the Kettle Loader
Again this was caused by having old framework jars in the classpath...
due to the previous issues with spring . and kettle 3.2