Search in sources :

Example 1 with SNewService

use of org.bimserver.interfaces.objects.SNewService in project BIMserver by opensourceBIM.

the class ServiceImpl method addNewServiceToProject.

@Override
public Long addNewServiceToProject(Long poid, SNewService sService, SAction sAction) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
    try {
        NewService service = (NewService) session.create(StorePackage.eINSTANCE.getNewService());
        getBimServer().getSConverter().convertFromSObject(sService, service, session);
        AddNewServiceToProjectDatabaseAction dbAction = new AddNewServiceToProjectDatabaseAction(session, getInternalAccessMethod(), poid, service, service.getAction(), getAuthorization());
        return session.executeAndCommitAction(dbAction);
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : DatabaseSession(org.bimserver.database.DatabaseSession) AddNewServiceToProjectDatabaseAction(org.bimserver.database.actions.AddNewServiceToProjectDatabaseAction) NewService(org.bimserver.models.store.NewService) SNewService(org.bimserver.interfaces.objects.SNewService) ServiceException(org.bimserver.shared.exceptions.ServiceException) 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) PluginException(org.bimserver.shared.exceptions.PluginException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException)

Example 2 with SNewService

use of org.bimserver.interfaces.objects.SNewService in project BIMserver by opensourceBIM.

the class ServiceImpl method getAllNewServicesOfProject.

@Override
public List<org.bimserver.interfaces.objects.SNewService> getAllNewServicesOfProject(Long poid) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
    try {
        BimDatabaseAction<Set<NewService>> action = new GetAllNewServicesOfProjectDatabaseAction(session, getInternalAccessMethod(), poid);
        List<SNewService> convertToSListRevision = getBimServer().getSConverter().convertToSListNewService(session.executeAndCommitAction(action));
        Collections.sort(convertToSListRevision, new SNewServiceComparator());
        return convertToSListRevision;
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) DatabaseSession(org.bimserver.database.DatabaseSession) SNewService(org.bimserver.interfaces.objects.SNewService) GetAllNewServicesOfProjectDatabaseAction(org.bimserver.database.actions.GetAllNewServicesOfProjectDatabaseAction) SNewServiceComparator(org.bimserver.webservices.SNewServiceComparator) ServiceException(org.bimserver.shared.exceptions.ServiceException) 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) PluginException(org.bimserver.shared.exceptions.PluginException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException)

Aggregations

IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 MalformedURLException (java.net.MalformedURLException)2 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)2 MessagingException (javax.mail.MessagingException)2 AddressException (javax.mail.internet.AddressException)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 DatabaseSession (org.bimserver.database.DatabaseSession)2 SNewService (org.bimserver.interfaces.objects.SNewService)2 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)2 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)2 SerializerException (org.bimserver.plugins.serializers.SerializerException)2 PluginException (org.bimserver.shared.exceptions.PluginException)2 ServerException (org.bimserver.shared.exceptions.ServerException)2 ServiceException (org.bimserver.shared.exceptions.ServiceException)2 UserException (org.bimserver.shared.exceptions.UserException)2 BcfException (org.opensourcebim.bcf.BcfException)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1