jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tri...@day.com>
Subject Re: Restore deleted node
Date Mon, 20 Jul 2009 12:58:28 GMT
On Mon, Jul 20, 2009 at 2:23 PM, Wulf Rowek |
THESISdigital<rowek@thesisdigital.de> wrote:
> hi tobi,
>
> thanks for your answer.
>
> I think
>
> Node.restore(Version version, String relPath, boolean removeExisting);
>
> is not static, isn't it?
>
> If this method is not static, how to retrieve a deleted node, on which i can
> call restore.
the node you call restore on, is any possible parent node. it does not
need to be versionable, but the node's parent indicated by relPath has
to exist.
for example:

n1 = session.getItem("/foo/bar");
version v1 = n1.checkin();
n1.remove();
session.save();

n2 = session.getItem("/foo"):
n2.restore("bar", v1);

regards, toby

>
>
> Tobias Bocanegra schrieb:
>>
>> hi,
>> of course you can restore a deleted node, using:
>>
>> Node.restore(Version version, String relPath, boolean removeExisting);
>>
>> the tricky part is to find the correct version. in order to do that,
>> you can use the search or traverse the version storage.
>> since a versionable node can be moved around without loosing it's id,
>> the path is not recorded in the version. but i might make sense to
>> add a "path" property to you node before the checkin, so you can use
>> that later to find the deleted version.
>>
>> as example, in our CMS we record the "parentPath" and the "name" of
>> the node in the node itself prior to a checkin.
>> so a deleted node can be easily found when searching for all versions
>> having a given parent path.
>>
>> regards, toby
>>
>> On Mon, Jul 20, 2009 at 1:58 PM, Wulf Rowek |
>> THESISdigital<rowek@thesisdigital.de> wrote:
>>>
>>> Hi,
>>>
>>> i've asked this already in another thread, but I think it is better to
>>> open
>>> an own one.
>>>
>>> It looks like it is not the intention of the version system (at least in
>>> the
>>> the meaning of jcr-170), but maybe (hopefully) i'm wrong:
>>>
>>> is it possible to restore a deleted versioned node? I cannot understand
>>> why
>>> it should not, because all information (except the former path) is
>>> contained
>>> in the version history.
>>> Is there any simple method like workspace.restore(String uuid, String
>>> pathToRestoreNode)?
>>>
>>> I will appreciate any comment to this.
>>>
>>> regards,
>>>
>>> Wulf
>>> --
>>> THESIS digital GmbH | Wulf Rowek
>>>
>>> Boxhagener Straße 76-78, 10245 Berlin
>>> Aufgang 3, 4. Obergeschoss
>>>
>>> Fon (030) 91 68 44-55
>>> Fax (030) 91 68 44-99
>>> Gsm (0170) 541 38 39
>>> Mail rowek@thesisdigital.de
>>> Web www.thesisdigital.de
>>>
>>
>
> --
> THESIS digital GmbH | Wulf Rowek
>
> Boxhagener Straße 76-78, 10245 Berlin
> Aufgang 3, 4. Obergeschoss
>
> Fon (030) 91 68 44-55
> Fax (030) 91 68 44-99
> Gsm (0170) 541 38 39
> Mail rowek@thesisdigital.de
> Web www.thesisdigital.de
>

Mime
View raw message