use of org.bimserver.notifications.ProgressOnProjectTopic in project BIMserver by opensourceBIM.
the class ServiceImpl method regenerateGeometry.
@Override
public Long regenerateGeometry(Long roid, Long eoid) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
Revision revision = session.get(roid, OldQuery.getDefault());
SUser user = getCurrentUser();
ProgressOnProjectTopic progressTopic = getBimServer().getNotificationsManager().createProgressOnProjectTopic(getAuthorization().getUoid(), revision.getProject().getOid(), SProgressTopicType.UPLOAD, "Regenerate geometry");
RegenerateGeometryDatabaseAction action = new RegenerateGeometryDatabaseAction(getBimServer(), session, getInternalAccessMethod(), revision.getProject().getOid(), roid, getCurrentUser().getOid(), eoid);
LongGenericAction longAction = new LongGenericAction(progressTopic.getKey().getId(), getBimServer(), user.getUsername(), user.getName(), getAuthorization(), action);
getBimServer().getLongActionManager().start(longAction);
return progressTopic.getKey().getId();
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.notifications.ProgressOnProjectTopic in project BIMserver by opensourceBIM.
the class ServiceImpl method initiateCheckin.
@Override
public Long initiateCheckin(Long poid, Long deserializerOid) throws ServerException, UserException {
requireAuthenticationAndRunningServer();
final DatabaseSession session = getBimServer().getDatabase().createSession();
try {
User user = (User) session.get(StorePackage.eINSTANCE.getUser(), getAuthorization().getUoid(), OldQuery.getDefault());
Project project = session.get(poid, OldQuery.getDefault());
if (!getAuthorization().hasRightsOnProjectOrSuperProjects(user, project)) {
throw new UserException("User has no rights to checkin models to this project");
}
if (!MailSystem.isValidEmailAddress(user.getUsername())) {
throw new UserException("Users must have a valid e-mail address to checkin");
}
if (project == null) {
throw new UserException("No project found with poid " + poid);
}
ProgressOnProjectTopic progressTopic = getBimServer().getNotificationsManager().createProgressOnProjectTopic(getAuthorization().getUoid(), poid, SProgressTopicType.UPLOAD, "Checkin");
return progressTopic.getKey().getId();
} catch (UserException e) {
throw e;
} catch (Throwable e) {
LOGGER.error("", e);
throw new ServerException(e);
} finally {
session.close();
}
}
Aggregations