return new JSSnippetNodeFactory();
}
@Override
protected void saveAsset(ImportSource source, VFSFile root, AssetNode node, Asset asset) throws Exception {
JSSnippet snippet = (JSSnippet)asset;
Document doc = getDatabase().createDocument();
try {
setItemValue(doc,"Form", FORM);
setItemValue(doc,"Author", doc.getParentDatabase().getParent().getEffectiveUserName()); // Should we make this private (reader field)?
setItemValue(doc,"Id", node.getUnid());
setItemValue(doc,"Category", node.getCategory());
setItemValue(doc,"Name", node.getName());
setItemValue(doc,"FilterRuntimes", snippet.getProperty("runtimes"));
setItemValue(doc,"FilterLibraries", snippet.getProperty("jslibs"));
setItemValues(doc,"Tags", snippet.getProperty("tags"));
setItemValue(doc,"Description", snippet.getProperty("description"));
setItemValue(doc,"ImportSource", source.getName());
setItemValueRichText(doc,"Html", snippet.getHtml());
setItemValueRichText(doc,"Css", snippet.getCss());
setItemValueRichText(doc,"JavaScript", snippet.getJs());
snippet.getProperties().remove("endpoints");
snippet.getProperties().remove("jslibs");
snippet.getProperties().remove("description");
setItemValueRichText(doc,"Properties", snippet.getPropertiesAsString());
setItemValueRichText(doc,"Documentation", snippet.getDocHtml());
doc.save();
} finally {
doc.recycle();
}