1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.validate;
17
18 import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.*;
19 import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidatorAssertions.*;
20
21 import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLRegistryObject;
22
23
24
25
26
27 public class ExternalIdentifierValidation implements RegistryObjectValidator {
28 private final String scheme;
29 private final ValueValidator validator;
30
31
32
33
34
35
36
37
38 public ExternalIdentifierValidation(String scheme, ValueValidator validator) {
39 this.scheme = scheme;
40 this.validator = validator;
41 }
42
43 @Override
44 public void validate(EbXMLRegistryObject obj) throws XDSMetaDataException {
45 String value = obj.getExternalIdentifierValue(scheme);
46 metaDataAssert(value != null, MISSING_EXTERNAL_IDENTIFIER, scheme);
47
48 validator.validate(value);
49 }
50 }