*/
public static BaseEntity getById(Collection entities, Class entityClass, int entityId)
throws ObjectRetrievalFailureException {
for (Iterator it = entities.iterator(); it.hasNext();) {
BaseEntity entity = (BaseEntity) it.next();
if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) {
return entity;
}
}
throw new ObjectRetrievalFailureException(entityClass, new Integer(entityId));
}