@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public MeasurementBaseline calculateAutoBaselineForGroupInNewTransaction( Subject subject, int groupId, int definitionId, long startDate, long endDate, boolean save) throws BaselineCreationException, MeasurementNotFoundException { if (save && !authorizationManager.hasGroupPermission( subject, Permission.MANAGE_MEASUREMENTS, groupId)) { throw new PermissionException( "User[" + subject.getName() + "] does not have permission to calculate and set baselines for group[id=" + groupId + "]"); } MeasurementBaseline baseline; try { baseline = calculateBaselineForGroup(groupId, definitionId, true, startDate, endDate, save); if (save) { // We have changed the baseline information for the schedule, so remove the now outdated OOB // info. oobManager.removeOOBsForGroupAndDefinition(subject, groupId, definitionId); } } catch (DataNotAvailableException e) { throw new BaselineCreationException( "Error fetching data for baseline calculation for group[id=" + groupId + "], definition[id=" + definitionId + "]"); } return baseline; }