Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded