throw new Exception(results.getMessages().get(0).toString());
}
loader.setDataProviderType(type);
// Get the provider instance common properties.
DataProviderImpl provider = new DataProviderImpl();
provider.setDataLoader(loader);
Node codeNode = item.getAttributes().getNamedItem("code");
if (codeNode != null) provider.setCode(StringEscapeUtils.unescapeXml(codeNode.getNodeValue()));
for (int j = 0; j < subNodes.getLength(); j++) {
item = subNodes.item(j);
if (item.getNodeName().equals("canEdit") && item.hasChildNodes()) {
String canEditStr = item.getFirstChild().getNodeValue();
if ("false".equalsIgnoreCase(canEditStr)) provider.canEdit = false;
}
if (item.getNodeName().equals("canEditProperties") && item.hasChildNodes()) {
String canEditPropertiesStr = item.getFirstChild().getNodeValue();
if ("false".equalsIgnoreCase(canEditPropertiesStr)) provider.canEditProperties = false;
}
if (item.getNodeName().equals("canDelete") && item.hasChildNodes()) {
String canDelete = item.getFirstChild().getNodeValue();
if ("false".equalsIgnoreCase(canDelete)) provider.canDelete = false;
}
if (item.getNodeName().equals("description") && item.hasChildNodes()) {
String description = item.getFirstChild().getNodeValue();
Locale locale = LocaleManager.currentLocale();
Node languageNode = item.getAttributes().getNamedItem("language");
if (languageNode != null) locale = new Locale(languageNode.getNodeValue());
provider.setDescription(StringEscapeUtils.unescapeXml(description), locale);
}
if (item.getNodeName().equals("dataproperties") && item.hasChildNodes()) {
provider.getDataSet().parseXMLProperties(item.getChildNodes());
}
}
// Register the imported provider.
results.addDataProvider(provider);