use of org.bimserver.plugins.modelmerger.ModelMergerPlugin in project BIMserver by opensourceBIM.
the class MergerFactory method createMerger.
public org.bimserver.plugins.modelmerger.ModelMerger createMerger(DatabaseSession databaseSession, Long currentUoid) throws MergeException, BimserverDatabaseException {
DatabaseSession session = bimServer.getDatabase().createSession();
try {
User user = databaseSession.get(StorePackage.eINSTANCE.getUser(), currentUoid, OldQuery.getDefault());
UserSettings userSettings = user.getUserSettings();
ModelMergerPluginConfiguration modelMergerObject = userSettings.getDefaultModelMerger();
if (modelMergerObject != null) {
ModelMergerPlugin modelMergerPlugin = bimServer.getPluginManager().getModelMergerPlugin(modelMergerObject.getPluginDescriptor().getPluginClassName(), true);
if (modelMergerPlugin != null) {
org.bimserver.plugins.modelmerger.ModelMerger modelMerger = modelMergerPlugin.createModelMerger(new PluginConfiguration(modelMergerObject.getSettings()));
return modelMerger;
} else {
throw new MergeException("No Model Merger found " + modelMergerObject.getPluginDescriptor().getPluginClassName());
}
} else {
throw new MergeException("No configured Model Merger found");
}
} finally {
session.close();
}
}
Aggregations