Search in sources :

Example 1 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class OdmImportServiceImpl method saveOrUpdateCrfAndFormLayouts.

private void saveOrUpdateCrfAndFormLayouts(String crfOid, List<OCodmComplexTypeDefinitionFormLayoutDef> formLayoutDefs, Form[] fmCrfs, UserAccount userAccount, Study study, String crfName) {
    DataBinder dataBinder = new DataBinder(new FormLayout());
    Errors errors = dataBinder.getBindingResult();
    StudyBean currentStudy = new StudyBean();
    currentStudy.setId(study.getStudyId());
    UserAccountBean ub = new UserAccountBean();
    ub.setId(userAccount.getUserId());
    ub.setActiveStudyId(currentStudy.getId());
    for (Form crf : fmCrfs) {
        if (crf.getOcoid().equals(crfOid)) {
            ExecuteIndividualCrfObject eicObj = new ExecuteIndividualCrfObject(crf, formLayoutDefs, errors, currentStudy, ub, true, null);
            xformService.executeIndividualCrf(eicObj);
        }
    }
}
Also used : FormLayout(org.akaza.openclinica.domain.datamap.FormLayout) Errors(org.springframework.validation.Errors) ExecuteIndividualCrfObject(org.akaza.openclinica.service.crfdata.ExecuteIndividualCrfObject) Form(org.akaza.openclinica.service.dto.Form) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) DataBinder(org.springframework.validation.DataBinder)

Example 2 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class AnonymousFormControllerV2 method createAnonymousEnketoUrl.

private String createAnonymousEnketoUrl(String studyOID, FormLayoutBean formLayout, EventDefinitionCRFBean edcBean, boolean isOffline) throws Exception {
    StudyBean parentStudyBean = getParentStudy(studyOID);
    PFormCache cache = PFormCache.getInstance(context);
    String enketoURL = cache.getPFormURL(parentStudyBean.getOid(), formLayout.getOid(), isOffline);
    String contextHash = cache.putAnonymousFormContext(studyOID, formLayout.getOid(), edcBean.getStudyEventDefinitionId());
    String url = null;
    if (isOffline)
        url = enketoURL.split("#", 2)[0] + "?" + FORM_CONTEXT + "=" + contextHash + "#" + enketoURL.split("#", 2)[1];
    else
        url = enketoURL + "?" + FORM_CONTEXT + "=" + contextHash;
    logger.debug("Enketo URL for " + formLayout.getName() + "= " + url);
    return url;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) PFormCache(org.akaza.openclinica.web.pform.PFormCache)

Example 3 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class AccountController method isStudyASiteLevelStudy.

private Boolean isStudyASiteLevelStudy(String studyOid) {
    StudyBean studyBean = getStudy(studyOid);
    if (studyBean.getParentStudyId() != 0) {
        logger.info("***Study provided in the URL is a Site study***");
        System.out.println("***Study provided in the URL is a Site study***");
        return true;
    }
    return false;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Example 4 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class OpenRosaServices method getUserXml.

private String getUserXml(ServletContext context) throws Exception {
    HashMap<String, String> value = getSubjectContextCacheValue(context);
    String studySubjectOid = value.get("studySubjectOID");
    StudySubject ssBean = ssDao.findByOcOID(studySubjectOid);
    StudyBean study = getStudy(ssBean.getStudy().getOc_oid());
    StudyBean parentStudy = getParentStudy(ssBean.getStudy().getOc_oid());
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.newDocument();
    Element root = doc.createElement("root");
    doc.appendChild(root);
    List<UserAccount> users = userAccountDao.findNonRootNonParticipateUsersByStudyId(study.getId(), parentStudy.getId());
    for (UserAccount userAccount : users) {
        Element item = doc.createElement("item");
        Element userName = doc.createElement("user_name");
        userName.appendChild(doc.createTextNode(userAccount.getUserName()));
        Element firstName = doc.createElement("first_name");
        firstName.appendChild(doc.createTextNode(userAccount.getFirstName()));
        Element lastName = doc.createElement("last_name");
        lastName.appendChild(doc.createTextNode(userAccount.getLastName()));
        item.appendChild(userName);
        item.appendChild(firstName);
        item.appendChild(lastName);
        root.appendChild(item);
    }
    DOMSource dom = new DOMSource(doc);
    StringWriter writer = new StringWriter();
    StreamResult result = new StreamResult(writer);
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    transformer.transform(dom, result);
    String userXml = writer.toString();
    return userXml;
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) TransformerFactory(javax.xml.transform.TransformerFactory) Transformer(javax.xml.transform.Transformer) StreamResult(javax.xml.transform.stream.StreamResult) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) StringWriter(java.io.StringWriter) StudySubject(org.akaza.openclinica.domain.datamap.StudySubject) DocumentBuilder(javax.xml.parsers.DocumentBuilder) UserAccount(org.akaza.openclinica.domain.user.UserAccount)

Example 5 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class RestoreStudyUserRoleServlet method sendEmail.

/**
     * Send email to the user, director and administrator
     *
     * @param request
     * @param response
     */
private String sendEmail(UserAccountBean u, StudyUserRoleBean sub) throws Exception {
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    StudyBean study = (StudyBean) sdao.findByPK(sub.getStudyId());
    logger.info("Sending email...");
    String body = u.getFirstName() + " " + u.getLastName() + "(" + resword.getString("username") + ": " + u.getName() + ") " + respage.getString("has_been_restored_to_the_study_site") + " " + study.getName() + respage.getString("with_the_role") + " " + sub.getRoleName() + ". " + respage.getString("the_user_is_now_be_able_to_access_study");
    sendEmail(u.getEmail().trim(), respage.getString("restore_user_role"), body, false);
    sendEmail(ub.getEmail().trim(), respage.getString("restore_user_role"), body, false);
    sendEmail(EmailEngine.getAdminEmail(), respage.getString("restore_user_role"), body, false);
    return body;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Aggregations

StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)366 ArrayList (java.util.ArrayList)185 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)184 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)92 HashMap (java.util.HashMap)85 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)68 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)65 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)62 Date (java.util.Date)61 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)59 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)58 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)56 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)45 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)42 Locale (java.util.Locale)41 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)41 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)38