public void enableAutoBaselineCalculation( Subject subject, Integer[] resourceIds, Integer[] definitionIds) { // bail out early if there's nothing to do if ((resourceIds.length < 1) || (definitionIds.length < 1)) { return; } List<MeasurementBaseline> bList = getBaselinesForResourcesAndDefinitionIds(resourceIds, definitionIds); for (MeasurementBaseline bl : bList) { if (!authorizationManager.hasResourcePermission( subject, Permission.MANAGE_MEASUREMENTS, bl.getSchedule().getResource().getId())) { throw new PermissionException( "Cannot enable baseline [" + bl + "] - you do not have permission"); } bl.setUserEntered(false); } }