use of org.bimserver.models.log.RevisionUpdated in project BIMserver by opensourceBIM.
the class UpdateRevisionDatabaseAction method execute.
@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
User actingUser = getUserByUoid(authorization.getUoid());
final Revision revision = getRevisionByRoid(sRevision.getOid());
if (revision == null) {
throw new UserException("Revision with pid " + sRevision.getOid() + " not found");
}
Project project = revision.getProject();
if (!authorization.hasRightsOnProjectOrSuperProjects(actingUser, project)) {
throw new UserException("User has no rights to update project properties");
}
final RevisionUpdated revisionUpdated = getDatabaseSession().create(RevisionUpdated.class);
revisionUpdated.setRevision(revision);
revisionUpdated.setDate(new Date());
revisionUpdated.setExecutor(actingUser);
revisionUpdated.setAccessMethod(getAccessMethod());
getDatabaseSession().addPostCommitAction(new PostCommitAction() {
@Override
public void execute() throws UserException {
bimServer.getNotificationsManager().notify(new SConverter().convertToSObject(revisionUpdated));
}
});
revision.setTag(sRevision.getTag());
getDatabaseSession().store(revision);
return null;
}
Aggregations