Accessing the version history

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing the version history

gertv
L.S.,


How can I access a node's version history in ESP?  Right now, I have...
<% history = currentNode.getVersionHistory();
   out.println(history);
   versions = history.getAllVersions();
   out.println(versions); %>

The first println shows a VersionHistory object instance, but the
subsequent call to getAllVersions() yields a
"org.mozilla.javascript.EcmaError: TypeError: getAllVersions is not a
function, it is org.mozilla.javascript.Undefined."

Shouldn't I be able to access a standard Java object from within the ESP
or do I have to add another ScriptableXyz class to get this done?


Thanks in advance,

Gert


Reply | Threaded
Open this post in threaded view
|

Re: Accessing the version history

Bertrand Delacretaz
Hi,

On Tue, Apr 15, 2008 at 12:44 PM, Gert Vanthienen
<[hidden email]> wrote:

>  How can I access a node's version history in ESP?  Right now, I have...
>  <% history = currentNode.getVersionHistory();
>   out.println(history);
>   versions = history.getAllVersions();
>   out.println(versions); %>
>
>  The first println shows a VersionHistory object instance, but the
> subsequent call to getAllVersions() yields a
>  "org.mozilla.javascript.EcmaError: TypeError: getAllVersions is not a
> function, it is org.mozilla.javascript.Undefined."...

What you're doing is correct, this looks like a bug - I have created
SLING-382 to fix it, but I won't have time right now.

I'm not sure how best to fix it - the easiest way might be for
SlingWrapFactory to have a list of interfaces that must be wrapped by
the default wrapper instead of our custom ones, and include
VersionHistory in that list.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: Accessing the version history

Bertrand Delacretaz
On Tue, Apr 15, 2008 at 2:05 PM, Bertrand Delacretaz
<[hidden email]> wrote:

> ...the easiest way might be for
>  SlingWrapFactory to have a list of interfaces that must be wrapped by
>  the default wrapper instead of our custom ones, and include
>  VersionHistory in that list....

If you want to try that, of course, patches are welcome!

-Bertrand