Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
07/10/08 13:50:09 (6 months ago)
Author:
rfoecking
Message:

complex-obs branch: Fixed bug - obs.isComplex() never returned true

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/complex-obs/src/api/org/openmrs/api/impl/ObsServiceImpl.java

    r4785 r4897  
    4444/** 
    4545 * Default implementation of the Observation Service 
    46  *  
     46 * 
    4747 * @see org.openmrs.api.ObsService 
    4848 */ 
     
    5656        /** 
    5757         * Report handlers that have been registered. 
    58          *  
     58         * 
    5959         * This is filled via {@link #setHandlers(Map)} and spring's 
    6060         * applicationContext-service.xml object 
     
    8080        public Obs saveObs(Obs obs, String changeMessage) throws APIException { 
    8181                // save or update complex obs 
    82                 if (obs.isComplex() && null != obs.getComplexData().getData()) { 
     82                if (obs.getConcept().isComplex() && null != obs.getComplexData().getData()) { 
    8383                        ComplexObsHandler handler = getHandler(obs); 
    8484                        if (null != handler) { 
     
    163163        /** 
    164164         * Voids an Obs 
    165          *  
     165         * 
    166166         * If the Obs argument is an obsGroup, all group members will be voided. 
    167          *  
     167         * 
    168168         * @see org.openmrs.api.ObsService#voidObs(org.openmrs.Obs, 
    169169         *      java.lang.String) 
     
    208208         * Convenience method that recursively finds all 
    209209         * child/grandchild/greatgrandchild group members of the given parentObs 
    210          *  
     210         * 
    211211         * @param parentObs 
    212212         * @param childMembers 
     
    225225        /** 
    226226         * Unvoids an Obs 
    227          *  
     227         * 
    228228         * If the Obs argument is an obsGroup, all group members with the same 
    229229         * dateVoided will also be unvoided. 
    230          *  
     230         * 
    231231         * @see org.openmrs.api.ObsService#unvoidObs(org.openmrs.Obs) 
    232232         * @param Obs obs the Obs to unvoid 
     
    388388         * <code>searchString</code> with the patient's identifier, encounterId, 
    389389         * and obsId 
    390          *  
     390         * 
    391391         * @see org.openmrs.api.ObsService#getObservations(java.lang.String) 
    392392         */ 
     
    441441        /** 
    442442         * Correct use case: 
    443          *  
     443         * 
    444444         * <pre> 
    445445         * Obs parent = new Obs(); 
    446446         * Obs child1 = new Obs(); 
    447447         * Obs child2 = new Obs(); 
    448          *  
     448         * 
    449449         * parent.addGroupMember(child1); 
    450450         * parent.addGroupMember(child2); 
    451451         * </pre> 
    452          *  
     452         * 
    453453         * @deprecated This method should no longer need to be called on the api. 
    454454         *             This was meant as temporary until we created a true ObsGroup 
    455455         *             pojo. 
    456          *  
     456         * 
    457457         * @see org.openmrs.api.ObsService#createObsGroup(org.openmrs.Obs[]) 
    458458         */ 
     
    565565         * Convenience method for turning a string like "location.locationId asc, 
    566566         * obs.valueDatetime desc" into a list of strings to sort on 
    567          *  
     567         * 
    568568         * @param sort string 
    569569         * @return simple list of strings to sort on without asc/desc 
     
    592592         * This method should be removed when all methods using an Integer 
    593593         * personType are removed. 
    594          *  
     594         * 
    595595         * This method does a bitwise compare on <code>personType</code> and 
    596596         * returns a list of PERSON_TYPEs that are comparable 
    597          *  
     597         * 
    598598         * @param personType Integer corresponding to {@link ObsService#PERSON}, 
    599599         *        {@link ObsService#USER}, or {@link ObsService#PATIENT}, 
     
    630630                return obsSet; 
    631631        } 
    632          
     632 
    633633        public List<Obs> getObservationsByPersonAndConcept(Person who, Concept question) throws APIException { 
    634634                List<Person> whom = new Vector<Person>(); 
     
    637637                List<Concept> questions = new Vector<Concept>(); 
    638638                questions.add(question); 
    639                  
     639 
    640640                return getObservations(whom, null, questions, null, null, null, null, null, null, null, null, false); 
    641641        } 
     
    862862                Date fromDate, Date toDate) { 
    863863                List<Person> persons = new Vector<Person>(); 
    864                  
     864 
    865865                if (patients != null) 
    866866                        for (Integer memberId : patients.getMemberIds()) 
    867867                                persons.add(new Person(memberId)); 
    868                  
     868 
    869869                return getObservations(persons, null, concepts, null, null, null, null, null, null, fromDate, toDate, false); 
    870870        } 
     
    881881                return obs; 
    882882        } 
    883  
     883         
    884884        /** 
    885885         * @see org.openmrs.api.ObsService#getAllComplexObs() 
     
    920920        /** 
    921921         * Voids an Obs 
    922          *  
     922         * 
    923923         * If the Obs argument is an obsGroup, all group members will be voided. 
    924          *  
     924         * 
    925925         * @see org.openmrs.api.ObsService#voidObs(org.openmrs.Obs, 
    926926         *      java.lang.String) 
     
    935935         * Obs.isComplexObs() is false or there is an error instantiating the 
    936936         * handler class. 
    937          *  
     937         * 
    938938         * @param obs A complex Obs. 
    939939         * @return ComplexObsHandler for the complex Obs. or null on error. 
     
    974974        /** 
    975975         * ADDs handlers...doesn't replace them. 
    976          *  
     976         * 
    977977         * @see org.openmrs.api.ObsService#setHandlers(Map) 
    978978         */