Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
02/26/08 14:45:39 (11 months ago)
Author:
dkayiwa
Message:

XForms Module: Removing FormEntry module dependency

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/xforms/src/org/openmrs/module/xforms/download/XformDownloadManager.java

    r3291 r3482  
    88 
    99import org.openmrs.Form; 
     10import org.openmrs.api.FormService; 
    1011import org.openmrs.api.context.Context; 
    11 import org.openmrs.module.formentry.FormEntryService; 
    12 import org.openmrs.module.formentry.FormEntryUtil; 
    13 import org.openmrs.module.formentry.FormXmlTemplateBuilder; 
     12import org.openmrs.module.xforms.SerializableData; 
    1413import org.openmrs.module.xforms.Xform; 
    1514import org.openmrs.module.xforms.XformBuilder; 
     
    1716import org.openmrs.module.xforms.XformsService; 
    1817import org.openmrs.module.xforms.XformsUtil; 
     18import org.openmrs.module.xforms.formentry.FormEntryWrapper; 
    1919import org.openmrs.util.OpenmrsClassLoader; 
    20 import org.openmrs.module.xforms.SerializableData; 
    2120 
    2221/** 
     
    6160 
    6261                XformsService xformsService = (XformsService)Context.getService(XformsService.class); 
    63                 FormEntryService formEntryService = (FormEntryService)Context.getService(FormEntryService.class); 
     62                FormService formService = (FormService)Context.getService(FormService.class); 
    6463 
    6564                List<Xform> xforms = xformsService.getXforms(); 
     
    6766                for(Xform xform : xforms){ 
    6867                        if(xform.getFormId() != XformConstants.PATIENT_XFORM_FORM_ID){ 
    69                                 String s = getXform(formEntryService,xformsService,xform.getFormId(),createNew,actionUrl); 
     68                                String s = getXform(formService,xformsService,xform.getFormId(),createNew,actionUrl); 
    7069                                xmlforms.add(s); 
    7170                        } 
     
    8180         *  
    8281         * @param request - the http request. 
    83          * @param formEntryService - the formentry service. 
     82         * @param formService - the form service. 
    8483         * @param formId - the form id. 
    8584         * @return - the created xml form. 
    8685         */ 
    87         public static String createNewXform(FormEntryService formEntryService, Integer formId,String actionUrl){ 
    88                 Form form = formEntryService.getForm(formId); 
    89                 return createNewXform(formEntryService, form,actionUrl); 
     86        public static String createNewXform(FormService formService, Integer formId,String actionUrl){ 
     87                Form form = formService.getForm(formId); 
     88                return createNewXform(formService, form,actionUrl); 
    9089        } 
    9190         
     
    9695         *  
    9796         * @param request - the request object. 
    98          * @param formEntryService - the formentry service. 
     97         * @param formService - the form service. 
    9998         * @param form - the form object. 
    10099         * @return - the xml content of the xform. 
    101100         */ 
    102         public static String createNewXform(FormEntryService formEntryService, Form form,String actionUrl){ 
    103                 String schemaXml = formEntryService.getSchema(form); 
    104                 String templateXml = new FormXmlTemplateBuilder(form,FormEntryUtil.getFormAbsoluteUrl(form)).getXmlTemplate(false); 
     101        public static String createNewXform(FormService formService, Form form,String actionUrl){ 
     102                String schemaXml = XformsUtil.getSchema(form); 
     103                String templateXml = FormEntryWrapper.getFormTemplate(form);//new FormXmlTemplateBuilder(form,FormEntryUtil.getFormAbsoluteUrl(form)).getXmlTemplate(false); 
    105104                return XformBuilder.getXform4mStrings(schemaXml, templateXml,actionUrl); 
    106105        } 
     
    109108         * Gets an xform for a given form id. 
    110109         *  
    111          * @param formEntryService - the formentry service. 
     110         * @param formService - the form service. 
    112111         * @param xformsService  the xforms service. 
    113112         * @param formId - the form id. 
     
    115114         * @return - the xml content of the xform. 
    116115         */ 
    117         public static String getXform(FormEntryService formEntryService,XformsService xformsService,Integer formId,boolean createNew,String actionUrl){ 
     116        public static String getXform(FormService formService,XformsService xformsService,Integer formId,boolean createNew,String actionUrl){ 
    118117                 
    119118                String xformXml = null; 
     
    126125                 
    127126                if(xformXml == null) 
    128                         xformXml = createNewXform(formEntryService, formId,actionUrl); 
     127                        xformXml = createNewXform(formService, formId,actionUrl); 
    129128                 
    130129                return xformXml;