protected void createResource(CreateResult result, String workspaceId, Long sectionId, Long panelId, XMLNode node, Map attributes, boolean onStartup) throws Exception {
String className = node.getAttributes().getProperty(ExportVisitor.RESOURCE_ATTR_CATEGORY);
String id = node.getAttributes().getProperty(ExportVisitor.RESOURCE_ATTR_ID);
byte[] rawContent = ((XMLNode) node.getChildren().get(0)).getContent();
GraphicElement element = (GraphicElement) Class.forName(className).newInstance();
if (element.getInstanceManager().getElement(id, workspaceId, sectionId, panelId) != null) {
log.warn("Refusing to overwrite existing resource with id " + id);
result.getWarnings().add("refusingOverwriteResource");
result.getWarningArguments().add(new Object[]{element.getCategoryName(), id, workspaceId, sectionId, panelId});
} else {
element.setId(id);
element.setWorkspaceId(workspaceId);
element.setSectionId(sectionId);
element.setPanelId(panelId);
element.setZipFile(rawContent);
element.getInstanceManager().createOrUpdate(element);
if (workspaceId == null)
result.setObjectCreated(element);
}
}