use of org.pentaho.platform.plugin.services.importer.mimeType.bindings.ImportHandlerDto in project pentaho-platform by pentaho.
the class MimeTypeListFactory method createMimeTypeList.
public List<IMimeType> createMimeTypeList(String handlerClass) {
List<IMimeType> mimeTypeList = new ArrayList<IMimeType>();
for (ImportHandlerDto importHandler : importHandlerMimeTypeDefinitions.getImportHandler()) {
if (importHandler.getClazz().equals(handlerClass)) {
for (MimeTypeDefinitionDto mimeTypeDef : importHandler.getMimeTypeDefinitions().getMimeTypeDefinition()) {
MimeType mimeType = new MimeType(mimeTypeDef.getMimeType(), mimeTypeDef.getExtension());
mimeType.setHidden(mimeTypeDef.isHidden());
mimeType.setLocale(mimeTypeDef.isLocale());
mimeType.setVersionEnabled(mimeTypeDef.isVersionEnabled());
mimeType.setVersionCommentEnabled(mimeTypeDef.isVersionCommentEnabled());
Converter converter = null;
String converterBeanName = mimeTypeDef.getConverter() != null && !mimeTypeDef.getConverter().isEmpty() ? mimeTypeDef.getConverter() : "streamConverter";
converter = PentahoSystem.get(Converter.class, /*session*/
null, Collections.singletonMap("name", converterBeanName));
if (converter == null) {
log.error("Could not find converter class \"" + converterBeanName + "\" for mimeType \"" + mimeTypeDef.getMimeType() + "\" in import handler " + handlerClass);
}
mimeType.setConverter(converter);
mimeTypeList.add(mimeType);
}
}
}
return mimeTypeList;
}
Aggregations