use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getAllWebModulePluginDescriptors.
@Override
public List<SPluginDescriptor> getAllWebModulePluginDescriptors() throws UserException, ServerException {
requireRealUserAuthentication();
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return session.executeAndCommitAction(new GetAllPluginDescriptorsDatabaseAction(session, getInternalAccessMethod(), getBimServer(), WebModulePlugin.class.getName()));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getModelMergerById.
@Override
public SModelMergerPluginConfiguration getModelMergerById(Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetModelMergerByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getWebModuleByName.
@Override
public SWebModulePluginConfiguration getWebModuleByName(String name) throws ServerException, UserException {
requireAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetWebModuleByNameDatabaseAction(session, getInternalAccessMethod(), name)));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
return null;
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method setDefaultModelMerger.
public void setDefaultModelMerger(final Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetUserSettingDatabaseAction action = new SetUserSettingDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), new UserSettingsSetter() {
@Override
public void set(UserSettings userSettings) {
userSettings.setDefaultModelMerger(find(userSettings.getModelMergers(), oid));
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method installPluginBundleFromUrl.
public void installPluginBundleFromUrl(String url, Boolean installAllPluginsForAllUsers, Boolean installAllPluginsForNewUsers) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
byte[] data = NetUtils.getContentAsBytes(new URL(url), 5000);
session.executeAndCommitAction(new InstallPluginBundleFromBytes(session, getInternalAccessMethod(), getBimServer(), data, installAllPluginsForAllUsers, installAllPluginsForNewUsers));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations