-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update .gitignore to also exclude symlinks to build dir Signed-off-by: Jurriaan Den Toonder <[email protected]> * Add dataintegrityviolation handler for sponsor controller Signed-off-by: Jurriaan Den Toonder <[email protected]> * Add naming of foreing key constraint to get readable error Signed-off-by: Jurriaan Den Toonder <[email protected]> * Remove hashcode from sponsor Signed-off-by: Jurriaan Den Toonder <[email protected]> * Undo foreign key and work with custom exception Signed-off-by: Jurriaan Den Toonder <[email protected]> * Rename exception and replace find method with native implementation
- Loading branch information
Showing
8 changed files
with
168 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
### Gradle ### | ||
.gradle | ||
build/ | ||
build | ||
.gradletasknamecache | ||
|
||
# Ignore Gradle GUI config | ||
|
40 changes: 40 additions & 0 deletions
40
src/main/java/ch/wisv/areafiftylan/exception/SponsorConstraintViolationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2016 W.I.S.V. 'Christiaan Huygens' | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package ch.wisv.areafiftylan.exception; | ||
|
||
import ch.wisv.areafiftylan.web.sponsor.model.Sponsor; | ||
import ch.wisv.areafiftylan.web.tournament.model.Tournament; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
public class SponsorConstraintViolationException extends AreaFiftyLANException { | ||
public SponsorConstraintViolationException(Sponsor sponsor) { | ||
super(String.format( | ||
"Sponsor %s is still used by tournaments: %s", | ||
sponsor.getName(), | ||
String.join(", ", sponsor.getTournaments() | ||
.stream() | ||
.map(Tournament::getHeaderTitle) | ||
.collect(Collectors.toList())) | ||
)); | ||
} | ||
|
||
public SponsorConstraintViolationException() { | ||
super("Sponsor is still being used by one or more tournaments"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters