Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 4896

Show
Ignore:
Timestamp:
07/10/08 13:18:27 (6 months ago)
Author:
rfoecking
Message:

complex-obs branch: Fixed bug--couldn't create ComplexData object properly

Files:

Legend:

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

    r4289 r4896  
    1919 * in the database. It has a data Object and a title. Alternatively, it can have 
    2020 * a byte array instead of an Object. 
    21  *  
     21 * 
    2222 */ 
    2323public class ComplexData implements java.io.Serializable { 
     
    3737        /** 
    3838         * Default constructor requires title and data. 
    39          *  
     39         * 
    4040         * @param title Name or brief description of ComplexData. 
    4141         * @param data The complex data for an Obs 
    4242         */ 
    4343        public ComplexData(String title, Object data) { 
     44                this.type = Type.OBJECT; 
    4445                setTitle(title); 
    4546                setData(data); 
    46                 this.type = Type.OBJECT; 
    4747        } 
    4848 
     
    5252         * OpenmrsUtil.getFileAsBytes(file); <br/>ComplexData data = new 
    5353         * ComplexData("test name", bytes); 
    54          *  
     54         * 
    5555         * @param title 
    5656         * @param bytes 
    5757         */ 
    5858        public ComplexData(String title, byte[] bytes) { 
     59                this.type = Type.BYTE; 
    5960                setBytes(bytes); 
    6061                setTitle(title); 
    61                 this.type = Type.BYTE; 
    6262        } 
    6363 
    6464        /** 
    6565         * Set the title for this ComplexData 
    66          *  
     66         * 
    6767         * @param title 
    6868         */ 
     
    7373        /** 
    7474         * Get the title for this ComplexData 
    75          *  
     75         * 
    7676         * @return 
    7777         */ 
     
    8282        /** 
    8383         * Set the data Object. 
    84          *  
     84         * 
    8585         * @param data 
    8686         */ 
     
    9494         * output may not be reliable. TODO: Should this even try to return the byte 
    9595         * array? 
    96          *  
     96         * 
    9797         * @return 
    9898         */ 
     
    106106        /** 
    107107         * Set the byte array. This is alternative to {@link #setData(Object)} 
    108          *  
     108         * 
    109109         * @param bytes 
    110110         */ 
     
    118118         * File("text"); <br/> FileOutputStream fout = new FileOutputStream(file); 
    119119         * <br/> fout.write(complexData.getBytes()); <br/> 
    120          *  
     120         * 
    121121         * @return 
    122122         */ 
     
    132132         * initialized with a byte array, returns ComplexData.Type.BYTE. If 
    133133         * initialized with an Object, returns ComplexData.Type.OBJECT. 
    134          *  
     134         * 
    135135         * @return ComplexData.Type.OBJECT or ComplexData.Type.BYTE 
    136136         */ 
     
    143143         * this.getData().getClass().getName() except that it safely returns the 
    144144         * String "null" if this.data is null. 
    145          *  
     145         * 
    146146         * TODO: This method is not used anywhere. Should it be deleted? 
    147          *  
     147         * 
    148148         * @return 
    149149         */