1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.core.persistence.jpa.validation.entity;
20
21 import java.lang.annotation.Annotation;
22 import javax.validation.ConstraintValidator;
23 import org.apache.syncope.common.lib.types.EntityViolationType;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 public abstract class AbstractValidator<A extends Annotation, T> implements ConstraintValidator<A, T> {
28
29 protected static final Logger LOG = LoggerFactory.getLogger(AbstractValidator.class);
30
31 @Override
32 public void initialize(final A annotation) {
33
34 }
35
36 protected static String getTemplate(final EntityViolationType type, final String message) {
37 return type.name() + ';' + message;
38 }
39
40 protected boolean isHtml(final String text) {
41 return text != null && (text.indexOf('<') != -1 || text.indexOf('>') != -1);
42 }
43 }