Search in sources :

Example 6 with ItemDataBean

use of org.akaza.openclinica.bean.submit.ItemDataBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    ItemDataBean eb = new ItemDataBean();
    this.setEntityAuditInformation(eb, hm);
    eb.setId(((Integer) hm.get("item_data_id")).intValue());
    eb.setEventCRFId(((Integer) hm.get("event_crf_id")).intValue());
    eb.setItemId(((Integer) hm.get("item_id")).intValue());
    eb.setValue((String) hm.get("value"));
    // fetching out from database
    if (formatDates) {
        ItemDataType dataType = getDataType(eb.getItemId());
        if (dataType.equals(ItemDataType.DATE)) {
            eb.setValue(Utils.convertedItemDateValue(eb.getValue(), oc_df_string, local_df_string, locale));
        } else if (dataType.equals(ItemDataType.PDATE)) {
            eb.setValue(reFormatPDate(eb.getValue()));
        }
    }
    eb.setStatus(Status.get(((Integer) hm.get("status_id")).intValue()));
    eb.setOrdinal(((Integer) hm.get("ordinal")).intValue());
    eb.setDeleted(((Boolean) hm.get("deleted")).booleanValue());
    eb.setOldStatus(Status.get(hm.get("old_status_id") == null ? 1 : ((Integer) hm.get("old_status_id")).intValue()));
    return eb;
}
Also used : ItemDataType(org.akaza.openclinica.bean.core.ItemDataType) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean)

Example 7 with ItemDataBean

use of org.akaza.openclinica.bean.submit.ItemDataBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method create.

public EntityBean create(EntityBean eb) {
    ItemDataBean idb = (ItemDataBean) eb;
    // YW 12-06-2007 << convert to oc_date_format_string pattern before
    // inserting into database
    ItemDataType dataType = getDataType(idb.getItemId());
    if (dataType.equals(ItemDataType.DATE)) {
        idb.setValue(Utils.convertedItemDateValue(idb.getValue(), local_df_string, oc_df_string, locale));
    } else if (dataType.equals(ItemDataType.PDATE)) {
        idb.setValue(formatPDate(idb.getValue()));
    }
    HashMap<Integer, Comparable> variables = new HashMap<Integer, Comparable>();
    int id = getNextPK();
    variables.put(new Integer(1), new Integer(id));
    variables.put(new Integer(2), new Integer(idb.getEventCRFId()));
    variables.put(new Integer(3), new Integer(idb.getItemId()));
    variables.put(new Integer(4), new Integer(idb.getStatus().getId()));
    variables.put(new Integer(5), idb.getValue());
    variables.put(new Integer(6), new Integer(idb.getOwnerId()));
    variables.put(new Integer(7), new Integer(idb.getOrdinal()));
    variables.put(new Integer(8), new Integer(idb.getStatus().getId()));
    variables.put(new Integer(9), new Boolean(idb.isDeleted()));
    this.execute(digester.getQuery("create"), variables);
    if (isQuerySuccessful()) {
        idb.setId(id);
    }
    return idb;
}
Also used : ItemDataType(org.akaza.openclinica.bean.core.ItemDataType) HashMap(java.util.HashMap) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean)

Example 8 with ItemDataBean

use of org.akaza.openclinica.bean.submit.ItemDataBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method findByPK.

public EntityBean findByPK(int ID) {
    ItemDataBean eb = new ItemDataBean();
    this.setTypesExpected();
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), new Integer(ID));
    String sql = digester.getQuery("findByPK");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        eb = (ItemDataBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return eb;
}
Also used : HashMap(java.util.HashMap) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 9 with ItemDataBean

use of org.akaza.openclinica.bean.submit.ItemDataBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method findByItemIdAndEventCRFId.

public ItemDataBean findByItemIdAndEventCRFId(int itemId, int eventCRFId) {
    setTypesExpected();
    ItemDataBean answer = new ItemDataBean();
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), new Integer(itemId));
    variables.put(new Integer(2), new Integer(eventCRFId));
    EntityBean eb = this.executeFindByPKQuery("findByItemIdAndEventCRFId", variables);
    if (!eb.isActive()) {
        return new ItemDataBean();
    } else {
        return (ItemDataBean) eb;
    }
}
Also used : HashMap(java.util.HashMap) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) EntityBean(org.akaza.openclinica.bean.core.EntityBean)

Example 10 with ItemDataBean

use of org.akaza.openclinica.bean.submit.ItemDataBean in project OpenClinica by OpenClinica.

the class ImportDataRuleRunner method runRules.

@Transactional
private MessageContainer runRules(StudyBean currentStudy, UserAccountBean ub, HashMap<String, String> variableAndValue, HashMap<String, ArrayList<RuleActionContainer>> toBeExecuted) {
    //Copied from DataEntryRuleRunner runRules
    MessageContainer messageContainer = new MessageContainer();
    for (Map.Entry<String, ArrayList<RuleActionContainer>> entry : toBeExecuted.entrySet()) {
        // Sort the list of actions
        Collections.sort(entry.getValue(), new RuleActionContainerComparator());
        for (RuleActionContainer ruleActionContainer : entry.getValue()) {
            logger.info("START Expression is : {} , RuleAction : {} ", new Object[] { ruleActionContainer.getExpressionBean().getValue(), ruleActionContainer.getRuleAction().toString() });
            ruleActionContainer.getRuleSetBean().setTarget(ruleActionContainer.getExpressionBean());
            ruleActionContainer.getRuleAction().setCuratedMessage(curateMessage(ruleActionContainer.getRuleAction(), ruleActionContainer.getRuleAction().getRuleSetRule()));
            ActionProcessor ap = ActionProcessorFacade.getActionProcessor(ruleActionContainer.getRuleAction().getActionType(), ds, getMailSender(), dynamicsMetadataService, ruleActionContainer.getRuleSetBean(), getRuleActionRunLogDao(), ruleActionContainer.getRuleAction().getRuleSetRule());
            ItemDataBean itemData = getExpressionService().getItemDataBeanFromDb(ruleActionContainer.getRuleSetBean().getTarget().getValue());
            RuleActionBean rab = ap.execute(RuleRunnerMode.IMPORT_DATA, ExecutionMode.SAVE, ruleActionContainer.getRuleAction(), itemData, DiscrepancyNoteBean.ITEM_DATA, currentStudy, ub, prepareEmailContents(ruleActionContainer.getRuleSetBean(), ruleActionContainer.getRuleAction().getRuleSetRule(), currentStudy, ruleActionContainer.getRuleAction()));
            if (rab != null) {
                if (rab instanceof ShowActionBean) {
                    messageContainer.add(getExpressionService().getGroupOidOrdinal(ruleActionContainer.getRuleSetBean().getTarget().getValue()), rab);
                } else {
                    messageContainer.add(getExpressionService().getGroupOrdninalConcatWithItemOid(ruleActionContainer.getRuleSetBean().getTarget().getValue()), ruleActionContainer.getRuleAction());
                }
            }
            logger.info("END Expression is : {} , RuleAction : {} ", new Object[] { ruleActionContainer.getExpressionBean().getValue(), ruleActionContainer.getRuleAction().toString() });
        }
    }
    return messageContainer;
}
Also used : ShowActionBean(org.akaza.openclinica.domain.rule.action.ShowActionBean) RuleActionBean(org.akaza.openclinica.domain.rule.action.RuleActionBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) ArrayList(java.util.ArrayList) ActionProcessor(org.akaza.openclinica.domain.rule.action.ActionProcessor) HashMap(java.util.HashMap) Map(java.util.Map) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)133 ArrayList (java.util.ArrayList)74 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)64 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)61 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)42 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)41 HashMap (java.util.HashMap)39 Date (java.util.Date)37 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)37 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)33 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)33 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)26 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)26 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)26 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)26 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)21 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)21 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)20 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)20 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)18