public Object executeTask(Object object) throws Exception { StringBuffer query = new StringBuffer(); Object result = null; Map incomingRequest = (Map) object; try { DBSession dbs = (DBSession) incomingRequest.get("dbsession"); BrowseObject b = (BrowseObject) incomingRequest.get("browseObject"); String organizationId = (String) incomingRequest.get("organizationId"); String userTimeZone = (String) incomingRequest.get("userTimeZone"); String userDateFormat = (String) incomingRequest.get("userDateFormat"); String sqlWhere = (String) incomingRequest.get("sqlWhere"); List dateArguments = new ArrayList(); if (Utility.isEmpty(userDateFormat)) { userDateFormat = PropertiesManager.getInstance(organizationId) .getProperty("MISC", "DATEFORMAT", "MM-dd-yyyy"); } sqlWhere = ReportDates.dateWhereClauseDecoder( sqlWhere, dateArguments, organizationId, userTimeZone, userDateFormat); if (Utility.isEmpty(sqlWhere)) { sqlWhere = ""; } String sqlSelect = b.getSqlSelect(); query.append(sqlSelect); query.append(" from " + b.getSqlFrom()); query.append(" " + sqlWhere); Log.debug(this, incomingRequest.get("userId") + " - query: " + query.toString()); long start = System.currentTimeMillis(); System.out.println("Report Query: " + query.toString()); List list = dbs.query(query.toString(), dateArguments.toArray(), b.getMaxRows()); long end = System.currentTimeMillis(); Log.error( this, "It took " + ((end - start) / 1000) + " seconds to execute the query: " + query.toString()); Log.debug(this, incomingRequest.get("userId") + " - dbs.query COMPLETE."); result = list; this.setStatus(dbs.getStatus()); } catch (Exception e) { incomingRequest.put("failed", Boolean.TRUE); Log.error( this, "Error executing Report Query: " + query.toString() + " -Exception: " + e.getMessage()); e.printStackTrace(); this.setStatus(Status.FAILED); } return result; }
/** * @param content * @param from * @param subject * @param organizationId */ private void handleStringContent(String content) { Log.debug(this, "handleStringContent"); try { this.bodytext.append(content); Log.debug(this, content); } catch (Exception e) { // TODO: handle exception } }
public void handleMessage(Message message, String contentType) throws IOException, MessagingException { Log.debug(this, "handleMessage"); Object objContent = message.getContent(); if (objContent instanceof Multipart) { Log.debug(this, "handleMessage-multipart"); Multipart multipart = (Multipart) message.getContent(); this.handleContent(multipart, contentType); } else { Log.debug(this, "handleMessage-string"); this.handleStringContent((String) objContent); } }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; try { String newStatus = (String) incomingRequest.get("newStatus"); if (Utility.isEmpty(newStatus)) { newStatus = DocumentStatus.PO_AWARDED; } PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader"); List poLineList = (List) incomingRequest.get("poLineList"); poHeader.setStatus(newStatus); Log.debug(this, poHeader.getDisplayPoNumber().toString() + " newStatus is: " + newStatus); for (int i = 0; i < poLineList.size(); i++) { PoLine poLine = (PoLine) poLineList.get(i); if (!poLine.getStatus().equals(DocumentStatus.CLOSED) || !poLine.getStatus().equals(DocumentStatus.CANCELLED)) { poLine.setStatus(newStatus); } } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw new TsaException("An Error ocurred closing order ", e); } return null; }
public void getReqLinesToExecute() { Log.debug(this, "Retrieve list of POs with status Order Pending from Change Request."); try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(this.getOrganizationId()); PuridiomProcess process = processLoader.loadProcess("poheader-retrieve-for-autoaward-revision.xml"); Map incomingRequest = new HashMap(); incomingRequest.put("organizationId", this.getOrganizationId()); incomingRequest.put("autoAwardRevision", "true"); process.executeProcess(incomingRequest); } catch (Exception e) { Log.error(this, "getPosToExecute failed: " + e.getMessage()); // TODO NOTIFY SOMEBODY } }
/** @param multipart */ private void handleContent(Multipart multipart, String contentType) { Log.debug(this, "handleContent"); try { // String contentType=multipart.getContentType(); for (int j = 0; j < multipart.getCount(); j++) { Part part = multipart.getBodyPart(j); Log.debug(this, String.valueOf(part.getLineCount())); Log.debug(this, String.valueOf(part.getContent())); Log.debug(this, String.valueOf(part.getContentType())); if (HiltonUtility.isEmpty(contentType) || part.getContentType().indexOf(contentType) >= 0) { String disposition = part.getDisposition(); Log.debug(this, "handleContent-disposition: " + disposition); // if (disposition != null) // { InputStream inputStream = part.getInputStream(); byte[] buffer = new byte[inputStream.available()]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) > -1) // Read // bytes // until // EOF { Log.debug(this, "reading contents"); } String tmp = new String(buffer); this.bodytext.append(tmp); this.bodytext.append("\r\n"); Log.debug(this, "handleContent: " + tmp); if (inputStream != null) { try { inputStream.close(); } catch (IOException io) { Log.error(this, " error Closing InputStream" + io.getMessage()); io.printStackTrace(); } } } } // } } catch (Exception e) { Log.error(this, e.getMessage()); e.printStackTrace(); } }
public Object executeTask(Object object) throws Exception { Log.debug(this, "execute Task"); Object ret = null; try { Map incomingRequest = (Map) object; PoHeader blanket = (PoHeader) incomingRequest.get("blanket"); if (blanket == null) { this.setStatus(Status.FAILED); throw new TsaException("Blanket Order was not Found."); } PoHeader newPoHeader = (PoHeader) incomingRequest.get("poHeader"); if (newPoHeader == null) { this.setStatus(Status.FAILED); throw new TsaException("Release Order was not Found."); } RequisitionHeader requisitionHeader = (RequisitionHeader) incomingRequest.get("requisitionHeader"); if (requisitionHeader == null) { this.setStatus(Status.FAILED); throw new TsaException("Requisition was not Found!."); } if (blanket.getTaxCode().equals("SHIPTO")) { newPoHeader.setTaxCode(requisitionHeader.getShipToAddress().getAddrFld10()); } incomingRequest.put("poHeader", newPoHeader); this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw new TsaException("No currency Code found!"); } return ret; }
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String requestURI = request.getRequestURI(); ApprovalLink approvalLink = new ApprovalLink(); String approvalLinkURL = requestURI.substring(requestURI.lastIndexOf("/") + 1, requestURI.length()); String[] approvalLinkData = this.getIcApprovalLink(approvalLinkURL); String message = ""; response.setContentType("text/plain"); try { approvalLink = this.retrieveApprovalLink(approvalLinkData[0], approvalLinkData[1]); message = this.acknowledgedReceipt(approvalLink, approvalLinkData[1]); message += "Thank you"; out.println(message); Log.debug( this, "Receipt Acknowledgement (ApprovalLink = " + approvalLink.getIcApprovalLink() + ") was processing successfully"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); Log.error( this, "Error processing Receipt Acknowledgement (ApprovalLink = " + approvalLink.getIcApprovalLink() + ") : " + e.getMessage()); } out.close(); }
/* (non-Javadoc) * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object) */ public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { String organizationId = (String) incomingRequest.get("organizationId"); String userTimeZone = (String) incomingRequest.get("userTimeZone"); String userDateFormat = (String) incomingRequest.get("userDateFormat"); if (HiltonUtility.isEmpty(userDateFormat)) { userDateFormat = PropertiesManager.getInstance(organizationId) .getProperty("MISC", "DATEFORMAT", "MM-dd-yyyy"); } String today = Dates.today(userDateFormat, userTimeZone); if (incomingRequest.containsKey("PoLine_catalogId") && incomingRequest.containsKey("PoLine_itemNumber")) { String catalogId = (String) incomingRequest.get("PoLine_catalogId"); String itemNumber = (String) incomingRequest.get("PoLine_itemNumber"); if (!HiltonUtility.isEmpty(catalogId) && !HiltonUtility.isEmpty(itemNumber)) { BigDecimal leadDays = CatalogItemManager.getInstance().getLeadDays(organizationId, catalogId, itemNumber); incomingRequest.put("PoLine_poPromised", Dates.add(today, leadDays.intValue())); } } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { Log.debug(this, e.getMessage()); e.printStackTrace(); throw e; } return result; }
public Object executeTask(Object object) throws Exception { List result; try { Map incomingRequest = (Map) object; DBSession dbs = (DBSession) incomingRequest.get("dbsession"); String o = (String) incomingRequest.get("organizationId"); String userId = (String) incomingRequest.get("userId"); String userDateFormat = (String) incomingRequest.get("userDateFormat"); BrowseObject b = (BrowseObject) incomingRequest.get("browseObject"); List groupFilters = b.getGroupFilters(); List groupFilterOptions = new ArrayList(); List commodities = new ArrayList(); // boolean unspscCommodities = PropertiesManager.getInstance(o).getProperty("MISC", // "CommodityType", "").equalsIgnoreCase("UNSPSC"); boolean unspscCommodities = false; boolean commoditySet = false; PropertiesManager propertiesManager = PropertiesManager.getInstance(o); if (Utility.isEmpty(userDateFormat)) { userDateFormat = propertiesManager.getProperty("MISC", "DateFormat", "MM-dd-yyyy"); } for (int ix = 0; ix < groupFilters.size(); ix++) { BrowseGroupFilter gf = (BrowseGroupFilter) groupFilters.get(ix); StringBuffer query = new StringBuffer(); StringBuffer queryFilter = new StringBuffer(); if (!Utility.isEmpty(gf.getType()) && gf.getType().equals("CostRange")) { incomingRequest.put("CostRange_itemType", incomingRequest.get("as_item_type")); } List dateArguments = new ArrayList(); if (Utility.isEmpty(gf.getType()) || !gf.getType().equals("Keywords")) { query.append(gf.getSqlSelect() + " from " + gf.getSqlFrom() + " where 1 = 1"); if (Utility.ckNull(gf.getSqlWhere()).length() > 0) { query.append(" and ( " + gf.getSqlWhere() + ")"); } if (Utility.ckNull(b.getSqlWhere()).length() > 0) { String sqlWhere = b.getSqlWhere(); sqlWhere = sqlWhere.replaceAll(":as_userid", "'" + userId + "'"); if (sqlWhere.indexOf(":as_today") > 0) { dateArguments.add( Dates.getDate( Dates.today(userDateFormat, (String) incomingRequest.get("userTimeZone")))); } sqlWhere = sqlWhere.replaceAll(":as_today", "?"); query.append(" and ( " + sqlWhere + ")"); } List filters = b.getBrowseFilters(); if (filters != null) { for (int i = 0; i < filters.size(); i++) { BrowseFilter filter = (BrowseFilter) filters.get(i); String key = filter.getColumnName(); if (!b.validateColumn(key)) { // skip this filter continue; } String value = encoder.encodeForSQL(new OracleCodec(), filter.getValue()); String operator = filter.getOperator(); String logicalOperator = filter.getLogicalOperator(); if (!BrowseValidationUtility.permissibleOperators.contains(operator)) { operator = "="; } if (!BrowseValidationUtility.permissibleLogicalOperators.contains(logicalOperator)) { logicalOperator = "AND"; } String type = filter.getType(); if (!Utility.isEmpty(value)) { if (Utility.isEmpty(operator)) { operator = "="; } if (Utility.isEmpty(logicalOperator)) { logicalOperator = "AND"; } if (Utility.isEmpty(type)) { type = "STRING"; } if (queryFilter.length() > 0) { queryFilter.append(" " + logicalOperator + " "); } if (type.equalsIgnoreCase("DATE")) { dateArguments.add(Dates.getDate(userDateFormat, value)); queryFilter.append(" " + key + " " + operator + " ?"); } else if (operator.equalsIgnoreCase("LIKE")) { queryFilter.append(" UPPER(" + key + ") " + operator + " '" + value + "'"); } else { queryFilter.append(" " + key + " " + operator + " '" + value + "'"); } if (key.indexOf(".commodity") > 0) { if (!Utility.isEmpty(value)) { commoditySet = true; if (value.indexOf("%") > 0) { String commodity = "00000000"; for (int iv = 0; iv < value.length(); iv++) { char temp = value.charAt(iv); if (temp != '%') { if (iv == 0) { commodity = temp + commodity.substring(iv + 1); } else if (commodity.length() >= (iv + 1)) { commodity = commodity.substring(0, iv) + temp + commodity.substring(iv + 1); } else { commodity = commodity.substring(0, iv) + temp; } } } if (!commodities.contains(commodity)) { commodities.add(commodity); } } } } } } } if (queryFilter.length() > 0) { query.append("AND (" + queryFilter + " )"); } if (gf.getType().equalsIgnoreCase("Commodity") && unspscCommodities) { String originalQueryString = query.toString(); List commodityList = null; CommodityGetUNSPSCWhereClause commodityWhere = new CommodityGetUNSPSCWhereClause(); int attempts = 0; while ((commodityList == null || commodityList.size() == 0) && attempts <= 3) { query = new StringBuffer(originalQueryString); String commodityArray[] = new String[commodities.size()]; commodities.toArray(commodityArray); incomingRequest.put("Commodity_commodity", commodityArray); incomingRequest.put("retrieveAllCodes", "N"); if (attempts > 0) { incomingRequest.put("retrieveAllFamilies", "Y"); if (attempts > 1) { incomingRequest.put("retrieveAllGroups", "Y"); if (attempts > 2) { incomingRequest.put("retrieveAllCommodities", "Y"); } } } String unspscWhere = (String) commodityWhere.executeTask(incomingRequest); if (!Utility.isEmpty(unspscWhere)) { query.append(" AND (" + unspscWhere + ")"); } if (!Utility.isEmpty(gf.getSqlGroupBy())) { query.append(" group by " + gf.getSqlGroupBy()); } if (!Utility.isEmpty(gf.getSqlOrderBy())) { query.append(" order by " + gf.getSqlOrderBy()); } Log.debug(this, "group filter query: " + query.toString()); Object arguments[] = new Object[dateArguments.size()]; for (int i = 0; i < dateArguments.size(); i++) { arguments[i] = dateArguments.get(i); } commodityList = dbs.query(query.toString(), arguments); attempts++; } gf.setSelectionValues(commodityList); } else { if (!Utility.isEmpty(gf.getSqlGroupBy())) { query.append(" group by " + gf.getSqlGroupBy()); } if (!Utility.isEmpty(gf.getSqlOrderBy())) { query.append(" order by " + gf.getSqlOrderBy()); } Log.debug(this, "group filter query: " + query.toString()); Object arguments[] = new Object[dateArguments.size()]; for (int i = 0; i < dateArguments.size(); i++) { arguments[i] = dateArguments.get(i); } List list = dbs.query(query.toString(), arguments); gf.setSelectionValues(list); } } } result = groupFilters; this.setStatus(dbs.getStatus()); } catch (Exception e) { e.printStackTrace(); throw e; } return result; }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { String organizationId = (String) incomingRequest.get("organizationId"); String backupApproverAction = (String) incomingRequest.get("backupApproverAction"); RequisitionHeader rqh = (RequisitionHeader) incomingRequest.get("requisitionHeader"); if (rqh == null) { this.setStatus(Status.FAILED); throw new TsaException(this.getName() + " RequisitionHeader was not found!"); } String requisitionNumber = rqh.getRequisitionNumber(); if (requisitionNumber == null) { this.setStatus(Status.FAILED); throw new TsaException(this.getName() + " RequisitionNumber was not found!"); } ApprovalLog approvalLog = (ApprovalLog) incomingRequest.get("approver"); if (approvalLog == null) { this.setStatus(Status.FAILED); throw new TsaException( this.getName() + " ApprovalLog record was not found. Email record cannot be written to notify the initial approver that the requisition has been approved by the backup approver!"); } String backupApprover = approvalLog.getBackupApprover(); String currentApprover = approvalLog.getCallForward(); if (Utility.isEmpty(backupApprover)) { // this.setStatus(Status.FAILED); // throw new TsaException(this.getName() + " BackupApprover was not found. Email record // cannot be written to notify the requisitioner that the requisition has been approved by // the backup approver!"); } if (Utility.isEmpty(currentApprover)) { this.setStatus(Status.FAILED); throw new TsaException( this.getName() + " CurrentApprover was not found. Email record cannot be written to notify the requisitioner that the requisition has been approved by the backup approver!"); } incomingRequest.put("SendQueue_doctype", "REQ"); incomingRequest.put( "SendQueue_docic", (String) incomingRequest.get("RequisitionHeader_icReqHeader")); if (!Utility.isEmpty(requisitionNumber)) { String owner = (String) incomingRequest.get("userId"); StringBuffer subject = new StringBuffer(""); subject.append( UserManager.getInstance().getUser(organizationId, backupApprover).getDisplayName()); subject.append(" has " + backupApproverAction + " Requisition "); subject.append(requisitionNumber); subject.append(" on your behalf. No action is required from you at this time."); incomingRequest.put("SendQueue_subject", subject.toString()); incomingRequest.put("SendQueue_sendfromtype", "E"); incomingRequest.put( "SendQueue_sendfrom", UserManager.getInstance().getUser(organizationId, owner).getMailId()); incomingRequest.put("SendQueue_sendtotype", "E"); incomingRequest.put( "SendQueue_sendto", UserManager.getInstance().getUser(organizationId, currentApprover).getMailId()); incomingRequest.put("SendQueue_action", EmailActionCodes.EMAIL); incomingRequest.put("SendQueue_messagetext", subject.toString()); incomingRequest.put("isRequisitionForwardApprovalProcess", "Y"); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("sendqueue-add.xml"); process.executeProcess(incomingRequest); this.status = process.getStatus(); } else { this.setStatus(Status.SUCCEEDED); Log.debug(this, "No record will be written for this Req: " + requisitionNumber); } } catch (Exception e) { this.status = Status.FAILED; throw e; } return result; }
public Object executeTask(Object object) throws Exception { Object ret = null; try { Map incomingRequest = (Map) object; boolean createReleaseFromReq = ((String) incomingRequest.get("createReleaseFromReq")).equals(String.valueOf(true)); List requisitionLineList = (List) incomingRequest.get("requisitionLineList"); List msgList = new ArrayList(); if (requisitionLineList.size() > 0) { // items to create release for String recalculate = (String) incomingRequest.get("recalculate"); if (recalculate == null) { recalculate = "N"; } List newReleases = new ArrayList(); RequisitionHeader rqh = (RequisitionHeader) incomingRequest.get("requisitionHeader"); PoHeader blanket = (PoHeader) incomingRequest.get("blanket"); Log.debug(this, "Release Request AutoRelease for req: " + rqh.getRequisitionNumber()); Log.debug(this, "Release Request AutoRelease for blanket: " + blanket.getPoNumber()); Log.debug(this, "AutoRelease recalculate: " + recalculate); Map newIncomingRequest = new HashMap(); newIncomingRequest.put("blanket", blanket); newIncomingRequest.put("requisitionHeader", rqh); newIncomingRequest.put("RequisitionHeader_icReqHeader", rqh.getIcReqHeader().toString()); newIncomingRequest.put("PoHeader_icPoHeader", blanket.getIcPoHeader().toString()); newIncomingRequest.put("requisitionLineList", requisitionLineList); newIncomingRequest.put("createReleaseFromReq", "true"); newIncomingRequest.put("Vendor_vendorId", blanket.getVendorId()); newIncomingRequest.put("recalculate", recalculate); newIncomingRequest.put("createdfrom", this.createdFrom()); newIncomingRequest.put("organizationId", incomingRequest.get("organizationId")); newIncomingRequest.put("userId", incomingRequest.get("userId")); newIncomingRequest.put("userTimeZone", incomingRequest.get("userTimeZone")); newIncomingRequest.put("dbsession", incomingRequest.get("dbsession")); newIncomingRequest.put("createReleaseFromReq", new Boolean(createReleaseFromReq)); newIncomingRequest.put("forwardallowed", new Boolean(createReleaseFromReq)); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("po-create-release-partial.xml"); process.executeProcess(newIncomingRequest); if (process.getStatus() != Status.SUCCEEDED) { msgList.add("Items " + requisitionLineList + " could not be placed on Order! "); } else { PoHeader poHeader = (PoHeader) newIncomingRequest.get("poHeader"); // msgList.add("Items " + requisitionLineList + " where Released on " + // OrderType.RELEASE_ORDER + // "# " + poHeader.getPoNumber() + "-" + // poHeader.getReleaseNumber().toString()); newReleases.add(poHeader); AutoReleasedItemsSummary autoReleasedItems = new AutoReleasedItemsSummary(rqh, requisitionLineList, poHeader); autoReleasedItems.setPoNumber(poHeader.getPoNumber()); autoReleasedItems.setReleaseNumber(poHeader.getReleaseNumber()); // autoReleasedItems.setRqSubType(rqh.getRqSubType()); autoReleasedItems.setRequisitionNumber(rqh.getRequisitionNumber()); autoReleasedItems.setReleaseOrder(poHeader); msgList.add(autoReleasedItems); incomingRequest.put("PoHeader_icPoHeader", poHeader.getIcPoHeader().toString()); } incomingRequest.put("releaseMessages", msgList); incomingRequest.put("poFromRelease", "Y"); incomingRequest.put("releases", newReleases); } else { // rest of items should go through normal process.????????? } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); } return super.executeTask(object); }
public BuyerGraphData() { Log.debug(this, "started"); }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { DBSession dbs = (DBSession) incomingRequest.get("dbsession"); InvoiceHeader invoiceHeader = (InvoiceHeader) incomingRequest.get("invoiceHeader"); BigDecimal icIvcHeader = invoiceHeader.getIcIvcHeader(); String newStatus = invoiceHeader.getStatus(); String invoiceUser = invoiceHeader.getEnteredBy(); // String buyerUser = invoiceHeader.getAssignedBuyer() ; /*String reqTotal = "$" + requisitionHeader.getTotal().toString() ;*/ String invoiceTotal = HiltonUtility.getCurrency( invoiceHeader.getInvoiceTotal(), invoiceHeader.getCurrencyCode(), (String) incomingRequest.get("organizationId"), true); if (invoiceTotal.indexOf("yen") > 0) { invoiceTotal = invoiceTotal.replaceAll(";", ""); invoiceTotal = invoiceTotal.replaceAll("¥", "¥"); } String purpose = invoiceHeader.getInvoiceDesc(); String nextUser = ""; String queryString = "select UserProfile.mailId from ApprovalLog as ApprovalLog, UserProfile as UserProfile where ApprovalLog.id.userId = UserProfile.userId and ApprovalLog.id.icHeader = ? and ApprovalLog.id.userId <> ? "; List resultList = dbs.query( queryString, new Object[] {icIvcHeader, invoiceUser}, new Type[] {Hibernate.BIG_DECIMAL, Hibernate.STRING}); if (resultList != null && resultList.size() > 0) { for (int x = 0; x < resultList.size(); x++) { nextUser += (String) resultList.get(x) + "; "; } } this.setStatus(dbs.getStatus()); nextUser += UserManager.getInstance() .getUser((String) incomingRequest.get("organizationId"), invoiceUser) .getMailId(); if (invoiceHeader == null) { this.setStatus(Status.FAILED); throw new TsaException(this.getName() + " Invoice could not be recalled!"); } Log.debug( this, "Writting send_queue record for invoice: " + invoiceHeader.getInvoiceNumber() + ", status " + newStatus); if (newStatus.equals(DocumentStatus.IVC_RECALLED) && !Utility.isEmpty(nextUser)) { String owner = (String) incomingRequest.get("userId"); StringBuffer subject = new StringBuffer("Invoice "); subject.append(invoiceHeader.getInvoiceNumber()); subject.append(" recalled"); StringBuffer message = new StringBuffer("Invoice "); message.append(invoiceHeader.getInvoiceNumber()); message.append( " was recalled by " + UserManager.getInstance() .getUser((String) incomingRequest.get("organizationId"), owner) .getDisplayName()); message.append(" on " + Dates.today("") + "\n\n"); message.append( "Invoice Creator: " + UserManager.getInstance() .getUser((String) incomingRequest.get("organizationId"), invoiceUser) .getDisplayName() + "\n"); message.append("Invoice Total: " + invoiceTotal + "\n"); message.append("Description: " + purpose); incomingRequest.put("SendQueue_doctype", "IVC"); incomingRequest.put( "SendQueue_docic", (String) incomingRequest.get("InvoiceHeader_icIvcHeader")); incomingRequest.put("SendQueue_subject", subject.toString()); incomingRequest.put("SendQueue_messagetext", message.toString()); incomingRequest.put("SendQueue_owner", owner); incomingRequest.put("SendQueue_sendfromtype", "E"); incomingRequest.put( "SendQueue_sendfrom", UserManager.getInstance() .getUser((String) incomingRequest.get("organizationId"), owner) .getMailId()); incomingRequest.put("SendQueue_sendtotype", "E"); incomingRequest.put("SendQueue_sendto", nextUser); incomingRequest.put("SendQueue_action", EmailActionCodes.EMAIL); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("sendqueue-add.xml"); process.executeProcess(incomingRequest); this.status = process.getStatus(); } else { this.setStatus(Status.SUCCEEDED); Log.debug( this, "No record will be written for this Invoice: " + invoiceHeader.getInvoiceNumber()); } } catch (Exception e) { this.setStatus(Status.FAILED); throw new TsaException("Invoice Approval Email couldn't be processed.", e); } return result; }