HL7DataTransformHelper { public static ENExplicit createEnExplicit(String firstName, String middleName, String lastName, String title, String suffix) { org.hl7.v3.ObjectFactory factory = new org.hl7.v3.ObjectFactory(); ENExplicit enName = factory.createENExplicit(); List enNamelist = enName.getContent(); if (NullChecker.isNotNullish(lastName)) { EnExplicitFamily familyName = createEnExplicitFamily(lastName); enNamelist.add(factory.createENExplicitFamily(familyName)); } if (NullChecker.isNotNullish(firstName)) { EnExplicitGiven givenName = createEnExplicitGiven(firstName); enNamelist.add(factory.createENExplicitGiven(givenName)); } if (NullChecker.isNotNullish(middleName)) { EnExplicitGiven givenName2 = createEnExplicitGiven(middleName); enNamelist.add(factory.createENExplicitGiven(givenName2)); } if (NullChecker.isNotNullish(title)) { EnExplicitPrefix prefix = createEnExplicitPrefix(title); enNamelist.add(factory.createENExplicitPrefix(prefix)); } if (NullChecker.isNotNullish(suffix)) { EnExplicitSuffix enSuffix = createEnExplicitSuffix(suffix); enNamelist.add(factory.createENExplicitSuffix(enSuffix)); } return enName; }  static II IIFactory(String root); static II IIFactory(String root, String extension); static II IIFactory(String root, String extension, String assigningAuthorityName); static II IIFactoryCreateNull(); static CS CSFactory(String code); static CE CEFactory(String code); static CD CDFactory(String code); static CD CDFactory(String code, String codeSystem); static CD CDFactory(String code, String codeSystem, String displayName); static TSExplicit TSExplicitFactory(String value); static TSExplicit creationTimeFactory(); static ENExplicit convertPNToEN(PNExplicit pnName); static PNExplicit convertENtoPN(ENExplicit value); static ENExplicit createEnExplicit(String firstName, String middleName, String lastName, String title,
            String suffix); static PNExplicit createPNExplicit(String firstName, String lastName); static PNExplicit createPNExplicit(String firstName, String middleName, String lastName); static PNExplicit createPNExplicit(String firstName, String middleName, String lastName, String title,
            String suffix); static ADExplicit createADExplicit(boolean notOrdered, String street, String city, String state,
            String zip); static ADExplicit createADExplicit(String street, String city, String state, String zip); static ADExplicit createADExplicit(boolean notOrdered, String street, String street1, String city,
            String state, String zip); static ADExplicit createADExplicit(String street, String street1, String city, String state, String zip); static TELExplicit createTELExplicit(String value);  }
@SuppressWarnings("rawtypes") @Test public void createEnExplicit() { String firstName = "Gallow"; String middleName = "Matt"; String lastName = "Younger"; String title = "Patient"; String suffix = "S"; EnExplicitFamily familyName = null; EnExplicitGiven givenName; EnExplicitPrefix prefix = null; EnExplicitSuffix suf = null; HL7DataTransformHelper helper = new HL7DataTransformHelper(); ENExplicit enName = helper.createEnExplicit(firstName, middleName, lastName, title, suffix); List<Serializable> enList = enName.getContent(); Iterator<Serializable> iter = enList.iterator(); while (iter.hasNext()) { Serializable contentItem = iter.next(); if (contentItem instanceof JAXBElement) { JAXBElement oJAXBElement = (JAXBElement) contentItem; if (oJAXBElement.getValue() instanceof EnExplicitFamily) { familyName = (EnExplicitFamily) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); System.out.println(givenName.getPartType()); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); System.out.println(givenName.getPartType()); } if (oJAXBElement.getValue() instanceof EnExplicitPrefix) { prefix = (EnExplicitPrefix) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitSuffix) { suf = (EnExplicitSuffix) oJAXBElement.getValue(); } } } assertEquals(familyName.getContent(), lastName); assertEquals(prefix.getContent(), title); assertEquals(suf.getContent(), suffix); }
@Test public void createEnExplicitWhenFamilyNameNull() { String firstName = "Gallow"; String middleName = "Matt"; String lastName = null; String title = "Patient"; String suffix = "S"; EnExplicitFamily familyName = null; EnExplicitGiven givenName = null; EnExplicitPrefix prefix = null; EnExplicitSuffix suf = null; HL7DataTransformHelper helper = new HL7DataTransformHelper(); ENExplicit enName = helper.createEnExplicit(firstName, middleName, lastName, title, suffix); List<Serializable> choice = enName.getContent(); Iterator<Serializable> iterSerialObjects = choice.iterator(); while (iterSerialObjects.hasNext()) { Serializable contentItem = iterSerialObjects.next(); if (contentItem instanceof JAXBElement) { JAXBElement oJAXBElement = (JAXBElement) contentItem; if (oJAXBElement.getValue() instanceof EnExplicitFamily) { familyName = (EnExplicitFamily) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitPrefix) { prefix = (EnExplicitPrefix) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitSuffix) { suf = (EnExplicitSuffix) oJAXBElement.getValue(); } } } assertNull(familyName); assertEquals(prefix.getContent(), title); assertEquals(suf.getContent(), suffix); }
@Test public void createEnExplicitWhenPrefixNull() { String firstName = "Gallow"; String middleName = "Matt"; String lastName = "Younger"; String title = null; String suffix = "S"; EnExplicitFamily familyName = null; EnExplicitGiven givenName = null; EnExplicitPrefix prefix = null; EnExplicitSuffix suf = null; HL7DataTransformHelper helper = new HL7DataTransformHelper(); ENExplicit enName = helper.createEnExplicit(firstName, middleName, lastName, title, suffix); List<Serializable> choice = enName.getContent(); Iterator<Serializable> iterSerialObjects = choice.iterator(); while (iterSerialObjects.hasNext()) { Serializable contentItem = iterSerialObjects.next(); if (contentItem instanceof JAXBElement) { JAXBElement oJAXBElement = (JAXBElement) contentItem; if (oJAXBElement.getValue() instanceof EnExplicitFamily) { familyName = (EnExplicitFamily) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitPrefix) { prefix = (EnExplicitPrefix) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitSuffix) { suf = (EnExplicitSuffix) oJAXBElement.getValue(); } } } assertEquals(familyName.getContent(), lastName); assertNull(prefix); assertEquals(suf.getContent(), suffix); }
@Test public void createEnExplicitWhenSuffixNull() { String firstName = "Gallow"; String middleName = "Matt"; String lastName = "Younger"; String title = "Mr"; String suffix = null; EnExplicitFamily familyName = null; EnExplicitGiven givenName = null; EnExplicitPrefix prefix = null; EnExplicitSuffix suf = null; HL7DataTransformHelper helper = new HL7DataTransformHelper(); ENExplicit enName = helper.createEnExplicit(firstName, middleName, lastName, title, suffix); List<Serializable> choice = enName.getContent(); Iterator<Serializable> iterSerialObjects = choice.iterator(); while (iterSerialObjects.hasNext()) { Serializable contentItem = iterSerialObjects.next(); if (contentItem instanceof JAXBElement) { JAXBElement oJAXBElement = (JAXBElement) contentItem; if (oJAXBElement.getValue() instanceof EnExplicitFamily) { familyName = (EnExplicitFamily) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitGiven) { givenName = (EnExplicitGiven) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitPrefix) { prefix = (EnExplicitPrefix) oJAXBElement.getValue(); } if (oJAXBElement.getValue() instanceof EnExplicitSuffix) { suf = (EnExplicitSuffix) oJAXBElement.getValue(); } } } assertEquals(familyName.getContent(), lastName); assertEquals(prefix.getContent(), title); assertNull(suf); }