Skip to content
Snippets Groups Projects
Commit bd653479 authored by felmer's avatar felmer
Browse files

extract code length as a constant

SVN: 13470
parent 0d360522
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMess ...@@ -28,6 +28,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMess
*/ */
public class CodeField extends TriggerField<String> public class CodeField extends TriggerField<String>
{ {
private static final int CODE_MAX_LENGTH = 40;
private static final String CODE_CHAR_PATTERN = "a-zA-Z0-9_\\-\\."; private static final String CODE_CHAR_PATTERN = "a-zA-Z0-9_\\-\\.";
public static final String CODE_CHARS = "[" + CODE_CHAR_PATTERN + "]+"; public static final String CODE_CHARS = "[" + CODE_CHAR_PATTERN + "]+";
...@@ -107,7 +109,7 @@ public class CodeField extends TriggerField<String> ...@@ -107,7 +109,7 @@ public class CodeField extends TriggerField<String>
final String pattern, final String allowedCharacters) final String pattern, final String allowedCharacters)
{ {
VarcharField.configureField(this, label, true); VarcharField.configureField(this, label, true);
setMaxLength(40); setMaxLength(CODE_MAX_LENGTH);
setRegex(pattern); setRegex(pattern);
getMessages().setRegexText( getMessages().setRegexText(
messageProvider.getMessage(Dict.INVALID_CODE_MESSAGE, allowedCharacters)); messageProvider.getMessage(Dict.INVALID_CODE_MESSAGE, allowedCharacters));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment