public void run(ErrorRecorder er) { new ObjectStructureValidator(m, vc, rvi).run(er); new CodeValidation(m, vc, er).run(); new SubmissionStructure(m, rvi).run(er, vc); }
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; } }
void submission_structure(ErrorRecorder er, ValidationContext vc) { if (vc.isSubmit() && vc.isRequest) er.sectionHeading("Submission Structure"); ss_doc_fol_must_have_ids(er, vc); if (vc.isSubmit() && vc.isRequest) { has_single_ss(er, vc); all_docs_linked_to_ss(er, vc); all_fols_linked_to_ss(er, vc); symbolic_refs_not_in_submission(er); eval_assocs(er, vc); // Verifications from ITI TF-3 4.2.2.2.6 Rev. 12.1 are in the ProcessMetadataForRegister class ss_status_single_value(er, vc); new PatientId(m, er).run(); } if (hasmember_error) log_hasmember_usage(er); }
void all_fols_linked_to_ss(ErrorRecorder er, ValidationContext vc) { List<OMElement> fols = m.getFolders(); for (int i=0; i<fols.size(); i++) { OMElement fol = (OMElement) fols.get(i); if ( !has_assoc(m.getSubmissionSetId(), assoc_type("HasMember"), m.getId(fol))) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "Folder " + m.getId(fol) + " is not linked to the SubmissionSet with a " + assoc_type("HasMember") + " Association", this, "ITI TF-3: 4.1.4.2"); hasmember_error = true; } } }
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 all_docs_linked_to_ss(ErrorRecorder er, ValidationContext vc) { List<OMElement> docs = m.getExtrinsicObjects(); for (int i=0; i<docs.size(); i++) { OMElement doc = (OMElement) docs.get(i); OMElement assoc = find_assoc(m.getSubmissionSetId(), assoc_type("HasMember"), doc.getAttributeValue(MetadataSupport.id_qname)); if ( assoc == null) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "DocumentEntry(" + doc.getAttributeValue(MetadataSupport.id_qname) + ") is not linked to the SubmissionSet with a " + assoc_type("HasMember") + " Association", this, "ITI TF-3: 4.1.4.1"); } else { if (!has_sss_slot(assoc)) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, assocDescription(assoc) + ": links a DocumentEntry to the SubmissionSet but does not have a " + "SubmissionSetStatus Slot with value Original", this, "ITI TF-3: 4.1.4.1"); hasmember_error = true; } else if (!is_sss_original(assoc)) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, assocDescription(assoc) + ": links a DocumentEntry to the SubmissionSet but does not have a " + "SubmissionSetStatus Slot with value Original", this, "ITI TF-3: 4.1.4.1"); hasmember_error = true; } } } }
public void updateExistingFolderTimes(Metadata m) { for (OMElement aele : m.getAssociations()) { String sourceId = m.getAssocSource(aele); if (!m.contains(sourceId)) { // folder not in submission if (new SubmissionStructure(m, mc).is_fol_to_de_hasmember(aele)) { // folder is in registry try { Fol f = delta.folCollection.getById(sourceId); // will look in delta and main table delta.labelFolderUpdated(f, new Hl7Date().now()); } catch (Exception e) { er.err(XdsErrorCode.Code.XDSRegistryError, "Internal Registry error - folder known to exist cannot be accessed", this, null); } } } } }
void validateFolderHasMemberAssoc(ErrorRecorder er, String assocId) { OMElement assoc = getObjectById(assocId); if (simpleAssocType(m.getAssocType(assoc)).equals("HasMember")) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, assocDescription(assocId) + ": only Folder to DocumentEntry associations can be members of SubmissionSet (linked to SubmissionSet model via HasMember association", this, assocsRef); hasmember_error = true;
String a_source = assoc.getAttributeValue(MetadataSupport.source_object_qname); if (a_target == null) { cannotValidate(er, "Association(" + assoc.getAttributeValue(MetadataSupport.id_qname) + ") - targetObject"); return; cannotValidate(er, "Association(" + assoc.getAttributeValue(MetadataSupport.id_qname) + ") - sourceObject"); return; cannotValidate(er, "Association(" + assoc.getAttributeValue(MetadataSupport.id_qname) + ") - associationType"); return; String hm = assoc_type("HasMember"); if ( !a_type.equals(hm)) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "Association referencing SubmissionSet has type " + a_type + " but only type " + assoc_type("HasMember") + " is allowed", this, "ITI TF-3: 4.1.4"); hasmember_error = true;
String assocDescription(OMElement obj) { return assocDescription(m.getId(obj)); }
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "SubmissionSetStatus Slot on Submission Set association has no value", this, "ITI TF-3: 4.1.4.1"); } else if ( ss_status.equals("Original")) { if ( !containsObject(target)) er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "SubmissionSetStatus Slot on SubmissionSet association has value 'Original' but the targetObject " + target + " references an model not in the submission", this, "ITI TF-3: 4.1.4.1"); } else if ( ss_status.equals("Reference")) { if (containsObject(target)) er.err(XdsErrorCode.Code.XDSRegistryMetadataError, "SubmissionSetStatus Slot on SubmissionSet association has value 'Reference' but the targetObject " + target + " references an model in the submission", this, "ITI TF-3: 4.1.4.1");
static public void main(String[] args) { Metadata m; ValidateSubmissionMain main = new ValidateSubmissionMain(); String sampleDir = "/Users/bill/dev/sampleSubmissions/"; ErrorRecorder er = new TextErrorRecorder(); try { m = MetadataParser.parseNonSubmission(new File(sampleDir + args[0])); ValidationContext vc = DefaultValidationContextFactory.validationContext(); vc.isR = true; vc.skipInternalStructure = true; MetadataValidator mv = new MetadataValidator(m, vc, null); new ObjectStructureValidator(m, vc, null).run(er); mv.runCodeValidation(er); new SubmissionStructure(m, null).run(er, vc); er.finish(); } catch (Exception e) { er.err(XdsErrorCode.Code.XDSRegistryMetadataError, e); } er.showErrorInfo(); }
new ObjectStructureValidator(m, vc, rvi).run(er); mv.runCodeValidation(er); new SubmissionStructure(m, rvi).run(er, vc);
new SubmissionStructure(m, rvi).run(er, vc);