[opencms-dev] Mass change types?

Christoph Schönfeld cschoenfeld at sylphen.com
Tue Apr 17 16:27:22 CEST 2007


You have to use CmsObject.chtype() to change the resource type.

Recently I had the same problem as you. ZIP upload does not recognize 
the file type and sets it to plain.
My solution was to write a JSP page which I now have as a custom admin 
tool hooked in the administration interface.

The code required to change the resource type is here:

                            cms.lockResource(resource.getRootPath());
                                cms.chtype(resource.getRootPath(),
                                        articleResourceTypeId);
                            cms.unlockResource(resource.getRootPath());

I am not sure if the lock is required for the chtype operation. I run 
other operations at the same time for which the lock is required.

Best regards,
Christoph



More information about the opencms-dev mailing list