private void saveMyFavorite() { Item item = vfMyFavorite.getForm().getValues(); String createId = (String) item.getItemProperty("createIn").getValue(); String newForder = (String) item.getItemProperty("newFolder").getValue(); if (FieldUtil.isNotEmpty(createId) && FieldUtil.isNotEmpty(newForder)) { Dialog dialog = new Dialog( Dialog.MODE.VALIDATE, messageResource.getMessage( "501014", locale, termResource.getTerm("Create In"), termResource.getTerm("New Folder"))); return; } String category; if (createId != null) { category = createId; } else { category = newForder; } List<Item> selection = gridFilter.getGrid().getSelection(); Item i = selection.get(0); String candidateUuid = (String) i.getItemProperty("candidateUuid").getValue(); Candidate candidate = candidateService.get(candidateUuid); CandFavorite candFavorite = new CandFavorite(); candFavorite.setCandidate(candidate); candFavorite.setCategory(category); candFavorite.setManager(currentUser); try { candFavoriteService.save(candFavorite); } catch (DuplicateConflictException d) { LOGGER.debug("DuplicateConflictException: ", d); Dialog dialog = new Dialog(Dialog.MODE.VALIDATE, d.getLocalizedMessage(locale)); return; } catch (ConstraintConflictException c) { LOGGER.debug("ConstraintConflictException: ", c); Dialog dialog = new Dialog(Dialog.MODE.VALIDATE, ViolationUtils.getViolation(c.getViolations(), locale)); return; } catch (OperationFailureException o) { LOGGER.error("Exception: ", o); Messagebox.hint(messageResource.getMessage("200001")); return; } // success Messagebox.info(messageResource.getMessage("100025")); closeMyFavorite(); refresh(); }