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); }
private void search() { gridFilter.reset(); String localeStr = locale.toString(); List<Object[]> datasList = candStageInterviewerService.findResumeReviewUnprocessByManager( currentUser.getUuid(), localeStr); // for isRead List<String> isReads = candProfileReadService.findCandidateByManager(currentUser.getUuid()); // System.out.println(ANSI_PURPLE + "start setGridContent" + ANSI_RESET); LOGGER.debug("start ResumeReviewToDoListFinder search"); long lStartTime = System.nanoTime(); for (Object[] datas : datasList) { long lStartOneTime = System.nanoTime(); Item newItem = grid.getItem(grid.addItem()); long lStartUuidTime = System.nanoTime(); // uuid String candidateUuid = (String) datas[0]; newItem.getItemProperty("candidateUuid").setValue(candidateUuid); // candStageInterviewerUuid String candStageInterviewerUuid = (String) datas[17]; newItem.getItemProperty("candStageInterviewerUuid").setValue(candStageInterviewerUuid); LOGGER.debug( "Start One - candidateUuid: " + candidateUuid + " candStageInterviewerUuid: " + candStageInterviewerUuid); // decision CodeData codeDataDecision = codeDataService.findOneByCodeTypeAndCode("reviewDecision", (String) datas[14], localeStr); newItem.getItemProperty("decision").setValue(codeDataDecision); newItem.getItemProperty("name").setValue((String) datas[1]); newItem.getItemProperty("totalWorkExp").setValue(datas[9]); long lEndUuidTime = System.nanoTime(); long differenceUuid = lEndUuidTime - lStartUuidTime; // System.out.println(ANSI_PURPLE+ "Put uuid name totalWorkExp time: "+candidateUuid+" spend // "+differenceUuid/1000000+" ms" + ANSI_RESET); LOGGER.debug( "Put uuid name totalWorkExp time: " + candidateUuid + " spend " + differenceUuid / 1000000 + " ms"); long lStartDegreeTime = System.nanoTime(); String degreeCode = (String) datas[2]; CodeData codeDataDegree = codeDataService.findOneByCodeTypeAndCode("degree", degreeCode, localeStr); if (codeDataDegree != null) { newItem.getItemProperty("degree").setValue(codeDataDegree); } String schoolCode = (String) datas[3]; if (schoolCode != null) { if (!schoolCode.equals(School.TYPE.OTHER.getValue())) { School school = schoolService.findOneByDegreeAndCodeAndLocale(degreeCode, schoolCode, localeStr); if (school != null) { newItem.getItemProperty("school").setValue(school.getName()); } // other school } else { newItem.getItemProperty("school").setValue((String) datas[5]); } } String majorCode = (String) datas[4]; if (majorCode != null) { if (!majorCode.equals(Major.TYPE.OTHER.getValue())) { Major major = majorService.findOneByDegreeAndCodeAndLocale(degreeCode, majorCode, localeStr); if (major != null) { newItem.getItemProperty("major").setValue(major.getName()); } // other major } else { newItem.getItemProperty("major").setValue((String) datas[6]); } } long lEndDegreeTime = System.nanoTime(); long differenceDegree = lEndDegreeTime - lStartDegreeTime; // System.out.println(ANSI_PURPLE+ "Put degree school major: "+candidateUuid+" spend // "+differenceDegree/1000000+" ms" + ANSI_RESET); LOGGER.debug( "Put degree school major: " + candidateUuid + " spend " + differenceDegree / 1000000 + " ms"); long lStartSourceTime = System.nanoTime(); // years, last job title , source newItem.getItemProperty("lastJobTitle").setValue((String) datas[8]); newItem.getItemProperty("lastEmplyer").setValue((String) datas[7]); newItem.getItemProperty("source").setValue((String) datas[10]); long lEndSourceTime = System.nanoTime(); long differenceSource = lEndSourceTime - lStartSourceTime; // System.out.println(ANSI_PURPLE+ "Put lastJobTitle lastEmplyer source: "+candidateUuid+" // spend "+differenceSource/1000000+" ms" + ANSI_RESET); LOGGER.debug( "Put lastJobTitle lastEmplyer source: " + candidateUuid + " spend " + differenceSource / 1000000 + " ms"); long lStartReadTime = System.nanoTime(); // read if (isReads.contains(candidateUuid)) { Label lRead = new Label(); lRead.setSizeUndefined(); lRead.setContentMode(ContentMode.HTML); lRead.setValue(FontAwesome.TAG.getHtml()); newItem.getItemProperty("read").setValue(lRead); } long lEndReadTime = System.nanoTime(); long differenceRead = lEndReadTime - lStartReadTime; // System.out.println(ANSI_PURPLE+ "Put read: "+candidateUuid+" spend // "+differenceRead/1000000+" ms" + ANSI_RESET); LOGGER.debug("Put read: " + candidateUuid + " spend " + differenceRead / 1000000 + " ms"); long lStartRequisitionTime = System.nanoTime(); newItem.getItemProperty("requisition").setValue((String) datas[11]); newItem.getItemProperty("location").setValue((String) datas[13]); // due on newItem.getItemProperty("dueOn").setValue((Date) datas[15]); // complete on newItem.getItemProperty("completeOn").setValue((Date) datas[16]); long lEndRequisitionTime = System.nanoTime(); long differenceRequisition = lEndRequisitionTime - lStartRequisitionTime; // System.out.println(ANSI_PURPLE+ "Put requisition location dueOn completeOn: // "+candidateUuid+" spend "+differenceRequisition/1000000+" ms"+ ANSI_RESET); LOGGER.debug( "Put requisition location dueOn completeOn: " + candidateUuid + " spend " + differenceRequisition / 1000000 + " ms"); long lEndOneTime = System.nanoTime(); long differenceOne = lEndOneTime - lStartOneTime; // System.out.println(ANSI_PURPLE+"One Item set done: "+candidateUuid+" spend // "+differenceOne/1000000+" ms"+ ANSI_RESET); LOGGER.debug( "One Item set done: " + candidateUuid + " spend " + differenceOne / 1000000 + " ms"); // // System.out.println(ANSI_PURPLE+"==========================================================="+ ANSI_RESET); LOGGER.debug("==========================================================="); } long lEndTime = System.nanoTime(); long difference = lEndTime - lStartTime; // System.out.println(ANSI_PURPLE+"Complete setGridContent spend "+difference/1000000+" ms"+ // ANSI_RESET); LOGGER.debug("Complete setGridContent spend " + difference / 1000000 + " ms"); long lStartAdjustTime = System.nanoTime(); gridFilter.adjust(); count(); long lEndAdjustTime = System.nanoTime(); long differenceAdjust = lEndAdjustTime - lStartAdjustTime; // System.out.println(ANSI_PURPLE+"Adjust Time "+differenceAdjust/1000000+" ms"+ ANSI_RESET); LOGGER.debug("Adjust Time " + differenceAdjust / 1000000 + " ms"); }