final String description) {
return AuthenticationUtil.runAs(new RunAsWork<NodeRef>() {
@Override
public NodeRef doWork() throws Exception {
final ChildAssociationRef childAssoc = nodeService.createNode(parentFolder,
ContentModel.ASSOC_CONTAINS, qName, ContentModel.TYPE_FOLDER);
if (childAssoc != null) {
final NodeRef nodeRef = childAssoc.getChildRef();
getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, name);
if (StringUtils.hasText(description)) {
getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, description.trim());
}
return nodeRef;