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();
}
}
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();
}
}
Aggregations