You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Wulf Rowek | THESISdigital <ro...@thesisdigital.de> on 2009/07/20 13:58:32 UTC
Restore deleted node
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
Re: Restore deleted node
Posted by Wulf Rowek | THESISdigital <ro...@thesisdigital.de>.
hi toby,
oh, my fault, you're right!
I didn't read the api docs carefully at this point and looked only on
the first Node.restore.
Thx a lot toby and best regards,
wulf
Tobias Bocanegra schrieb:
> On Mon, Jul 20, 2009 at 2:23 PM, Wulf Rowek |
> THESISdigital<ro...@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<ro...@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
>>
>
--
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
Re: Restore deleted node
Posted by Tobias Bocanegra <tr...@day.com>.
On Mon, Jul 20, 2009 at 2:23 PM, Wulf Rowek |
THESISdigital<ro...@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<ro...@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
>
Re: Restore deleted node
Posted by Wulf Rowek | THESISdigital <ro...@thesisdigital.de>.
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.
Am I overlooking something?
regards,
wulf
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<ro...@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
Re: Restore deleted node
Posted by Tobias Bocanegra <tr...@day.com>.
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<ro...@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
>
Re: Restore deleted node
Posted by ma...@gmail.com.
>> Since the support for final deletion of a node is not in there (yet)
>What do you mean by this?
Cédric wrote a few days ago:
>As of 1.6, empty and unused VersionHistory will be automatically removed
>after removal of the last Version (see
>https://issues.apache.org/jira/browse/JCR-134).
>This will ensure that the disk usage will not grow unnecessarily.
As the lead developer of another rather large open source project I always like to think it's more constructive to work with the possibilities, rather than the impossibilities.
With that attitude it still makes sense to have a debate on whether or not Jackrabbit acts according to the JCR-specs, but it wouldn't block you from creating a solution that works.
Cheers,
Matt
Matt Casters
Chief Data Integration
Pentaho : The Commercial Open Source Alternative for Business Intelligence
On Monday 20 July 2009 14:33:34 Wulf Rowek | THESISdigital wrote:
> Hi Matt,
>
> thanks for your detailed answer.
> My intention for deleting nodes is, that i don't want to deal with them
> after removing. You always have to check on your "deleted"-flag, either
> on node- or querylevel.
>
> For the moment i implemented a workaround like you suggested, only that
> i use something like a trash where i just move my node, i like to delete.
>
> But still, I think this is nothing more like a workaround and should
> achieved with node.remove and and workspace.restore or something similar
> and not with session.move or node.hasProperty
>
> > Since the support for final deletion of a node is not in there (yet)
> What do you mean by this?
>
> Do you mean that the JCR-Specs doesn't define the removing of the
> version history at all and instead only the removing of partial versions?
>
> regards,
>
> wulf
>
>
>
> mattcasters@gmail.com schrieb:
> > Since the support for final deletion of a node is not in there (yet), why would you even try to delete it?
> > The way I solved is with a simple "deleted" property on the nodes.
> > I then simply ignore nodes where this property is set to true (in my application).
> > Restoring is then simply a matter or setting the property back to false.
> > You can then either create a bin or allow certain users to view/restore deleted items.
> >
> > When permanent deletion of nodes arrives (1.6/2.0?) I'll create an administration option to purge deleted object permanently.
> >
> > Cheers,
> > Matt
> >
> > Matt Casters
> > Chief Data Integration
> > Pentaho : The Commercial Open Source Alternative for Business Intelligence
> >
> >
> >
> > On Monday 20 July 2009 13:58:32 Wulf Rowek | THESISdigital 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
> >>
> >
> >
>
>
Re: Restore deleted node
Posted by Wulf Rowek | THESISdigital <ro...@thesisdigital.de>.
Hi Matt,
thanks for your detailed answer.
My intention for deleting nodes is, that i don't want to deal with them
after removing. You always have to check on your "deleted"-flag, either
on node- or querylevel.
For the moment i implemented a workaround like you suggested, only that
i use something like a trash where i just move my node, i like to delete.
But still, I think this is nothing more like a workaround and should
achieved with node.remove and and workspace.restore or something similar
and not with session.move or node.hasProperty
> Since the support for final deletion of a node is not in there (yet)
What do you mean by this?
Do you mean that the JCR-Specs doesn't define the removing of the
version history at all and instead only the removing of partial versions?
regards,
wulf
mattcasters@gmail.com schrieb:
> Since the support for final deletion of a node is not in there (yet), why would you even try to delete it?
> The way I solved is with a simple "deleted" property on the nodes.
> I then simply ignore nodes where this property is set to true (in my application).
> Restoring is then simply a matter or setting the property back to false.
> You can then either create a bin or allow certain users to view/restore deleted items.
>
> When permanent deletion of nodes arrives (1.6/2.0?) I'll create an administration option to purge deleted object permanently.
>
> Cheers,
> Matt
>
> Matt Casters
> Chief Data Integration
> Pentaho : The Commercial Open Source Alternative for Business Intelligence
>
>
>
> On Monday 20 July 2009 13:58:32 Wulf Rowek | THESISdigital 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
Re: Restore deleted node
Posted by ma...@gmail.com.
Since the support for final deletion of a node is not in there (yet), why would you even try to delete it?
The way I solved is with a simple "deleted" property on the nodes.
I then simply ignore nodes where this property is set to true (in my application).
Restoring is then simply a matter or setting the property back to false.
You can then either create a bin or allow certain users to view/restore deleted items.
When permanent deletion of nodes arrives (1.6/2.0?) I'll create an administration option to purge deleted object permanently.
Cheers,
Matt
Matt Casters
Chief Data Integration
Pentaho : The Commercial Open Source Alternative for Business Intelligence
On Monday 20 July 2009 13:58:32 Wulf Rowek | THESISdigital 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
>