Search in sources :

Example 96 with Address

use of com.adobe.target.delivery.v1.model.Address in project summary-care-record-api by NHSDigital.

the class AgentOrganisationMapper method mapOrganization.

private Organization mapOrganization(Node agentOrganisation) {
    Organization org;
    Optional<Node> orgNode = xmlUtils.detachOptionalNodeByXPath(agentOrganisation, ORG_XPATH);
    if (orgNode.isPresent()) {
        org = organisationMapper.mapOrganization(orgNode.get());
    } else {
        org = new Organization();
        org.setId(randomUUID());
    }
    org.setTelecom(mapContactPoints(agentOrganisation));
    xmlUtils.getOptionalValueByXPath(agentOrganisation, ADDRESS_XPATH).ifPresent(val -> org.addAddress(new Address().setText(val)));
    return org;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Address(org.hl7.fhir.r4.model.Address) Node(org.w3c.dom.Node)

Example 97 with Address

use of com.adobe.target.delivery.v1.model.Address in project elexis-server by elexis.

the class OrganizationTest method getOrganizationProperties.

/**
 * Test all properties set by
 * {@link TestDatabaseInitializer#initializeOrganization()}.
 */
@Test
public void getOrganizationProperties() {
    Organization readOrganization = client.read().resource(Organization.class).withId(TestDatabaseInitializer.getOrganization().getId()).execute();
    assertNotNull(readOrganization);
    assertEquals("Test Organization", readOrganization.getName());
    List<ContactPoint> telcoms = readOrganization.getTelecom();
    assertNotNull(telcoms);
    assertEquals(2, telcoms.size());
    assertEquals(1, telcoms.get(0).getRank());
    assertEquals("+01555345", telcoms.get(0).getValue());
    assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
    assertEquals("+01444345", telcoms.get(1).getValue());
    List<Address> addresses = readOrganization.getAddress();
    assertNotNull(addresses);
    assertEquals(1, addresses.size());
    assertEquals("City", addresses.get(0).getCity());
    assertEquals("123", addresses.get(0).getPostalCode());
    assertEquals("Street 10", addresses.get(0).getLine().get(0).asStringValue());
}
Also used : ContactPoint(org.hl7.fhir.r4.model.ContactPoint) Organization(org.hl7.fhir.r4.model.Organization) Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 98 with Address

use of com.adobe.target.delivery.v1.model.Address in project elexis-server by elexis.

the class PatientTest method createDeletePatient.

@Test
public void createDeletePatient() {
    Patient patient = new Patient();
    HumanName hn = new HumanName();
    hn.setUse(NameUse.OFFICIAL);
    hn.setFamily("familyName");
    patient.setName(Collections.singletonList(hn));
    patient.setBirthDate(new Date());
    Address address = new Address();
    address.setCity("City");
    address.setCountry("CH");
    patient.setAddress(Collections.singletonList(address));
    // create
    MethodOutcome execute = client.create().resource(patient).execute();
    assertTrue(execute.getCreated());
    assertNotNull(execute.getId());
    assertEquals("Patient", execute.getId().getResourceType());
    IIdType id = execute.getId();
    Patient created = client.read().resource(Patient.class).withId(id).execute();
    assertEquals(hn.getFamily(), created.getName().get(0).getFamily());
    // delete
    client.delete().resource(created).execute();
    Optional<IPatient> load = AllTests.getModelService().load(id.getIdPart(), IPatient.class, true);
    assertTrue(load.isPresent());
    assertTrue(load.get().isDeleted());
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) Address(org.hl7.fhir.r4.model.Address) Patient(org.hl7.fhir.r4.model.Patient) IPatient(ch.elexis.core.model.IPatient) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Date(java.util.Date) LocalDate(java.time.LocalDate) IPatient(ch.elexis.core.model.IPatient) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.Test)

Example 99 with Address

use of com.adobe.target.delivery.v1.model.Address in project integration-adaptor-111 by nhsconnect.

the class AddressMapperTest method shouldMapAddress.

@Test
public void shouldMapAddress() {
    Address address = addressMapper.mapAddress(itkAddress);
    assertThat(address.getUse()).isEqualTo(AddressUse.HOME);
    assertThat(address.getLine().get(0).getValue()).isEqualTo(ADDRESS_LINE);
    assertThat(address.getCity()).isEqualTo(CITY);
    assertThat(address.getPostalCode()).isEqualTo(POSTAL_CODE);
    assertThat(address.getCountry()).isEqualTo(COUNTRY);
    assertThat(address.getText()).isEqualTo(DESCRIPTION);
    assertThat(address.getState()).isEqualTo(STATE);
    assertThat(address.getDistrict()).isEqualTo(DISTRICT);
    assertThat(address.getPeriod()).isEqualTo(period);
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) Test(org.junit.jupiter.api.Test)

Example 100 with Address

use of com.adobe.target.delivery.v1.model.Address in project target-java-sdk by adobe.

the class PageParamsCollatorTest method testCollator.

@Test
public void testCollator() {
    VisitorProvider.init("testOrgId");
    String url = "http://WWW.TARGET.ADOBE.COM/ABOUT/?foo=bar&name=JimmyG#Part1";
    RequestDetails pageLoad = new RequestDetails();
    TargetDeliveryRequest request = TargetDeliveryRequest.builder().execute(new ExecuteRequest().pageLoad(pageLoad)).context(new Context().address(new Address().url(url))).build();
    PageParamsCollator collator = new PageParamsCollator();
    Map<String, Object> result = collator.collateParams(request, pageLoad);
    assertEquals(url, result.get(PageParamsCollator.PAGE_URL));
    assertEquals(url.toLowerCase(), result.get(PageParamsCollator.PAGE_URL_LOWER));
    assertEquals("/ABOUT/", result.get(PageParamsCollator.PAGE_PATH));
    assertEquals("/about/", result.get(PageParamsCollator.PAGE_PATH_LOWER));
    assertEquals("WWW.TARGET.ADOBE.COM", result.get(PageParamsCollator.PAGE_DOMAIN));
    assertEquals("www.target.adobe.com", result.get(PageParamsCollator.PAGE_DOMAIN_LOWER));
    assertEquals("TARGET", result.get(PageParamsCollator.PAGE_SUBDOMAIN));
    assertEquals("target", result.get(PageParamsCollator.PAGE_SUBDOMAIN_LOWER));
    assertEquals("COM", result.get(PageParamsCollator.PAGE_TOP_LEVEL_DOMAIN));
    assertEquals("com", result.get(PageParamsCollator.PAGE_TOP_LEVEL_DOMAIN_LOWER));
    assertEquals("foo=bar&name=JimmyG", result.get(PageParamsCollator.PAGE_QUERY));
    assertEquals("foo=bar&name=jimmyg", result.get(PageParamsCollator.PAGE_QUERY_LOWER));
    assertEquals("Part1", result.get(PageParamsCollator.PAGE_FRAGMENT));
    assertEquals("part1", result.get(PageParamsCollator.PAGE_FRAGMENT_LOWER));
}
Also used : Context(com.adobe.target.delivery.v1.model.Context) ExecuteRequest(com.adobe.target.delivery.v1.model.ExecuteRequest) Address(com.adobe.target.delivery.v1.model.Address) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) RequestDetails(com.adobe.target.delivery.v1.model.RequestDetails) Test(org.junit.jupiter.api.Test)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)35 Address (org.hl7.fhir.dstu3.model.Address)22 PersonAddress (org.openmrs.PersonAddress)21 HumanName (org.hl7.fhir.r4.model.HumanName)20 Patient (org.hl7.fhir.r4.model.Patient)18 ArrayList (java.util.ArrayList)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)16 Test (org.junit.jupiter.api.Test)13 Organization (org.hl7.fhir.r4.model.Organization)12 Address (com.amazonaws.services.ec2.model.Address)7 HumanName (org.hl7.fhir.dstu3.model.HumanName)7 PatientCommunicationComponent (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 DescribeAddressesResult (com.amazonaws.services.ec2.model.DescribeAddressesResult)5 HashSet (java.util.HashSet)5 Coding (org.hl7.fhir.r4.model.Coding)5 StringType (org.hl7.fhir.r4.model.StringType)5 Before (org.junit.Before)5