use of org.bimserver.models.log.ExtendedDataAddedToProject in project BIMserver by opensourceBIM.
the class AddExtendedDataToProjectDatabaseAction method execute.
@Override
public Long execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
super.execute();
User actingUser = getUserByUoid(authorization.getUoid());
Project project = getProjectByPoid(poid);
if (project == null) {
throw new UserException("Project with poid " + poid + " not found");
}
project.getExtendedData().add(getIdEObject());
getDatabaseSession().store(project);
final ExtendedDataAddedToProject extendedDataAddedToProject = getDatabaseSession().create(ExtendedDataAddedToProject.class);
extendedDataAddedToProject.setAccessMethod(getAccessMethod());
extendedDataAddedToProject.setDate(new Date());
extendedDataAddedToProject.setExecutor(actingUser);
extendedDataAddedToProject.setExtendedData(getIdEObject());
extendedDataAddedToProject.setProject(project);
getDatabaseSession().addPostCommitAction(new PostCommitAction() {
@Override
public void execute() throws UserException {
bimServer.getNotificationsManager().notify(new SConverter().convertToSObject(extendedDataAddedToProject));
}
});
return null;
}
Aggregations