Search in sources :

Example 1 with FullReportBean

use of org.akaza.openclinica.bean.extract.odm.FullReportBean in project OpenClinica by OpenClinica.

the class RuleController method studyMetadata.

@RequestMapping(value = "/studies/{study}/metadata", method = RequestMethod.GET)
public ModelAndView studyMetadata(Model model, HttpSession session, @PathVariable("study") String studyOid, HttpServletResponse response) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    StudyBean currentStudy = (StudyBean) session.getAttribute("study");
    UserAccountBean userAccount = (UserAccountBean) session.getAttribute("userBean");
    UserAccountDAO userAccountDao = new UserAccountDAO(dataSource);
    userAccount = (UserAccountBean) userAccountDao.findByUserName("root");
    StudyDAO studyDao = new StudyDAO(dataSource);
    currentStudy = studyDao.findByOid(studyOid);
    MetaDataCollector mdc = new MetaDataCollector(dataSource, currentStudy, getRuleSetRuleDao());
    AdminDataCollector adc = new AdminDataCollector(dataSource, currentStudy);
    // RulesDataCollector rdc = new RulesDataCollector(sm.getDataSource(), currentStudy,getRuleSetRuleDao());
    MetaDataCollector.setTextLength(200);
    ODMBean odmb = mdc.getODMBean();
    odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC2-0.xsd");
    ArrayList<String> xmlnsList = new ArrayList<String>();
    xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
    // xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
    xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
    xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
    odmb.setXmlnsList(xmlnsList);
    odmb.setODMVersion("oc1.3");
    mdc.setODMBean(odmb);
    adc.setOdmbean(odmb);
    // rdc.setOdmbean(odmb);
    mdc.collectFileData();
    MetaDataReportBean metaReport = new MetaDataReportBean(mdc.getOdmStudyMap(), coreResources);
    metaReport.setODMVersion("oc1.3");
    metaReport.setOdmBean(mdc.getODMBean());
    metaReport.createChunkedOdmXml(Boolean.FALSE);
    adc.collectFileData();
    AdminDataReportBean adminReport = new AdminDataReportBean(adc.getOdmAdminDataMap());
    adminReport.setODMVersion("oc1.3");
    adminReport.setOdmBean(mdc.getODMBean());
    adminReport.createChunkedOdmXml(Boolean.FALSE);
    // rdc.collectFileData();
    // RulesDataReportBean rulesReport = new RulesDataReportBean(rdc.getOdmRulesDataMap(),getCoreResources());
    // rulesReport.setODMVersion("oc1.3");
    // rulesReport.setOdmBean(mdc.getODMBean());
    // rulesReport.createChunkedOdmXml(Boolean.FALSE);
    FullReportBean report = new FullReportBean();
    report.setAdminDataMap(adc.getOdmAdminDataMap());
    report.setOdmStudyMap(mdc.getOdmStudyMap());
    report.setCoreResources(coreResources);
    // report.setRulesDataMap(rdc.getOdmRulesDataMap());
    report.setOdmBean(mdc.getODMBean());
    report.setODMVersion("oc1.3");
    report.createStudyMetaOdmXml(Boolean.FALSE);
    response.setContentType("application/xml");
    PrintWriter out = response.getWriter();
    out.print(report.getXmlOutput().toString().trim());
    return null;
}
Also used : Locale(java.util.Locale) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) AdminDataCollector(org.akaza.openclinica.logic.odmExport.AdminDataCollector) ArrayList(java.util.ArrayList) MetaDataReportBean(org.akaza.openclinica.bean.extract.odm.MetaDataReportBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) FullReportBean(org.akaza.openclinica.bean.extract.odm.FullReportBean) AdminDataReportBean(org.akaza.openclinica.bean.extract.odm.AdminDataReportBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) MetaDataCollector(org.akaza.openclinica.logic.odmExport.MetaDataCollector) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) PrintWriter(java.io.PrintWriter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with FullReportBean

use of org.akaza.openclinica.bean.extract.odm.FullReportBean in project OpenClinica by OpenClinica.

the class MetadataCollectorResource method collectODMMetadataForForm.

public String collectODMMetadataForForm(String studyOID, String formVersionOID) {
    StudyBean studyBean = getStudyDao().findByOid(studyOID);
    if (studyBean != null)
        studyBean = populateStudyBean(studyBean);
    MetaDataCollector mdc = new MetaDataCollector(this.dataSource, studyBean, getRuleSetRuleDao());
    AdminDataCollector adc = new AdminDataCollector(this.dataSource, studyBean);
    MetaDataCollector.setTextLength(200);
    ODMBean odmb = mdc.getODMBean();
    odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC2-0.xsd");
    ArrayList<String> xmlnsList = new ArrayList<String>();
    xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
    // xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
    xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
    xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
    odmb.setXmlnsList(xmlnsList);
    odmb.setODMVersion("oc1.3");
    mdc.setODMBean(odmb);
    adc.setOdmbean(odmb);
    if (studyBean == null)
        mdc.collectFileData(formVersionOID);
    else
        mdc.collectFileData();
    adc.collectFileData();
    FullReportBean report = new FullReportBean();
    report.setAdminDataMap(adc.getOdmAdminDataMap());
    report.setOdmStudyMap(mdc.getOdmStudyMap());
    report.setCoreResources(getCoreResources());
    report.setOdmBean(mdc.getODMBean());
    report.setODMVersion("oc1.3");
    report.createStudyMetaOdmXml(Boolean.FALSE);
    return report.getXmlOutput().toString().trim();
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) AdminDataCollector(org.akaza.openclinica.logic.odmExport.AdminDataCollector) ArrayList(java.util.ArrayList) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) MetaDataCollector(org.akaza.openclinica.logic.odmExport.MetaDataCollector) FullReportBean(org.akaza.openclinica.bean.extract.odm.FullReportBean)

Example 3 with FullReportBean

use of org.akaza.openclinica.bean.extract.odm.FullReportBean in project OpenClinica by OpenClinica.

the class MetadataCollectorResource method collectODMMetadata.

public String collectODMMetadata(String studyOID) {
    StudyBean studyBean = getStudyDao().findByOid(studyOID);
    MetaDataCollector mdc = new MetaDataCollector(this.dataSource, studyBean, getRuleSetRuleDao());
    AdminDataCollector adc = new AdminDataCollector(this.dataSource, studyBean);
    MetaDataCollector.setTextLength(200);
    ODMBean odmb = mdc.getODMBean();
    odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC2-0.xsd");
    ArrayList<String> xmlnsList = new ArrayList<String>();
    xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
    // xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
    xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
    xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
    odmb.setXmlnsList(xmlnsList);
    odmb.setODMVersion("oc1.3");
    mdc.setODMBean(odmb);
    adc.setOdmbean(odmb);
    mdc.collectFileData();
    adc.collectFileData();
    FullReportBean report = new FullReportBean();
    report.setAdminDataMap(adc.getOdmAdminDataMap());
    report.setOdmStudyMap(mdc.getOdmStudyMap());
    report.setCoreResources(getCoreResources());
    report.setOdmBean(mdc.getODMBean());
    report.setODMVersion("oc1.3");
    report.createStudyMetaOdmXml(Boolean.FALSE);
    return report.getXmlOutput().toString().trim();
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) AdminDataCollector(org.akaza.openclinica.logic.odmExport.AdminDataCollector) ArrayList(java.util.ArrayList) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) MetaDataCollector(org.akaza.openclinica.logic.odmExport.MetaDataCollector) FullReportBean(org.akaza.openclinica.bean.extract.odm.FullReportBean)

Example 4 with FullReportBean

use of org.akaza.openclinica.bean.extract.odm.FullReportBean in project OpenClinica by OpenClinica.

the class StudyEndpoint method getReport.

private String getReport(StudyBean currentStudy) {
    // ServletContext servletContext =
    // (ServletContext) context.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
    MetaDataCollector mdc = new MetaDataCollector(dataSource, currentStudy, ruleSetRuleDao);
    AdminDataCollector adc = new AdminDataCollector(dataSource, currentStudy);
    MetaDataCollector.setTextLength(200);
    ODMBean odmb = mdc.getODMBean();
    odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC2-0.xsd");
    ArrayList<String> xmlnsList = new ArrayList<String>();
    xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
    // xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
    xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
    xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
    odmb.setXmlnsList(xmlnsList);
    odmb.setODMVersion("oc1.3");
    mdc.setODMBean(odmb);
    adc.setOdmbean(odmb);
    mdc.collectFileData();
    adc.collectFileData();
    FullReportBean report = new FullReportBean();
    report.setAdminDataMap(adc.getOdmAdminDataMap());
    report.setOdmStudyMap(mdc.getOdmStudyMap());
    report.setCoreResources(coreResources);
    report.setOdmBean(mdc.getODMBean());
    report.setODMVersion("oc1.3");
    report.createStudyMetaOdmXml(Boolean.FALSE);
    return report.getXmlOutput().toString().trim();
}
Also used : AdminDataCollector(org.akaza.openclinica.logic.odmExport.AdminDataCollector) ArrayList(java.util.ArrayList) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) MetaDataCollector(org.akaza.openclinica.logic.odmExport.MetaDataCollector) FullReportBean(org.akaza.openclinica.bean.extract.odm.FullReportBean)

Example 5 with FullReportBean

use of org.akaza.openclinica.bean.extract.odm.FullReportBean in project OpenClinica by OpenClinica.

the class DownloadStudyMetadataServlet method processRequest.

@Override
public void processRequest() throws Exception {
    MetaDataCollector mdc = new MetaDataCollector(sm.getDataSource(), currentStudy, getRuleSetRuleDao());
    AdminDataCollector adc = new AdminDataCollector(sm.getDataSource(), currentStudy);
    MetaDataCollector.setTextLength(200);
    ODMBean odmb = mdc.getODMBean();
    odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC2-0.xsd");
    ArrayList<String> xmlnsList = new ArrayList<String>();
    xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
    // xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
    xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
    xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
    odmb.setXmlnsList(xmlnsList);
    odmb.setODMVersion("oc1.3");
    mdc.setODMBean(odmb);
    adc.setOdmbean(odmb);
    mdc.collectFileData();
    adc.collectFileData();
    FullReportBean report = new FullReportBean();
    report.setAdminDataMap(adc.getOdmAdminDataMap());
    report.setOdmStudyMap(mdc.getOdmStudyMap());
    report.setCoreResources(getCoreResources());
    report.setOdmBean(mdc.getODMBean());
    report.setODMVersion("oc1.3");
    report.createStudyMetaOdmXml(Boolean.FALSE);
    request.setAttribute("generate", report.getXmlOutput().toString().trim());
    Page finalTarget = Page.EXPORT_DATA_CUSTOM;
    finalTarget.setFileName("/WEB-INF/jsp/extract/downloadStudyMetadata.jsp");
    forwardPage(finalTarget);
}
Also used : AdminDataCollector(org.akaza.openclinica.logic.odmExport.AdminDataCollector) ArrayList(java.util.ArrayList) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) Page(org.akaza.openclinica.view.Page) MetaDataCollector(org.akaza.openclinica.logic.odmExport.MetaDataCollector) FullReportBean(org.akaza.openclinica.bean.extract.odm.FullReportBean)

Aggregations

FullReportBean (org.akaza.openclinica.bean.extract.odm.FullReportBean)9 ArrayList (java.util.ArrayList)7 ODMBean (org.akaza.openclinica.bean.odmbeans.ODMBean)7 AdminDataCollector (org.akaza.openclinica.logic.odmExport.AdminDataCollector)7 MetaDataCollector (org.akaza.openclinica.logic.odmExport.MetaDataCollector)7 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)4 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)3 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 AdminDataReportBean (org.akaza.openclinica.bean.extract.odm.AdminDataReportBean)2 MetaDataReportBean (org.akaza.openclinica.bean.extract.odm.MetaDataReportBean)2 File (java.io.File)1 PrintWriter (java.io.PrintWriter)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Locale (java.util.Locale)1 JSON (net.sf.json.JSON)1 XMLSerializer (net.sf.json.xml.XMLSerializer)1