cancel
Showing results for 
Search instead for 
Did you mean: 

updating a file using Alfresco JavaScript API

ngiolet
Champ in-the-making
Champ in-the-making
Using the Alfresco JavaScript API, I noticed that when you run a script that changes a file, the file is not updated until the script does not finish its execution.
At least to me seems to behave in this way. :x
I wanted to know if it is actually so, and if you can force the update of the file during script execution?

Thanks in advance for the help.
Regards,
ngiolet
3 REPLIES 3

mikeh
Star Contributor
Star Contributor
If you've updated properties only, then use node.save().

I suspect the issue you have is that webscripts execute in one transaction - currently this is not configurable. You could change the webscript descriptor to not use transactions, but this isn't recommended.

Mike

lista
Star Contributor
Star Contributor
These are your options, when talking about transactions:

transaction (optional) is the required level transaction; valid values are:

    * none specifies that no transaction is required at all
    * required specifies that a transaction is required (and will inherit an existing transaction, if open)
    * requiresnew specifies that a new transaction is required

MikeH, do you know of any documentation talking about transactions? I'm having troubles finding any.

mikeh
Star Contributor
Star Contributor
MikeH, do you know of any documentation talking about transactions? I'm having troubles finding any.
Not specifically, but these are the top wiki hits which talk about them:

http://wiki.alfresco.com/wiki/Java_Foundation_API
http://wiki.alfresco.com/wiki/Introducing_the_Alfresco_Java_Content_Repository_API#Transaction_Manag...
http://wiki.alfresco.com/wiki/Alfresco_Repository_Architecture

Thanks,
Mike