String objectDescription(OMElement ele) { return objectDescription(m.getId(ele)); }
void has_single_ss(ErrorRecorder er, ValidationContext vc) { List<OMElement> ssEles = m.getSubmissionSets(); if (ssEles.size() == 0) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "Submission does not contain a SubmissionSet", this, "ITI TF-3: 4.1.4"); } else if (ssEles.size() > 1) { List<String> doc = new ArrayList<String>(); for (String ssid : m.getSubmissionSetIds()) doc.add(objectDescription(ssid)); er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "Submission contains multiple SubmissionSets: " + doc , this, "ITI TF-3: 4.1.4"); } else er.detail(ssDescription(ssEles.get(0)) + ": SubmissionSet found"); }
void evalRelationship(ErrorRecorder er, OMElement assoc, ValidationContext vc) { String source = m.getAssocSource(assoc); String target = m.getAssocTarget(assoc); String type = m.getAssocType(assoc); if (source == null || target == null || type == null) return; if (!isDocumentEntry(source) && !vc.isMU) er.err(XdsErrorCode.Code.XDSRegistryMetadataError, objectDescription(assoc) + ": with type " + simpleAssocType(type) + " must reference a DocumentEntry in submission with its sourceObject attribute, it references " + objectDescription(source), this, "ITI TF-3: 4.1.6.1"); if (type.equals("urn:ihe:iti:2010:AssociationType:SubmitAssociation")) { if (!vc.isMU) er.err(XdsErrorCode.Code.XDSMetadataUpdateError, "Metadata Update feature disabled", null, null); if (!source.equals(m.getSubmissionSetId())) er.err(XdsErrorCode.Code.XDSMetadataUpdateError, "SubmitAssociation Association Type must reference the SubmissionSet with its sourceObject attribute", null, null); if (!m.isAssociation(target)) er.err(XdsErrorCode.Code.XDSMetadataUpdateError, "SubmitAssociation Association Type must reference an Association in the submission with its targetObject attribute", null, null); return; } if (containsObject(target)) { // This only checks for a circular reference but not the registry collection XdsErrorCode.Code err = XdsErrorCode.Code.XDSRegistryMetadataError; if (muAssocTypes.contains(type)) err = XdsErrorCode.Code.XDSMetadataUpdateError; er.err(err, objectDescription(assoc) + ": with type " + simpleAssocType(type) + " must reference a DocumentEntry in the registry with its targetObject attribute, it references " + objectDescription(target) + " which is in the submission", this, "ITI TF-3: 4.1.6.1"); } if (!isUUID(target)) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, objectDescription(assoc) + ": with type " + simpleAssocType(type) + " must reference a DocumentEntry in the registry with its targetObject attribute, it references " + objectDescription(target) + " which is a symbolic ID that cannot reference an model in the registry", this, "ITI TF-3: 4.1.6.1"); } }
void symbolic_refs_not_in_submission(ErrorRecorder er) { List<OMElement> assocs = m.getAssociations(); for (int i=0; i<assocs.size(); i++) { OMElement assoc = (OMElement) assocs.get(i); String target = assoc.getAttributeValue(MetadataSupport.target_object_qname); String type = assoc.getAttributeValue(MetadataSupport.association_type_qname); String source = assoc.getAttributeValue(MetadataSupport.source_object_qname); if (target == null || source == null || type == null) continue; if (!isUUID(source) && !submissionContains(source)) er.err(XdsErrorCode.Code.XDSRegistryMetadataError, objectDescription(assoc) + ": sourceObject has value " + source + " which is not in the submission but cannot be in registry since it is not in UUID format", this, "ITI TF-3: 4.1.12.3"); if (!isUUID(target) && !submissionContains(target)) er.err(XdsErrorCode.Code.XDSRegistryMetadataError, objectDescription(assoc) + ": targetObject has value " + target + " which is not in the submission but cannot be in registry since it is not in UUID format", this, "ITI TF-3: 4.1.12.3"); } }
void evalHasMember(ErrorRecorder er, OMElement assoc) { String source = m.getAssocSource(assoc); String target = m.getAssocTarget(assoc); String type = m.getAssocType(assoc); if (source == null || target == null || type == null) return; if (is_ss_to_de_hasmember(assoc)) { er.detail(assocDescription(assoc) + ": is a SubmissionSet to DocmentEntry HasMember association"); } else if (is_ss_to_existing_de_hasmember(assoc)) { er.detail(assocDescription(assoc) + ": is a SubmissionSet to existing DocmentEntry HasMember (ByReference) association"); } else if (is_ss_to_folder_hasmember(assoc)) { er.detail(assocDescription(assoc) + ": is a SubmissionSet to Folder HasMember association"); } else if (is_ss_to_folder_hasmember_hasmember(assoc)) { er.detail(assocDescription(assoc) + ": is a SubmissionSet to Folder-HasMember HasMember association (adds existing DocumentEntry to existing Folder)"); } else if (is_fol_to_de_hasmember(assoc)) { er.detail(assocDescription(assoc) + ": is a Folder to DocumentEntry HasMember association"); } else { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, assocDescription(assoc) + ": do not understand this HasMember association. " + "sourceObject is " + objectDescription(source) + " and targetObject is " + objectDescription(target), this, assocsRef); hasmember_error = true; } }