switch (type) {
case WGDocument.TYPE_TML:{
FileObject newTml = getTmlFolder().resolveFile(mediaKey.toLowerCase() + "/" + name.replace(":", "/") + ".tml");
if (newTml.exists()) {
throw new WGCreationException("Document already exists: " + (new WGDocumentKey(type, name, mediaKey)).toString());
}
newTml.createFile();
break;
}
case WGDocument.TYPE_CSSJS: {
String suffix = DesignDirectory.getScriptInformation(mediaKey).getSuffix();
FileObject newScript = getScriptTypeFolder(mediaKey).resolveFile(mediaKey.toLowerCase() + "/" + name.replace(":", "/") + suffix);
if (newScript.exists()) {
throw new WGCreationException("Document already exists: " + (new WGDocumentKey(type, name, mediaKey)).toString());
}
newScript.createFile();
break;
}
case WGDocument.TYPE_FILECONTAINER: {
FileObject newFC = getFilesFolder().resolveFile(name.replace(":", "/"));
if (newFC.exists()) {
throw new WGCreationException("Document already exists: " + (new WGDocumentKey(type, name, mediaKey)).toString());
}
newFC.createFolder();
break;
}
}
return getDesignObject(type, name, mediaKey);
}
catch (Exception e) {
throw new WGCreationException("Exception creating design document " + (new WGDocumentKey(type, name, mediaKey)).toString(), e);
}
}