@@ -0,0 +1,1494 @@
+package uk.ac.ebi.quickgo.annotation.validation;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Stream;%0Aimport javax.validation.ConstraintValidator;%0Aimport javax.validation.ConstraintValidatorContext;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.beans.factory.annotation.Value;%0A%0Aimport static uk.ac.ebi.quickgo.annotation.validation.QuickGoValidation.toDb;%0A%0A/**%0A * @author Tony Wardell%0A * Date: 10/11/2016%0A * Time: 13:22%0A * Created with IntelliJ IDEA.%0A */%0Apublic class ReferenceDBXRefEntityValidation implements ConstraintValidator%3CReferenceValidator, String%5B%5D%3E %7B%0A%0A    @Autowired%0A    DBXRefEntityValidation dbxRefEntityValidation;%0A%0A    //@Value(%22$%7Bannotation.validation.reference.databases%7D%22)%0A    List%3CString%3E referenceDatabases = Arrays.asList(%22pmid%22,%22doi%22,%22go_ref%22,%22reactome%22);%0A%0A    @Override public void initialize(ReferenceValidator constraintAnnotation) %7B%7D%0A%0A%0A    @Override public boolean isValid(String%5B%5D values, ConstraintValidatorContext context) %7B%0A        return values == null %7C%7C%0A                Stream.of(values).allMatch(this::validReference) && dbxRefEntityValidation.isValid(values, context);%0A    %7D%0A%0A    private boolean validReference(String s) %7B%0A%0A        if(s == null)%7B%0A            return false;%0A        %7D%0A%0A        if(s.trim().isEmpty())%7B%0A            return false;%0A        %7D%0A%0A        if(!s.contains(%22:%22))%7B%0A            return true;%0A        %7D%0A%0A        return referenceDatabases.contains(toDb.apply(s));%0A    %7D%0A%7D%0A

Validate references against OK list of databases.