コード例 #1
0
 private Club findClub(String acronym) {
   Club club = clubRepository.findByAcronym(acronym);
   if (club == null) {
     throw new ElementNotFoundException(
         "The club with the acronym " + acronym + " could not be found");
   }
   return club;
 }
コード例 #2
0
 @Override
 public void createClub(ClubData clubData) {
   Club existingClub = clubRepository.findByAcronym(clubData.getAcronym());
   if (existingClub != null) {
     throw new ElementAlreadyExistsException("There is already a club with this acronym");
   }
   clubRepository.save(convertClub(clubData));
 }