Creating new folders on MYS dynamically

Hello,

I’m trying to implement the logic to permit new folders being created dynamically in MWS 7.1.2 from a business process. Unfortunatelly, I can only create raw objects instead of folders.

My implementation is using the interface com.webMethods.portal.bizPolicy.biz.meta.IContainerPolicy to create new folders from a already created one (the root folder) in the following way:

[i]HashMap properties = new HashMap();
properties.put(IConstants.XTYPE_ID,“xtype”);
properties.put(IConstants.NAME, “folderName”);
properties.put(IConstants.FOLDER_TYPE, “folder”);

IContainerPolicy.createChild(IContext, IThingID, properties).[/i]

I think the problem is related on the properties values “XTYPE_ID”, “NAME” and “FOLDER_TYPE”, as actually a new object is created on MWS after its invocation, but it is not a folder. I’m not able to find the Javadoc of the interface com.webMethods.portal.framework.IConstants, so I just guessed the values to be used…

Is this interface javadoc anywhere or does anybody know the appropiate values to create a new folder? Is there any other way to implement such functionallity?

Thanks in advance for any suggestion and best regards,

Albert Capdevila

Hi Albert
instead of doing
properties.put(IConstants.FOLDER_TYPE, “folder”);

use this property:
properties.put(IConstants.XTYPE_NAME, “folder”);

I believe that should solve it.

Best regards
Javier

Hi Javier,

I already tried that, as specified in the IContainerPolicy.createChild javadoc, but I get a compilation error as the member XTYPE_NAME does not exist in the interface IConstants. I also tried to specify “folder” as the value of “XTYPE_ID” with the same bad results.
I’m not sure if any of the following causes could be the problem:

  • Something in the API changed (the javadoc is refered to MWS 7.1.1 and I’m using 7.1.2).
  • The right IConstants interface is in another package thant the one I’m using (com.webMethods.portal.framework).

Thanks and best regards.

Albert

Hi
that is exactly the problem… you have to use the interface

com.webmethods.portal.system.IConstants

best regards,
Javier

It was really the problem. Now it works.

Thanks a lot.

Hi,

I have tried to create folders, too. However the IContainerPolicy.createChild(…) cannot be invoked statically. How do I retrieve an IContainerPolicy object? Somewhere via PortalSystem… ?

Regards, Michael