use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.
the class CdaHeaderGenerator method getAddressDetails.
public static List<Address> getAddressDetails() {
List<Address> addrs = new ArrayList<>();
Address addr = new Address();
List<StringType> addrLine = new ArrayList<>();
addrLine.add(new StringType("0987 Facility Drive"));
addr.setLine(addrLine);
addr.setCity("alt Lake City");
addr.setState("UT");
addr.setCountry("US");
addr.setPostalCode("84101");
addr.setUse(AddressUse.WORK);
addrs.add(addr);
return addrs;
}
use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.
the class CdaHeaderGenerator method getPractitionerXml.
public static String getPractitionerXml(Practitioner pr) {
StringBuilder sb = new StringBuilder(500);
if (pr != null) {
Identifier npi = CdaFhirUtilities.getIdentifierForSystem(pr.getIdentifier(), CdaGeneratorConstants.FHIR_NPI_URL);
if (npi != null) {
sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, npi.getValue()));
} else {
sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
}
sb.append(CdaFhirUtilities.getAddressXml(pr.getAddress()));
sb.append(CdaFhirUtilities.getTelecomXml(pr.getTelecom(), false));
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
List<HumanName> hns = pr.getName();
sb.append(CdaFhirUtilities.getNameXml(hns));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
} else {
sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
List<Address> addrs = null;
sb.append(CdaFhirUtilities.getAddressXml(addrs));
List<ContactPoint> cps = null;
sb.append(CdaFhirUtilities.getTelecomXml(cps, false));
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
List<HumanName> hns = null;
sb.append(CdaFhirUtilities.getNameXml(hns));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
}
return sb.toString();
}
use of com.adobe.target.delivery.v1.model.Address in project eCRNow by drajer-health.
the class CdaFhirUtilitiesTest method testGetAddressXml.
@Test
public void testGetAddressXml() {
List<Address> addrs = new ArrayList<Address>();
Address ad1 = new Address();
ad1.setUse(AddressUse.HOME);
StringType line = new StringType();
line.setValue("142 Example Drive");
List<StringType> lines = new ArrayList<StringType>();
lines.add(line);
ad1.setLine(lines);
ad1.setCity("Rockville");
ad1.setState("MD");
ad1.setPostalCode("20874");
ad1.setCountry("US");
addrs.add(ad1);
String result = CdaFhirUtilities.getAddressXml(addrs);
assertTrue(result.contains("142 Example Drive"));
assertTrue(result.contains("20874"));
assertTrue(result.contains("MD"));
assertTrue(result.contains("Rockville"));
addrs.clear();
Address ad2 = new Address();
ad1.setUse(AddressUse.BILLING);
StringType line2 = new StringType();
line2.setValue("142 Example Drive");
List<StringType> lines2 = new ArrayList<StringType>();
lines2.add(line2);
ad2.setLine(lines2);
ad2.setCity("Rockville");
ad2.setState("MD");
ad2.setPostalCode("20874");
ad2.setCountry("US");
addrs.add(ad2);
String result2 = CdaFhirUtilities.getAddressXml(addrs);
assertTrue(result2.contains("142 Example Drive"));
assertTrue(result2.contains("20874"));
assertTrue(result2.contains("MD"));
assertTrue(result2.contains("Rockville"));
addrs.clear();
String result3 = CdaFhirUtilities.getAddressXml(addrs);
assertTrue(result3.contains("nullFlavor=\"NI\""));
addrs.clear();
Address ad3 = new Address();
StringType line3 = new StringType();
line3.setValue("142 Example Drive");
List<StringType> lines3 = new ArrayList<StringType>();
lines3.add(line3);
ad3.setLine(lines3);
ad3.setCity("Rockville");
ad3.setState("MD");
ad3.setPostalCode("20874");
ad3.setCountry("US");
addrs.add(ad3);
String result4 = CdaFhirUtilities.getAddressXml(addrs);
assertTrue(result4.contains("142 Example Drive"));
assertTrue(result4.contains("20874"));
assertTrue(result4.contains("MD"));
assertTrue(result4.contains("Rockville"));
}
use of com.adobe.target.delivery.v1.model.Address in project GNS by MobilityFirst.
the class AWSEC2 method describeElasticIPs.
/**
*
* @param ec2
*/
public static void describeElasticIPs(AmazonEC2 ec2) {
StringBuilder output = new StringBuilder();
String prefix = currentTab + "Elastic IPs: ";
DescribeAddressesResult describeAddressesResult = ec2.describeAddresses();
for (Address address : describeAddressesResult.getAddresses()) {
output.append(prefix);
prefix = ", ";
output.append(address.getPublicIp());
}
System.out.println(output);
}
use of com.adobe.target.delivery.v1.model.Address in project data-transfer-project by google.
the class VCardToGoogleContactConverterTest method testConversionToGoogleAddresses.
@Test
public void testConversionToGoogleAddresses() {
// Set up vCard with a primary address and a secondary address
String primaryStreet = "221B Baker St";
String primaryLocality = "London";
ezvcard.property.Address primaryAddress = new ezvcard.property.Address();
primaryAddress.setStreetAddress(primaryStreet);
primaryAddress.setLocality(primaryLocality);
primaryAddress.setPref(VCARD_PRIMARY_PREF);
String altStreet = "42 Wallaby Way";
String altLocality = "Sydney";
ezvcard.property.Address altAddress = new ezvcard.property.Address();
altAddress.setStreetAddress(altStreet);
altAddress.setLocality(altLocality);
altAddress.setPref(VCARD_PRIMARY_PREF + 1);
// Add addresses to vCard. Order shouldn't matter.
VCard vCard = defaultVCard;
vCard.addAddress(primaryAddress);
vCard.addAddress(altAddress);
// Run test
Person person = VCardToGoogleContactConverter.convert(vCard);
// Check results
// Check correct number of addresses
assertThat(person.getAddresses().size()).isEqualTo(2);
// Check primary address
List<Address> actualPrimaryAddresses = person.getAddresses().stream().filter(a -> a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualPrimaryAddressStreets = getValuesFromFields(actualPrimaryAddresses, Address::getStreetAddress);
assertThat(actualPrimaryAddressStreets).containsExactly(primaryStreet);
// Check secondary address
List<Address> actualSecondaryAddresses = person.getAddresses().stream().filter(a -> !a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualSecondaryAddressStreets = getValuesFromFields(actualSecondaryAddresses, Address::getStreetAddress);
assertThat(actualSecondaryAddressStreets).containsExactly(altStreet);
}
Aggregations