cancel
Showing results for 
Search instead for 
Did you mean: 

Upload new Version calls onUpdateNode twice with bogus NodeRef

technaton
Champ in-the-making
Champ in-the-making
Hello everybody,

I've created a behavior along with a custom aspect that implements the
OnUpdateNodePolicy
interface. The behavior itself does nothing spectacular: It creates or updates a PDF using the content transformation service.

Now, when uploading a new version of the document that already has the aspect, the behavior is actually called twice: Once with the original document's NodeRef (that which has the aspect applied), and once with another NodeRef of a document/node that <em>does not exist</em>.

Of course I can easily check whether the file exists, i.e.

<blockcode>if (!fileFolderService.exists(srcNode)) {
         return;
      }</blockcode>

… which of course solves the immediate problem, but I'm interested in the Why: Where does this bogus noderef come from?

Thanks alot in advance for any hints1

Cheers,
Eric
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

uploading a new version via Share is actually done using a temporary working copy. This working copy is probably your non-existent node because I presume your behaviour is bound to TRANSACTION_COMMIT and the working copy has already been deleted again at that point. For TRANSACTION_COMMIT behaviours you always HAVE TO include existence and other checks (e.g. does the trigger condition still apply?) because anything could have happend between the behaviour being schedule and actually being executed.

Regards
Axel

technaton
Champ in-the-making
Champ in-the-making
Hello Axel,

thank you very much for the explanation. You are right, the behavior is tied to
TRANSACTION_COMMIT
.

Regards
Eric