use of org.bimserver.interfaces.objects.SObjectDefinition in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getPluginObjectDefinition.
@Override
public SObjectDefinition getPluginObjectDefinition(Long oid) throws ServerException, UserException {
if (oid == -1) {
return null;
}
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
PluginDescriptor pluginDescriptor = session.get(oid, OldQuery.getDefault());
if (pluginDescriptor == null) {
throw new UserException("No PluginDescriptor found with oid " + oid);
}
Plugin plugin = getBimServer().getPluginManager().getPlugin(pluginDescriptor.getPluginClassName(), false);
if (plugin == null) {
throw new UserException("No plugin with class name " + pluginDescriptor.getPluginClassName() + " found");
}
ObjectDefinition settingsDefinition = plugin.getSettingsDefinition();
return getBimServer().getSConverter().convertToSObject(settingsDefinition);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations