Search in sources :

Example 16 with EntityBean

use of org.akaza.openclinica.bean.core.EntityBean in project OpenClinica by OpenClinica.

the class StudyEventDAO method removeDouble.

// so as to remove the object correctly, tbh
public HashMap removeDouble(HashMap hm, EntityBean event) {
    ArrayList al = new ArrayList();
    Set s = hm.entrySet();
    EntityBean removeMe = new EntityBean();
    for (Iterator it = s.iterator(); it.hasNext(); ) {
        Map.Entry me = (Map.Entry) it.next();
        EntityBean eb = (EntityBean) me.getKey();
        if (eb.getId() == event.getId() && eb.getName().equals(event.getName())) {
            logger.warn("found OLD bean, remove it");
            removeMe = eb;
        }
    }
    hm.remove(removeMe);
    return hm;
}
Also used : Set(java.util.Set) EntityBean(org.akaza.openclinica.bean.core.EntityBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map)

Example 17 with EntityBean

use of org.akaza.openclinica.bean.core.EntityBean in project OpenClinica by OpenClinica.

the class StudyEventDAO method returnDouble.

// so as not to get null pointer returns, tbh
public ArrayList returnDouble(HashMap hm, EntityBean event) {
    ArrayList al = new ArrayList();
    Set s = hm.entrySet();
    for (Iterator it = s.iterator(); it.hasNext(); ) {
        Map.Entry me = (Map.Entry) it.next();
        EntityBean eb = (EntityBean) me.getKey();
        if (eb.getId() == event.getId() && eb.getName().equals(event.getName())) {
            // logger.warn("found OLD bean, return true");
            al = (ArrayList) me.getValue();
        }
    }
    return al;
}
Also used : Set(java.util.Set) EntityBean(org.akaza.openclinica.bean.core.EntityBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map)

Example 18 with EntityBean

use of org.akaza.openclinica.bean.core.EntityBean in project OpenClinica by OpenClinica.

the class StudyEventDAO method findDouble.

// TODO make sure we are returning the correct boolean, tbh
public boolean findDouble(HashMap hm, EntityBean event) {
    boolean returnMe = false;
    Set s = hm.entrySet();
    for (Iterator it = s.iterator(); it.hasNext(); ) {
        Map.Entry me = (Map.Entry) it.next();
        EntityBean eb = (EntityBean) me.getKey();
        if (eb.getId() == event.getId() && eb.getName().equals(event.getName())) {
            logger.warn("found OLD bean, return true");
            returnMe = true;
        }
    }
    return returnMe;
}
Also used : Set(java.util.Set) EntityBean(org.akaza.openclinica.bean.core.EntityBean) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map)

Example 19 with EntityBean

use of org.akaza.openclinica.bean.core.EntityBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method findByItemIdAndEventCRFIdAndOrdinal.

// YW, 1-25-2008, for repeating item
public ItemDataBean findByItemIdAndEventCRFIdAndOrdinal(int itemId, int eventCRFId, int ordinal) {
    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));
    variables.put(new Integer(3), new Integer(ordinal));
    EntityBean eb = this.executeFindByPKQuery("findByItemIdAndEventCRFIdAndOrdinal", variables);
    if (!eb.isActive()) {
        // hmm, return null instead?
        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 20 with EntityBean

use of org.akaza.openclinica.bean.core.EntityBean in project OpenClinica by OpenClinica.

the class ItemDataDAO method findByItemIdAndEventCRFIdAndOrdinalRaw.

public ItemDataBean findByItemIdAndEventCRFIdAndOrdinalRaw(int itemId, int eventCRFId, int ordinal) {
    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));
    variables.put(new Integer(3), new Integer(ordinal));
    EntityBean eb = this.executeFindByPKQuery("findByItemIdAndEventCRFIdAndOrdinal", variables);
    if (!eb.isActive()) {
        // hmm, return null instead?
        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)

Aggregations

EntityBean (org.akaza.openclinica.bean.core.EntityBean)20 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)7 Iterator (java.util.Iterator)7 AuditableEntityBean (org.akaza.openclinica.bean.core.AuditableEntityBean)4 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)4 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)4 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)4 Date (java.util.Date)3 Map (java.util.Map)3 Set (java.util.Set)3 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)3 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)3 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)3 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)3 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)3 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)3 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)3 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)3 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)2