AdapterComponentDocRepositoryOrchImpl { protected void setDocumentObjectsFromClassifications(DocumentMetadata doc, List<ClassificationType> classifications) { String authorPerson = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_AUTHOR_CLASSIFICATION, DocRepoConstants.XDS_AUTHOR_PERSON_SLOT, -1); doc.setAuthorPerson(authorPerson); String authorInstitution = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_AUTHOR_CLASSIFICATION, DocRepoConstants.XDS_AUTHOR_INSTITUTION_SLOT, -1); doc.setAuthorInstitution(authorInstitution); String authorRole = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_AUTHOR_CLASSIFICATION, DocRepoConstants.XDS_AUTHOR_ROLE_SLOT, -1); doc.setAuthorRole(authorRole); String authorSpeciality = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_AUTHOR_CLASSIFICATION, DocRepoConstants.XDS_AUTHOR_SPECIALITY_SLOT, -1); doc.setAuthorSpecialty(authorSpeciality); String classCode = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CLASSCODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION); doc.setClassCode(classCode); String classCodeScheme = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CLASSCODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0); doc.setClassCodeScheme(classCodeScheme); String classCodeDisplayName = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CLASSCODE_CLASSIFICATION, DocRepoConstants.XDS_NAME); doc.setClassCodeDisplayName(classCodeDisplayName); String confidentialityCode = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CONFIDENTIALITY_CODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION); doc.setConfidentialityCode(confidentialityCode); String confidentialityCodeScheme = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CONFIDENTIALITY_CODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0); doc.setConfidentialityCodeScheme(confidentialityCodeScheme); String confidentialityCodeDisplayName = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_CONFIDENTIALITY_CODE_CLASSIFICATION, DocRepoConstants.XDS_NAME); doc.setConfidentialityCodeDisplayName(confidentialityCodeDisplayName); String formatCode = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_FORMAT_CODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION); doc.setFormatCode(formatCode); String formatCodeScheme = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_FORMAT_CODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0); doc.setFormatCodeScheme(formatCodeScheme); String formatCodeDisplayName = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_FORMAT_CODE_CLASSIFICATION, DocRepoConstants.XDS_NAME); doc.setFormatCodeDisplayName(formatCodeDisplayName); doc.setFacilityCode(docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_HEALTHCARE_FACILITY_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION)); doc.setFacilityCodeScheme(docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_HEALTHCARE_FACILITY_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0)); doc.setFacilityCodeDisplayName(docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_HEALTHCARE_FACILITY_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_NAME)); String practiceSetting = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_PRACTICE_SETTING_CODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION); doc.setPracticeSetting(practiceSetting); String practiceSettingScheme = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_PRACTICE_SETTING_CODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0); doc.setPracticeSettingScheme(practiceSettingScheme); String practiceSettingDisplayName = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_PRACTICE_SETTING_CODE_CLASSIFICATION, DocRepoConstants.XDS_NAME); doc.setPracticeSettingDisplayName(practiceSettingDisplayName); String typeCode = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_NODE_REPRESENTATION); doc.setTypeCode(typeCode); String typeCodeScheme = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_CODING_SCHEME_SLOT, 0); doc.setTypeCodeScheme(typeCodeScheme); String typeCodeDisplayName = docRepoHelper.extractClassificationMetadata(classifications, DocRepoConstants.XDS_TYPE_CODE_CLASSIFICATION, DocRepoConstants.XDS_NAME); doc.setTypeCodeDisplayName(typeCodeDisplayName); if (LOG.isDebugEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("authorPerson: " + authorPerson + ",\n"); builder.append("authorPerson: " + authorPerson + ",\n"); builder.append("authorInstitution: " + authorInstitution + ",\n"); builder.append("authorRole: " + authorRole + ",\n"); builder.append("authorSpeciality: " + authorSpeciality + ",\n"); builder.append("classCode: " + classCode + ",\n"); builder.append("classCodeScheme: " + classCodeScheme + ",\n"); builder.append("classCodeDisplayName: " + classCodeDisplayName + ",\n"); builder.append("confidentialityCode: " + confidentialityCode + ",\n"); builder.append("confidentialityCodeDisplayName: " + confidentialityCodeDisplayName + ",\n"); builder.append("confidentialityCodeScheme: " + confidentialityCodeScheme + ",\n"); builder.append("formatCode: " + formatCode + ",\n"); builder.append("typeCode: " + typeCode + ",\n"); builder.append("formatCodeScheme: " + formatCodeScheme + ",\n"); builder.append("formatCodeDisplayName: " + formatCodeDisplayName + ",\n"); builder.append("practiceSetting: " + practiceSetting + ",\n"); builder.append("practiceSettingScheme: " + practiceSettingScheme + ",\n"); builder.append("practiceSettingDisplayName: " + practiceSettingDisplayName + ",\n"); builder.append("typeCodeScheme: " + typeCodeScheme + ",\n"); builder.append("typeCodeDisplayName: " + typeCodeDisplayName); LOG.debug(builder.toString()); } } AdapterComponentDocRepositoryOrchImpl(); DocumentService getDocumentService(); LargeFileUtils getLargeFileUtils(); UTCDateUtil getDateUtil(); RetrieveDocumentSetResponseType documentRepositoryRetrieveDocumentSet(RetrieveDocumentSetRequestType body); RegistryResponseType registerDocumentSet(RegisterDocumentSetRequestType body); RegistryResponseType documentRepositoryProvideAndRegisterDocumentSet(
        ProvideAndRegisterDocumentSetRequestType body); DocumentMetadata saveExtrinsicObject(ExtrinsicObjectType extrinsicObject, RegistryErrorList errorList,
        Map<String, DataHandler> docMap, boolean hasReplacementRequest);  }
@Test public void testSetDocumentObjectsFromClassifications() { final AdapterComponentDocRepositoryHelper docRepoHelper = mock(AdapterComponentDocRepositoryHelper.class); AdapterComponentDocRepositoryOrchImpl docRepo = new AdapterComponentDocRepositoryOrchImpl() { @Override protected AdapterComponentDocRepositoryHelper getHelper() { return docRepoHelper; } }; DocumentMetadata doc = new DocumentMetadata(); List<ClassificationType> classifications = mock(ArrayList.class); final String AUTHOR_PERSON = "author"; final String AUTHOR_INSTITUTION = "author institution"; final String AUTHOR_ROLE = "author role"; final String AUTHOR_SPECIALTY = "author specialty"; final String CLASS_CODE_SCHEME = "code scheme"; final String CLASS_CODE = "class code"; final String CONFIDENTIALITY_CODE_SCHEME = "conf code scheme"; final String FORMAT_CODE_SCHEME = "format code scheme"; final String HC_CODE_SCHEME = "facility code scheme"; final String PRACTICE_SETTING_SCHEME = "practice setting scheme"; final String TYPE_CODE_SCHEME = "type code scheme"; final String CLASS_CODE_NAME = "class code name"; final String CONFIDENTIALITY_CODE = "confidentiality code"; final String CONFIDENTIALITY_CODE_NAME = "confidentiality code name"; final String FORMAT_CODE = "format code"; final String FORMAT_CODE_NAME = "formant code name"; final String HC_CODE = "hc code"; final String HC_CODE_NAME = "hc code name"; final String PRACTICE_SETTING = "practice setting"; final String PRACTICE_SETTING_NAME = "practice setting name"; final String TYPE_CODE = "type code"; final String TYPE_CODE_NAME = "type code name"; when(docRepoHelper.extractClassificationMetadata(any(List.class), anyString(), anyString(), anyInt())) .thenReturn(AUTHOR_PERSON, AUTHOR_INSTITUTION, AUTHOR_ROLE, AUTHOR_SPECIALTY, CLASS_CODE_SCHEME, CONFIDENTIALITY_CODE_SCHEME, FORMAT_CODE_SCHEME, HC_CODE_SCHEME, PRACTICE_SETTING_SCHEME, TYPE_CODE_SCHEME); when(docRepoHelper.extractClassificationMetadata(any(List.class), anyString(), anyString())).thenReturn( CLASS_CODE, CLASS_CODE_NAME, CONFIDENTIALITY_CODE, CONFIDENTIALITY_CODE_NAME, FORMAT_CODE, FORMAT_CODE_NAME, HC_CODE, HC_CODE_NAME, PRACTICE_SETTING, PRACTICE_SETTING_NAME, TYPE_CODE, TYPE_CODE_NAME); docRepo.setDocumentObjectsFromClassifications(doc, classifications); assertEquals(AUTHOR_INSTITUTION, doc.getAuthorInstitution()); assertEquals(AUTHOR_PERSON, doc.getAuthorPerson()); assertEquals(AUTHOR_ROLE, doc.getAuthorRole()); assertEquals(AUTHOR_SPECIALTY, doc.getAuthorSpecialty()); assertEquals(CLASS_CODE, doc.getClassCode()); assertEquals(CLASS_CODE_NAME, doc.getClassCodeDisplayName()); assertEquals(CLASS_CODE_SCHEME, doc.getClassCodeScheme()); assertEquals(CONFIDENTIALITY_CODE, doc.getConfidentialityCode()); assertEquals(CONFIDENTIALITY_CODE_NAME, doc.getConfidentialityCodeDisplayName()); assertEquals(CONFIDENTIALITY_CODE_SCHEME, doc.getConfidentialityCodeScheme()); assertEquals(HC_CODE, doc.getFacilityCode()); assertEquals(HC_CODE_NAME, doc.getFacilityCodeDisplayName()); assertEquals(HC_CODE_SCHEME, doc.getFacilityCodeScheme()); assertEquals(FORMAT_CODE, doc.getFormatCode()); assertEquals(FORMAT_CODE_NAME, doc.getFormatCodeDisplayName()); assertEquals(FORMAT_CODE_SCHEME, doc.getFormatCodeScheme()); assertEquals(PRACTICE_SETTING, doc.getPracticeSetting()); assertEquals(PRACTICE_SETTING_NAME, doc.getPracticeSettingDisplayName()); assertEquals(PRACTICE_SETTING_SCHEME, doc.getPracticeSettingScheme()); assertEquals(TYPE_CODE, doc.getTypeCode()); assertEquals(TYPE_CODE_NAME, doc.getTypeCodeDisplayName()); assertEquals(TYPE_CODE_SCHEME, doc.getTypeCodeScheme()); }