Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SIGPUBLIC
unantes-orientation-active
Commits
0f08045d
Commit
0f08045d
authored
Sep 30, 2021
by
Kevin Robert
Browse files
Mise en place de l'ancienne regex pour la validation de la référence des réponses.
parent
e9d8806a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/unantes/orientactive/converter/bean/Choice.java
View file @
0f08045d
...
...
@@ -30,7 +30,7 @@ public class Choice {
public
void
validate
()
{
this
.
value
=
this
.
value
.
trim
();
ValidationUtils
.
validateReference
(
this
.
value
);
ValidationUtils
.
validateReference
Answer
(
this
.
value
);
}
public
String
getLabel
()
{
...
...
src/main/java/com/unantes/orientactive/validation/ValidationUtils.java
View file @
0f08045d
...
...
@@ -8,6 +8,7 @@ import com.unantes.orientactive.web.rest.errors.InvalidReferenceException;
public
class
ValidationUtils
{
public
static
Pattern
PATTERN_REFERENCE
=
Pattern
.
compile
(
"^[a-zA-Z]+[a-zA-Z0-9_]*$"
);
public
static
Pattern
PATTERN_REFERENCE_ANSWERS
=
Pattern
.
compile
(
"^[a-zA-Z0-9_]*$"
);
public
static
String
RESERVED_SEPARATOR
=
"__"
;
public
static
void
validateReference
(
final
String
reference
)
{
...
...
@@ -16,4 +17,11 @@ public class ValidationUtils {
throw
new
InvalidReferenceException
();
}
}
public
static
void
validateReferenceAnswer
(
final
String
reference
)
{
Matcher
matcher
=
PATTERN_REFERENCE_ANSWERS
.
matcher
(
reference
);
if
(!
matcher
.
matches
()
||
reference
.
contains
(
RESERVED_SEPARATOR
))
{
throw
new
InvalidReferenceException
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment