List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED
Isolation READ_COMMITTED
To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.
Click Source Link
From source file:com.inkubator.hrm.service.impl.ApprovalActivityNotSendListenerServiceImpl.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void onMessage(Message msg) { SchedulerLog log = null;//from ww w .j a va 2 s . c om try { TextMessage textMessage = (TextMessage) msg; log = schedulerLogDao.getEntiyByPK(Long.parseLong(textMessage.getText())); sendNotificationApprovalNotSend(); log.setStatusMessages("FINISH"); super.doUpdateSchedulerLogSchedulerLog(log); } catch (Exception ex) { if (log != null) { log.setStatusMessages(ex.getMessage()); super.doUpdateSchedulerLogSchedulerLog(log); } LOGGER.error(ex, ex); } }
From source file:de.thm.arsnova.FeedbackStorage.java
@Transactional(isolation = Isolation.READ_COMMITTED) public Map<Session, List<User>> cleanFeedbackVotes(final int cleanupFeedbackDelay) { final Map<Session, List<User>> removedFeedbackOfUsersInSession = new HashMap<Session, List<User>>(); for (final Session session : data.keySet()) { List<User> affectedUsers = cleanFeedbackVotesInSession(session, cleanupFeedbackDelay); if (!affectedUsers.isEmpty()) { removedFeedbackOfUsersInSession.put(session, affectedUsers); }/*from www . java 2 s .c om*/ } return removedFeedbackOfUsersInSession; }
From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(BioRelasiPerusahaan entity) throws Exception { }
From source file:net.longfalcon.newsj.FetchBinaries.java
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) public long scan(NewsClient nntpClient, Group group, long firstArticle, long lastArticle, String type, boolean compressedHeaders) throws IOException { // this is a hack - tx is not working ATM TransactionStatus transaction = transactionManager .getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED)); long startHeadersTime = System.currentTimeMillis(); long maxNum = 0; Map<String, Message> messages = new LinkedHashMap<>(MESSAGE_BUFFER + 1); Iterable<NewsArticle> articlesIterable = null; try {/* w w w . j ava2 s .c o m*/ if (compressedHeaders) { _log.warn("Compressed Headers setting not currently functional"); articlesIterable = nntpClient.iterateArticleInfo(firstArticle, lastArticle); } else { articlesIterable = nntpClient.iterateArticleInfo(firstArticle, lastArticle); } } catch (IOException e) { _log.error(e.toString()); if (nntpClient.getReplyCode() == 400) { _log.info("NNTP connection timed out. Reconnecting..."); nntpClient = nntpConnectionFactory.getNntpClient(); nntpClient.selectNewsgroup(group.getName()); articlesIterable = nntpClient.iterateArticleInfo(firstArticle, lastArticle); } } Period headersTime = new Period(startHeadersTime, System.currentTimeMillis()); Set<Long> rangeRequested = ArrayUtil.rangeSet(firstArticle, lastArticle); Set<Long> messagesReceived = new HashSet<>(); Set<Long> messagesBlacklisted = new HashSet<>(); Set<Long> messagesIgnored = new HashSet<>(); Set<Long> messagesInserted = new HashSet<>(); Set<Long> messagesNotInserted = new HashSet<>(); // check error codes? long startUpdateTime = System.currentTimeMillis(); if (articlesIterable != null) { for (NewsArticle article : articlesIterable) { long articleNumber = article.getArticleNumberLong(); if (articleNumber == 0) { continue; } messagesReceived.add(articleNumber); Pattern pattern = Defaults.PARTS_SUBJECT_REGEX; String subject = article.getSubject(); Matcher matcher = pattern.matcher(subject); if (ValidatorUtil.isNull(subject) || !matcher.find()) { // not a binary post most likely.. continue messagesIgnored.add(articleNumber); if (_log.isDebugEnabled()) { _log.debug(String.format("Skipping message no# %s : %s", articleNumber, subject)); } continue; } //Filter binaries based on black/white list if (isBlacklisted(article, group)) { messagesBlacklisted.add(articleNumber); continue; } String group1 = matcher.group(1); String group2 = matcher.group(2); if (ValidatorUtil.isNumeric(group1) && ValidatorUtil.isNumeric(group2)) { int currentPart = Integer.parseInt(group1); int maxParts = Integer.parseInt(group2); subject = (matcher.replaceAll("")).trim(); if (!messages.containsKey(subject)) { messages.put(subject, new Message(article, currentPart, maxParts)); } else if (currentPart > 0) { Message message = messages.get(subject); String articleId = article.getArticleId(); String messageId = articleId.substring(1, articleId.length() - 1); int size = article.getSize(); message.addPart(currentPart, messageId, articleNumber, size); messages.put(subject, message); } } } long count = 0; long updateCount = 0; long partCount = 0; maxNum = lastArticle; // add all the requested then remove the ones we did receive. Set<Long> rangeNotRecieved = new HashSet<>(); rangeNotRecieved.addAll(rangeRequested); rangeNotRecieved.removeAll(messagesReceived); if (!type.equals("partrepair")) { _log.info(String.format("Received %d articles of %d requested, %d blacklisted, %d not binaries", messagesReceived.size(), lastArticle - firstArticle + 1, messagesBlacklisted.size(), messagesIgnored.size())); } if (rangeNotRecieved.size() > 0) { switch (type) { case "backfill": // don't add missing articles break; case "partrepair": case "update": default: addMissingParts(rangeNotRecieved, group); break; } _log.info("Server did not return article numbers " + ArrayUtil.stringify(rangeNotRecieved)); } if (!messages.isEmpty()) { long dbUpdateTime = 0; maxNum = firstArticle; //insert binaries and parts into database. when binary already exists; only insert new parts for (Map.Entry<String, Message> entry : messages.entrySet()) { String subject = entry.getKey(); Message message = entry.getValue(); Map<Integer, MessagePart> partsMap = message.getPartsMap(); if (!ValidatorUtil.isNull(subject) && !partsMap.isEmpty()) { String binaryHash = EncodingUtil .md5Hash(subject + message.getFrom() + String.valueOf(group.getId())); Binary binary = binaryDAO.findByBinaryHash(binaryHash); if (binary == null) { long startDbUpdateTime = System.currentTimeMillis(); binary = new Binary(); binary.setName(subject); binary.setFromName(message.getFrom()); binary.setDate(message.getDate().toDate()); binary.setXref(message.getxRef()); binary.setTotalParts(message.getMaxParts()); binary.setGroupId(group.getId()); binary.setBinaryHash(binaryHash); binary.setDateAdded(new Date()); binaryDAO.updateBinary(binary); dbUpdateTime += (System.currentTimeMillis() - startDbUpdateTime); count++; if (count % 500 == 0) { _log.info(String.format("%s bin adds...", count)); } } else { updateCount++; if (updateCount % 500 == 0) { _log.info(String.format("%s bin updates...", updateCount)); } } long binaryId = binary.getId(); if (binaryId == 0) { throw new RuntimeException("ID for binary wasnt set."); } for (MessagePart messagePart : message.getPartsMap().values()) { long articleNumber = messagePart.getArticleNumber(); maxNum = (articleNumber > maxNum) ? articleNumber : maxNum; partCount++; // create part - its possible some bugs are happening here. Part part = new Part(); part.setBinaryId(binaryId); part.setMessageId(messagePart.getMessageId()); part.setNumber(messagePart.getArticleNumber()); part.setPartNumber(messagePart.getPartNumber()); part.setSize(messagePart.getSize()); part.setDateAdded(new Date()); try { long startDbUpdateTime = System.currentTimeMillis(); partDAO.updatePart(part); dbUpdateTime += (System.currentTimeMillis() - startDbUpdateTime); messagesInserted.add(messagePart.getArticleNumber()); } catch (Exception e) { _log.error(e.toString()); messagesNotInserted.add(messagePart.getArticleNumber()); } } } } //TODO: determine whether to add to missing articles if insert failed if (messagesNotInserted.size() > 0) { _log.warn("WARNING: Parts failed to insert"); addMissingParts(messagesNotInserted, group); } Period dbUpdatePeriod = new Period(dbUpdateTime); _log.info("Spent " + _periodFormatter.print(dbUpdatePeriod) + " updating the db"); } Period updateTime = new Period(startUpdateTime, System.currentTimeMillis()); if (!type.equals("partrepair")) { _log.info(count + " new, " + updateCount + " updated, " + partCount + " parts."); _log.info(" " + _periodFormatter.print(headersTime) + " headers, " + _periodFormatter.print(updateTime) + " update."); } transactionManager.commit(transaction); return maxNum; } else { _log.error("Error: Can't get parts from server (msgs not array)\n Skipping group"); return 0; } }
From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(MecineFinger entity) throws Exception { // check duplicate name long totalDuplicates = mecineFingerDao.getTotalByCode(entity.getCode()); if (totalDuplicates > 0) { throw new BussinessException("mecinefinger.error_duplicate_mecinefinger_code"); }//from w w w .j a v a2s. co m entity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); entity.setName(entity.getName()); entity.setMecineMethode(entity.getMecineMethode()); entity.setCreatedBy(UserInfoUtil.getUserName()); entity.setCreatedOn(new Date()); this.mecineFingerDao.save(entity); }
From source file:com.inkubator.hrm.service.impl.NotificationApprovalMessagesListener.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override/* ww w . j a v a2 s .co m*/ @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { try { LOGGER.info("Begin Send Email Approval"); TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd-MMMM-yyyy"); Gson gson = gsonBuilder.create(); Gson gsonDateSerializer = JsonUtil.getHibernateEntityGsonBuilder() .registerTypeAdapter(Date.class, new DateJsonDeserializer()).create(); JsonObject jsonObject = (JsonObject) gson.fromJson(json, JsonObject.class); String locale = jsonObject.get("locale").getAsString(); ApprovalActivity appActivity = approvalActivityDao .getEntiyByPK(jsonObject.get("approvalActivityId").getAsLong()); HrmUser approverUser = hrmUserDao.getByUserId(appActivity.getApprovedBy()); HrmUser requesterUser = hrmUserDao.getByUserId(appActivity.getRequestBy()); VelocityTempalteModel vtm = new VelocityTempalteModel(); List<String> toSend = new ArrayList<>(); List<String> toSentCC = new ArrayList<String>(); List<String> toSentBCC = new ArrayList<String>(); vtm.setFrom(ownerEmail); /*if(appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_WAITING) { //kirim email ke approver nya jika status waiting toSend.add(approverUser.getEmailAddress()); } else if(appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_CANCELLED){ //kirim email ke approver nya jika status cancelled. Dan cc email ke requester toSend.add(approverUser.getEmailAddress()); toSentCC.add(requesterUser.getEmailAddress()); } else if((appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_APPROVED) && appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_REJECTED) { //kirim email ke requester nya jika statusnya sudah di approved/rejected. Dan cc email (if any) toSend.add(requesterUser.getEmailAddress()); for(JsonElement el:jsonObject.get("ccEmailAddresses").getAsJsonArray()){ toSentCC.add(el.getAsString()); } }*/ toSend.add("deni.arianto1606@gmail.com"); toSend.add("rizal2_dhfr@yahoo.com"); // toSend.add("yosa.mareta@gmail.com"); toSend.add("guntur@incubatechnology.com"); toSentCC.add("rizkykojek@gmail.com"); toSentCC.add("amjadicky@gmail.com"); vtm.setTo(toSend.toArray(new String[toSend.size()])); vtm.setCc(toSentCC.toArray(new String[toSentCC.size()])); vtm.setBcc(toSentBCC.toArray(new String[toSentBCC.size()])); Map maptoSend = new HashMap(); if (StringUtils.equals(locale, "en")) { //not yet implemented } else { if (Objects.equals(appActivity.getApprovalStatus(), HRMConstant.APPROVAL_STATUS_WAITING_APPROVAL)) { //configure email parameter based on approval name switch (appActivity.getApprovalDefinition().getName()) { case HRMConstant.VACANCY_ADVERTISEMENT: List<VacancyAdvertisementDetailModel> listAdvertisementDetail = gsonDateSerializer.fromJson( jsonObject.get("listAdvertisementDetail").getAsString(), new TypeToken<List<VacancyAdvertisementDetailModel>>() { }.getType()); vtm.setSubject("Pengajuan Iklan Lowongan"); vtm.setTemplatePath("email_vacancy_advertisement_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("effectiveDate", jsonObject.get("effectiveDate").getAsString()); maptoSend.put("advertisementMediaName", jsonObject.get("advertisementMediaName").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("listAdvertisementDetail", listAdvertisementDetail); maptoSend.put("dateTool", new DateTool()); maptoSend.put("numTool", new NumberTool()); maptoSend.put("locale", new Locale(locale)); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: List<WtEmpCorrectionAttendanceDetail> listCorrectionAttendance = gsonDateSerializer .fromJson(jsonObject.get("listCorrectionAttendance").getAsString(), new TypeToken<List<WtEmpCorrectionAttendanceDetail>>() { }.getType()); vtm.setTemplatePath("email_correction_attendance_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("listCorrectionAttendance", listCorrectionAttendance); maptoSend.put("dateTool", new DateTool()); maptoSend.put("locale", new Locale(locale)); break; case HRMConstant.BUSINESS_TRAVEL: vtm.setSubject("Permohonan Perjalanan Dinas"); vtm.setTemplatePath("email_travel_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("businessTravelNo", jsonObject.get("businessTravelNo").getAsString()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("destination", jsonObject.get("destination").getAsString()); maptoSend.put("start", jsonObject.get("startDate").getAsString()); maptoSend.put("end", jsonObject.get("endDate").getAsString()); maptoSend.put("description", jsonObject.get("description").getAsString()); maptoSend.put("totalAmount", jsonObject.get("totalAmount").getAsString()); maptoSend.put("deadline", jsonObject.get("deadline").getAsString()); break; case HRMConstant.REIMBURSEMENT: vtm.setSubject("Permohonan Penggantian Biaya"); vtm.setTemplatePath("email_reimbursment_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("reimbursementType", jsonObject.get("reimbursementType").getAsString()); maptoSend.put("applicationDate", jsonObject.get("applicationDate").getAsString()); maptoSend.put("nominal", jsonObject.get("nominal").getAsString()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("deadline", jsonObject.get("deadline").getAsString()); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: vtm.setSubject("Permohonan Pencairan Penggantian Biaya"); vtm.setTemplatePath("email_rmbs_disbursement_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("deadline", jsonObject.get("deadline").getAsString()); break; case HRMConstant.LOAN: vtm.setSubject("Permohonan Pinjaman Lunak"); vtm.setTemplatePath("email_loan_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("loanSchemaName", jsonObject.get("loanSchemaName").getAsString()); maptoSend.put("nominalPrincipal", jsonObject.get("nominalPrincipal").getAsString()); maptoSend.put("interestRate", jsonObject.get("interestRate").getAsString()); maptoSend.put("nominalInstallment", jsonObject.get("nominalInstallment").getAsString()); maptoSend.put("interestInstallment", jsonObject.get("interestInstallment").getAsString()); maptoSend.put("totalNominalInstallment", jsonObject.get("totalNominalInstallment").getAsString()); break; case HRMConstant.SHIFT_SCHEDULE: vtm.setSubject("Permohonan Perubahan Jadwal Kerja Karyawan"); vtm.setTemplatePath("email_shift_schedule_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("jabatan", requesterUser.getEmpData().getJabatanByJabatanId().getName()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); break; case HRMConstant.LEAVE: vtm.setSubject("Permohonan Cuti"); vtm.setTemplatePath("email_leave_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("leaveName", jsonObject.get("leaveName").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("fillingDate", jsonObject.get("fillingDate").getAsString()); maptoSend.put("materialJobsAbandoned", jsonObject.get("materialJobsAbandoned").getAsString()); break; case HRMConstant.LEAVE_CANCELLATION: vtm.setSubject("Permohonan Pembatalan Cuti"); vtm.setTemplatePath("email_leave_cancellation_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("leaveName", jsonObject.get("leaveName").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("fillingDate", jsonObject.get("fillingDate").getAsString()); maptoSend.put("materialJobsAbandoned", jsonObject.get("materialJobsAbandoned").getAsString()); maptoSend.put("cancellationDate", jsonObject.get("cancellationDate").getAsString()); break; case HRMConstant.OVERTIME: vtm.setSubject("Permohonan Lembur"); vtm.setTemplatePath("email_overtime_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("overTimeName", jsonObject.get("overTimeName").getAsString()); maptoSend.put("hour", jsonObject.get("hour").getAsString()); maptoSend.put("minute", jsonObject.get("minute").getAsString()); maptoSend.put("overTimeDate", jsonObject.get("overTimeDate").getAsString()); maptoSend.put("implementationNumber", jsonObject.get("implementationNumber").getAsString()); break; case HRMConstant.ANNOUNCEMENT: TypeToken<List<String>> token = new TypeToken<List<String>>() { }; List<String> dataGolonganJabatan = gson.fromJson(jsonObject.get("listGolonganJabatan"), token.getType()); List<String> dataUnitKerja = gson.fromJson(jsonObject.get("listUnitKerja"), token.getType()); List<String> dataEmployeeType = gson.fromJson(jsonObject.get("listEmployeeType"), token.getType()); vtm.setSubject("Pengajuan Pengumuman"); vtm.setTemplatePath("email_announcement_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("subjek", jsonObject.get("subjek").getAsString()); maptoSend.put("content", jsonObject.get("content").getAsString()); maptoSend.put("company", jsonObject.get("company").getAsString()); maptoSend.put("listEmployeeType", dataEmployeeType); maptoSend.put("listUnitKerja", dataUnitKerja); maptoSend.put("listGolonganJabatan", dataGolonganJabatan); break; case HRMConstant.PERMIT: vtm.setSubject("Permohonan Izin"); vtm.setTemplatePath("email_permit_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("permitClassification", jsonObject.get("permitClassification").getAsString()); break; case HRMConstant.RECRUITMENT_REQUEST: vtm.setSubject("PENGAJUAN PERMINTAAN TENAGA KERJA"); vtm.setTemplatePath("email_recruitment_request_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("periodeStart", jsonObject.get("periodeStart").getAsString()); maptoSend.put("periodeEnd", jsonObject.get("periodeEnd").getAsString()); maptoSend.put("jabatan", jsonObject.get("jabatan").getAsString()); maptoSend.put("mppName", jsonObject.get("mppName").getAsString()); maptoSend.put("salaryMin", jsonObject.get("salaryMin").getAsString()); maptoSend.put("salaryMax", jsonObject.get("salaryMax").getAsString()); maptoSend.put("candidateCountRequest", jsonObject.get("candidateCountRequest").getAsString()); break; case HRMConstant.RECRUIT_MPP_APPLY: TypeToken<List<String>> token2 = new TypeToken<List<String>>() { }; List<String> listNamaJabatan = gson.fromJson(jsonObject.get("listNamaJabatan"), token2.getType()); vtm.setSubject("PERSETUJUAN RENCANA KETENAGAKERJAAN"); vtm.setTemplatePath("email_mpp_apply_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("recruitMppApplyName", jsonObject.get("recruitMppApplyName").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("listNamaJabatan", listNamaJabatan); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: vtm.setSubject("Pengajuan Transisi Karir"); vtm.setTemplatePath("email_career_transition_waiting_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("beforeNik", jsonObject.get("beforeNik").getAsString()); maptoSend.put("beforeJoinDate", jsonObject.get("beforeJoinDate").getAsString()); maptoSend.put("beforeEmployeeType", jsonObject.get("beforeEmployeeType").getAsString()); maptoSend.put("beforeJabatan", jsonObject.get("beforeJabatan").getAsString()); maptoSend.put("beforeDepartment", jsonObject.get("beforeDepartment").getAsString()); maptoSend.put("afterNik", jsonObject.get("afterNik").getAsString()); maptoSend.put("afterJoinDate", jsonObject.get("afterJoinDate").getAsString()); maptoSend.put("afterEmployeeType", jsonObject.get("afterEmployeeType").getAsString()); maptoSend.put("afterJabatan", jsonObject.get("afterJabatan").getAsString()); maptoSend.put("afterDepartment", jsonObject.get("afterDepartment").getAsString()); break; default: break; } } else if ((appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_APPROVED) || (appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_REJECTED)) { //configure email parameter based on approval name switch (appActivity.getApprovalDefinition().getName()) { case HRMConstant.VACANCY_ADVERTISEMENT: List<VacancyAdvertisementDetailModel> listAdvertisementDetail = gsonDateSerializer.fromJson( jsonObject.get("listAdvertisementDetail").getAsString(), new TypeToken<List<VacancyAdvertisementDetailModel>>() { }.getType()); vtm.setSubject("Pengajuan Iklan Lowongan"); vtm.setTemplatePath("email_vacancy_advertisement_approved_or_rejected.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("effectiveDate", jsonObject.get("effectiveDate").getAsString()); maptoSend.put("advertisementMediaName", jsonObject.get("advertisementMediaName").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("listAdvertisementDetail", listAdvertisementDetail); maptoSend.put("dateTool", new DateTool()); maptoSend.put("numTool", new NumberTool()); maptoSend.put("locale", new Locale(locale)); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.EMP_CORRECTION_ATTENDANCE: List<WtEmpCorrectionAttendanceDetail> listCorrectionAttendance = gsonDateSerializer .fromJson(jsonObject.get("listCorrectionAttendance").getAsString(), new TypeToken<List<WtEmpCorrectionAttendanceDetail>>() { }.getType()); vtm.setSubject("Pengajuan Koreksi Kehadiran"); vtm.setTemplatePath("email_correction_attendance_approved_or_rejected.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("listCorrectionAttendance", listCorrectionAttendance); maptoSend.put("dateTool", new DateTool()); maptoSend.put("locale", new Locale(locale)); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.BUSINESS_TRAVEL: vtm.setSubject("Permohonan Perjalanan Dinas"); vtm.setTemplatePath("email_travel_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("businessTravelNo", jsonObject.get("businessTravelNo").getAsString()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("destination", jsonObject.get("destination").getAsString()); maptoSend.put("start", jsonObject.get("startDate").getAsString()); maptoSend.put("end", jsonObject.get("endDate").getAsString()); maptoSend.put("description", jsonObject.get("description").getAsString()); maptoSend.put("totalAmount", jsonObject.get("totalAmount").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.REIMBURSEMENT: vtm.setSubject("Permohonan Pergantian Biaya"); vtm.setTemplatePath("email_reimbursment_approved_or_rejected.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("reimbursementType", jsonObject.get("reimbursementType").getAsString()); maptoSend.put("applicationDate", jsonObject.get("applicationDate").getAsString()); maptoSend.put("nominal", jsonObject.get("nominal").getAsString()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.REIMBURSEMENT_DISBURSEMENT: vtm.setSubject("Permohonan Pencairan Pergantian Biaya"); vtm.setTemplatePath("email_rmbs_disbursement_approved_or_rejected.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.LOAN: vtm.setSubject("Permohonan Pinjaman Lunak"); vtm.setTemplatePath("email_loan_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("loanSchemaName", jsonObject.get("loanSchemaName").getAsString()); maptoSend.put("nominalPrincipal", jsonObject.get("nominalPrincipal").getAsString()); maptoSend.put("interestRate", jsonObject.get("interestRate").getAsString()); maptoSend.put("nominalInstallment", jsonObject.get("nominalInstallment").getAsString()); maptoSend.put("interestInstallment", jsonObject.get("interestInstallment").getAsString()); maptoSend.put("totalNominalInstallment", jsonObject.get("totalNominalInstallment").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.SHIFT_SCHEDULE: vtm.setSubject("Permohonan Perubahan Jadwal Kerja Karyawan"); vtm.setTemplatePath("email_shift_schedule_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.LEAVE: vtm.setSubject("Permohonan Cuti"); vtm.setTemplatePath("email_leave_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("leaveName", jsonObject.get("leaveName").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("fillingDate", jsonObject.get("fillingDate").getAsString()); maptoSend.put("materialJobsAbandoned", jsonObject.get("materialJobsAbandoned").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.LEAVE_CANCELLATION: vtm.setSubject("Permohonan Pembatalan Cuti"); vtm.setTemplatePath("email_leave_cancellation_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("leaveName", jsonObject.get("leaveName").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("fillingDate", jsonObject.get("fillingDate").getAsString()); maptoSend.put("materialJobsAbandoned", jsonObject.get("materialJobsAbandoned").getAsString()); maptoSend.put("cancellationDate", jsonObject.get("cancellationDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.OVERTIME: vtm.setSubject("Permohonan Lembur"); vtm.setTemplatePath("email_overtime_approved_or_rejected_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("overTimeName", jsonObject.get("overTimeName").getAsString()); maptoSend.put("hour", jsonObject.get("hour").getAsString()); maptoSend.put("minute", jsonObject.get("minute").getAsString()); maptoSend.put("overTimeDate", jsonObject.get("overTimeDate").getAsString()); maptoSend.put("implementationNumber", jsonObject.get("implementationNumber").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.ANNOUNCEMENT: TypeToken<List<String>> token = new TypeToken<List<String>>() { }; List<String> dataGolonganJabatan = gson.fromJson(jsonObject.get("listGolonganJabatan"), token.getType()); List<String> dataUnitKerja = gson.fromJson(jsonObject.get("listUnitKerja"), token.getType()); List<String> dataEmployeeType = gson.fromJson(jsonObject.get("listEmployeeType"), token.getType()); vtm.setSubject("Pengajuan Pengumuman"); vtm.setTemplatePath("email_announcement_approved_or_rejected_approval.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); maptoSend.put("subjek", jsonObject.get("subjek").getAsString()); maptoSend.put("content", jsonObject.get("content").getAsString()); maptoSend.put("company", jsonObject.get("company").getAsString()); maptoSend.put("listEmployeeType", dataEmployeeType); maptoSend.put("listUnitKerja", dataUnitKerja); maptoSend.put("listGolonganJabatan", dataGolonganJabatan); break; case HRMConstant.PERMIT: vtm.setSubject("Permohonan Izin"); vtm.setTemplatePath("email_permit_approved_and_rejected_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("permitClassification", jsonObject.get("permitClassification").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.RECRUITMENT_REQUEST: vtm.setSubject("PERSETUJUAN PERMINTAAN TENAGA KERJA"); vtm.setTemplatePath("email_recruitment_request_approved_or_reject_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("periodeStart", jsonObject.get("periodeStart").getAsString()); maptoSend.put("periodeEnd", jsonObject.get("periodeEnd").getAsString()); maptoSend.put("jabatan", jsonObject.get("jabatan").getAsString()); maptoSend.put("mppName", jsonObject.get("mppName").getAsString()); maptoSend.put("salaryMin", jsonObject.get("salaryMin").getAsString()); maptoSend.put("salaryMax", jsonObject.get("salaryMax").getAsString()); maptoSend.put("candidateCountRequest", jsonObject.get("candidateCountRequest").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.RECRUIT_MPP_APPLY: TypeToken<List<String>> tokens = new TypeToken<List<String>>() { }; List<String> listNamaJabatan = gson.fromJson(jsonObject.get("listNamaJabatan"), tokens.getType()); vtm.setSubject("PERSETUJUAN RENCANA KETENAGAKERJAAN"); vtm.setTemplatePath("email_mpp_apply_approved_or_rejected_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("recruitMppApplyName", jsonObject.get("recruitMppApplyName").getAsString()); maptoSend.put("applyDate", jsonObject.get("applyDate").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("listNamaJabatan", listNamaJabatan); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.EMPLOYEE_CAREER_TRANSITION: vtm.setSubject("Pengajuan Transisi Karir"); if (appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_APPROVED) { vtm.setTemplatePath("email_career_transition_approved.vm"); maptoSend.put("employeeName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("effectiveDate", jsonObject.get("effectiveDate").getAsString()); maptoSend.put("beforeNik", jsonObject.get("beforeNik").getAsString()); maptoSend.put("beforeJoinDate", jsonObject.get("beforeJoinDate").getAsString()); maptoSend.put("beforeEmployeeType", jsonObject.get("beforeEmployeeType").getAsString()); maptoSend.put("beforeJabatan", jsonObject.get("beforeJabatan").getAsString()); maptoSend.put("beforeDepartment", jsonObject.get("beforeDepartment").getAsString()); maptoSend.put("afterNik", jsonObject.get("afterNik").getAsString()); maptoSend.put("afterJoinDate", jsonObject.get("afterJoinDate").getAsString()); maptoSend.put("afterEmployeeType", jsonObject.get("afterEmployeeType").getAsString()); maptoSend.put("afterJabatan", jsonObject.get("afterJabatan").getAsString()); maptoSend.put("afterDepartment", jsonObject.get("afterDepartment").getAsString()); } else { vtm.setTemplatePath("email_career_transition_rejected.vm"); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("beforeNik", jsonObject.get("beforeNik").getAsString()); maptoSend.put("beforeJoinDate", jsonObject.get("beforeJoinDate").getAsString()); maptoSend.put("beforeEmployeeType", jsonObject.get("beforeEmployeeType").getAsString()); maptoSend.put("beforeJabatan", jsonObject.get("beforeJabatan").getAsString()); maptoSend.put("beforeDepartment", jsonObject.get("beforeDepartment").getAsString()); maptoSend.put("afterNik", jsonObject.get("afterNik").getAsString()); maptoSend.put("afterJoinDate", jsonObject.get("afterJoinDate").getAsString()); maptoSend.put("afterEmployeeType", jsonObject.get("afterEmployeeType").getAsString()); maptoSend.put("afterJabatan", jsonObject.get("afterJabatan").getAsString()); maptoSend.put("afterDepartment", jsonObject.get("afterDepartment").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); } break; default: break; } } else if ((appActivity.getApprovalStatus() == HRMConstant.APPROVAL_STATUS_CANCELLED)) { //configure email parameter based on approval name switch (appActivity.getApprovalDefinition().getName()) { case HRMConstant.BUSINESS_TRAVEL: vtm.setSubject("Permohonan Perjalanan Dinas"); vtm.setTemplatePath("email_travel_cancelled_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("businessTravelNo", jsonObject.get("businessTravelNo").getAsString()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("destination", jsonObject.get("destination").getAsString()); maptoSend.put("start", jsonObject.get("startDate").getAsString()); maptoSend.put("end", jsonObject.get("endDate").getAsString()); maptoSend.put("description", jsonObject.get("description").getAsString()); maptoSend.put("totalAmount", jsonObject.get("totalAmount").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.REIMBURSEMENT: vtm.setSubject("Permohonan Pergantian Biaya"); vtm.setTemplatePath("email_reimbursment_cancelled.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("reimbursementType", jsonObject.get("reimbursementType").getAsString()); maptoSend.put("applicationDate", jsonObject.get("applicationDate").getAsString()); maptoSend.put("nominal", jsonObject.get("nominal").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.LOAN: vtm.setSubject("Permohonan Pinjaman Lunak"); vtm.setTemplatePath("email_loan_cancelled_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("loanSchemaName", jsonObject.get("loanSchemaName").getAsString()); maptoSend.put("nominalPrincipal", jsonObject.get("nominalPrincipal").getAsString()); maptoSend.put("interestRate", jsonObject.get("interestRate").getAsString()); maptoSend.put("nominalInstallment", jsonObject.get("nominalInstallment").getAsString()); maptoSend.put("interestInstallment", jsonObject.get("interestInstallment").getAsString()); maptoSend.put("totalNominalInstallment", jsonObject.get("totalNominalInstallment").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.SHIFT_SCHEDULE: vtm.setSubject("Permohonan Perubahan Jadwal Kerja Karyawan"); vtm.setTemplatePath("email_shift_schedule_cancelled_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.LEAVE: vtm.setSubject("Permohonan Cuti"); vtm.setTemplatePath("email_leave_cancelled_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("leaveName", jsonObject.get("leaveName").getAsString()); maptoSend.put("startDate", jsonObject.get("startDate").getAsString()); maptoSend.put("endDate", jsonObject.get("endDate").getAsString()); maptoSend.put("fillingDate", jsonObject.get("fillingDate").getAsString()); maptoSend.put("materialJobsAbandoned", jsonObject.get("materialJobsAbandoned").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; case HRMConstant.OVERTIME: vtm.setSubject("Permohonan Lembur"); vtm.setTemplatePath("email_overtime_cancelled_approval.vm"); maptoSend.put("approverName", approverUser.getEmpData().getBioData().getFullName()); maptoSend.put("requesterName", requesterUser.getEmpData().getBioData().getFullName()); maptoSend.put("nik", requesterUser.getEmpData().getNik()); maptoSend.put("proposeDate", jsonObject.get("proposeDate").getAsString()); maptoSend.put("overTimeName", jsonObject.get("overTimeName").getAsString()); maptoSend.put("hour", jsonObject.get("hour").getAsString()); maptoSend.put("minute", jsonObject.get("minute").getAsString()); maptoSend.put("overTimeDate", jsonObject.get("overTimeDate").getAsString()); maptoSend.put("implementationNumber", jsonObject.get("implementationNumber").getAsString()); maptoSend.put("statusDesc", getStatusDesc(appActivity.getApprovalStatus(), locale)); break; default: break; } } if (jsonObject.get("urlLinkToApprove").getAsString() != null) { String urlLinkToApprove = serverName + "" + jsonObject.get("urlLinkToApprove").getAsString(); maptoSend.put("urlLinkToApprove", urlLinkToApprove); } else { maptoSend.put("urlLinkToApprove", applicationUrl); } maptoSend.put("ownerAdministrator", ownerAdministrator); maptoSend.put("ownerCompany", ownerCompany); maptoSend.put("applicationUrl", applicationUrl); maptoSend.put("applicationName", applicationName); velocityTemplateSender.sendMail(vtm, maptoSend); //update approval activity, set notification true if (appActivity.getNotificationSend() == false) { appActivity.setNotificationSend(true); this.approvalActivityDao.update(appActivity); } } } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(BioRelasiPerusahaan entity) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
From source file:com.inkubator.hrm.service.impl.LoanTypeServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(LoanType t) throws Exception { /*LoanType prevLoanType = loanTypeDao.getEntiyByPK(t.getId()); String prevLoanTypeCode = prevLoanType.getLoanTypeCode(); String prevLoanTypeName = prevLoanType.getLoanTypeName(); /*from www. j a v a 2s. c o m*/ if(!StringUtils.equals(prevLoanTypeCode, t.getLoanTypeCode())){ long totalLoanCodeDuplicates = loanTypeDao.getTotalByLoanTypeCode(t.getLoanTypeCode()); if (totalLoanCodeDuplicates > 0) { throw new BussinessException("loantype.error_duplicate_loan_type_code"); } } if(!StringUtils.equals(prevLoanTypeName, t.getLoanTypeName())){ long totalLoanNameDuplicates = loanTypeDao.getTotalByLoanTypeName(t.getLoanTypeName()); if(totalLoanNameDuplicates > 0){ throw new BussinessException("loantype.error_duplicate_loan_type_name"); } }*/ LoanType loanTypeUpdate = loanTypeDao.getEntiyByPK(t.getId()); loanTypeUpdate.setLoanTypeCode(t.getLoanTypeCode()); loanTypeUpdate.setLoanTypeName(t.getLoanTypeName()); loanTypeUpdate.setRoundingStatus(t.getRoundingStatus()); loanTypeUpdate.setInterest(t.getInterest()); loanTypeUpdate.setInterestMethod(t.getInterestMethod()); if (null != t.getCurrency()) { Currency currency = currencyDao.getEntiyByPK(t.getCurrency().getId()); loanTypeUpdate.setCurrency(currency); } loanTypeUpdate.setUpdatedBy(UserInfoUtil.getUserName()); loanTypeUpdate.setUpdatedOn(new Date()); loanTypeDao.saveAndMerge(loanTypeUpdate); }
From source file:com.inkubator.sms.gateway.service.impl.UserServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(SmsGatewayUser entity) throws Exception { SmsGatewayUser update = userDao.getEntiyByPK(entity.getId()); update.getUserRoles().clear();//from w ww .j a v a2 s.c o m update.setRealName(entity.getRealName()); update.setUserId(entity.getUserId()); update.setPhoneNumber(entity.getPhoneNumber()); update.setEmailAddress(entity.getEmailAddress()); update.setIsActive(entity.getIsActive()); update.setIsExpired(entity.getIsExpired()); update.setIsLock(entity.getIsLock()); userDao.saveAndMerge(update); Set<UserRole> dataToSave = entity.getUserRoles(); for (UserRole userRole : dataToSave) { userRole.setUser(update); this.userRoleDao.save(userRole); } }
From source file:com.inkubator.hrm.service.impl.MecineFingerServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(MecineFinger entity) throws Exception { // check duplicate name long totalDuplicates = mecineFingerDao.getTotalByCodeAndNotId(entity.getCode(), entity.getId()); if (totalDuplicates > 0) { throw new BussinessException("mecinefinger.error_duplicate_mecinefinger_code"); }/*from ww w . jav a2 s. c om*/ MecineFinger update = mecineFingerDao.getEntiyByPK(entity.getId()); update.setName(entity.getName()); update.setCode(entity.getCode()); update.setDescription(entity.getDescription()); update.setMecineMethode(entity.getMecineMethode()); update.setUpdatedBy(UserInfoUtil.getUserName()); update.setUpdatedOn(new Date()); this.mecineFingerDao.update(update); }