if (Phone.PHONE_GROUP_RESOURCE.equals(group.getResource())) {
if (Phone.GROUP_RESOURCE_ID.equals(group.getResource())) {
    public void onDelete(Object entity) {        Class c = entity.getClass();        if (Group.class.equals(c)) {            Group group = (Group) entity;            getHibernateTemplate().update(group);            if (Phone.PHONE_GROUP_RESOURCE.equals(group.getResource())) {                Collection phones = getPhonesByGroupId(group.getId());                Iterator iphones = phones.iterator();                while (iphones.hasNext()) {                    Phone phone = (Phone) iphones.next();                    Object[] ids = new Object[] {                        group.getId()                    };                    DataCollectionUtil.removeByPrimaryKey(phone.getGroups(), ids);                    storePhone(phone);                }            }        } else if (User.class.equals(c)) {            User user = (User) entity;            Collection phones = getPhonesByUserId(user.getId());            Iterator iphones = phones.iterator();            while (iphones.hasNext()) {                Phone phone = (Phone) iphones.next();                Collection lines = phone.getLines();                Iterator ilines = lines.iterator();                List ids = new ArrayList();                while (ilines.hasNext()) {                    Line line = (Line) ilines.next();                    User lineUser = line.getUser();                    if (lineUser.getId().equals(user.getId())) {                        ids.add(line.getId());                    }                }                DataCollectionUtil.removeByPrimaryKey(lines, ids.toArray());                storePhone(phone);            }        }    }