create the directory if it doesn't exist yet (checking in so britt can repro a bug in createDirectory)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-09-09 00:06:28 +00:00
parent 99dc9c9128
commit c8a0c38baf

View File

@@ -40,8 +40,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.avm.AVMExistsException;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.*;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -77,7 +76,18 @@ public class OutputUtil
final String parentName = (String)
nodeService.getProperty(caf.getParentRef(), ContentModel.PROP_NAME);
LOGGER.debug("computed avm path " + PARENT_AVM_PATH + "/" + parentName);
return PARENT_AVM_PATH + "/" + parentName;
final String result = PARENT_AVM_PATH + "/" + parentName;
AVMService avmService = AVMContext.fgInstance.getAVMService();
try
{
avmService.lookup(-1, result);
return result;
}
catch (AVMNotFoundException notFound)
{
avmService.createDirectory(PARENT_AVM_PATH, parentName);
return PARENT_AVM_PATH;
}
}
public static void generate(NodeRef createdNode,