public Object executeTask(Object object) throws Exception { Object ret = null; Map incomingRequest = (Map) object; try { SendQueue sendQueue = (SendQueue) incomingRequest.get("alertSendQueue"); sendQueue.setStatus("10"); sendQueue.setErrorText("Alert sucessfully sent"); sendQueue.setAttempts(sendQueue.getAttempts().add(new BigDecimal(1))); sendQueue.setDatesent(Dates.today("yyyy/MM/dd", "")); sendQueue.setTimesent(Dates.getNow(null, "")); if (incomingRequest.containsKey("report") && !Utility.isEmpty((String) incomingRequest.get("report"))) { // sendQueue.setAttachment((String) incomingRequest.get("report")); incomingRequest.put("SendQueue_attachment", incomingRequest.get("report")); } ret = sendQueue; this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw new TsaException("AlertGetProcessFromType failed!" + e.getMessage(), e); } return ret; }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { String userId = (String) incomingRequest.get("userId"); incomingRequest.put("InvBinLocHistory_itemNumber", ""); incomingRequest.put("InvBinLocHistory_itemLocation", ""); incomingRequest.put("InvBinLocHistory_vendorId", ""); incomingRequest.put("InvBinLocHistory_manufactNo", ""); incomingRequest.put("InvBinLocHistory_lot", ""); incomingRequest.put("InvBinLocHistory_cost", "0"); incomingRequest.put("InvBinLocHistory_itemDate", Dates.today("")); incomingRequest.put("InvBinLocHistory_aisle", ""); incomingRequest.put("InvBinLocHistory_locrow", ""); incomingRequest.put("InvBinLocHistory_tier", ""); incomingRequest.put("InvBinLocHistory_bin", ""); incomingRequest.put("InvBinLocHistory_udf1Code", ""); incomingRequest.put("InvBinLocHistory_udf2Code", ""); incomingRequest.put("InvBinLocHistory_udf3Code", ""); incomingRequest.put("InvBinLocHistory_udf4Code", ""); incomingRequest.put("InvBinLocHistory_udf5Code", ""); incomingRequest.put("InvBinLocHistory_qtyOnHand", "0"); incomingRequest.put("InvBinLocHistory_qtyAlloc", "0"); incomingRequest.put("InvBinLocHistory_actionCode", ""); incomingRequest.put("InvBinLocHistory_qtyMoved", "0"); incomingRequest.put("InvBinLocHistory_histText", ""); incomingRequest.put("InvBinLocHistory_transactionDate", Dates.today("")); incomingRequest.put("InvBinLocHistory_icCode", "0"); incomingRequest.put("InvBinLocHistory_transactionTime", ""); incomingRequest.put("InvBinLocHistory_userId", userId); incomingRequest.put("InvBinLocHistory_reasonCode", ""); incomingRequest.put("InvBinLocHistory_icPoHeader", "0"); incomingRequest.put("InvBinLocHistory_icDsbHeader", "0"); incomingRequest.put("InvBinLocHistory_icDsbLine", "0"); incomingRequest.put("InvBinLocHistory_duomQtyOnHand", "0"); incomingRequest.put("InvBinLocHistory_duomQtyAlloc", "0"); this.status = Status.SUCCEEDED; } catch (Exception e) { this.status = Status.FAILED; 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 { 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 void setLastRun(String alertName) { List alerts = this.xmlDocument.getRootElement().getChildren("alert"); for (int i = 0; i < alerts.size(); i++) { Element alertElement = (Element) alerts.get(i); String name = alertElement.getChildText("name"); if (name.equalsIgnoreCase(alertName)) { Element lastRunEl = alertElement.getChild("last-run"); if (lastRunEl != null) { CDATA cdata = new CDATA(Dates.today("yyyy/MM/dd", "")); List cdataL = new ArrayList(); cdataL.add(cdata); lastRunEl.setContent(cdataL); this.output(); } } } }
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 { Map incomingRequest = (Map) object; Object result = null; try { PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader"); PoLine poLine = (PoLine) incomingRequest.get("poLine"); if (poHeader == null) { throw new Exception("Recent Order Item cannot be setup. PoHeader was not found."); } if (poLine == null) { throw new Exception("Recent Order Item cannot be setup. PoLine was not found."); } String source = poLine.getItemSource(); String location = poLine.getItemLocation(); String buyer = poHeader.getBuyerCode(); if (source.equals("CAT") || source.equals("XML")) { location = poLine.getCatalogId(); } if (Utility.isEmpty(buyer)) { buyer = poHeader.getOwner(); } incomingRequest.put("RecentOrderItem_buyerCode", buyer); incomingRequest.put("RecentOrderItem_itemNumber", poLine.getItemNumber()); incomingRequest.put("RecentOrderItem_itemSource", source); incomingRequest.put("RecentOrderItem_itemLocation", location); incomingRequest.put("RecentOrderItem_description", poLine.getDescription()); incomingRequest.put("RecentOrderItem_dateEntered", Dates.today("", "")); this.status = Status.SUCCEEDED; } 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 { String organizationId = (String) incomingRequest.get("organizationId"); String userTimeZone = (String) incomingRequest.get("userTimeZone"); String userDateFormat = (String) incomingRequest.get("userDateFormat"); PropertiesManager propertiesManager = PropertiesManager.getInstance(organizationId); if (Utility.isEmpty(userDateFormat)) { userDateFormat = propertiesManager.getProperty("MISC", "DateFormat", ""); } String today = Dates.today(userDateFormat, userTimeZone); incomingRequest.put("AssetService_tagNumber", ""); incomingRequest.put("AssetService_sequenceNo", "0"); incomingRequest.put("AssetService_serviceCallDate", today); incomingRequest.put("AssetService_callInitiatedBy", ""); incomingRequest.put("AssetService_dateInitiated", today); incomingRequest.put("AssetService_responseDate", today); incomingRequest.put("AssetService_completionDate", today); incomingRequest.put("AssetService_serviceAction", ""); incomingRequest.put("AssetService_serviceCost", "0"); incomingRequest.put("AssetService_lastChgBy", ""); incomingRequest.put("AssetService_dateChanged", today); this.status = Status.SUCCEEDED; } catch (Exception e) { this.status = Status.FAILED; 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; try { String assignTo = (String) incomingRequest.get("assignToEngine"); String userTimeZone = (String) incomingRequest.get("userTimeZone"); incomingRequest.put("ReceiptLine_engineerAssigned", assignTo); incomingRequest.put("ReceiptLine_receiptDate", Dates.today("", userTimeZone)); // check incomingRequest.put("historyStatus", HistoryStatus.ENGINEER_ASSIGNMENT); ReceiptLine receiptLine = (ReceiptLine) incomingRequest.get("receiptLine"); if (receiptLine != null) { incomingRequest.put( "ReceiptHeader_icRecHeader", String.valueOf(receiptLine.getIcRecHeader())); } this.setStatus(Status.SUCCEEDED); } catch (Exception e) { this.setStatus(Status.FAILED); throw e; } return null; }
public Object executeTask(Object object) throws Exception { Map incomingRequest = (Map) object; Object result = null; try { String userTimeZone = (String) incomingRequest.get("userTimeZone"); String userDateFormat = (String) incomingRequest.get("userDateFormat"); String isVendorInsuranceDefaultValid = "Y"; String[] vendorInsuranceDefaultResults = null; InsCategoryLevel insCategoryLevel = (InsCategoryLevel) incomingRequest.get("insCategoryLevel"); VendorInsuranceDefault vendorInsuranceDefault = (VendorInsuranceDefault) incomingRequest.get("vendorInsuranceDefault"); if (vendorInsuranceDefault == null) { vendorInsuranceDefault = new VendorInsuranceDefault(); } if (insCategoryLevel == null) { insCategoryLevel = new InsCategoryLevel(); } if (insCategoryLevel != null && vendorInsuranceDefault != null) { if (!vendorInsuranceDefault.getInsuranceOverride().equalsIgnoreCase("Y")) { Method[] insCategoryLevelMethods = new InsCategoryLevel().getClass().getDeclaredMethods(); Method[] vendorInsuranceDefaultMethods = new VendorInsuranceDefault().getClass().getDeclaredMethods(); int insCategoryLevelCount = 0; for (int i = 0; i < insCategoryLevelMethods.length; i++) { Method method = insCategoryLevelMethods[i]; if (method.getName().indexOf("getIclRequired") >= 0) { insCategoryLevelCount++; } } int vendorInsuranceDefaultCount = 0; for (int i = 0; i < vendorInsuranceDefaultMethods.length; i++) { Method method = vendorInsuranceDefaultMethods[i]; if (method.getName().indexOf("getCoverage") >= 0) { vendorInsuranceDefaultCount++; } } int minMethods = 0; if (insCategoryLevelCount >= vendorInsuranceDefaultCount) { minMethods = vendorInsuranceDefaultCount; } else { minMethods = insCategoryLevelCount; } vendorInsuranceDefaultResults = new String[minMethods]; for (int i = 1; i <= minMethods; i++) { Method iclRequiredMethod = insCategoryLevel.getClass().getMethod("getIclRequired" + i, null); Method iclMinimumMethod = insCategoryLevel.getClass().getMethod("getIclMinimum" + i, null); Method coverageMethod = vendorInsuranceDefault.getClass().getMethod("getCoverage" + i, null); Method limitMethod = vendorInsuranceDefault.getClass().getMethod("getLimit" + i, null); Method expiresMethod = vendorInsuranceDefault.getClass().getMethod("getExpires" + i, null); String iclRequired = (String) iclRequiredMethod.invoke(insCategoryLevel, null); BigDecimal iclMinimum = (BigDecimal) iclMinimumMethod.invoke(insCategoryLevel, null); String coverage = (String) coverageMethod.invoke(vendorInsuranceDefault, null); BigDecimal limit = (BigDecimal) limitMethod.invoke(vendorInsuranceDefault, null); java.util.Date expires = (java.util.Date) expiresMethod.invoke(vendorInsuranceDefault, null); vendorInsuranceDefaultResults[i - 1] = "Y"; if (iclRequired.equalsIgnoreCase("Y")) { if (coverage.equalsIgnoreCase("A") || HiltonUtility.isEmpty(coverage)) { if (limit.compareTo(iclMinimum) < 0) { isVendorInsuranceDefaultValid = "N"; vendorInsuranceDefaultResults[i - 1] = "N"; } if (expires != null) { Date dateToday = Dates.getDate(Dates.today(userDateFormat, userTimeZone)); Date dateExpires = Dates.getDate(String.valueOf(expires)); if (dateExpires.compareTo(dateToday) < 0) { isVendorInsuranceDefaultValid = "N"; vendorInsuranceDefaultResults[i - 1] = "N"; } } } else if (coverage.equalsIgnoreCase("C") || coverage.equalsIgnoreCase("I") || coverage.equalsIgnoreCase("P") || coverage.equalsIgnoreCase("U")) { isVendorInsuranceDefaultValid = "N"; vendorInsuranceDefaultResults[i - 1] = "N"; } } } } } else { isVendorInsuranceDefaultValid = "N"; } incomingRequest.put("isVendorInsuranceDefaultValid", isVendorInsuranceDefaultValid); incomingRequest.put("vendorInsuranceDefaultResults", vendorInsuranceDefaultResults); 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 { InvStage invStage = (InvStage) incomingRequest.get("invStage"); if (invStage == null) { invStage = new InvStage(); } if (incomingRequest.containsKey("InvStage_stageId")) { String stageId = (String) incomingRequest.get("InvStage_stageId"); invStage.setStageId(stageId); } if (incomingRequest.containsKey("InvStage_description")) { String description = (String) incomingRequest.get("InvStage_description"); invStage.setDescription(description); } if (incomingRequest.containsKey("InvStage_respons")) { String respons = (String) incomingRequest.get("InvStage_respons"); invStage.setRespons(respons); } if (incomingRequest.containsKey("InvStage_notes")) { String notes = (String) incomingRequest.get("InvStage_notes"); invStage.setNotes(notes); } if (incomingRequest.containsKey("InvStage_workCenterId")) { String workCenterId = (String) incomingRequest.get("InvStage_workCenterId"); invStage.setWorkCenterId(workCenterId); } if (incomingRequest.containsKey("InvStage_utilization")) { String utilizationString = (String) incomingRequest.get("InvStage_utilization"); if (Utility.isEmpty(utilizationString)) { utilizationString = "0"; } BigDecimal utilization = new BigDecimal(utilizationString); invStage.setUtilization(utilization); } if (incomingRequest.containsKey("InvStage_qtyDays")) { String qtyDaysString = (String) incomingRequest.get("InvStage_qtyDays"); if (Utility.isEmpty(qtyDaysString)) { qtyDaysString = "0"; } BigDecimal qtyDays = new BigDecimal(qtyDaysString); invStage.setQtyDays(qtyDays); } if (incomingRequest.containsKey("InvStage_setupHours")) { String setupHoursString = (String) incomingRequest.get("InvStage_setupHours"); if (Utility.isEmpty(setupHoursString)) { setupHoursString = "0"; } BigDecimal setupHours = new BigDecimal(setupHoursString); invStage.setSetupHours(setupHours); } if (incomingRequest.containsKey("InvStage_partsHour")) { String partsHourString = (String) incomingRequest.get("InvStage_partsHour"); if (Utility.isEmpty(partsHourString)) { partsHourString = "0"; } BigDecimal partsHour = new BigDecimal(partsHourString); invStage.setPartsHour(partsHour); } if (incomingRequest.containsKey("InvStage_timePart")) { String timePartString = (String) incomingRequest.get("InvStage_timePart"); if (Utility.isEmpty(timePartString)) { timePartString = "0"; } BigDecimal timePart = new BigDecimal(timePartString); invStage.setTimePart(timePart); } if (incomingRequest.containsKey("InvStage_vendorName")) { String vendorName = (String) incomingRequest.get("InvStage_vendorName"); invStage.setVendorName(vendorName); } if (incomingRequest.containsKey("InvStage_leadTime")) { String leadTimeString = (String) incomingRequest.get("InvStage_leadTime"); if (Utility.isEmpty(leadTimeString)) { leadTimeString = "0"; } BigDecimal leadTime = new BigDecimal(leadTimeString); invStage.setLeadTime(leadTime); } if (incomingRequest.containsKey("InvStage_outside")) { String outside = (String) incomingRequest.get("InvStage_outside"); invStage.setOutside(outside); } if (incomingRequest.containsKey("InvStage_descriptor")) { String descriptor = (String) incomingRequest.get("InvStage_descriptor"); invStage.setDescriptor(descriptor); } if (incomingRequest.containsKey("InvStage_machineId")) { String machineId = (String) incomingRequest.get("InvStage_machineId"); invStage.setMachineId(machineId); } if (incomingRequest.containsKey("InvStage_backflush")) { String backflush = (String) incomingRequest.get("InvStage_backflush"); invStage.setBackflush(backflush); } if (incomingRequest.containsKey("InvStage_persons")) { String personsString = (String) incomingRequest.get("InvStage_persons"); if (Utility.isEmpty(personsString)) { personsString = "0"; } BigDecimal persons = new BigDecimal(personsString); invStage.setPersons(persons); } if (incomingRequest.containsKey("InvStage_ccost")) { String ccostString = (String) incomingRequest.get("InvStage_ccost"); if (Utility.isEmpty(ccostString)) { ccostString = "0"; } BigDecimal ccost = new BigDecimal(ccostString); invStage.setCcost(ccost); } if (incomingRequest.containsKey("InvStage_unitOfMeasure")) { String unitOfMeasure = (String) incomingRequest.get("InvStage_unitOfMeasure"); invStage.setUnitOfMeasure(unitOfMeasure); } if (incomingRequest.containsKey("InvStage_dateEntered")) { String dateEnteredString = (String) incomingRequest.get("InvStage_dateEntered"); Date dateEntered = Dates.getDate(dateEnteredString); invStage.setDateEntered(dateEntered); } if (incomingRequest.containsKey("InvStage_dateExpires")) { String dateExpiresString = (String) incomingRequest.get("InvStage_dateExpires"); Date dateExpires = Dates.getDate(dateExpiresString); invStage.setDateExpires(dateExpires); } if (incomingRequest.containsKey("InvStage_owner")) { String owner = (String) incomingRequest.get("InvStage_owner"); invStage.setOwner(owner); } if (incomingRequest.containsKey("InvStage_status")) { String status = (String) incomingRequest.get("InvStage_status"); invStage.setStatus(status); } result = invStage; this.status = Status.SUCCEEDED; } catch (Exception e) { this.status = Status.FAILED; 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 { BomMethod bomMethod = (BomMethod) incomingRequest.get("bomMethod"); if (bomMethod == null) { bomMethod = new BomMethod(); } if (incomingRequest.containsKey("BomMethod_icMethod")) { String icMethodString = (String) incomingRequest.get("BomMethod_icMethod"); if (Utility.isEmpty(icMethodString)) { icMethodString = "0"; } BigDecimal icMethod = new BigDecimal(icMethodString); bomMethod.setIcMethod(icMethod); } if (incomingRequest.containsKey("BomMethod_parentItem")) { String parentItem = (String) incomingRequest.get("BomMethod_parentItem"); bomMethod.setParentItem(parentItem); } if (incomingRequest.containsKey("BomMethod_componentItem")) { String componentItem = (String) incomingRequest.get("BomMethod_componentItem"); bomMethod.setComponentItem(componentItem); } if (incomingRequest.containsKey("BomMethod_methodId")) { String methodId = (String) incomingRequest.get("BomMethod_methodId"); bomMethod.setMethodId(methodId); } if (incomingRequest.containsKey("BomMethod_batchSize")) { String batchSizeString = (String) incomingRequest.get("BomMethod_batchSize"); if (Utility.isEmpty(batchSizeString)) { batchSizeString = "0"; } BigDecimal batchSize = new BigDecimal(batchSizeString); bomMethod.setBatchSize(batchSize); } if (incomingRequest.containsKey("BomMethod_unitOfMeasure")) { String unitOfMeasure = (String) incomingRequest.get("BomMethod_unitOfMeasure"); bomMethod.setUnitOfMeasure(unitOfMeasure); } if (incomingRequest.containsKey("BomMethod_description")) { String description = (String) incomingRequest.get("BomMethod_description"); bomMethod.setDescription(description); } if (incomingRequest.containsKey("BomMethod_notes")) { String notes = (String) incomingRequest.get("BomMethod_notes"); bomMethod.setNotes(notes); } if (incomingRequest.containsKey("BomMethod_dateEntered")) { String dateEnteredString = (String) incomingRequest.get("BomMethod_dateEntered"); Date dateEntered = Dates.getDate(dateEnteredString); bomMethod.setDateEntered(dateEntered); } if (incomingRequest.containsKey("BomMethod_owner")) { String owner = (String) incomingRequest.get("BomMethod_owner"); bomMethod.setOwner(owner); } result = bomMethod; this.status = Status.SUCCEEDED; } 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 { String today = Dates.today("", ""); incomingRequest.put("VendorInsurance_icPoHeader", ""); incomingRequest.put("VendorInsurance_vendorId", ""); incomingRequest.put("VendorInsurance_contNumber", ""); incomingRequest.put("VendorInsurance_contType", ""); incomingRequest.put("VendorInsurance_contEffective", today); incomingRequest.put("VendorInsurance_contExpires", today); incomingRequest.put("VendorInsurance_contAdmin", ""); incomingRequest.put("VendorInsurance_contModFlag", ""); incomingRequest.put("VendorInsurance_contModUserid", ""); incomingRequest.put("VendorInsurance_contModDate", today); incomingRequest.put("VendorInsurance_contOwner", ""); incomingRequest.put("VendorInsurance_contStatus", ""); incomingRequest.put("VendorInsurance_contRequestDate", today); incomingRequest.put("VendorInsurance_contDescription", ""); incomingRequest.put("VendorInsurance_contUdf1", ""); incomingRequest.put("VendorInsurance_contUdf2", ""); incomingRequest.put("VendorInsurance_contUdf3", ""); incomingRequest.put("VendorInsurance_contUdf4", ""); incomingRequest.put("VendorInsurance_contUdf5", ""); incomingRequest.put("VendorInsurance_insuranceStatus", ""); incomingRequest.put("VendorInsurance_insuranceContact", ""); incomingRequest.put("VendorInsurance_expiredLetter", today); incomingRequest.put("VendorInsurance_coverage1", ""); incomingRequest.put("VendorInsurance_expires1", ""); incomingRequest.put("VendorInsurance_named1", ""); incomingRequest.put("VendorInsurance_waiver1", ""); incomingRequest.put("VendorInsurance_limit1", ""); incomingRequest.put("VendorInsurance_coverage2", ""); incomingRequest.put("VendorInsurance_expires2", ""); incomingRequest.put("VendorInsurance_named2", ""); incomingRequest.put("VendorInsurance_waiver2", ""); incomingRequest.put("VendorInsurance_limit2", ""); incomingRequest.put("VendorInsurance_coverage3", ""); incomingRequest.put("VendorInsurance_expires3", ""); incomingRequest.put("VendorInsurance_named3", ""); incomingRequest.put("VendorInsurance_waiver3", ""); incomingRequest.put("VendorInsurance_limit3", ""); incomingRequest.put("VendorInsurance_coverage4", ""); incomingRequest.put("VendorInsurance_expires4", ""); incomingRequest.put("VendorInsurance_named4", ""); incomingRequest.put("VendorInsurance_waiver4", ""); incomingRequest.put("VendorInsurance_limit4", ""); incomingRequest.put("VendorInsurance_coverage5", ""); incomingRequest.put("VendorInsurance_expires5", ""); incomingRequest.put("VendorInsurance_named5", ""); incomingRequest.put("VendorInsurance_waiver5", ""); incomingRequest.put("VendorInsurance_limit5", ""); incomingRequest.put("VendorInsurance_coverage6", ""); incomingRequest.put("VendorInsurance_expires6", ""); incomingRequest.put("VendorInsurance_named6", ""); incomingRequest.put("VendorInsurance_waiver6", ""); incomingRequest.put("VendorInsurance_limit6", ""); incomingRequest.put("VendorInsurance_certifiedDate1", ""); incomingRequest.put("VendorInsurance_certStatus1", ""); incomingRequest.put("VendorInsurance_certifiedDate2", ""); incomingRequest.put("VendorInsurance_certStatus2", ""); incomingRequest.put("VendorInsurance_certifiedDate3", ""); incomingRequest.put("VendorInsurance_certStatus3", ""); incomingRequest.put("VendorInsurance_certifiedDate4", ""); incomingRequest.put("VendorInsurance_certStatus4", ""); incomingRequest.put("VendorInsurance_certifiedDate5", ""); incomingRequest.put("VendorInsurance_certStatus5", ""); incomingRequest.put("VendorInsurance_certUdf1", ""); incomingRequest.put("VendorInsurance_certUdf2", ""); incomingRequest.put("VendorInsurance_certUdf3", ""); incomingRequest.put("VendorInsurance_certUdf4", ""); incomingRequest.put("VendorInsurance_certUdf5", ""); incomingRequest.put("VendorInsurance_certContact", ""); incomingRequest.put("VendorInsurance_contractNotes", ""); incomingRequest.put("VendorInsurance_complianceNotes", ""); incomingRequest.put("VendorInsurance_insuranceNotes", ""); incomingRequest.put("VendorInsurance_notifiedDate", today); incomingRequest.put("VendorInsurance_dollarValue", "0"); incomingRequest.put("VendorInsurance_certifiedDate6", ""); incomingRequest.put("VendorInsurance_certStatus6", ""); incomingRequest.put("VendorInsurance_certUdf6", ""); incomingRequest.put("VendorInsurance_certifiedDate7", ""); incomingRequest.put("VendorInsurance_certStatus7", ""); incomingRequest.put("VendorInsurance_certUdf7", ""); incomingRequest.put("VendorInsurance_dateExpires1", ""); incomingRequest.put("VendorInsurance_dateExpires2", ""); incomingRequest.put("VendorInsurance_dateExpires3", ""); incomingRequest.put("VendorInsurance_dateExpires4", ""); incomingRequest.put("VendorInsurance_dateExpires5", ""); incomingRequest.put("VendorInsurance_dateExpires6", ""); incomingRequest.put("VendorInsurance_dateExpires7", ""); this.status = Status.SUCCEEDED; } catch (Exception e) { this.status = Status.FAILED; 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 { 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; }