/** * Checks that the given name is unique within the given business unit. If the name is not unique, * an IllegalArgumentExcption is raised and processing terminates. * * @param locationId The identifier of the location to check. * @param name The location name to check for uniqueness. * @param businessUnitId The business unit within which to check. */ private void checkUniqueName(LocationId locationId, String name, BusinessUnitId businessUnitId) { Assert.notNull(locationRepository, "null repository"); boolean isUnique = locationRepository.checkUniqueName(locationId, name, businessUnitId); if (!isUnique) { throw new IllegalArgumentException("duplicate name within the business unit"); } }