You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Nikhil Dhamapurkar <ni...@healthengine.com.au> on 2018/01/18 10:15:37 UTC

Idempotent behavior based on Limited Fields.

Hi,

We are receiving updates of appointment object on apache isis via swagger API. 
The Appointment object’s equals for identifying the Object is based on few parameters which are part of the class,  some fields like ‘status’ accept / reject are to be updated, and are not part of identifying if the objects is same.

Any Idea if I can control the insert / update behaviour based on fields as part of equals – I don’t have the primary key / id of the Object where I am updating.

Example.
Appointment  can uniquely be identified by  :
Apt between person1 and person2, date , start and end time. – fields like status can have any value

If I get apt with different status it should end updating the status of existing appointment based on these fields.

Regards
Nikhil


RE: Idempotent behavior based on Limited Fields.

Posted by Nikhil Dhamapurkar <ni...@healthengine.com.au>.
Bang on reply  ! I  sent the mail & realised that I can select the existing record and update else create new.

Regards
Nikhil

From: Johan Doornenbal
Sent: 18 January 2018 15:56
To: users@isis.apache.org
Subject: Re: Idempotent behavior based on Limited Fields.

Hi Nikhil,
I am not entirely sure if I fully understand your use case. But from what I read
I would suggest to create some 'upsert' method that does a search on the params
you mentioned and creates a new record when the search does not return results.
An example of this pattern can be found in Estatio 1)
Best regards,
Johan Doornenbal+31 6 227 666 28
1)
https://github.com/estatio/estatio/blob/master/estatioapp/app/src/main/java/org/estatio/module/capex/dom/order/OrderItemRepository.java#L72 
 





On Thu, Jan 18, 2018 11:15 AM, Nikhil Dhamapurkar 
nikhil.dhamapurkar@healthengine.com.au  wrote:



Hi,




We are receiving updates of appointment object on apache isis via swagger API. 

The Appointment object’s equals for identifying the Object is based on few
parameters which are part of the class, some fields like ‘status’ accept /
reject are to be updated, and are not part of identifying if the objects is
same.




Any Idea if I can control the insert / update behaviour based on fields as part
of equals – I don’t have the primary key / id of the Object where I am updating.




Example.

Appointment can uniquely be identified by :

Apt between person1 and person2, date , start and end time. – fields like status
can have any value




If I get apt with different status it should end updating the status of existing
appointment based on these fields.




Regards

Nikhil


Re: Idempotent behavior based on Limited Fields.

Posted by Johan Doornenbal <jd...@incode.org>.
Hi Nikhil,
I am not entirely sure if I fully understand your use case. But from what I read
I would suggest to create some 'upsert' method that does a search on the params
you mentioned and creates a new record when the search does not return results.
An example of this pattern can be found in Estatio 1)
Best regards,
Johan Doornenbal+31 6 227 666 28
1)
https://github.com/estatio/estatio/blob/master/estatioapp/app/src/main/java/org/estatio/module/capex/dom/order/OrderItemRepository.java#L72 
 





On Thu, Jan 18, 2018 11:15 AM, Nikhil Dhamapurkar 
nikhil.dhamapurkar@healthengine.com.au  wrote:



Hi,




We are receiving updates of appointment object on apache isis via swagger API. 

The Appointment object’s equals for identifying the Object is based on few
parameters which are part of the class, some fields like ‘status’ accept /
reject are to be updated, and are not part of identifying if the objects is
same.




Any Idea if I can control the insert / update behaviour based on fields as part
of equals – I don’t have the primary key / id of the Object where I am updating.




Example.

Appointment can uniquely be identified by :

Apt between person1 and person2, date , start and end time. – fields like status
can have any value




If I get apt with different status it should end updating the status of existing
appointment based on these fields.




Regards

Nikhil