[CDO] How delete all revisions of object? [message #1797423] |
Tue, 30 October 2018 17:45 |
DENIS B Messages: 3 Registered: June 2017 |
Junior Member |
|
|
Hi. Some EMF objects that are no longer needed remain in the database. It is possible to delete all revisions of certain type of EMF Object from CDO Store?
I try to write script for that, but i could not calculate the number of nodes for ERESOURCE_CDORESOURCEFOLDER for each revision. Maybe exist any legal way to do this?
[Updated on: Tue, 30 October 2018 18:04] Report message to a moderator
|
|
|
Re: [CDO] How delete all revisions of object? [message #1797427 is a reply to message #1797423] |
Tue, 30 October 2018 18:24 |
|
Hi Denis,
Your problem description confuses me a bit.
Are you using CDO's auditing (or branching) mode and want to know how to delete historical CDORevisions of a given EObject? If so, that's not possible because it would defeat the purpose of an audit. Being able to reduce the size of the history would be a nice thing, but difficult to achieve. https://bugs.eclipse.org/bugs/show_bug.cgi?id=256490 is there, already.
Or do you want to know how to delete all EObjects of a given EClass from the HEAD of a given branch, which, if you don't use the auditing (or branching) mode, is equivalent to all EObjects of that EClass from the entire repository? That can be accomplished with code like this:
CDOTransaction transaction = session.openTransaction(branch);
List<EAnnotation> annotations = transaction.queryInstances(EcorePackage.Literals.EANNOTATION);
for (EAnnotation annotation : annotations)
{
EcoreUtil.remove(annotation);
}
transaction.commit();
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Powered by
FUDForum. Page generated in 0.02147 seconds