Search in sources :

Example 6 with ServerException

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();
    }
}
Also used : SLogAction(org.bimserver.interfaces.objects.SLogAction) LogAction(org.bimserver.models.log.LogAction) DatabaseSession(org.bimserver.database.DatabaseSession) GetLogsDatabaseAction(org.bimserver.database.actions.GetLogsDatabaseAction) SLogComparator(org.bimserver.webservices.SLogComparator) List(java.util.List) ArrayList(java.util.ArrayList) SLogAction(org.bimserver.interfaces.objects.SLogAction) UserException(org.bimserver.shared.exceptions.UserException) BimBotsException(org.bimserver.bimbots.BimBotsException) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Example 7 with ServerException

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);
    }
}
Also used : ServerException(org.bimserver.shared.exceptions.ServerException) UserException(org.bimserver.shared.exceptions.UserException) BimBotsException(org.bimserver.bimbots.BimBotsException) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Example 8 with ServerException

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();
}
Also used : ServerException(org.bimserver.shared.exceptions.ServerException) StringWriter(java.io.StringWriter) InputStream(java.io.InputStream) IOException(java.io.IOException)

Example 9 with ServerException

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();
    }
}
Also used : User(org.bimserver.models.store.User) SUser(org.bimserver.interfaces.objects.SUser) DatabaseSession(org.bimserver.database.DatabaseSession) UserException(org.bimserver.shared.exceptions.UserException) ServerException(org.bimserver.shared.exceptions.ServerException)

Example 10 with ServerException

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();
    }
}
Also used : SDataObject(org.bimserver.interfaces.objects.SDataObject) DataObject(org.bimserver.models.store.DataObject) DatabaseSession(org.bimserver.database.DatabaseSession) GetDataObjectByGuidDatabaseAction(org.bimserver.database.actions.GetDataObjectByGuidDatabaseAction) SDataObject(org.bimserver.interfaces.objects.SDataObject) UserException(org.bimserver.shared.exceptions.UserException) NoTransactionException(org.bimserver.webservices.NoTransactionException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Aggregations

ServerException (org.bimserver.shared.exceptions.ServerException)253 UserException (org.bimserver.shared.exceptions.UserException)250 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)224 DatabaseSession (org.bimserver.database.DatabaseSession)215 IOException (java.io.IOException)212 SerializerException (org.bimserver.plugins.serializers.SerializerException)111 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)110 MalformedURLException (java.net.MalformedURLException)109 BcfException (org.opensourcebim.bcf.BcfException)109 UnsupportedEncodingException (java.io.UnsupportedEncodingException)108 MessagingException (javax.mail.MessagingException)108 AddressException (javax.mail.internet.AddressException)108 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)108 ArrayList (java.util.ArrayList)29 SProject (org.bimserver.interfaces.objects.SProject)26 User (org.bimserver.models.store.User)23 Project (org.bimserver.models.store.Project)20 SUser (org.bimserver.interfaces.objects.SUser)19 UserSettings (org.bimserver.models.store.UserSettings)18 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)18