@Override public boolean equals(Object object) { if (this == object) { return true; } if (object == null || !(object instanceof Event)) { return false; } Event event = (Event) object; return id.equals(event.id); }
/** * Set the OID to query. WARNING! This method assumes that table <CODE>SoftwareCandidate</CODE> * has a column named <CODE>"oid"</CODE>. This method is called from the DO classes to retrieve an * object by id. * * @param oid The object id to query. */ public void setQueryOId(ObjectId oid) { // Remove from cacheHits any DOs that do not meet this // setQuery requirement. if (null == oid) return; requireUniqueInstance(); for (int i = 0; i < cacheHits.size(); i++) { SoftwareCandidateDO DO = (SoftwareCandidateDO) cacheHits.elementAt(i); if (null == DO) continue; boolean equals = true; ObjectId id = DO.getOId(); if (null == id || !id.equals(oid)) cacheHits.removeElementAt(i--); } // Also prepare the SQL needed to query the database // in case there is no cache, or the query involves other tables. builder.addWhereClause("oid", oid.toBigDecimal(), QueryBuilder.NOT_NULL); }