AnsweredAssumed Answered

Custom Folder Created But Name is UUID?

Question asked by cpaul on Mar 9, 2012
Latest reply on Mar 9, 2012 by cpaul
Hi all,

I'm writing a Java-backed webscript that creates a custom folder (a type that extends "cm:folder" with a few additional attributes). The folder is created without a problem, but the "cm:name" attribute is set to the node's UUID and not the file name I'm passing into the FileFolderService. I'm using the following command, where "filename" is a String that I'd like to use as the object's name (e.g., "Test Folder").


FileInfo fileInfo = fileFolderService.create(parentNodeRef, filename, customQName);
When I view it in Share, instead of the filename, I see the folder with the UUID as its name (e.g., "0b9a49fd-972d-448a-9fb6-f92587755433"). I've even tried explicitly setting the "cm:name" attribute after the node is created:


NodeRef currentNode = fileInfo.getNodeRef();
HashMap<QName, Serializable> propertyMap = new HashMap<QName, Serializable>();
propertyMap.put(ContentModel.PROP_NAME, filename);
propertyMap.put(ContentModel.PROP_DESCRIPTION, description);
propertyMap.put(ContentModel.PROP_TITLE, title);
nodeService.setProperties(currentNode, propertyMap);
Not only does the "cm:name" attribute not get set, but the "cm:title" and "cm:description" fields are blank when I look at the node in Share. The really WEIRD thing is if I attempt to run the webscript again and create the folder with the same filename ("Test Folder"), I get a DB error tells me there's already a node with that name, even though it's clearly the UUID in Share and the node browser. Any idea what I'm doing wrong? Is there another/better way to do this?

Thanks,
Chris

Outcomes