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.requests;
17
18 import org.openehealth.ipf.commons.core.modules.api.Validator;
19 import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLRemoveMetadataRequest;
20 import org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationProfile;
21
22 import static org.openehealth.ipf.commons.ihe.xds.XDS.Interactions.ITI_62;
23 import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.EMPTY_REFERENCE_LIST;
24 import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.OBJECT_SHALL_NOT_BE_SPECIFIED;
25 import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidatorAssertions.metaDataAssert;
26
27
28
29
30
31 public class RemoveMetadataRequestValidator implements Validator<EbXMLRemoveMetadataRequest, ValidationProfile> {
32
33
34
35
36
37
38
39
40 @Override
41 public void validate(EbXMLRemoveMetadataRequest request, ValidationProfile profile) {
42 if (profile == ITI_62) {
43 metaDataAssert(request.getReferences().size() > 0, EMPTY_REFERENCE_LIST, "RemoveObjectsRequest");
44 metaDataAssert(request.getId() == null &&
45 request.getHome() == null &&
46 request.getSql() == null &&
47 request.getSlots().isEmpty(), OBJECT_SHALL_NOT_BE_SPECIFIED, "AdhocQuery");
48 }
49 }
50 }