Example #1
0
 private void checkDeleteLocation(LocationId locationId) {
   boolean hasNoOrgs = locationRepository.checkBusinessUnits(locationId);
   if (!hasNoOrgs) {
     throw new IllegalArgumentException("cannot delete location with associated business units");
   }
   boolean hasNoPositions = locationRepository.checkPositions(locationId);
   if (!hasNoPositions) {
     throw new IllegalArgumentException("cannot delete location with associated positions");
   }
 }
Example #2
0
 /**
  * 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");
   }
 }