Exemplo n.º 1
0
  public EntityBean create(EntityBean eb, UserAccountBean ub) {
    // INSERT INTO rule_set_audit (rule_set_audit_id,rule_set_id, status_id,updater_id,date_updated)
    // VALUES (?,?,?,?,?)
    RuleSetBean ruleSetBean = (RuleSetBean) eb;
    RuleSetAuditBean ruleSetAudit = new RuleSetAuditBean();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(1, ruleSetBean.getId());
    variables.put(2, ruleSetBean.getStatus().getId());
    variables.put(3, ub.getId());

    this.execute(digester.getQuery("create"), variables);
    if (isQuerySuccessful()) {
      ruleSetAudit.setRuleSetBean(ruleSetBean);
      ruleSetAudit.setId(getCurrentPK());
      ruleSetAudit.setStatus(ruleSetBean.getStatus());
      ruleSetAudit.setUpdater(ub);
    }
    return ruleSetAudit;
  }
 private Collection<TableColumnHolder> populate(CRFBean crf, ArrayList<CRFVersionBean> versions) {
   HashMap<String, ArrayList<TableColumnHolder>> hm =
       new HashMap<String, ArrayList<TableColumnHolder>>();
   List<TableColumnHolder> tableColumnHolders = new ArrayList<TableColumnHolder>();
   for (CRFVersionBean versionBean : versions) {
     hm.put(versionBean.getName(), new ArrayList<TableColumnHolder>());
   }
   List<RuleSetBean> ruleSets = getRuleSetService().getRuleSetsByCrfAndStudy(crf, currentStudy);
   for (RuleSetBean ruleSetBean : ruleSets) {
     if (ruleSetBean.getCrfVersion() == null) {
       for (String key : hm.keySet()) {
         hm.get(key).addAll(createFromRuleSet(ruleSetBean, key));
       }
     }
     if (ruleSetBean.getCrfVersion() != null) {
       hm.get(ruleSetBean.getCrfVersion().getName())
           .addAll(createFromRuleSet(ruleSetBean, ruleSetBean.getCrfVersion().getName()));
     }
   }
   for (ArrayList<TableColumnHolder> list : hm.values()) {
     tableColumnHolders.addAll(list);
   }
   return tableColumnHolders;
 }
 private List<TableColumnHolder> createFromRuleSet(RuleSetBean ruleSet, String crfVersionName) {
   List<TableColumnHolder> tchs = new ArrayList<TableColumnHolder>();
   for (RuleSetRuleBean ruleSetRule : ruleSet.getRuleSetRules()) {
     String ruleExpression = ruleSetRule.getRuleBean().getExpression().getValue();
     String ruleName = ruleSetRule.getRuleBean().getName();
     TableColumnHolder tch =
         new TableColumnHolder(
             crfVersionName,
             ruleName,
             ruleExpression,
             ruleSetRule.getActions(),
             ruleSetRule.getId());
     tchs.add(tch);
   }
   return tchs;
 }
Exemplo n.º 4
0
  public ArrayList<RuleSetAuditBean> findAllByRuleSet(RuleSetBean ruleSet) {
    ArrayList<RuleSetAuditBean> ruleSetAuditBeans = new ArrayList<RuleSetAuditBean>();

    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), ruleSet.getId());

    String sql = digester.getQuery("findAllByRuleSet");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();

    while (it.hasNext()) {
      RuleSetAuditBean ruleSetAudit =
          (RuleSetAuditBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
      ruleSetAuditBeans.add(ruleSetAudit);
    }
    return ruleSetAuditBeans;
  }
Exemplo n.º 5
0
 public EntityBean create(EntityBean eb) throws OpenClinicaException {
   RuleSetBean ruleSetBean = (RuleSetBean) eb;
   UserAccountBean userAccount = new UserAccountBean();
   userAccount.setId(ruleSetBean.getUpdaterId());
   return create(eb, userAccount);
 }