Package org.openmrs

Examples of org.openmrs.RelationshipType


  public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request)
          throws ResponseException {
    initRelationshipController();
    Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson"));
    Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson"));
    RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType"));
    List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType);
    ArrayList results = new ArrayList();
    for (Relationship relationship : relationships) {
      results.add(getRelationshipAsSimpleObject(relationship));
    }
View Full Code Here


      @Override
      public Patient getPatient() {
        // as a sanity check, make sure this relationship hasn't already been created
       
        // now make sure the relationship has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Patient parent = Context.getPatientService().getPatient(2);
        Person child = Context.getPersonService().getPerson(6);
        Assert.assertEquals(0, Context.getPersonService().getRelationships(parent, child, type).size());
       
        return parent;
      };
     
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:", "Relationship:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
        // hack because person widget is a hidden input with no label 
        request.addParameter("w7", "6");
      }
     
      @Override
      public void testResults(SubmissionResults results) {
       
        // check the basics
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure the relationship has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(2);
        Person child = Context.getPersonService().getPerson(6);
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
      }
View Full Code Here

      @Override
      public Patient getPatient() {
        // as a sanity check, make sure this relationship hasn't already been created
       
        // now make sure the relationship has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(6);
        Patient child = Context.getPatientService().getPatient(2);
        Assert.assertEquals(0, Context.getPersonService().getRelationships(parent, child, type).size());
       
        return child;
      };
     
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:", "Relationship:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
        // hack because person widget is a hidden input with no label 
        request.addParameter("w7", "6");
      }
     
      @Override
      public void testResults(SubmissionResults results) {
       
        // check the basics
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure the relationship has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(6);
        Person child = Context.getPersonService().getPerson(2);
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
      }
View Full Code Here

        results.assertObsCreated(2, 70d);
        results.assertObsCreated(8, "Bee stings");
        results.assertObsCreated(1119, date);
       
        // now make sure the relationship has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(2);
        Person child = Context.getPersonService().getPerson(6);
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
      }
View Full Code Here

        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure all three relationships have been created
        RelationshipType type1 = Context.getPersonService().getRelationshipType(1);
        RelationshipType type2 = Context.getPersonService().getRelationshipType(4);
       
        Person person1 = Context.getPersonService().getPerson(2);
        Person person2 = Context.getPersonService().getPerson(6);
        Person person3 = Context.getPersonService().getPerson(7);
       
View Full Code Here

        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure all three relationships have been created
        RelationshipType type1 = Context.getPersonService().getRelationshipType(1);
        RelationshipType type2 = Context.getPersonService().getRelationshipType(4);
       
        Person person1 = Context.getPersonService().getPerson(2);
        Person person2 = Context.getPersonService().getPerson(6);
        Person person3 = Context.getPersonService().getPerson(7);
       
View Full Code Here

      }
     
      @Override
      public Patient getPatient() {
        // preemptively create a relationship
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Patient parent = Context.getPatientService().getPatient(2);
        Person child = Context.getPersonService().getPerson(6);
       
        Relationship rel = new Relationship(parent, child, type);
        Context.getPersonService().saveRelationship(rel);
       
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
        return parent;
      };
     
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:", "Relationship:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
        // hack because person widget is a hidden input with no label 
        request.addParameter("w7", "6");
      }
     
      @Override
      public void testResults(SubmissionResults results) {
       
        // check the basics
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure the relationship has not been created twice
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(2);
        Person child = Context.getPersonService().getPerson(6);
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
      }
View Full Code Here

      }
     
      @Override
      public Patient getPatient() {
        // preemptively create a relationship
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Patient parent = Context.getPatientService().getPatient(2);
        Person child = Context.getPersonService().getPerson(6);
       
        Relationship rel = new Relationship(parent, child, type);
        Context.getPersonService().saveRelationship(rel);
       
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
        return parent;
      };
     
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:", "Relationship:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
        // hack because person widget is a hidden input with no label 
        request.addParameter("w7", "7");
      }
     
      @Override
      public void testResults(SubmissionResults results) {
       
        // check the basics
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure both relationships have been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(2);
        Person child1 = Context.getPersonService().getPerson(6);
        Person child2 = Context.getPersonService().getPerson(7);
       
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child1, type).size());
View Full Code Here

      }
     
      @Override
      public Patient getPatient() {
        // preemptively create a relationship
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Patient parent = Context.getPatientService().getPatient(2);
        Person child = Context.getPersonService().getPerson(6);
       
        Relationship rel = new Relationship(parent, child, type);
        Context.getPersonService().saveRelationship(rel);
       
        Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size());
       
        return parent;
      };
     
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:", "Relationship:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
        // hack because person widget is a hidden input with no label 
        request.addParameter("w7", "7");
      }
     
      @Override
      public void testResults(SubmissionResults results) {
       
        // check the basics
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // now make sure the old the relationship is gone and the new one has been created
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Person parent = Context.getPersonService().getPerson(2);
        Person child1 = Context.getPersonService().getPerson(6);
        Person child2 = Context.getPersonService().getPerson(7);
       
        Assert.assertEquals(0, Context.getPersonService().getRelationships(parent, child1, type).size());
View Full Code Here

      }
     
      @Override
      public Patient getPatient() {
        // preemptively create a relationship
        RelationshipType type = Context.getPersonService().getRelationshipType(1);
        Patient parent = Context.getPatientService().getPatient(2);
        Person child = Context.getPersonService().getPerson(6);
       
        Relationship rel = new Relationship(parent, child, type);
        Context.getPersonService().saveRelationship(rel);
View Full Code Here

TOP

Related Classes of org.openmrs.RelationshipType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.