-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GAP-2454 | add helper function to check version without renaming vers…
…ion to revision
- Loading branch information
1 parent
56df1aa
commit 19ce87d
Showing
8 changed files
with
128 additions
and
23 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
29 changes: 29 additions & 0 deletions
29
src/main/java/gov/cabinetoffice/gap/adminbackend/dtos/application/PatchSectionDTO.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,29 @@ | ||
package gov.cabinetoffice.gap.adminbackend.dtos.application; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.Pattern; | ||
import javax.validation.constraints.Size; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class PatchSectionDTO { | ||
|
||
// following regex allows empty string, letters, spaces, apostrophes, commas, and | ||
// hyphens. | ||
// the reason it allows empty string is so that only the @NotBlank error message will | ||
// return on empty string | ||
@Pattern(regexp = "^(?![\\s\\S])|^[a-zA-Z\\s',-]+$", | ||
message = "Section name must only use letters a to z, and special characters such as hyphens, spaces and apostrophes") | ||
@NotBlank(message = "Enter a section name") | ||
@Size(max = 250, message = "Your Section name must be 250 characters or less.") | ||
private String sectionTitle; | ||
|
||
private Integer version; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/gov/cabinetoffice/gap/adminbackend/exceptions/ConflictException.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,24 @@ | ||
package gov.cabinetoffice.gap.adminbackend.exceptions; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@ResponseStatus(HttpStatus.CONFLICT) | ||
public class ConflictException extends RuntimeException { | ||
|
||
public ConflictException() { | ||
} | ||
|
||
public ConflictException(String message) { | ||
super(message); | ||
} | ||
|
||
public ConflictException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ConflictException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
} |
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