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(); }
private void execute() { search(); // from home - find more candidates String findDue = (String) data.get("findDue"); if (FieldUtil.isNotEmpty(findDue)) { LOGGER.debug(findDue); // 設條件 DateField dfFrom = (DateField) gridFilter.getField("dueOn" + "_From"); DateField dfTo = (DateField) gridFilter.getField("dueOn" + "_To"); if (findDue.equals(CardDonut.MODE_DUE.DUE_TODAY.getValue())) { dfFrom.setValue(DateUtil.getOnlyDate(new Date(), timeZone)); dfTo.setValue(DateUtil.getOnlyDate(new Date(), timeZone)); } else if (findDue.equals(CardDonut.MODE_DUE.OVERDUE.getValue())) { DateTime dt = new DateTime(); dfTo.setValue(DateUtil.getOnlyDate(dt.minusDays(1).toDate(), timeZone)); } else if (findDue.equals(CardDonut.MODE_DUE.TOTAL.getValue())) { } // 清除 data.put("findDue", null); UI.getCurrent().setData(data); gridFilter.search(); } }