Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/14/08 21:19:41 (5 months ago)
Author:
kevjay
Message:

logicws: Fixed bug where Obs cannot be extracted for some token Results.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/logicws/web/src/org/openmrs/module/logicws/web/FlatDataStyle.java

    r5220 r5284  
    9292            log.info("<column token=\"PATIENTID\" />"); 
    9393 
    94              
    95             for (String t : tokenNamesFromQuery)  
    96             { 
     94            for (String t : tokenNamesFromQuery) { 
    9795                int max = Integer.parseInt(dataQuery.getTokenAggregateValue(t)); 
    98                  
     96 
    9997                for (int i = 1; i < max + 1; i++) { 
    10098                    out.print("<column token=\"" + t + "_" + i + "\" />"); 
     
    152150                        Result res = resultsForTokens.get(token).get(patient); 
    153151 
    154  
    155                         int max = Integer.parseInt(dataQuery.getTokenAggregateValue(token 
    156                                 .getRootToken())); 
    157                         
    158                          
     152                        int max = Integer.parseInt(dataQuery 
     153                                .getTokenAggregateValue(token.getRootToken())); 
     154 
    159155                        for (int i = 0; i < max; i++) { 
    160156                            out.print(START_VALUE_TAG + res.get(i) 
     
    190186                                    } else if (split 
    191187                                            .equals(OBSERVATIONLOCATION)) { 
    192                                         Obs obs = (Obs) res.get(i) 
    193                                                 .getResultObject(); 
     188 
     189                                        Obs obs = null; 
     190                                        try { 
     191                                            obs = (Obs) res.get(i) 
     192                                                    .getResultObject(); 
     193                                        } catch (ClassCastException e) { 
     194                                        } 
     195 
    194196                                        if (obs != null) { 
    195197                                            out.print(START_VALUE_TAG 
     
    206208                                        } 
    207209                                    } else if (split.equals(ENCOUNTERDATE)) { 
    208                                         Obs obs = (Obs) res.get(i) 
    209                                                 .getResultObject(); 
     210                                        Obs obs = null; 
     211                                        try { 
     212                                            obs = (Obs) res.get(i) 
     213                                                    .getResultObject(); 
     214                                        } catch (ClassCastException e) { 
     215                                        } 
    210216                                        if (obs != null) { 
    211217                                            out 
     
    230236                                        } 
    231237                                    } else if (split.equals(ENCOUNTERTYPE)) { 
    232                                         Obs obs = (Obs) res.get(i) 
    233                                                 .getResultObject(); 
     238                                        Obs obs = null; 
     239                                        try { 
     240                                            obs = (Obs) res.get(i) 
     241                                                    .getResultObject(); 
     242                                        } catch (ClassCastException e) { 
     243                                        } 
    234244                                        if (obs != null) { 
    235245                                            out.print(START_VALUE_TAG