Search in sources :

Example 1 with SpreadsheetPreviewNw

use of org.akaza.openclinica.control.admin.SpreadsheetPreviewNw in project OpenClinica by OpenClinica.

the class FormServlet method doGet.

@Override
protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
    PrintWriter pw = httpServletResponse.getWriter();
    HorizontalFormBuilder builder = new HorizontalFormBuilder();
    SpreadsheetPreviewNw spnw = new SpreadsheetPreviewNw();
    BeanFactory beanFactory = new BeanFactory();
    ServletContext context = this.getServletContext();
    String path = context.getRealPath("/");
    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(new File(path + "group_demo_nw.xls")));
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    Map<String, Map> allMap = spnw.createCrfMetaObject(wb);
    /*
         * Map gmap = spnw.createGroupsMap(wb); Map map2 =
         * spnw.createItemsOrSectionMap(wb,"items"); FormGroupBean fgBean =
         * beanFactory.createFormGroupBeanFromMap(gmap); DisplayFormGroupBean
         * displayGroup = new DisplayFormGroupBean(); List itemsDisplayList =
         * beanFactory. createDisplayItemBeansFromMap(map2,"group_demo");
         * displayGroup.setFormGroupBean(fgBean);
         * displayGroup.setItems(itemsDisplayList);
         */
    List<DisplayItemGroupBean> formGroupsL = new ArrayList<DisplayItemGroupBean>();
    String crfName = (String) allMap.get("crf_info").get("crf_name");
    Map sections = allMap.get("sections");
    Map sectionMap = (Map) sections.get(1);
    String sectionLabel = (String) sectionMap.get("section_label");
    formGroupsL = beanFactory.createGroupBeans(allMap.get("items"), allMap.get("groups"), sectionLabel, crfName);
    // formGroupsL.add(displayGroup);
    builder.setDisplayItemGroups(formGroupsL);
    pw.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" + "        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + "<head>\n" + "\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n" + "\t<title>test form</title><link rel=\"stylesheet\" href=\"includes/styles.css\" type=\"text/css\">\n" + "  <link rel=\"stylesheet\" href=\"includes/styles2.css\" type=\"text/css\">\n" + " <script type=\"text/javascript\"  language=\"JavaScript\" src=\n" + "    \"includes/repetition-model/repetition-model.js\"></script>" + "</head>\n" + "<body>");
    pw.write(builder.createMarkup());
    pw.write("</body>\n" + "</html>");
}
Also used : DisplayItemGroupBean(org.akaza.openclinica.bean.submit.DisplayItemGroupBean) ArrayList(java.util.ArrayList) FileInputStream(java.io.FileInputStream) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook) POIFSFileSystem(org.apache.poi.poifs.filesystem.POIFSFileSystem) BeanFactory(org.akaza.openclinica.control.managestudy.BeanFactory) ServletContext(javax.servlet.ServletContext) SpreadsheetPreviewNw(org.akaza.openclinica.control.admin.SpreadsheetPreviewNw) File(java.io.File) Map(java.util.Map) PrintWriter(java.io.PrintWriter)

Aggregations

File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ServletContext (javax.servlet.ServletContext)1 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)1 SpreadsheetPreviewNw (org.akaza.openclinica.control.admin.SpreadsheetPreviewNw)1 BeanFactory (org.akaza.openclinica.control.managestudy.BeanFactory)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1 POIFSFileSystem (org.apache.poi.poifs.filesystem.POIFSFileSystem)1