bean.setSelectedVigilant(vigilant); bean.setSelectedVigilantGroup(group); List<Vigilant> vigilants = new ArrayList<Vigilant>(group.getVigilants()); vigilants.remove(vigilant); if (vigilant.hasIncompatiblePerson()) { vigilants.remove(vigilant.getIncompatibleVigilant()); }
bean.setSelectedVigilant(vigilant); bean.setSelectedVigilantGroup(group); List<Vigilant> vigilants = new ArrayList<Vigilant>(group.getVigilants()); vigilants.remove(vigilant); if (vigilant.getIncompatibleVigilant()!=null) { vigilants.remove(vigilant.getIncompatibleVigilant()); }
    public ActionForward addIncompatibilityToVigilant(ActionMapping mapping, ActionForm form,            HttpServletRequest request, HttpServletResponse response) throws Exception {        String vigilantId = request.getParameter("oid");        String personId = request.getParameter("pid");        String groupId = request.getParameter("gid");        Vigilant vigilant = (Vigilant) RootDomainObject.readDomainObjectByOID(Vigilant.class, Integer                .valueOf(vigilantId));        Person person = (Person) RootDomainObject.readDomainObjectByOID(Person.class, Integer                .valueOf(personId));        VigilantGroup group = (VigilantGroup) RootDomainObject.readDomainObjectByOID(                VigilantGroup.class, Integer.valueOf(groupId));        Object[] args = { vigilant, person };        executeService(request, "AddIncompatiblePerson", args);        VigilantGroupBean bean = prepareBean(getLoggedPerson(request));        bean.setSelectedVigilant(vigilant);        bean.setSelectedVigilantGroup(group);        List<Vigilant> vigilants = new ArrayList<Vigilant>(group.getVigilants());        vigilants.remove(vigilant);        if (vigilant.hasIncompatiblePerson()) {            vigilants.remove(vigilant.getIncompatibleVigilant());        }        bean.setVigilants(vigilants);        request.setAttribute("bean", bean);        return mapping.findForward("addIncompatiblePersonToVigilant");    }