@Test(expected = IllegalArgumentException.class) public void testCreateConsentCDAInvalidParam1() { Patient patient = createPatient(); DocumentEntry documentEntry = documentEntryBuilder.createDocumentEntry( new CoalaAuthor("testName", "testName", "testName"), patient, PatientConsentPolicy.ONE, new Date(), new Date()); cdaBuilder.createConsentCDA(null, PatientConsentPolicy.ONE, documentEntry); }
public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry == null) throw new IllegalArgumentException("documentEntry cannot be null."); StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context = createMetaContext(context, patient, policy, documentEntry); context.put(TAG_CDA_ID_ROOT, documentEntry.getUniqueId()); context.put(TAG_CDA_CODE_CODE, documentEntry.getTypeCode().getCode()); context.put(TAG_CDA_CODE_DISPLAYNAME, documentEntry.getTypeCode() .getDisplayName().getValue()); context.put(TAG_CDA_CODE_CODESYSTEM, CDA_CODE_CODESYSTEM_OID); context.put(TAG_CDA_CODE_CODESYSTEMNAME, documentEntry.getTypeCode() .getSchemeName()); context.put(TAG_CDA_EFFECTIVETIME, documentEntry.getCreationTime()); context.put(TAG_CDA_CONFIDENTIALTY_CODE, documentEntry .getConfidentialityCodes().get(0).getCode()); context.put(TAG_CDA_CONFIDENTIALTY_DISPLAYNAME, documentEntry .getConfidentialityCodes().get(0).getDisplayName().getValue()); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEM, CDA_CONFIDENTIALTY_CODESYSTEM_OID); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEMNAME, documentEntry .getConfidentialityCodes().get(0).getSchemeName()); context.put(TAG_CDA_LANGUAGECODE, documentEntry.getLanguageCode()); context.put(TAG_CDA_Author_TITLE, documentEntry.getAuthor() .getAuthorPerson().getName().getPrefix()); context.put(TAG_CDA_Author_FAMILY, documentEntry.getAuthor() .getAuthorPerson().getName().getFamilyName()); context.put(TAG_CDA_Author_GIVEN, documentEntry.getAuthor() .getAuthorPerson().getName().getGivenName()); context.put(TAG_CDA_VALIDFROM, documentEntry.getServiceStartTime()); context.put(TAG_CDA_VALIDUNTIL, documentEntry.getServiceStopTime()); try { t.merge(context, writer); } catch (Exception e) { throw new CDACreationException(e.getLocalizedMessage(), e); } LOG.debug(writer.toString()); return writer.toString(); }
CDABuilder { public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry == null) throw new IllegalArgumentException("documentEntry cannot be null."); StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context = createMetaContext(context, patient, policy, documentEntry); context.put(TAG_CDA_ID_ROOT, documentEntry.getUniqueId()); context.put(TAG_CDA_CODE_CODE, documentEntry.getTypeCode().getCode()); context.put(TAG_CDA_CODE_DISPLAYNAME, documentEntry.getTypeCode() .getDisplayName().getValue()); context.put(TAG_CDA_CODE_CODESYSTEM, CDA_CODE_CODESYSTEM_OID); context.put(TAG_CDA_CODE_CODESYSTEMNAME, documentEntry.getTypeCode() .getSchemeName()); context.put(TAG_CDA_EFFECTIVETIME, documentEntry.getCreationTime()); context.put(TAG_CDA_CONFIDENTIALTY_CODE, documentEntry .getConfidentialityCodes().get(0).getCode()); context.put(TAG_CDA_CONFIDENTIALTY_DISPLAYNAME, documentEntry .getConfidentialityCodes().get(0).getDisplayName().getValue()); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEM, CDA_CONFIDENTIALTY_CODESYSTEM_OID); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEMNAME, documentEntry .getConfidentialityCodes().get(0).getSchemeName()); context.put(TAG_CDA_LANGUAGECODE, documentEntry.getLanguageCode()); context.put(TAG_CDA_Author_TITLE, documentEntry.getAuthor() .getAuthorPerson().getName().getPrefix()); context.put(TAG_CDA_Author_FAMILY, documentEntry.getAuthor() .getAuthorPerson().getName().getFamilyName()); context.put(TAG_CDA_Author_GIVEN, documentEntry.getAuthor() .getAuthorPerson().getName().getGivenName()); context.put(TAG_CDA_VALIDFROM, documentEntry.getServiceStartTime()); context.put(TAG_CDA_VALIDUNTIL, documentEntry.getServiceStopTime()); try { t.merge(context, writer); } catch (Exception e) { throw new CDACreationException(e.getLocalizedMessage(), e); } LOG.debug(writer.toString()); return writer.toString(); } }
CDABuilder { public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry == null) throw new IllegalArgumentException("documentEntry cannot be null."); StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context = createMetaContext(context, patient, policy, documentEntry); context.put(TAG_CDA_ID_ROOT, documentEntry.getUniqueId()); context.put(TAG_CDA_CODE_CODE, documentEntry.getTypeCode().getCode()); context.put(TAG_CDA_CODE_DISPLAYNAME, documentEntry.getTypeCode() .getDisplayName().getValue()); context.put(TAG_CDA_CODE_CODESYSTEM, CDA_CODE_CODESYSTEM_OID); context.put(TAG_CDA_CODE_CODESYSTEMNAME, documentEntry.getTypeCode() .getSchemeName()); context.put(TAG_CDA_EFFECTIVETIME, documentEntry.getCreationTime()); context.put(TAG_CDA_CONFIDENTIALTY_CODE, documentEntry .getConfidentialityCodes().get(0).getCode()); context.put(TAG_CDA_CONFIDENTIALTY_DISPLAYNAME, documentEntry .getConfidentialityCodes().get(0).getDisplayName().getValue()); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEM, CDA_CONFIDENTIALTY_CODESYSTEM_OID); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEMNAME, documentEntry .getConfidentialityCodes().get(0).getSchemeName()); context.put(TAG_CDA_LANGUAGECODE, documentEntry.getLanguageCode()); context.put(TAG_CDA_Author_TITLE, documentEntry.getAuthor() .getAuthorPerson().getName().getPrefix()); context.put(TAG_CDA_Author_FAMILY, documentEntry.getAuthor() .getAuthorPerson().getName().getFamilyName()); context.put(TAG_CDA_Author_GIVEN, documentEntry.getAuthor() .getAuthorPerson().getName().getGivenName()); context.put(TAG_CDA_VALIDFROM, documentEntry.getServiceStartTime()); context.put(TAG_CDA_VALIDUNTIL, documentEntry.getServiceStopTime()); try { t.merge(context, writer); } catch (Exception e) { throw new CDACreationException(e.getLocalizedMessage(), e); } LOG.debug(writer.toString()); return writer.toString(); } CDABuilder(String templateName); }
CDABuilder { public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry == null) throw new IllegalArgumentException("documentEntry cannot be null."); StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context = createMetaContext(context, patient, policy, documentEntry); context.put(TAG_CDA_ID_ROOT, documentEntry.getUniqueId()); context.put(TAG_CDA_CODE_CODE, documentEntry.getTypeCode().getCode()); context.put(TAG_CDA_CODE_DISPLAYNAME, documentEntry.getTypeCode() .getDisplayName().getValue()); context.put(TAG_CDA_CODE_CODESYSTEM, CDA_CODE_CODESYSTEM_OID); context.put(TAG_CDA_CODE_CODESYSTEMNAME, documentEntry.getTypeCode() .getSchemeName()); context.put(TAG_CDA_EFFECTIVETIME, documentEntry.getCreationTime()); context.put(TAG_CDA_CONFIDENTIALTY_CODE, documentEntry .getConfidentialityCodes().get(0).getCode()); context.put(TAG_CDA_CONFIDENTIALTY_DISPLAYNAME, documentEntry .getConfidentialityCodes().get(0).getDisplayName().getValue()); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEM, CDA_CONFIDENTIALTY_CODESYSTEM_OID); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEMNAME, documentEntry .getConfidentialityCodes().get(0).getSchemeName()); context.put(TAG_CDA_LANGUAGECODE, documentEntry.getLanguageCode()); context.put(TAG_CDA_Author_TITLE, documentEntry.getAuthor() .getAuthorPerson().getName().getPrefix()); context.put(TAG_CDA_Author_FAMILY, documentEntry.getAuthor() .getAuthorPerson().getName().getFamilyName()); context.put(TAG_CDA_Author_GIVEN, documentEntry.getAuthor() .getAuthorPerson().getName().getGivenName()); context.put(TAG_CDA_VALIDFROM, documentEntry.getServiceStartTime()); context.put(TAG_CDA_VALIDUNTIL, documentEntry.getServiceStopTime()); try { t.merge(context, writer); } catch (Exception e) { throw new CDACreationException(e.getLocalizedMessage(), e); } LOG.debug(writer.toString()); return writer.toString(); } CDABuilder(String templateName); void setPxsDateConverter(PXSDateConverter pxsDateConverter); String createConsentCDA(Patient patient,
			PatientConsentPolicy policy, DocumentEntry documentEntry); }
CDABuilder { public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry == null) throw new IllegalArgumentException("documentEntry cannot be null."); StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context = createMetaContext(context, patient, policy, documentEntry); context.put(TAG_CDA_ID_ROOT, documentEntry.getUniqueId()); context.put(TAG_CDA_CODE_CODE, documentEntry.getTypeCode().getCode()); context.put(TAG_CDA_CODE_DISPLAYNAME, documentEntry.getTypeCode() .getDisplayName().getValue()); context.put(TAG_CDA_CODE_CODESYSTEM, CDA_CODE_CODESYSTEM_OID); context.put(TAG_CDA_CODE_CODESYSTEMNAME, documentEntry.getTypeCode() .getSchemeName()); context.put(TAG_CDA_EFFECTIVETIME, documentEntry.getCreationTime()); context.put(TAG_CDA_CONFIDENTIALTY_CODE, documentEntry .getConfidentialityCodes().get(0).getCode()); context.put(TAG_CDA_CONFIDENTIALTY_DISPLAYNAME, documentEntry .getConfidentialityCodes().get(0).getDisplayName().getValue()); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEM, CDA_CONFIDENTIALTY_CODESYSTEM_OID); context.put(TAG_CDA_CONFIDENTIALTY_CODESYSTEMNAME, documentEntry .getConfidentialityCodes().get(0).getSchemeName()); context.put(TAG_CDA_LANGUAGECODE, documentEntry.getLanguageCode()); context.put(TAG_CDA_Author_TITLE, documentEntry.getAuthor() .getAuthorPerson().getName().getPrefix()); context.put(TAG_CDA_Author_FAMILY, documentEntry.getAuthor() .getAuthorPerson().getName().getFamilyName()); context.put(TAG_CDA_Author_GIVEN, documentEntry.getAuthor() .getAuthorPerson().getName().getGivenName()); context.put(TAG_CDA_VALIDFROM, documentEntry.getServiceStartTime()); context.put(TAG_CDA_VALIDUNTIL, documentEntry.getServiceStopTime()); try { t.merge(context, writer); } catch (Exception e) { throw new CDACreationException(e.getLocalizedMessage(), e); } LOG.debug(writer.toString()); return writer.toString(); } CDABuilder(String templateName); void setPxsDateConverter(PXSDateConverter pxsDateConverter); String createConsentCDA(Patient patient,
			PatientConsentPolicy policy, DocumentEntry documentEntry);  }