Search in sources :

Example 56 with UserException

use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.

the class ServiceImpl method getTopLevelProjectByName.

@Override
public SProject getTopLevelProjectByName(String name) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        GetTopLevelProjectByNameDatabaseAction action = new GetTopLevelProjectByNameDatabaseAction(session, getInternalAccessMethod(), name, getAuthorization());
        return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(action));
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) GetTopLevelProjectByNameDatabaseAction(org.bimserver.database.actions.GetTopLevelProjectByNameDatabaseAction) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Example 57 with UserException

use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.

the class ServiceImpl method getSerializerByName.

@Override
public SSerializerPluginConfiguration getSerializerByName(String serializerName) throws ServerException, UserException {
    requireAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetSerializerByNameDatabaseAction(session, getInternalAccessMethod(), serializerName)));
    } catch (Exception e) {
        handleException(e);
    } finally {
        session.close();
    }
    return null;
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) GetSerializerByNameDatabaseAction(org.bimserver.database.actions.GetSerializerByNameDatabaseAction) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Example 58 with UserException

use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.

the class ServiceImpl method getAllProjectsSmall.

@Override
public List<SProjectSmall> getAllProjectsSmall() throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<List<SProjectSmall>> action = new GetAllProjectsSmallDatabaseAction(getBimServer(), session, getInternalAccessMethod(), getAuthorization());
        return action.execute();
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) GetAllProjectsSmallDatabaseAction(org.bimserver.database.actions.GetAllProjectsSmallDatabaseAction) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Example 59 with UserException

use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.

the class ServiceImpl method addExtendedDataSchema.

@Override
public Long addExtendedDataSchema(SExtendedDataSchema extendedDataSchema) throws ServerException, UserException {
    // requireAdminAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        ExtendedDataSchema create = session.create(ExtendedDataSchema.class);
        ExtendedDataSchema convert = getBimServer().getSConverter().convertFromSObject(extendedDataSchema, create, session);
        return session.executeAndCommitAction(new AddExtendedDataSchemaDatabaseAction(session, getInternalAccessMethod(), convert));
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) SExtendedDataSchema(org.bimserver.interfaces.objects.SExtendedDataSchema) ExtendedDataSchema(org.bimserver.models.store.ExtendedDataSchema) AddExtendedDataSchemaDatabaseAction(org.bimserver.database.actions.AddExtendedDataSchemaDatabaseAction) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Example 60 with UserException

use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.

the class ServiceImpl method uploadFile.

@Override
public Long uploadFile(SFile file) throws ServerException, UserException {
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        File convertFromSObject = getBimServer().getSConverter().convertFromSObject(file, session.create(File.class), session);
        UploadFileDatabaseAction action = new UploadFileDatabaseAction(session, getInternalAccessMethod(), convertFromSObject);
        return session.executeAndCommitAction(action);
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) File(org.bimserver.models.store.File) SFile(org.bimserver.interfaces.objects.SFile) BcfFile(org.opensourcebim.bcf.BcfFile) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) UploadFileDatabaseAction(org.bimserver.database.actions.UploadFileDatabaseAction)

Aggregations

UserException (org.bimserver.shared.exceptions.UserException)362 ServerException (org.bimserver.shared.exceptions.ServerException)253 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)241 DatabaseSession (org.bimserver.database.DatabaseSession)227 IOException (java.io.IOException)220 SerializerException (org.bimserver.plugins.serializers.SerializerException)113 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)112 MalformedURLException (java.net.MalformedURLException)109 MessagingException (javax.mail.MessagingException)109 BcfException (org.opensourcebim.bcf.BcfException)109 UnsupportedEncodingException (java.io.UnsupportedEncodingException)108 AddressException (javax.mail.internet.AddressException)108 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)108 User (org.bimserver.models.store.User)65 Project (org.bimserver.models.store.Project)48 Revision (org.bimserver.models.store.Revision)39 ArrayList (java.util.ArrayList)35 Date (java.util.Date)34 SProject (org.bimserver.interfaces.objects.SProject)31 PackageMetaData (org.bimserver.emf.PackageMetaData)30