コード例 #1
0
  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();
  }
コード例 #2
0
  private void check(String instruction) {

    Map<String, Object> data = new HashMap<>();

    List<Item> selection = grid.getSelection();

    if (selection.size() == 0) {
      Messagebox.hint(messageResource.getMessage("100003"));
      return;
    }

    List<PropertysetItem> items = ItemUtils.getItemsIsolated(selection);

    data.put("items", items);

    CommandEvent.ExecuteEvent event = CommandEvent.createExecuteEvent(this, instruction, data);
    fireEvent(event);

    // 記錄 最後是誰讀取了此Candidate, 並記錄時間
    Item item = selection.get(0);
    String candidateUuid = (String) item.getItemProperty("candidateUuid").getValue();
    Candidate candidate = candidateService.get(candidateUuid);

    Account reader = this.currentUser;

    try {
      candProfileReadService.save(candidate, reader);
    } 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;
    }

    // 標記此筆資料已經讀取過
    Label lRead = new Label();
    lRead.setSizeUndefined();
    lRead.setContentMode(ContentMode.HTML);
    lRead.setValue(FontAwesome.TAG.getHtml());
    item.getItemProperty("read").setValue(lRead);
  }
コード例 #3
0
  private void compare() {
    String instruction = COMMAND.COMPARE.getValue();

    Map<String, Object> data = new HashMap<>();

    List<Item> selection = grid.getSelection();

    if (selection.size() == 0) {
      Messagebox.hint(messageResource.getMessage("100003"));
      return;
    }

    data.put("items", selection);

    CommandEvent.ExecuteEvent event = CommandEvent.createExecuteEvent(this, instruction, data);
    fireEvent(event);

    //		for(int i = 1601 ; i< 2100 ; i++) {
    //			String numberName = String.format("%04d", i);
    //			System.out.println(numberName);
    //
    //
    //			CandApplyRequisition bean=new CandApplyRequisition();
    //			Candidate candidate=candidateService.findOneByEmail("Julia"+numberName+"@gmail.com");
    //			bean.setApplyDate(new DateTime(2015,5,24,0,0,0).toDate() );
    //			bean.setCandidate(candidate);
    //			bean.setRequisition(requisitionService.findOneByNo("MTK120150519002"));
    //			bean.setStage("02");
    //
    //		    CandStageInterviewer stageInterviewer=new CandStageInterviewer();
    //		    stageInterviewer.setInterviewer(accountService.findOneByUsername("MTK05756"));
    //		    stageInterviewer.setStage(Stage.RESUMEREVIEW.getValue());
    //		    stageInterviewer.setStartDate(new DateTime(2015,11,17,0,0,0).toDate());
    //	            stageInterviewer.setDueDate(new DateTime(2015,11,19,0,0,0).toDate());
    //		    bean.addStageInterviewer(stageInterviewer);
    //		    candApplyRequisitionService.save(bean);
    //		}
  }
コード例 #4
0
  private void popMyFavorite(String instruction) {
    List<Item> selection = grid.getSelection();

    if (selection.size() != 1) {
      Messagebox.hint(messageResource.getMessage("100004"));
      return;
    }

    String name = selection.get(0).getItemProperty("name").getValue().toString();

    windowMyFavorite.setCaption(name + "-" + termResource.getTerm("To My Favorite"));
    // reset combobox
    List<String> categories =
        candFavoriteService.findUniqueCategoryByManager(this.currentUser.getUuid());
    ComboBox cbCreateIn = (ComboBox) vfMyFavorite.getForm().getField("createIn");
    cbCreateIn.removeAllItems();
    for (String cbItem : categories) {
      cbCreateIn.addItem(cbItem);
    }

    vfMyFavorite.getForm().clear();
    windowMyFavorite.open();
  }