use of org.bimserver.plugins.serializers.MessagingSerializer in project BIMserver by opensourceBIM.
the class SerializerFactory method createMessagingSerializer.
public MessagingSerializer createMessagingSerializer(String username, IfcModelInterface model, DownloadParameters downloadParameters) throws SerializerException {
DatabaseSession session = bimDatabase.createSession();
try {
MessagingSerializerPluginConfiguration serializerPluginConfiguration = session.get(StorePackage.eINSTANCE.getMessagingSerializerPluginConfiguration(), downloadParameters.getSerializerOid(), OldQuery.getDefault());
if (serializerPluginConfiguration != null) {
MessagingSerializerPlugin serializerPlugin = (MessagingSerializerPlugin) pluginManager.getPlugin(serializerPluginConfiguration.getPluginDescriptor().getPluginClassName(), true);
if (serializerPlugin != null) {
ObjectType settings = serializerPluginConfiguration.getSettings();
MessagingSerializer serializer = serializerPlugin.createSerializer(new PluginConfiguration(settings));
if (serializer != null) {
try {
serializer.init(model, null, pluginManager, model.getPackageMetaData(), true);
return serializer;
} catch (NullPointerException e) {
LOGGER.error("", e);
}
}
}
}
} catch (BimserverDatabaseException e) {
LOGGER.error("", e);
} finally {
session.close();
}
return null;
}
Aggregations