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();
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 {
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 AuthServiceImpl method setHash.
@Override
public void setHash(Long uoid, byte[] hash, byte[] salt) throws ServerException, UserException {
requireAdminAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
User user = session.get(uoid, OldQuery.getDefault());
user.setPasswordHash(hash);
user.setPasswordSalt(salt);
session.commit();
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class LowLevelServiceImpl method getDataObjectByGuid.
@Override
public SDataObject getDataObjectByGuid(Long roid, String guid) throws ServerException, UserException {
requireAuthenticationAndRunningServer();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<DataObject> action = new GetDataObjectByGuidDatabaseAction(getBimServer(), session, getInternalAccessMethod(), roid, guid, getAuthorization());
SDataObject dataObject = getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(action));
return dataObject;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations