Package org.openmrs

Examples of org.openmrs.Concept


    private List<Concept> generateConceptList() {

        List<Concept>  conceptList = new ArrayList<Concept>();

        Concept concept1 = new Concept();
        concept1.setConceptId(1);
        ConceptName concept1Name = new ConceptName();
        concept1Name.setName("concept1");
        concept1.addName(concept1Name);
        conceptList.add(concept1);

        Concept concept2 = new Concept();
        concept2.setConceptId(2);
        ConceptName concept2Name = new ConceptName();
        concept1Name.setName("concept2");
        concept1.addName(concept2Name);
        conceptList.add(concept2);

        Concept concept3 = new Concept();
        concept3.setConceptId(3);
        ConceptName concept3Name = new ConceptName();
        concept1Name.setName("concept3");
        concept1.addName(concept3Name);
        conceptList.add(concept3);
View Full Code Here


   * @param accessionNumber accession number associatd with the Obs (may be null)
   * @return the created Obs instance
   */
 
  public static Obs createObs(FormField formField, Object value, Date datetime, String accessionNumber) {
    Concept concept = formField.getField().getConcept();
    if (concept == null)
      throw new FormEntryException("Can't create an Obs for a formField that doesn't represent a Concept");
    return createObs(concept, value, datetime, accessionNumber);
  }
View Full Code Here

   * @should return null otherwise
   * @should find a concept by its mapping with a space in between
   */
  public static Concept getConcept(String id) {

    Concept cpt = null;
   
    if (id != null) {

      id = id.trim();

View Full Code Here

   * @return
   * @throws IllegalArgumentException
   */
  public static Concept getConcept(String id, String errorMessageIfNotFound) throws IllegalArgumentException {

    Concept c = null;
    try {
      c = getConcept(id);
    }
    catch (Exception ex) {
      throw new IllegalArgumentException(errorMessageIfNotFound, ex);
View Full Code Here

     
      // finally, try to fetch by concept map
      // handle  mapping id: xyz:ht
      int index = identifier.indexOf(":");
      if (index != -1) {
        Concept concept = getConcept(identifier);
       
        // iterate through workflows until we see if we find a match
        if (concept != null) {
          for (Program program : Context.getProgramWorkflowService().getAllPrograms(false)) {
            for (ProgramWorkflow w : program.getAllWorkflows()) {
View Full Code Here

    else {
      identifier = identifier.trim();

            int index = identifier.indexOf(":");
      if (index != -1) {
        Concept concept = getConcept(identifier);
        if (concept != null) {
          for (ProgramWorkflow workflow : program.getAllWorkflows()) {
            for (ProgramWorkflowState s : workflow.getStates(false)) {
              if (s.getConcept().equals(concept)) {
                return s;
View Full Code Here

    else {
            identifier = identifier.trim();

      int index = identifier.indexOf(":");
      if (index != -1) {
        Concept concept = getConcept(identifier);
        if (concept != null) {
          for (ProgramWorkflowState s : workflow.getStates(false)) {
            if (s.getConcept().equals(concept)) {
              return s;
            }
View Full Code Here

    Assert.assertTrue(formClone.getXmlData().contains(incomingUuid1));
    Assert.assertTrue(formClone.getXmlData().contains(incomingUuid2));
    Assert.assertFalse(formClone.getXmlData().contains(existingUuid1));
    Assert.assertFalse(formClone.getXmlData().contains(existingUuid2));
   
    Concept incoming1 = new Concept();
    incoming1.setUuid(incomingUuid1);
    Concept incoming2 = new Concept();
    incoming2.setUuid(incomingUuid2);
    Concept existing1 = new Concept();
    existing1.setUuid(existingUuid1);
    Concept existing2 = new Concept();
    existing2.setUuid(existingUuid2);
   
    Map<OpenmrsObject, OpenmrsObject> incomingToExisting = new HashMap<OpenmrsObject, OpenmrsObject>();
    incomingToExisting.put(incoming1, existing1);
    incomingToExisting.put(incoming2, existing2);
   
View Full Code Here

    String incomingUuid2 = "32296060-0370-102d-b0e3-123456789011";
   
    String existingUuid1 = "a";
    String existingUuid2 = "b";
   
    Concept incoming1 = new Concept();
    incoming1.setUuid(incomingUuid1);
    Concept incoming2 = new Concept();
    incoming2.setUuid(incomingUuid2);
    Concept existing1 = new Concept();
    existing1.setUuid(existingUuid1);
    Concept existing2 = new Concept();
    existing2.setUuid(existingUuid2);
   
    Map<OpenmrsObject, OpenmrsObject> incomingToExisting = new HashMap<OpenmrsObject, OpenmrsObject>();
    incomingToExisting.put(incoming1, existing1);
    incomingToExisting.put(incoming2, existing2);
   
View Full Code Here

                + " in conceptId attribute value. Parameters: " + parameters);
    } else {
      concepts = new ArrayList<Concept>();
      for (StringTokenizer st = new StringTokenizer(conceptIds, ","); st.hasMoreTokens();) {
        String s = st.nextToken().trim();
        Concept concept = HtmlFormEntryUtil.getConcept(s);
        if (concept == null)
          throw new IllegalArgumentException("Cannot find concept for value " + s
                  + " in conceptIds attribute value. Parameters: " + parameters);
        concepts.add(concept);
      }
      if (concepts.size() == 0)
        throw new IllegalArgumentException(
                "You must provide some valid conceptIds for the conceptIds attribute. Parameters: " + parameters);
    }
   
    // test to make sure the answerConceptId, if it exists, is valid
    String answerConceptId = parameters.get("answerConceptId");
    if (StringUtils.isNotBlank(answerConceptId)) {
      if (HtmlFormEntryUtil.getConcept(answerConceptId) == null)
        throw new IllegalArgumentException("Cannot find concept for value " + answerConceptId
                + " in answerConceptId attribute value. Parameters: " + parameters);
    }
   
    // test to make sure the answerConceptIds, if they exist, are valid
    String answerConceptIds = parameters.get("answerConceptIds");
    if (StringUtils.isNotBlank(answerConceptIds)) {
      for (StringTokenizer st = new StringTokenizer(answerConceptIds, ","); st.hasMoreTokens();) {
        String s = st.nextToken().trim();
        Concept concept = HtmlFormEntryUtil.getConcept(s);
        if (concept == null)
          throw new IllegalArgumentException("Cannot find concept for value " + s
                  + " in answerConceptIds attribute value. Parameters: " + parameters);
      }
    }
View Full Code Here

TOP

Related Classes of org.openmrs.Concept

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.