public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("currcode-add.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { String errorMsg = (String) incomingRequest.get("duplicateCurrCodeErrorMsg"); if (errorMsg != null && errorMsg.trim().length() > 0) { incomingRequest.put("viewPage", incomingRequest.get("duplicateCurrCodeFailurePage")); } else { incomingRequest.put("viewPage", incomingRequest.get("successPage")); /* * kathleen added the following on 06-16-05 * so that after a currency code record is successfully added * the user gets returned back to the currency code browse * (browseName is declared on the jsp) */ process = processLoader.loadProcess("browse-retrieve.xml"); process.executeProcess(incomingRequest); } } else { incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); } } return incomingRequest; }
public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("vendor-deletebyid.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { String errorMsg = (String) incomingRequest.get("deleteVendorErrorMsg"); if (errorMsg != null && errorMsg.trim().length() > 0) { incomingRequest.put("viewPage", incomingRequest.get("deleteVendorFailurePage")); } else { incomingRequest.put("viewPage", incomingRequest.get("successPage")); } } else { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("viewPage", incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } return incomingRequest; }
public Object executeTask(Object object) throws Exception { Object ret = null; Map incomingRequest = (Map) object; String organizationId = (String) incomingRequest.get("organizationId"); try { String alertName = (String) incomingRequest.get("alertname"); Alert alert = AlertManager.getInstance().getAlert(organizationId, alertName); String action = alert.getProcess(); if (!Utility.isEmpty(action)) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess(action); Map newIncomingRequest = new HashMap(); newIncomingRequest.put("organizationId", organizationId); try { process.executeProcess(newIncomingRequest); } catch (Exception e) { // TODO: handle exception if process to be executed from alert fails. } } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw new TsaException("AlertGetProcessFromType failed!" + e.getMessage(), e); } return ret; }
public Map handleRequest(Map incomingRequest) throws Exception { try { String organizationId = (String) incomingRequest.get("organizationId"); PuridiomProcessLoader processLoader = new PuridiomSupplierPortalProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess("vendorregister-validate.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { incomingRequest.put("viewPage", incomingRequest.get("successPage")); } else { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("exception", exception); incomingRequest.put("viewPage", incomingRequest.get("failurePage")); // throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } return incomingRequest; }
private String acknowledgedReceipt(ApprovalLink approvalLink, String organizationId) throws Exception { String message = ""; PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess("po-supplier-acknowledgement.xml"); Map incomingRequest = new HashMap(); Contact contact; String[] contactData; if (approvalLink.getDoctype().equalsIgnoreCase("PO")) { incomingRequest.put("PoHeader_icPoHeader", approvalLink.getIcHeader().toString()); contactData = approvalLink.getUserId().split("//"); contact = this.getVendorContact(contactData[0], contactData[1], organizationId); incomingRequest.put("userName", contact.getDisplayName()); incomingRequest.put("userId", contact.getEmailAddr()); } incomingRequest.put("organizationId", organizationId); process.executeProcess(incomingRequest); return message; }
public static void test(String[] args) throws Exception { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("invalloc-retrieve-all.xml"); Map incomingRequest = new HashMap(); // TODO add your parameters to incomingRequest here process.executeProcess(incomingRequest); System.out.println(incomingRequest); }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; try { List poLineList = (List) incomingRequest.get("poLineList"); List reqLineList = new ArrayList(); String icPoHeader = (String) incomingRequest.get("PoHeader_icPoHeader"); PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("requisitionline-create-from-poline.xml"); HashMap updateParameters = new HashMap(); updateParameters.put("userId", incomingRequest.get("userId")); updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone")); updateParameters.put("organizationId", incomingRequest.get("organizationId")); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "RequisitionHeader_icReqHeader", incomingRequest.get("RequisitionHeader_icReqHeader")); updateParameters.put( "RequisitionHeader_icRevisedOrder", incomingRequest.get("RequisitionHeader_icRevisedOrder")); updateParameters.put( "RequisitionHeader_requisitionNumber", incomingRequest.get("RequisitionHeader_requisitionNumber")); updateParameters.put("requisitionHeader", incomingRequest.get("requisitionHeader")); for (int i = 0; i < poLineList.size(); i++) { PoLine poLine = (PoLine) poLineList.get(i); updateParameters.put("poLine", poLine); process.executeProcess(updateParameters); if (process.getStatus() == Status.SUCCEEDED) { reqLineList.add(updateParameters.get("requisitionLine")); updateParameters.remove("requisitionLine"); updateParameters.remove("poLine"); } else { this.setStatus(process.getStatus()); throw new Exception("Process to create requisition lines from po lines failed."); } } incomingRequest.put("PoLine_icPoHeader", icPoHeader); this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw e; } return null; }
public static void main(String[] args) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("requisitionheader-add.xml"); Map incomingRequest = new HashMap(); // TODO add your parameters to incomingRequest here process.executeProcess(incomingRequest); System.out.println(incomingRequest); } catch (Exception e) { e.printStackTrace(); } }
private ApprovalLink retrieveApprovalLink(String icApprovalLink, String organizationId) throws Exception { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess("approvallink-retrieve.xml"); Map incomingRequest = new HashMap(); incomingRequest.put("organizationId", organizationId); incomingRequest.put("ApprovalLink_icApprovalLink", icApprovalLink); process.executeProcess(incomingRequest); return (ApprovalLink) incomingRequest.get("approvalLink"); }
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 } }
private Object getBuyerData(String organizationId, String userId) { Object ret = null; try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("buyer-graph-data.xml"); Map incomingRequest = new HashMap(); incomingRequest.put("organizationId", organizationId); incomingRequest.put("userId", userId); process.executeProcess(incomingRequest); this.setData(incomingRequest); } catch (Exception e) { Log.error(this, e.toString()); } return ret; }
private Contact getVendorContact(String vendorId, String contactCode, String organizationId) throws Exception { if (Utility.isEmpty(vendorId)) { return null; } if (Utility.isEmpty(contactCode)) { contactCode = "001"; } Map incomingRequest = new HashMap(); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess("contact-retrieve-by-code.xml"); incomingRequest.put("organizationId", organizationId); incomingRequest.put("Contact_contactCode", contactCode); incomingRequest.put("Contact_vendorId", vendorId); process.executeProcess(incomingRequest); return (Contact) incomingRequest.get("contact"); }
public List today() { List list = new ArrayList(); try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(this.getOrganizationId()); PuridiomProcess process = processLoader.loadProcess("sendqueue-retrieve-by-action-date.xml"); Map incomingRequest = new HashMap(); incomingRequest.put("organizationId", this.getOrganizationId()); incomingRequest.put("SendQueue_dateadded", Dates.today("yyyy/MM/dd", "")); this.setAction(incomingRequest); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { list = (List) incomingRequest.get("daysList"); } } catch (Exception e) { Log.error(this, e.getMessage() + " -getting today's list"); } return list; }
public Object executeTask(Object object) throws Exception { Object result = null; try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = null; Map incomingRequest = (Map) object; String organizationId = (String) incomingRequest.get("organizationId"); List poHeaderList = (List) incomingRequest.get("poHeaderList"); if (poHeaderList != null && poHeaderList.size() > 0) { for (Iterator iterator = poHeaderList.iterator(); iterator.hasNext(); ) { PoHeader poHeader = (PoHeader) iterator.next(); incomingRequest.put("userId", incomingRequest.get("userId")); incomingRequest.put("organizationId", organizationId); incomingRequest.put("dbsession", incomingRequest.get("dbsession")); incomingRequest.put("PoHeader_icPoHeader", poHeader.getIcPoHeader().toString()); incomingRequest.put("PoLine_icPoHeader", poHeader.getIcPoHeader().toString()); incomingRequest.put("ApprovalLog_icHeader", poHeader.getIcPoHeader().toString()); incomingRequest.put("PoHeader_status", poHeader.getStatus()); incomingRequest.put("PoHeader_poType", poHeader.getPoType()); incomingRequest.put("poaction", "FORWARD"); incomingRequest.put("formtype", "PO"); incomingRequest.put("newStatus", DocumentStatus.PO_AWARDED); process = processLoader.loadProcess("po-autoaward-revision.xml"); process.executeProcess(incomingRequest); } } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { Log.error(this, "PoHeaderAutoAwardRevision failed: " + e.getMessage()); this.setStatus(Status.FAILED); throw new TsaException( "PoHeaderAutoAwardRevision failed to retrieve POs: " + e.getMessage(), e); } return result; }
public void sendQueueUpdate(String organizationId, SendQueue sendQueue) { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess processSendQueueUpdate = processLoader.loadProcess("sendqueue-update.xml"); Map sendQueueIncomingRequest = new HashMap(); sendQueueIncomingRequest.put("organizationId", organizationId); sendQueueIncomingRequest.put("sendQueue", sendQueue); processSendQueueUpdate.executeProcess(sendQueueIncomingRequest); this.setStatus(processSendQueueUpdate.getStatus()); } catch (Exception e) { this.setStatus(Status.FAILED); try { throw new TsaException("SendQueueUpdateByList failed SendQueue Update "); } catch (TsaException e1) { e1.printStackTrace(); } } }
public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("invmethod-update.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { incomingRequest.put("viewPage", (String) incomingRequest.get("successPage")); } else { incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage")); } } return incomingRequest; }
@SuppressWarnings("unchecked") public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("schedule-add-from-interval.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { incomingRequest.put("viewPage", incomingRequest.get("successPage")); } else { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("viewPage", incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } return incomingRequest; }
public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("labels-delete-by-id-refresh.xml"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { incomingRequest.put("viewPage", incomingRequest.get("successPage")); } else { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("exception", exception); incomingRequest.put("viewPage", incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } return incomingRequest; }
public static void main(String[] args) { try { System.out.println("Delete catalogComopnent record"); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("catalogComponent-delete.xml"); Map incomingRequest = new HashMap(); incomingRequest.put("catalogID", "936"); incomingRequest.put("itemNumber", "10"); incomingRequest.put("sequence", new Integer(1)); process.executeProcess(incomingRequest); CatalogComponent catalogComponent = (CatalogComponent) incomingRequest.get("catalogcomponentdelete"); System.out.println("status: " + process.getStatus()); System.out.println("end of catalogPriceBrk Delete process test"); } catch (Exception exception) { exception.printStackTrace(); ErrorHandlingService ehs = ErrorHandlingService.getInstance(); ehs.handleException("catalogComponentDeleteTest", "executeTask", null, exception); } }
public Map handleRequest(Map incomingRequest) throws Exception { try { PuridiomProcessLoader processLoader = new PuridiomSupplierPortalProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("suppliercerts-checklistentry-retrieve-by-referencetype.xml"); incomingRequest.put("ChecklistEntry_referenceType", "VCT"); process.executeProcess(incomingRequest); if (process.getStatus() == Status.SUCCEEDED) { incomingRequest.put("viewPage", incomingRequest.get("successPage")); } else { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } catch (Exception exception) { incomingRequest.put("errorMsg", exception.getMessage()); incomingRequest.put("viewPage", incomingRequest.get("failurePage")); throw exception; } finally { if (incomingRequest.get("viewPage") == null) { incomingRequest.put("viewPage", incomingRequest.get("failurePage")); } } return incomingRequest; }
/* (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 userDateFormat = (String) incomingRequest.get("userDateFormat"); PropertiesManager propertiesManager = PropertiesManager.getInstance(organizationId); CatalogSecurity catalogSecurity = (CatalogSecurity) incomingRequest.get("catalogSecurity"); String isCatalog = HiltonUtility.ckNull((String) incomingRequest.get("isCatalog")); String catalogId = (String) catalogSecurity.getCatalogId(); String accesType = (String) catalogSecurity.getAccessType(); String accessId = (String) catalogSecurity.getAccessId(); if (HiltonUtility.isEmpty(userDateFormat)) { userDateFormat = propertiesManager.getProperty("MISC", "DateFormat", "MM-dd-yyyy"); } String today = Dates.today(userDateFormat, (String) incomingRequest.get("userTimeZone")); if (isCatalog.equalsIgnoreCase("V")) { DBSession dbs = (DBSession) incomingRequest.get("dbsession"); String queryString = "from CatalogSecurity as cs " + "where cs.catalogId = ? and cs.itemNumber != '0' " + "and cs.accessType = ? "; List resultList = dbs.query( queryString, new Object[] {catalogId, accesType}, new Type[] {Hibernate.STRING, Hibernate.STRING}); if (resultList != null && resultList.size() > 0) { for (int i = 0; i < resultList.size(); i++) { CatalogSecurity catalogItemSecurity = (CatalogSecurity) resultList.get(i); if (!accessId.equalsIgnoreCase(catalogItemSecurity.getAccessId())) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("catalogsecurity-add.xml"); Map updateParameters = new HashMap(); updateParameters.put("organizationId", organizationId); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "CatalogSecurity_catalogId", (String) catalogSecurity.getCatalogId()); updateParameters.put( "CatalogSecurity_itemNumber", (String) catalogItemSecurity.getItemNumber()); updateParameters.put( "CatalogSecurity_accessType", (String) catalogSecurity.getAccessType()); updateParameters.put( "CatalogSecurity_accessId", (String) catalogSecurity.getAccessId()); updateParameters.put("CatalogSecurity_owner", (String) catalogSecurity.getOwner()); updateParameters.put("CatalogSecurity_dateEntered", today); updateParameters.put("CatalogSecurity_dateChanged", today); updateParameters.put( "CatalogSecurity_lastChangedBy", (String) catalogSecurity.getCatalogId()); process.executeProcess(updateParameters); catalogSecurity.setAccessId(accessId); dbs.add(catalogSecurity); if (dbs.getStatus() != Status.SUCCEEDED) { throw new TsaException( "error ocurred at update catalog security from for " + catalogSecurity.getItemNumber()); } } } } } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); Log.error(this, "An Error occurred at CatalogItemSecurityAddFromCatalog" + e); e.printStackTrace(); throw e; } return result; }
/* (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 { if (incomingRequest.containsKey("InspectionStd_standardCode")) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("inspectionstd-update-std-row.xml"); Object inspObj = incomingRequest.get("InspectionStd_inspectCode"); if (inspObj instanceof String[]) { int arraySize = ((String[]) inspObj).length; Set keySet = incomingRequest.keySet(); for (int i = 0; i < arraySize; i++) { Map updateParameters = new HashMap(); updateParameters.put("userId", incomingRequest.get("userId")); updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone")); updateParameters.put("organizationId", incomingRequest.get("organizationId")); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "InspectionStd_icInspStd", incomingRequest.get("InspectionStd_icInspStd")); updateParameters.put( "InspectionStd_standardCode", incomingRequest.get("InspectionStd_standardCode")); updateParameters.put( "InspectionStd_description", incomingRequest.get("InspectionStd_description")); updateParameters.put("InspectionStd_cgdNo", incomingRequest.get("InspectionStd_cgdNo")); updateParameters.put( "InspectionStd_cgdRev", incomingRequest.get("InspectionStd_cgdRev")); updateParameters.put( "InspectionStd_inspectType", incomingRequest.get("InspectionStd_inspectType")); updateParameters.put( "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_" + i)); updateParameters.put("InspectionStd_owner", incomingRequest.get("InspectionStd_owner")); updateParameters.put( "InspectionStd_status", incomingRequest.get("InspectionStd_status")); updateParameters.put( "InspectionStd_dateEntered", incomingRequest.get("InspectionStd_dateEntered")); updateParameters.put( "InspectionStd_dateExpires", incomingRequest.get("InspectionStd_dateExpires")); Iterator iterator = keySet.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); if (key.indexOf("InspectionStd_") == 0) { Object obj = incomingRequest.get(key); System.out.println(key + "=" + obj); if (obj instanceof String[]) { String arrayObj[] = (String[]) obj; updateParameters.put(key, arrayObj[i]); System.out.println(key + "=" + arrayObj[i]); } } } process.executeProcess(updateParameters); } } else { incomingRequest.put( "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_0")); process.executeProcess(incomingRequest); } } else { throw new Exception("Unable to find Standard Code"); } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); 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 { 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; }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { if (incomingRequest.containsKey("InspectionLine_icInspNo")) { PuridiomProcessLoader processLoader = new PuridiomProcessLoader((String) incomingRequest.get("organizationId")); PuridiomProcess process = processLoader.loadProcess("inspection-update-line-row.xml"); Object inspCritNoObj = incomingRequest.get("InspectionLine_critNo"); String inspectCode = (String) incomingRequest.get("InspectionLine_inspectCode"); if (!HiltonUtility.isEmpty(inspectCode)) { if (inspCritNoObj instanceof String[]) { int arraySize = ((String[]) inspCritNoObj).length; Set keySet = incomingRequest.keySet(); for (int i = 0; i < arraySize; i++) { Map updateParameters = new HashMap(); updateParameters.put("userId", incomingRequest.get("userId")); updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone")); updateParameters.put("organizationId", incomingRequest.get("organizationId")); updateParameters.put("dbsession", incomingRequest.get("dbsession")); updateParameters.put( "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo")); updateParameters.put( "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine")); Iterator iterator = keySet.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); if (key.indexOf("InspectionLine_") == 0) { Object obj = incomingRequest.get(key); if (obj instanceof String[]) { String arrayObj[] = (String[]) obj; updateParameters.put(key, arrayObj[i]); } } } updateParameters.put( "InspectionLine_inspectCode", incomingRequest.get("InspectionLine_inspectCode")); process.executeProcess(updateParameters); } } else { incomingRequest.put( "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo")); incomingRequest.put( "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine")); incomingRequest.put("InspectionLine_seqNo", "1"); process.executeProcess(incomingRequest); } } } else { throw new Exception("The value for InspectionLine_icInspNo was not found."); } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw e; } return result; }
public Object executeTask(Object object) throws Exception { try { Map incomingRequest = (Map) object; String assignTo = (String) incomingRequest.get("assignTo"); if (Utility.isEmpty(assignTo)) { // Notification cannot be sent throw new Exception( "The notification cannot be sent because the assigned buyer user id was not specified (assignTo)."); } if (assignTo.equalsIgnoreCase("AUTORELEASE")) { // Notification should not be sent this.setStatus(Status.SUCCEEDED); return null; } if (assignTo.equalsIgnoreCase("UNASSIGNED")) { assignTo = "PURCHASING"; } String userId = (String) incomingRequest.get("userId"); String organizationId = (String) incomingRequest.get("organizationId"); RequisitionHeader requisitionHeader = (RequisitionHeader) incomingRequest.get("requisitionHeader"); List requisitionLineList = (List) incomingRequest.get("requisitionLineList"); String assignType = (String) incomingRequest.get("assignType"); if (assignType == null) { assignType = "MANUAL"; } UserProfile assignedBuyer = UserManager.getInstance().getUser(organizationId, assignTo); UserProfile requisitioner = UserManager.getInstance() .getUser(organizationId, requisitionHeader.getRequisitionerCode()); UserProfile owner = UserManager.getInstance().getUser(organizationId, requisitionHeader.getOwner()); StringBuffer message = new StringBuffer(); StringBuffer sendTo = new StringBuffer(); String sendFrom = UserManager.getInstance().getUser(organizationId, userId).getMailId(); if (Utility.isEmpty(sendFrom)) { sendFrom = PropertiesManager.getInstance(organizationId) .getProperty("MAILEVENTS", "AdminEmailAddr", ""); } if (!Utility.isEmpty(assignedBuyer.getMailId())) { sendTo.append(assignedBuyer.getMailId()); } if (!Utility.isEmpty(requisitioner.getMailId()) && assignType.equals("MANUAL")) { if (sendTo.length() > 0) { sendTo.append(";" + requisitioner.getMailId()); } else { sendTo.append(requisitioner.getMailId()); } } if (!Utility.isEmpty(owner.getMailId())) { if (sendTo.length() > 0) { sendTo.append(";" + owner.getMailId()); } else { sendTo.append(owner.getMailId()); } } if (!Utility.isEmpty(assignedBuyer.getMailId())) { message.append( "Request " + requisitionHeader.getRequisitionNumber() + " was assigned to " + assignedBuyer.getDisplayName() + " on " + HiltonUtility.getFormattedDate( requisitionHeader.getAssignedDate(), organizationId) + "."); message.append("\r"); message.append("\r"); message.append("This request contains the following items:"); message.append("\r"); for (int il = 0; il < requisitionLineList.size(); il++) { RequisitionLine requisitionLine = (RequisitionLine) requisitionLineList.get(il); message.append(requisitionLine.getLineNumber() + "." + " "); if (!Utility.isEmpty(requisitionLine.getItemNumber())) { message.append(requisitionLine.getItemNumber() + " - "); } message.append(requisitionLine.getDescription()); message.append("\r"); } incomingRequest.put( "SendQueue_subject", "Assignment Notification: Requisition " + requisitionHeader.getRequisitionNumber()); incomingRequest.put("SendQueue_sendfromtype", "E"); incomingRequest.put("SendQueue_sendfrom", sendFrom); incomingRequest.put("SendQueue_sendtotype", "E"); incomingRequest.put("SendQueue_action", "EN"); incomingRequest.put("SendQueue_messagetext", message.toString()); incomingRequest.put("SendQueue_owner", userId); incomingRequest.put("SendQueue_doctype", "REQ"); incomingRequest.put("SendQueue_docic", String.valueOf(requisitionHeader.getIcReqHeader())); incomingRequest.put("SendQueue_sendto", sendTo.toString()); PuridiomProcessLoader processLoader = new PuridiomProcessLoader(); PuridiomProcess process = processLoader.loadProcess("sendqueue-add.xml"); process.executeProcess(incomingRequest); this.status = process.getStatus(); if (this.getStatus() != Status.SUCCEEDED) { throw new Exception("The email record could not be written to the queue."); } } this.status = Status.SUCCEEDED; } catch (Exception e) { this.status = Status.FAILED; throw e; } return null; }
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); }