use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class AdminServiceImpl method getLogs.
@Override
public List<SLogAction> getLogs() throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
BimDatabaseAction<List<LogAction>> action = new GetLogsDatabaseAction(session, getInternalAccessMethod(), getAuthorization());
List<LogAction> logs = session.executeAndCommitAction(action);
List<SLogAction> convertToSListLogAction = getBimServer().getSConverter().convertToSListLogAction(logs);
Collections.sort(convertToSListLogAction, new SLogComparator(true));
return convertToSListLogAction;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class AdminServiceImpl method migrateDatabase.
@Override
public void migrateDatabase() throws ServerException, UserException {
requireAdminAuthentication();
try {
getBimServer().getDatabase().getMigrator().migrate();
getBimServer().getServerInfoManager().update();
} catch (Exception e) {
LOGGER.error("", e);
throw new ServerException(e);
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class AdminServiceImpl method getProtocolBuffersFile.
@Override
public String getProtocolBuffersFile(String interfaceName) throws ServerException, UserException {
InputStream resourceAsStream = ProtocolBuffersBimServerClientFactory.class.getResourceAsStream(interfaceName + ".proto");
StringWriter stringWriter = new StringWriter();
try {
IOUtils.copy(resourceAsStream, stringWriter);
} catch (IOException e) {
throw new ServerException(e);
}
return stringWriter.toString();
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method updateModelChecker.
@Override
public void updateModelChecker(SModelCheckerInstance modelCheckerInstance) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
try {
BimDatabaseAction<Void> action = new UpdateModelCheckerDatabaseAction(getBimServer(), session, getInternalAccessMethod(), getBimServer().getSConverter().convertFromSObject(modelCheckerInstance, session));
session.executeAndCommitAction(action);
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method getDeserializerById.
@Override
public SDeserializerPluginConfiguration getDeserializerById(Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetDeserializerByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
return null;
}
Aggregations