public Collection findAllAdmin() { this.setTypesExpected(); ArrayList alist = this.select(digester.getQuery("findAllAdmin")); ArrayList al = new ArrayList(); Iterator it = alist.iterator(); while (it.hasNext()) { FilterBean fb = (FilterBean) this.getEntityFromHashMap((HashMap) it.next()); al.add(fb); } return al; }
public EntityBean update(EntityBean eb) { FilterBean fb = (FilterBean) eb; HashMap variables = new HashMap(); HashMap nullVars = new HashMap(); variables.put(new Integer(1), fb.getName()); variables.put(new Integer(2), fb.getDescription()); variables.put(new Integer(3), new Integer(fb.getStatus().getId())); variables.put(new Integer(4), fb.getSQLStatement()); // string, updateid, filterid variables.put(new Integer(5), new Integer(fb.getUpdaterId())); variables.put(new Integer(6), new Integer(fb.getId())); this.execute(digester.getQuery("update"), variables, nullVars); return fb; }
public EntityBean findByPK(int ID) { FilterBean fb = new FilterBean(); this.setTypesExpected(); HashMap variables = new HashMap(); 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()) { fb = (FilterBean) this.getEntityFromHashMap((HashMap) it.next()); } return fb; }
public EntityBean create(EntityBean eb) { FilterBean fb = (FilterBean) eb; logger.info("logged following owner id: " + fb.getOwnerId() + " vs. " + fb.getOwner().getId()); HashMap variables = new HashMap(); // HashMap nullVars = new HashMap(); variables.put(new Integer(1), fb.getName()); // name desc sql, status id owner id variables.put(new Integer(2), fb.getDescription()); variables.put(new Integer(3), fb.getSQLStatement()); variables.put(new Integer(4), new Integer(fb.getStatus().getId())); variables.put(new Integer(5), new Integer(fb.getOwner().getId())); // changed from get owner id, tbh this.execute(digester.getQuery("create"), variables); fb.setId(getCurrentPK()); return fb; }