Skip to Content
author's profile photo Former Member
Former Member

Create versioned folders using API

I try to create folders with versioning enabled on EP6.

I use the com.sapportals.wcm.repository package.

My code looks like this:

IResourceFactory resourceFactory = ResourceFactory.getInstance();

ICollection parentCollection = (ICollection)resourceFactory.getResource( getParent(), rContext);

this.resource = parentCollection.createCollection( getName(), parentCollection.getProperties());

this.resource.enableVersioning(true);

But the created folders, don't have versioning enabled. I still have to activate it manually.

What's wrong ?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 26, 2004 at 09:07 AM

    Unfortunately, there is some terminology confusion around versioned collections.

    A collection can be version-controlled. A versioned collection is similar to a version-controlled plain resource -- each state change is recorded in a separate version resource. This, for instance, includes modifying collection properties or changing the set of version-controlled collection members.

    But I think what you're looking for is a "auto-version-controlling" collection -- a collection that automatically has version-control enabled for each of it's members (and turns it on for each new member) <i>This is not a version controlled collection!</i>

    Something like the following should do what you need:

    (IVersionController)vc = (IVersionController)this.resource.as(IVersionController.class);

    if (vc != null) vc.enable();

    Hope this helps,

    Julian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2004 at 11:02 PM

    Thanks,

    this is exactly what I need !! It works fine !!

    As the folder is empty when created, the enable() method needs an empty list :

    this.resource = parentCollection.createCollection(getName(), props);

    IVersionController vc = (IVersionController)this.resource.as(IVersionController.class);

    if (vc != null) vc.enable( new ResourceList());

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.