Search in sources :

Example 21 with DatabaseSession

use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.

the class ServiceImpl method getAllNonAuthorizedProjectsOfUser.

@Override
public List<SProject> getAllNonAuthorizedProjectsOfUser(Long uoid) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<Set<Project>> action = new GetAllNonAuthorizedProjectsOfUserDatabaseAction(session, getInternalAccessMethod(), uoid);
        return getBimServer().getSConverter().convertToSListProject(session.executeAndCommitAction(action));
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) GetAllNonAuthorizedProjectsOfUserDatabaseAction(org.bimserver.database.actions.GetAllNonAuthorizedProjectsOfUserDatabaseAction) DatabaseSession(org.bimserver.database.DatabaseSession) 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 22 with DatabaseSession

use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.

the class ServiceImpl method getAllModelCheckers.

@Override
public List<SModelCheckerInstance> getAllModelCheckers() throws UserException, ServerException {
    requireAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        return getBimServer().getSConverter().convertToSListModelCheckerInstance(session.executeAndCommitAction(new GetAllModelCheckersDatabaseAction(session, getInternalAccessMethod())));
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : GetAllModelCheckersDatabaseAction(org.bimserver.database.actions.GetAllModelCheckersDatabaseAction) DatabaseSession(org.bimserver.database.DatabaseSession) 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 23 with DatabaseSession

use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.

the class ServiceImpl method getAllCheckoutsByUser.

@Override
public List<SCheckout> getAllCheckoutsByUser(Long uoid) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<List<Checkout>> action = new GetAllCheckoutsByUserDatabaseAction(session, getInternalAccessMethod(), uoid);
        List<Checkout> list = session.executeAndCommitAction(action);
        Collections.sort(list, new CheckoutComparator());
        return getBimServer().getSConverter().convertToSListCheckout(list);
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : SCheckout(org.bimserver.interfaces.objects.SCheckout) Checkout(org.bimserver.models.store.Checkout) DatabaseSession(org.bimserver.database.DatabaseSession) CheckoutComparator(org.bimserver.webservices.CheckoutComparator) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) GetAllCheckoutsByUserDatabaseAction(org.bimserver.database.actions.GetAllCheckoutsByUserDatabaseAction) 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 24 with DatabaseSession

use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.

the class ServiceImpl method removeUserFromProject.

@Override
public Boolean removeUserFromProject(Long uoid, Long poid) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<Boolean> action = new RemoveUserFromProjectDatabaseAction(getBimServer(), session, getInternalAccessMethod(), uoid, poid, getAuthorization());
        return session.executeAndCommitAction(action);
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : RemoveUserFromProjectDatabaseAction(org.bimserver.database.actions.RemoveUserFromProjectDatabaseAction) DatabaseSession(org.bimserver.database.DatabaseSession) 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 25 with DatabaseSession

use of org.bimserver.database.DatabaseSession 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();
    try {
        return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetDeserializerByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
    } catch (Exception e) {
        handleException(e);
    } finally {
        session.close();
    }
    return null;
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) GetDeserializerByIdDatabaseAction(org.bimserver.database.actions.GetDeserializerByIdDatabaseAction) 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)

Aggregations

DatabaseSession (org.bimserver.database.DatabaseSession)279 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)258 UserException (org.bimserver.shared.exceptions.UserException)228 ServerException (org.bimserver.shared.exceptions.ServerException)217 IOException (java.io.IOException)194 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)105 SerializerException (org.bimserver.plugins.serializers.SerializerException)105 UnsupportedEncodingException (java.io.UnsupportedEncodingException)103 MalformedURLException (java.net.MalformedURLException)103 MessagingException (javax.mail.MessagingException)103 AddressException (javax.mail.internet.AddressException)103 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)103 BcfException (org.opensourcebim.bcf.BcfException)103 User (org.bimserver.models.store.User)34 ArrayList (java.util.ArrayList)29 UserSettings (org.bimserver.models.store.UserSettings)29 Project (org.bimserver.models.store.Project)25 ServerSettings (org.bimserver.models.store.ServerSettings)21 ServerSettingsSetter (org.bimserver.database.actions.ServerSettingsSetter)18 SetServerSettingDatabaseAction (org.bimserver.database.actions.SetServerSettingDatabaseAction)18