Re: [xwiki-users] How to update an object only if it change

2013-03-19 Thread Arnaud bourree
Finaly I do: diffs.each { diff -> oldTicket.set(diff.propName, ticket.get(diff.propName)) } ticketDoc.removeObject(ticket) ticketDoc.save() And I get history difference only updated field Arnaud. 2013/3/19 Arnaud bourree : > I just tr

Re: [xwiki-users] How to update an object only if it change

2013-03-19 Thread Arnaud bourree
I just try: ticketDoc.removeObject(oldTicket) ticket.setGuid(oldTicket.getGuid()) ticketDoc.save() And I get unexpected history difference I suspect: object[0] is deleted and object[1] is added, so not compared together. Arnaud. 2013/3/18 Arnaud bourree : > Th

Re: [xwiki-users] How to update an object only if it change

2013-03-18 Thread Arnaud bourree
Thanks, that right test should be if (diffs.size() == 0) But an new object is created anyway Arnaud. 2013/3/18 Edo Beutler : > Hi Arnaud > > I'm not sure, but I suspect you just flipped the if statement. Shouldn't > the document be saved when "diffs.size() != 0" instead? Everything else > looks

Re: [xwiki-users] How to update an object only if it change

2013-03-18 Thread Edo Beutler
Hi Arnaud I'm not sure, but I suspect you just flipped the if statement. Shouldn't the document be saved when "diffs.size() != 0" instead? Everything else looks ok to me if I understood correctly what you try to do. if (diffs.size() *!=* 0) { println "none" } else { println "Updated" ticket

[xwiki-users] How to update an object only if it change

2013-03-18 Thread Arnaud bourree
Hello, I'm prototyping a connector to a ticket tracking tool: I'm writing a Groovy page which import CSV calls into XWiki. I map each CSV rows to one XWiki object store in one page (one object per page). OK, I succeed to to it. My issue is that imported CSV contains rows (tickets) which don't cha