List of usage examples for javax.script ScriptEngineManager getEngineByName
public ScriptEngine getEngineByName(String shortName)
ScriptEngine
for a given name. From source file:com.willwinder.universalgcodesender.model.GUIBackend.java
@Override public void setWorkPositionUsingExpression(final Axis axis, final String expression) throws Exception { String expr = StringUtils.trimToEmpty(expression); expr = expr.replaceAll("#", String.valueOf(getWorkPosition().get(axis))); // If the expression starts with a mathimatical operation add the original position if (StringUtils.startsWithAny(expr, "/", "*")) { double value = getWorkPosition().get(axis); expr = value + " " + expr; }/*from w w w. j a v a2 s.c o m*/ // Start a script engine and evaluate the expression ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); try { double position = Double.valueOf(engine.eval(expr).toString()); setWorkPosition(axis, position); } catch (ScriptException e) { throw new Exception("Invalid expression", e); } }
From source file:org.samjoey.gui.GraphicalViewer.java
private void selectedPGN(File file) { String fileLoc = file.getAbsolutePath(); //fileLoc = "File:" + fileLoc.substring(2); if (fileLoc.substring(fileLoc.length() - 3).equals("pgn")) { for (int i = 0; i < fileLoc.length(); i++) { if (fileLoc.substring(i, i + 1).equals("/")) { fileLoc = fileLoc.substring(0, i) + "\\" + fileLoc.substring(i + 1); }/* ww w.j a va 2s . c om*/ } try { // Below: Talk to JavaScript ScriptEngineManager factory = new ScriptEngineManager(); // create JavaScript engine final ScriptEngine engine = factory.getEngineByName("JavaScript"); // evaluate JavaScript code from given file - specified by first argument engine.put("engine", engine); ClassLoader cl = GraphicalViewer.class.getClassLoader(); // Talk to GameLooper_1 URL url = cl.getResource("\\org\\samjoey\\gameLooper\\GameLooper_1.js"); String loopLoc = url.toString().substring(5); for (int i = 0; i < loopLoc.length() - 3; i++) { if (loopLoc.substring(i, i + 3).equals("%5c")) { loopLoc = loopLoc.substring(0, i) + "/" + loopLoc.substring(i + 3); } } engine.put("loopLoc", loopLoc); // Talk to calcDefs_1 url = cl.getResource("\\org\\samjoey\\calculator\\calcDefs_1.js"); String defsLoc = url.toString().substring(5); for (int i = 0; i < defsLoc.length() - 3; i++) { if (defsLoc.substring(i, i + 3).equals("%5c")) { defsLoc = defsLoc.substring(0, i) + "/" + defsLoc.substring(i + 3); } } engine.put("defsLoc", defsLoc); // Talk to Calculator url = cl.getResource("\\org\\samjoey\\calculator\\Calculator.js"); String calcLoc = url.toString().substring(5); for (int i = 0; i < calcLoc.length() - 3; i++) { if (calcLoc.substring(i, i + 3).equals("%5c")) { calcLoc = calcLoc.substring(0, i) + "/" + calcLoc.substring(i + 3); } } engine.put("calcLoc", calcLoc); String args[] = { "-g:false", fileLoc }; engine.put("arguments", args); // Create a Thread to update the parser's progress bar parserProgress.setStringPainted(true); running = false; running = true; Thread thread = new Thread() { @Override public void run() { long last = 0l; boolean print = true; double p = .01; while (engine.get("progress") == null || engine.get("size") == null || Integer.parseInt((String) engine.get("progress")) != Integer .parseInt((String) engine.get("size"))) { //if (Parser.numGames > 0 && Parser.progress == Parser.numGames) { try { parserProgress.setValue(Integer.parseInt((String) engine.get("progress"))); parserProgress.setMaximum(Integer.parseInt((String) engine.get("size"))); if (last == 0l) { last = System.nanoTime(); } if ((double) parserProgress.getValue() / (double) parserProgress.getMaximum() > p && print) { //System.out.println(p + ": " + (System.nanoTime() - last)); //print = false; p += .01; } } catch (Exception e) { } //} else { // parserProgress.setMaximum(Parser.numGames - 1); // parserProgress.setMinimum(0); // parserProgress.setValue(Parser.progress); //} } // finally parserProgress.setValue(parserProgress.getMaximum()); } }; thread.start(); // I have no clue what's here!?? engine.eval(new java.io.FileReader( GraphicalViewer.class.getClassLoader().getResource("driver_1.js").toString().substring(5))); while (games == null || games.get((int) (Math.random() * games.size())).getVarData().size() < 20) { games = (LinkedList<Game>) engine.get("gameList"); } } catch (ScriptException | FileNotFoundException ex) { Logger.getLogger(GraphicalViewer.class.getName()).log(Level.SEVERE, null, ex); } } else if (fileLoc.substring(fileLoc.length() - 4).equals("jsca")) { JSCAParser jsca = new JSCAParser(fileLoc); games = (LinkedList<Game>) jsca.getGamesList(); } Set<String> keys = games.get(0).getVarData().keySet(); for (String key : keys) { Variable_Chooser.addItem(key); } graphs = GraphUtility.getGraphs(games); setViewer(0, 0); }
From source file:com.inkubator.hrm.service.impl.PayTempKalkulasiServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void executeBatchFinalSalaryCalculation(EmpData empData) throws ScriptException { PayTempKalkulasiEmpPajak tax_23 = payTempKalkulasiEmpPajakDao .getEntityByEmpDataIdAndTaxComponentId(empData.getId(), 23L); PayTempKalkulasi taxKalkulasi = payTempKalkulasiDao .getEntityByEmpDataIdAndSpecificModelComponent(empData.getId(), HRMConstant.MODEL_COMP_TAX); //jika pajak PPh pasal 21 kurang dari 0(minus), maka di set 0 saja di payTempKalkulasi if (tax_23.getNominal() > 0) { taxKalkulasi.setNominal(new BigDecimal(tax_23.getNominal())); } else {// w w w . ja v a2s . c o m taxKalkulasi.setNominal(new BigDecimal(0)); } payTempKalkulasiDao.update(taxKalkulasi); PayTempKalkulasi ceilKalkulasi = payTempKalkulasiDao .getEntityByEmpDataIdAndSpecificModelComponent(empData.getId(), HRMConstant.MODEL_COMP_CEIL); ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine jsEngine = mgr.getEngineByName("JavaScript"); double ceiling = (Double) jsEngine.eval(ceilKalkulasi.getPaySalaryComponent().getFormula()); PayTempKalkulasi totalIncomeKalkulasi = payTempKalkulasiDao.getEntityByEmpDataIdAndSpecificModelComponent( empData.getId(), HRMConstant.MODEL_COMP_TAKE_HOME_PAY); BigDecimal totalIncome = totalIncomeKalkulasi.getNominal(); totalIncome = this.calculateTotalIncome(totalIncome, taxKalkulasi); //dapatkan nilai sisa/pembulatan BigDecimal val[] = totalIncome.divideAndRemainder(new BigDecimal(ceiling)); ceilKalkulasi.setNominal(val[1]); payTempKalkulasiDao.update(ceilKalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, ceilKalkulasi); totalIncomeKalkulasi.setNominal(totalIncome); payTempKalkulasiDao.update(totalIncomeKalkulasi); }
From source file:org.jwebsocket.plugins.scripting.ScriptingPlugIn.java
/** * Loads an script application.//from w w w .j a v a2 s . com * * @param aAppName The application name * @param aAppPath The application home path * @param aHotLoad * @return * @throws Exception */ private void loadApp(final String aAppName, String aAppPath, boolean aHotLoad) throws Exception { // notifying before app reload event here BaseScriptApp lScript = mApps.get(aAppName); if (null != lScript) { lScript.notifyEvent(BaseScriptApp.EVENT_BEFORE_APP_RELOAD, new Object[] { aHotLoad }); if (!aHotLoad) { destroyAppBeans(lScript); } } // parsing app manifest File lManifestFile = new File(aAppPath + "/manifest.json"); // parsing app manifest file ObjectMapper lMapper = new ObjectMapper(); Map<String, Object> lTree = lMapper.readValue(lManifestFile, Map.class); Token lManifestJSON = TokenFactory.createToken(); lManifestJSON.setMap(lTree); // getting script language extension String lExt = lManifestJSON.getString(Manifest.LANGUAGE_EXT, "js"); // validating bootstrap file final File lBootstrap = new File(aAppPath + "/App." + lExt); // support hot app load if (aHotLoad && mApps.containsKey(aAppName)) { try { // loading app mApps.get(aAppName).eval(lBootstrap.getPath()); } catch (ScriptException lEx) { mLog.error("Script applicaton '" + aAppName + "' failed to start: " + lEx.getMessage()); mApps.remove(aAppName); throw new ScriptException(lEx.getMessage()); } } else { LocalLoader lClassLoader = new LocalLoader((URLClassLoader) ClassLoader.getSystemClassLoader()); ScriptEngineManager lManager = new ScriptEngineManager(lClassLoader); final ScriptEngine lScriptApp; if ("js".equals(lExt)) { // making "nashorn" the default engine for JavaScript if (null != lManager.getEngineByName("nashorn")) { lScriptApp = lManager.getEngineByName("nashorn"); } else { lScriptApp = lManager.getEngineByExtension(lExt); } } else { lScriptApp = lManager.getEngineByExtension(lExt); } // crating the high level script app instance if ("js".equals(lExt)) { mApps.put(aAppName, new JavaScriptApp(this, aAppName, aAppPath, lScriptApp, lClassLoader)); } else { String lMsg = "The extension '" + lExt + "' is not currently supported!"; mLog.error(lMsg); throw new Exception(lMsg); } final BaseScriptApp lApp = mApps.get(aAppName); // loading application into security sandbox Tools.doPrivileged(mSettings.getAppPermissions(aAppName, aAppPath), new PrivilegedAction<Object>() { @Override public Object run() { try { // loading app lApp.eval(lBootstrap.getPath()); return null; } catch (Exception lEx) { mLog.error("Script applicaton '" + aAppName + "' failed to start: " + lEx.getMessage()); mApps.remove(aAppName); throw new RuntimeException(lEx); } } }); } // notifying app loaded event mApps.get(aAppName).notifyEvent(BaseScriptApp.EVENT_APP_LOADED, new Object[] { aHotLoad }); if (mLog.isDebugEnabled()) { mLog.debug(aAppName + "(" + lExt + ") application loaded successfully!"); } }
From source file:org.jwebsocket.plugins.scripting.ScriptingPlugIn.java
private void execAppBeforeLoadChecks(final String aAppName, String aAppPath) throws Exception { // parsing app manifest File lManifestFile = new File(aAppPath + "/manifest.json"); if (!lManifestFile.exists() || !lManifestFile.canRead()) { String lMsg = "Unable to load '" + aAppName + "' application. Manifest file no found!"; mLog.error(lMsg);/*w ww. j av a 2s . co m*/ throw new FileNotFoundException(lMsg); } // parsing app manifest file ObjectMapper lMapper = new ObjectMapper(); Map<String, Object> lTree = lMapper.readValue(lManifestFile, Map.class); Token lManifestJSON = TokenFactory.createToken(); lManifestJSON.setMap(lTree); // getting script language extension String lExt = lManifestJSON.getString(Manifest.LANGUAGE_EXT, "js"); // checking jWebSocket version Manifest.checkJwsVersion(lManifestJSON.getString(Manifest.JWEBSOCKET_VERSION, "1.0.0")); // checking jWebSocket plug-ins dependencies Manifest.checkJwsDependencies( lManifestJSON.getList(Manifest.JWEBSOCKET_PLUGINS_DEPENDENCIES, new ArrayList<String>())); // checking sandbox permissions dependency Manifest.checkPermissions(lManifestJSON.getList(Manifest.PERMISSIONS, new ArrayList()), mSettings.getAppPermissions(aAppName, aAppPath), aAppPath); // validating bootstrap file final File lBootstrap = new File(aAppPath + "/App." + lExt); if (!lBootstrap.exists() || !lBootstrap.canRead()) { String lMsg = "Unable to load '" + aAppName + "' application. Bootstrap file not found!"; mLog.error(lMsg); throw new FileNotFoundException(lMsg); } LocalLoader lClassLoader = new LocalLoader((URLClassLoader) ClassLoader.getSystemClassLoader()); ScriptEngineManager lManager = new ScriptEngineManager(lClassLoader); final ScriptEngine lScriptApp; final BaseScriptApp lApp; if ("js".equals(lExt)) { // making "nashorn" the default engine for JavaScript if (null != lManager.getEngineByName("nashorn")) { lScriptApp = lManager.getEngineByName("nashorn"); } else { lScriptApp = lManager.getEngineByExtension(lExt); } } else { lScriptApp = lManager.getEngineByExtension(lExt); } // creating the high level script app instance if ("js".equals(lExt)) { lApp = new JavaScriptApp(this, aAppName, aAppPath, lScriptApp, lClassLoader); } else { String lMsg = "The extension '" + lExt + "' is not currently supported!"; mLog.error(lMsg); throw new Exception(lMsg); } // loading application into security sandbox Tools.doPrivileged(mSettings.getAppPermissions(aAppName, aAppPath), new PrivilegedAction<Object>() { @Override public Object run() { try { // evaluating app content lScriptApp.eval(FileUtils.readFileToString(lBootstrap)); return null; } catch (Exception lEx) { String lAction = (mApps.containsKey(aAppName)) ? "reloaded" : "loaded"; String lMsg = "Script applicaton '" + aAppName + "' not " + lAction + " because it failed the 'before-load' checks: " + lEx.getMessage(); mLog.info(lMsg); throw new RuntimeException(lMsg); } } }); if (mLog.isDebugEnabled()) { mLog.debug(aAppName + "(" + lExt + ") application passed the 'before-load' checks successfully!"); } }
From source file:com.inkubator.hrm.service.impl.PayTempKalkulasiServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public List<PayTempKalkulasi> getAllDataCalculatedPayment(Date startPeriodDate, Date endPeriodDate, Date createdOn, String createdBy) throws Exception { //initial//from w ww .j a va2s .c o m PaySalaryComponent totalIncomeComponent = paySalaryComponentDao .getEntityBySpecificModelComponent(HRMConstant.MODEL_COMP_TAKE_HOME_PAY); PaySalaryComponent taxComponent = paySalaryComponentDao .getEntityBySpecificModelComponent(HRMConstant.MODEL_COMP_TAX); PaySalaryComponent ceilComponent = paySalaryComponentDao .getEntityBySpecificModelComponent(HRMConstant.MODEL_COMP_CEIL); List<PayTempKalkulasi> datas = new ArrayList<PayTempKalkulasi>(); ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine jsEngine = mgr.getEngineByName("JavaScript"); Double basicSalary = null; Double workingDay = null; Double lessTime = null; Double moreTime = null; Double overTIme = null; Double totalDay = this.getDefaultWorkingDay(startPeriodDate, endPeriodDate); //total working day dari kelompok kerja DEFAULT(reguler) Double outPut = null; //Start calculation List<EmpData> totalEmployee = empDataDao.getAllDataNotTerminateAndJoinDateLowerThan(endPeriodDate); /*List<EmpData> totalEmployee = new ArrayList<EmpData>(); EmpData emp = empDataDao.getEntiyByPK((long)130); totalEmployee.add(emp);*/ for (EmpData empData : totalEmployee) { LOGGER.info( " ============= EMPLOYEE : " + empData.getBioData().getFirstName() + " ====================="); /** * Set initial variabel untuk masing2 karyawan, * yang akan dibutuhkan untuk perhitungan model komponen FORMULA (if any) * */ basicSalary = Double.parseDouble(empData.getBasicSalaryDecrypted()); PayTempOvertime payTempOvertime = payTempOvertimeDao.getEntityByEmpDataId(empData.getId()); overTIme = payTempOvertime != null ? payTempOvertime.getOvertime() : 0.0; PayTempAttendanceStatus payTempAttendanceStatus = payTempAttendanceStatusDao .getEntityByEmpDataId(empData.getId()); workingDay = payTempAttendanceStatus != null ? (double) payTempAttendanceStatus.getTotalAttendance() : 0.0; lessTime = ((workingDay > 0) && (workingDay < totalDay)) ? totalDay - workingDay : 0.0; moreTime = (workingDay > totalDay) ? workingDay - totalDay : 0.0; /** * Saat ini totalIncome masih temporary, karena belum dikurangi * pajak dan pembulatan CSR Sedangkan untuk final totalIncome (take * home pay) ada di proses(step) selanjutnya di batch proses, * silahkan lihat batch-config.xml */ BigDecimal totalIncome = new BigDecimal(0); List<PayComponentDataException> payComponentExceptions = payComponentDataExceptionDao .getAllByEmpId(empData.getId()); for (PayComponentDataException dataException : payComponentExceptions) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(dataException.getPaySalaryComponent()); kalkulasi.setFactor( this.getFactorBasedCategory(dataException.getPaySalaryComponent().getComponentCategory())); kalkulasi.setNominal(dataException.getNominal()); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By ComponentDataException - " + dataException.getPaySalaryComponent().getName() + ", nominal : " + dataException.getNominal()); } int timeTmb = DateTimeUtil.getTotalDay(empData.getJoinDate(), createdOn); List<Long> componentIds = Lambda.extract(payComponentExceptions, Lambda.on(PayComponentDataException.class).getPaySalaryComponent().getId()); List<PaySalaryComponent> listPayComponetNotExcp = paySalaryComponentDao .getAllDataByEmpTypeIdAndActiveFromTmAndIdNotIn(empData.getEmployeeType().getId(), timeTmb, componentIds); if (null == Lambda.selectFirst(listPayComponetNotExcp, Lambda.having(Lambda.on(PaySalaryComponent.class).getModelComponent().getSpesific(), Matchers.equalTo(HRMConstant.MODEL_COMP_BASIC_SALARY))) && null == Lambda.selectFirst(payComponentExceptions, Lambda.having( Lambda.on(PayComponentDataException.class).getPaySalaryComponent() .getModelComponent().getSpesific(), Matchers.equalTo(HRMConstant.MODEL_COMP_BASIC_SALARY)))) { throw new BussinessException("global.error_user_does_not_have_basic_salary", empData.getNikWithFullName()); } for (PaySalaryComponent paySalaryComponent : listPayComponetNotExcp) { if (paySalaryComponent.getModelComponent().getSpesific().equals(HRMConstant.MODEL_COMP_UPLOAD)) { PayTempUploadData payUpload = this.payTempUploadDataDao .getEntityByEmpIdAndComponentId(empData.getId(), paySalaryComponent.getId()); if (payUpload != null) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(payUpload.getPaySalaryComponent()); kalkulasi.setFactor(this .getFactorBasedCategory(payUpload.getPaySalaryComponent().getComponentCategory())); BigDecimal nominal = new BigDecimal(payUpload.getNominalValue()); kalkulasi.setNominal(nominal); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Upload - " + payUpload.getPaySalaryComponent().getName() + ", nominal : " + nominal); } } else if (paySalaryComponent.getModelComponent().getSpesific() .equals(HRMConstant.MODEL_COMP_BASIC_SALARY)) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(paySalaryComponent); kalkulasi.setFactor(this.getFactorBasedCategory(paySalaryComponent.getComponentCategory())); BigDecimal nominal = new BigDecimal(empData.getBasicSalaryDecrypted()); if ((timeTmb / 30) < 1) { //jika TMB belum memenuhi satu bulan, jadi basic salary dibagi pro-rate nominal = nominal.divide(new BigDecimal(timeTmb), RoundingMode.UP); } kalkulasi.setNominal(nominal); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Basic Salary " + (((timeTmb / 30) < 1) ? "Not Full" : "Full") + ", nominal : " + nominal); } else if (paySalaryComponent.getModelComponent().getSpesific() .equals(HRMConstant.MODEL_COMP_LOAN)) { //cek apakah modelReferensi di paySalaryComponent valid atau tidak LoanNewType loanType = loanNewTypeDao .getEntiyByPK((long) paySalaryComponent.getModelReffernsil()); if (loanType == null) { throw new BussinessException("salaryCalculation.error_salary_component_reference", paySalaryComponent.getName()); } List<LoanNewApplicationInstallment> installments = loanNewApplicationInstallmentDao .getAllDataDisbursedByEmpDataIdAndLoanTypeIdAndPeriodDate(empData.getId(), loanType.getId(), startPeriodDate, endPeriodDate); for (LoanNewApplicationInstallment installment : installments) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(paySalaryComponent); kalkulasi.setFactor(this.getFactorBasedCategory(paySalaryComponent.getComponentCategory())); BigDecimal nominal = new BigDecimal(installment.getTotalPayment()); nominal = nominal.setScale(0, RoundingMode.UP); kalkulasi.setNominal(nominal); //set detail loan int termin = installment.getLoanNewApplication().getTermin(); long cicilanKe = termin - installment.getNumOfInstallment(); kalkulasi.setDetail(cicilanKe + "/" + termin); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Loan - " + paySalaryComponent.getName() + ", nominal : " + nominal); } } else if (paySalaryComponent.getModelComponent().getSpesific() .equals(HRMConstant.MODEL_COMP_REIMBURSEMENT)) { //cek apakah modelReferensi di paySalaryComponent valid atau tidak RmbsType rmbsType = rmbsTypeDao.getEntiyByPK((long) paySalaryComponent.getModelReffernsil()); if (rmbsType == null) { throw new BussinessException("salaryCalculation.error_salary_component_reference", paySalaryComponent.getName()); } List<RmbsApplication> reimbursments = rmbsApplicationDao .getAllDataDisbursedByEmpDataIdAndRmbsTypeIdAndPeriodDate(empData.getId(), rmbsType.getId(), startPeriodDate, endPeriodDate); for (RmbsApplication reimbursment : reimbursments) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(paySalaryComponent); kalkulasi.setFactor(this.getFactorBasedCategory(paySalaryComponent.getComponentCategory())); kalkulasi.setNominal(reimbursment.getNominal()); //set detail reimbursement kalkulasi.setDetail(reimbursment.getCode()); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Reimbursment, nominal : " + reimbursment.getNominal()); } } else if (paySalaryComponent.getModelComponent().getSpesific() .equals(HRMConstant.MODEL_COMP_FORMULA)) { String formulaOne = paySalaryComponent.getFormula(); if (formulaOne != null) { jsEngine.put("bS", basicSalary); jsEngine.put("wD", workingDay); jsEngine.put("lT", lessTime); jsEngine.put("mT", moreTime); jsEngine.put("oT", overTIme); jsEngine.put("tD", totalDay); outPut = (Double) jsEngine.eval(formulaOne); PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(paySalaryComponent); kalkulasi.setFactor(this.getFactorBasedCategory(paySalaryComponent.getComponentCategory())); BigDecimal nominal = new BigDecimal(outPut); kalkulasi.setNominal(nominal); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Formula, nominal : " + nominal); } } else if (paySalaryComponent.getModelComponent().getSpesific() .equals(HRMConstant.MODEL_COMP_BENEFIT_TABLE)) { //cek apakah modelReferensi di paySalaryComponent valid atau tidak BenefitGroup benefitGroup = benefitGroupDao .getEntiyByPK((long) paySalaryComponent.getModelReffernsil()); if (benefitGroup == null) { throw new BussinessException("salaryCalculation.error_salary_component_reference", paySalaryComponent.getName()); } //cek apakah tunjangan yg didapatkan sesuai dengan hak dari golonganJabatan karyawan BenefitGroupRate benefitGroupRate = benefitGroupRateDao .getEntityByBenefitGroupIdAndGolJabatanId(benefitGroup.getId(), empData.getGolonganJabatan().getId()); if (benefitGroupRate != null) { PayTempKalkulasi kalkulasi = new PayTempKalkulasi(); kalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); kalkulasi.setEmpData(empData); kalkulasi.setPaySalaryComponent(paySalaryComponent); kalkulasi.setFactor(this.getFactorBasedCategory(paySalaryComponent.getComponentCategory())); //nominal untuk benefit dikali nilai dari measurement BigDecimal nominal = new BigDecimal(benefitGroupRate.getNominal()).multiply(this .getMultiplierFromMeasurement(benefitGroupRate.getBenefitGroup().getMeasurement())); kalkulasi.setNominal(nominal); //set detail benefit kalkulasi.setDetail(benefitGroupRate.getGolonganJabatan().getCode()); kalkulasi.setCreatedBy(createdBy); kalkulasi.setCreatedOn(createdOn); datas.add(kalkulasi); totalIncome = this.calculateTotalIncome(totalIncome, kalkulasi); //calculate totalIncome temporary LOGGER.info("Save By Benefit - " + paySalaryComponent.getName() + ", nominal : " + nominal); } } } //create totalIncome Kalkulasi, hasil penjumlahan nominal dari semua component di atas PayTempKalkulasi totalIncomeKalkulasi = new PayTempKalkulasi(); totalIncomeKalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); totalIncomeKalkulasi.setEmpData(empData); totalIncomeKalkulasi.setPaySalaryComponent(totalIncomeComponent); totalIncomeKalkulasi .setFactor(this.getFactorBasedCategory(totalIncomeComponent.getComponentCategory())); totalIncomeKalkulasi.setNominal(totalIncome); totalIncomeKalkulasi.setCreatedBy(createdBy); totalIncomeKalkulasi.setCreatedOn(createdOn); datas.add(totalIncomeKalkulasi); //create initial tax Kalkulasi, set nominal 0. Akan dibutuhkan di batch proses step selanjutnya PayTempKalkulasi taxKalkulasi = new PayTempKalkulasi(); taxKalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); taxKalkulasi.setEmpData(empData); taxKalkulasi.setPaySalaryComponent(taxComponent); taxKalkulasi.setFactor(this.getFactorBasedCategory(taxComponent.getComponentCategory())); taxKalkulasi.setNominal(new BigDecimal(0)); taxKalkulasi.setCreatedBy(createdBy); taxKalkulasi.setCreatedOn(createdOn); datas.add(taxKalkulasi); //create initial ceil Kalkulasi, set nominal 0. Akan dibutuhkan di batch proses step selanjutnya PayTempKalkulasi ceilKalkulasi = new PayTempKalkulasi(); ceilKalkulasi.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); ceilKalkulasi.setEmpData(empData); ceilKalkulasi.setPaySalaryComponent(ceilComponent); ceilKalkulasi.setFactor(this.getFactorBasedCategory(ceilComponent.getComponentCategory())); ceilKalkulasi.setNominal(new BigDecimal(0)); ceilKalkulasi.setCreatedBy(createdBy); ceilKalkulasi.setCreatedOn(createdOn); datas.add(ceilKalkulasi); } return datas; }
From source file:azkaban.execapp.FlowRunner.java
private boolean evaluateExpression(final String expression) { boolean result = false; final ScriptEngineManager sem = new ScriptEngineManager(); final ScriptEngine se = sem.getEngineByName("JavaScript"); // Restrict permission using the two-argument form of doPrivileged() try {//from w w w . ja va 2 s. c o m final Object object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws ScriptException { return se.eval(expression); } }, new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, null) }) // no permissions ); if (object != null) { result = (boolean) object; } } catch (final Exception e) { this.logger.error("Failed to evaluate the expression.", e); } this.logger.info("Evaluate expression result: " + result); return result; }
From source file:org.zaproxy.zap.extension.zest.ExtensionZest.java
@Override public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getParam()); if (getView() != null) { extensionHook.addProxyListener(this); extensionHook.addSessionListener(new ViewSessionChangedListener()); extensionHook.getHookView().addStatusPanel(this.getZestResultsPanel()); extensionHook.getHookView().addOptionPanel(getOptionsPanel()); this.dialogManager = new ZestDialogManager(this, this.getExtScript().getScriptUI()); new ZestMenuManager(this, extensionHook); View.getSingleton().addMainToolbarButton(getRecordButton()); View.getSingleton().addMainToolbarSeparator(getToolbarSeparator()); if (getExtScript().getScriptUI() != null) { ZestTreeTransferHandler th = new ZestTreeTransferHandler(this); getExtScript().getScriptUI().addScriptTreeTransferHandler(ZestElementWrapper.class, th); }/*from w ww . ja v a2 s . c om*/ } List<Path> defaultTemplates = getDefaultTemplates(); ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine se = mgr.getEngineByName(ZestScriptEngineFactory.NAME); if (se != null) { // Looks like this only works if the Zest lib is in the top level // lib directory this.zestEngineFactory = (ZestScriptEngineFactory) se.getFactory(); } else { // Needed for when the Zest lib is in an add-on (usual case) this.zestEngineFactory = new ZestScriptEngineFactory(); se = zestEngineFactory.getScriptEngine(); } zestEngineWrapper = new ZestEngineWrapper(se, defaultTemplates); this.getExtScript().registerScriptEngineWrapper(zestEngineWrapper); this.getExtScript().addListener(this); if (this.getExtScript().getScriptUI() != null) { ZestTreeCellRenderer renderer = new ZestTreeCellRenderer(); this.getExtScript().getScriptUI().addRenderer(ZestElementWrapper.class, renderer); this.getExtScript().getScriptUI().addRenderer(ZestScriptWrapper.class, renderer); this.getExtScript().getScriptUI().disableScriptDialog(ZestScriptWrapper.class); } }
From source file:org.apache.jsp.fileUploader_jsp.java
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null;// www . ja v a2 s .com HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=utf-8"); pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("<!--\n"); out.write("Copyright 2012 The Infinit.e Open Source Project\n"); out.write("\n"); out.write("Licensed under the Apache License, Version 2.0 (the \"License\");\n"); out.write("you may not use this file except in compliance with the License.\n"); out.write("You may obtain a copy of the License at\n"); out.write("\n"); out.write(" http://www.apache.org/licenses/LICENSE-2.0\n"); out.write("\n"); out.write("Unless required by applicable law or agreed to in writing, software\n"); out.write("distributed under the License is distributed on an \"AS IS\" BASIS,\n"); out.write("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); out.write("See the License for the specific language governing permissions and\n"); out.write("limitations under the License.\n"); out.write("-->\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"); out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"); out.write("<head>\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"); out.write("<title>Infinit.e File Upload Tool</title>\n"); out.write("<style media=\"screen\" type=\"text/css\">\n"); out.write("\n"); out.write("body \n"); out.write("{\n"); out.write("\tfont: 14px Arial,sans-serif;\n"); out.write("}\n"); out.write("h2\n"); out.write("{\n"); out.write("\tfont-family: \"Times New Roman\";\n"); out.write("\tfont-style: italic;\n"); out.write("\tfont-variant: normal;\n"); out.write("\tfont-weight: normal;\n"); out.write("\tfont-size: 24px;\n"); out.write("\tline-height: 29px;\n"); out.write("\tfont-size-adjust: none;\n"); out.write("\tfont-stretch: normal;\n"); out.write("\t-x-system-font: none;\n"); out.write("\tcolor: #d2331f;\n"); out.write("\tmargin-bottom: 25px;\n"); out.write("}\n"); out.write(".show {\n"); out.write("display: ;\n"); out.write("visibility: visible;\n"); out.write("}\n"); out.write(".hide {\n"); out.write("display: none;\n"); out.write("visibility: hidden;\n"); out.write("}\n"); out.write("</style>\n"); out.write("<script language=\"javascript\" src=\"AppConstants.js\"> </script>\n"); out.write("</head>\n"); out.write("\n"); out.write("<body onload=\"populate()\">\n"); if (API_ROOT == null) { ServletContext context = session.getServletContext(); String realContextPath = context.getRealPath("/"); ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("javascript"); try { // EC2 Machines FileReader reader = new FileReader(realContextPath + "/AppConstants.js"); engine.eval(reader); reader.close(); engine.eval("output = getEndPointUrl();"); API_ROOT = (String) engine.get("output"); SHARE_ROOT = API_ROOT + "share/get/"; } catch (Exception je) { try { ////////////Windows + Tomcat FileReader reader = new FileReader(realContextPath + "\\..\\AppConstants.js"); engine.eval(reader); reader.close(); engine.eval("output = getEndPointUrl();"); API_ROOT = (String) engine.get("output"); SHARE_ROOT = API_ROOT + "share/get/"; } catch (Exception e) { System.err.println(e.toString()); } } if (null == API_ROOT) { // Default to localhost API_ROOT = "http://localhost:8080/api/"; SHARE_ROOT = "$infinite/share/get/"; } if (API_ROOT.contains("localhost")) localCookie = true; else localCookie = false; } Boolean isLoggedIn = isLoggedIn(request, response); if (isLoggedIn == null) { out.println("The Infinit.e API cannot be reached."); out.println(API_ROOT); } else if (isLoggedIn == true) { showAll = (request.getParameter("sudo") != null); DEBUG_MODE = (request.getParameter("debug") != null); communityList = generateCommunityList(request, response); if (request.getParameter("logout") != null) { logOut(request, response); out.println("<div style=\" text-align: center;\">"); out.println("<meta http-equiv=\"refresh\" content=\"0\">"); out.println("</div>"); } else { out.println("<div style=\" text-align: center;\">"); String contentType = request.getContentType(); if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); // Parse the request FileItemIterator iter = upload.getItemIterator(request); byte[] fileBytes = null; String fileDS = null; byte[] iconBytes = null; String iconDS = null; Set<String> communities = new HashSet<String>(); boolean isFileSet = false; while (iter.hasNext()) { FileItemStream item = iter.next(); String name = item.getFieldName(); InputStream stream = item.openStream(); if (item.isFormField()) { if (name.equalsIgnoreCase("communities")) { communities.add(Streams.asString(stream)); } else request.setAttribute(name, Streams.asString(stream)); //out.println("<b>" + name + ":</b>" + request.getAttribute(name).toString()+"</br>"); } else { if (name.equalsIgnoreCase("file")) { if (!item.getName().equals("")) isFileSet = true; fileDS = item.getContentType(); fileBytes = IOUtils.toByteArray(stream); // Check if this should be a java-archive (rather than just an octet stream) if (fileDS.equals("application/octet-stream")) { ZipInputStream zis = new ZipInputStream( new ByteArrayInputStream(fileBytes)); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (entry.getName().endsWith(".class")) { fileDS = "application/java-archive"; break; } } } // Reset stream, and read } } } ////////////////////////////////////Delete Share //////////////////////////////// if (request.getAttribute("deleteId") != null) { String fileId = request.getAttribute("deleteId").toString(); if (fileId != null && fileId != "") removeFromShare(fileId, request, response).toString(); } ////////////////////////////////////Update Community Info//////////////////////////////// else if (null == fileBytes) { String shareId = request.getAttribute("DBId").toString(); if (shareId != null && shareId != "") addRemoveCommunities(shareId, communities, request, response); } else { ////////////////////////////////////////////////////////////////////////////////// Boolean newUpload = (request.getAttribute("DBId").toString().length() == 0); ///////////////////////////////// SWF Manip ///////////////////////////////// String shareId = request.getAttribute("DBId").toString(); String fileUrl = ""; String fileId = ""; String bin = request.getAttribute("binary").toString(); if (request.getAttribute("title") != null && request.getAttribute("description") != null && fileBytes != null) { if (!isFileSet) //if not a binary file or file was not changed { fileId = shareId; if (shareId != null && shareId != "") addRemoveCommunities(shareId, communities, request, response); out.println("File was not set, just updated communities."); } else if (bin.equals("null")) //is a json file, make sure its okay and upload it { fileId = UpdateToShare(fileBytes, fileDS, request.getAttribute("title").toString(), request.getAttribute("description").toString(), shareId, communities, true, request.getAttribute("type").toString(), newUpload, request, response); } else //is a binary, do normal { fileId = UpdateToShare(fileBytes, fileDS, request.getAttribute("title").toString(), request.getAttribute("description").toString(), shareId, communities, false, request.getAttribute("type").toString(), newUpload, request, response); } if (fileId.contains("Failed")) { out.println(fileId); } else { fileUrl = SHARE_ROOT + fileId; if (newUpload) out.println( "You have successfully added a file to the share, its location is: " + fileUrl); else out.println( "You have successfully updated a file on the share, its location is: " + fileUrl); } } else { fileUrl = null; out.println("Error: Not enough information provided for file Upload"); } ///////////////////////////////// End File Manip ///////////////////////////////// out.println("</div>"); } } else { } out.write("\n"); out.write("\t\n"); out.write("\t<script>\n"); out.write("\tfunction clearCommList()\n"); out.write("\t\t{\n"); out.write("\t\t\tmult_comms = document.getElementById('communities');\n"); out.write("\t\t\tfor ( var i = 0, l = mult_comms.options.length, o; i < l; i++ )\n"); out.write("\t\t\t{\n"); out.write("\t\t\t o = mult_comms.options[i];\n"); out.write("\t\t\t o.selected = false;\n"); out.write("\t\t\t}\n"); out.write("\t\t}\n"); out.write("\t\tfunction highlightComms(commList)\n"); out.write("\t\t{\n"); out.write("\t\t\tmult_comms = document.getElementById('communities');\n"); out.write("\t\t\tfor ( var i = 0, l = mult_comms.options.length, o; i < l; i++ )\n"); out.write("\t\t\t{\n"); out.write("\t\t\t o = mult_comms.options[i];\n"); out.write("\t\t\t if(commList.indexOf(o.value) == -1)\n"); out.write("\t\t\t\to.selected = false;\n"); out.write("\t\t\t else \n"); out.write("\t\t\t \to.selected = true;\n"); out.write("\t\t\t}\n"); out.write("\t\t}\n"); out.write("\tfunction populate()\n"); out.write("\t{\n"); out.write("\t\tvar typerow = document.getElementById('typerow');\n"); out.write("\t\tvar type = document.getElementById('type');\n"); out.write("\t\tvar title = document.getElementById('title');\n"); out.write("\t\tvar description = document.getElementById('description');\n"); out.write("\t\tvar file = document.getElementById('file');\n"); out.write("\t\tvar created = document.getElementById('created');\n"); out.write("\t\tvar DBId = document.getElementById('DBId');\n"); out.write("\t\tvar deleteId = document.getElementById('deleteId');\n"); out.write("\t\tvar deleteButton = document.getElementById('deleteButton');\n"); out.write("\t\tvar share_url = document.getElementById('share_url');\n"); out.write("\t\tvar owner_text = document.getElementById('owner_text');\n"); out.write("\t\tvar owner = document.getElementById('owner');\n"); out.write("\t\tvar url_row = document.getElementById('url_row');\n"); out.write("\t\tvar dropdown = document.getElementById(\"upload_info\");\n"); out.write("\t\tvar list = dropdown.options[dropdown.selectedIndex].value;\n"); out.write("\t\tvar binary = document.getElementById(\"binary\");\n"); out.write("\t\t\n"); out.write("\t\tif (list == \"new\")\n"); out.write("\t\t{\n"); out.write("\t\t\ttitle.value = \"\";\n"); out.write("\t\t\tdescription.value = \"\";\n"); out.write("\t\t\ttype.value = \"binary\";\n"); out.write("\t\t\tcreated.value = \"\";\n"); out.write("\t\t\tDBId.value = \"\";\n"); out.write("\t\t\tdeleteId.value = \"\";\n"); out.write("\t\t\tshare_url.value = \"\";\n"); out.write("\t\t\towner.value = \"\";\n"); out.write("\t\t\ttyperow.className = \"hide\";\n"); out.write("\t\t\turl_row.className = \"hide\";\n"); out.write("\t\t\towner.className = \"hide\";\n"); out.write("\t\t\towner_text.className = \"hide\";\n"); out.write("\t\t\tdeleteButton.className = \"hide\";\n"); out.write("\t\t\tclearCommList();\n"); out.write("\t\t\tbinary.value = \"\";\n"); out.write("\t\t\treturn;\n"); out.write("\t\t}\n"); out.write("\t\t\n"); out.write("\t\tif ( list == \"newJSON\")\n"); out.write("\t\t{\n"); out.write("\t\t\ttitle.value = \"\";\n"); out.write("\t\t\tdescription.value = \"\";\n"); out.write("\t\t\ttype.value = \"\";\n"); out.write("\t\t\tcreated.value = \"\";\n"); out.write("\t\t\tDBId.value = \"\";\n"); out.write("\t\t\tdeleteId.value = \"\";\n"); out.write("\t\t\tshare_url.value = \"\";\n"); out.write("\t\t\towner.value = \"\";\n"); out.write("\t\t\ttyperow.className = \"show\";\n"); out.write("\t\t\turl_row.className = \"hide\";\n"); out.write("\t\t\towner.className = \"hide\";\n"); out.write("\t\t\towner_text.className = \"hide\";\n"); out.write("\t\t\tdeleteButton.className = \"hide\";\n"); out.write("\t\t\tclearCommList();\n"); out.write("\t\t\tbinary.value = \"null\";\n"); out.write("\t\t\treturn;\n"); out.write("\t\t}\n"); out.write("\t\t\n"); out.write("\t\t//_id, created, title, description\n"); out.write("\t\tsplit = list.split(\"$$$\");\n"); out.write("\t\t\n"); out.write("\t\tres_id = split[0];\n"); out.write("\t\tres_created = split[1];\n"); out.write("\t\tres_title = split[2];\n"); out.write("\t\tres_description = split[3];\n"); out.write("\t\tres_url = split[4];\n"); out.write("\t\tcommunities = split[5];\n"); out.write("\t\tres_owner = split[6];\n"); out.write("\t\tres_binary = split[7];\t\t\n"); out.write("\t\tres_type = split[8];\t\t\t\n"); out.write("\t\t\n"); out.write("\t\tif ( res_binary == \"null\" )\n"); out.write("\t\t{\n"); out.write("\t\t\ttyperow.className = \"show\";\n"); out.write("\t\t}\n"); out.write("\t\telse\n"); out.write("\t\t{\n"); out.write("\t\t\ttyperow.className = \"hide\";\n"); out.write("\t\t}\n"); out.write("\t\ttitle.value = res_title;\n"); out.write("\t\tdescription.value = res_description;\n"); out.write("\t\tcreated.value = res_created;\n"); out.write("\t\tDBId.value = res_id;\n"); out.write("\t\tdeleteId.value = res_id;\n"); out.write("\t\tshare_url.value = res_url;\n"); out.write("\t\towner.value = res_owner;\t\t\n"); out.write("\t\tdeleteButton.className = \"show\";\n"); out.write("\t\towner.className = \"show\";\n"); out.write("\t\towner_text.className = \"show\";\n"); out.write("\t\turl_row.className = \"show\";\n"); out.write("\t\thighlightComms(communities);\t\t\n"); out.write("\t\tbinary.value = res_binary;\n"); out.write("\t\ttype.value = res_type;\n"); out.write("\t}\n"); out.write("\t\tfunction validate_fields()\n"); out.write("\t\t{\n"); out.write("\t\t\ttitle = document.getElementById('title').value;\n"); out.write("\t\t\tdescription = document.getElementById('description').value;\n"); out.write("\t\t\tfile = document.getElementById('file').value;\n"); out.write("\t\t\tbinary = document.getElementById(\"binary\").value;\n"); out.write("\t\t\ttype = document.getElementById(\"type\").value;\n"); out.write("\t\t\t//share_url = document.getElementById('share_url').value;\n"); out.write("\t\t\t//file_url = document.getElementById('file_url').value;\n"); out.write("\t\t\t//file_check = document.getElementById('file_check').checked;\n"); out.write("\t\t\t\n"); out.write("\t\t\tif (title == \"\")\n"); out.write("\t\t\t{\n"); out.write("\t\t\t\talert('Please provide a title.');\n"); out.write("\t\t\t\treturn false;\n"); out.write("\t\t\t}\n"); out.write("\t\t\tif (description == \"\")\n"); out.write("\t\t\t{\n"); out.write("\t\t\t\talert('Please provide a description.');\n"); out.write("\t\t\t\treturn false;\n"); out.write("\t\t\t}\n"); out.write("\t\t\tif ( binary == \"null\" && type == \"\")\n"); out.write("\t\t\t{\n"); out.write("\t\t\t\talert('Please provide a type.');\n"); out.write("\t\t\t\treturn false;\n"); out.write("\t\t\t}\n"); out.write("\t\t\t\n"); out.write("\t\t\t\n"); out.write("\t\t}\n"); out.write("\t\tfunction confirmDelete()\n"); out.write("\t\t{\n"); out.write( "\t\t\tvar agree=confirm(\"Are you sure you wish to Delete this file from the File Share?\");\n"); out.write("\t\t\tif (agree)\n"); out.write("\t\t\t\treturn true ;\n"); out.write("\t\t\telse\n"); out.write("\t\t\t\treturn false ;\n"); out.write("\t\t}\n"); out.write("\t\tfunction showResults()\n"); out.write("\t\t{\n"); out.write("\t\t\tvar title = document.getElementById('DBId').value;\n"); out.write("\t\t\tvar url = getEndPointUrl() + \"share/get/\" + title;\n"); out.write("\t\t\twindow.open(url, '_blank');\n"); out.write("\t\t\twindow.focus();\t\t\t\n"); out.write("\t\t}\n"); out.write("\t\t// -->\n"); out.write("\t\t</script>\n"); out.write("\t</script>\n"); out.write( "\t\t<div id=\"uploader_outter_div\" name=\"uploader_outter_div\" align=\"center\" style=\"width:100%\" >\n"); out.write( "\t \t<div id=\"uploader_div\" name=\"uploader_div\" style=\"border-style:solid; border-color:#999999; border-radius: 10px; width:475px; margin:auto\">\n"); out.write("\t \t<h2>File Uploader</h2>\n"); out.write("\t \t<form id=\"search_form\" name=\"search_form\" method=\"get\">\n"); out.write("\t \t\t<div align=\"center\"\">\n"); out.write("\t \t\t<label for=\"ext\">Filter On</label>\n"); out.write("\t\t\t\t\t <select name=\"ext\" id=\"ext\" onchange=\"this.form.submit();\">\n"); out.write("\t\t\t\t\t "); out.print(populateMediaTypes(request, response)); out.write("\n"); out.write("\t\t\t\t\t </select>\n"); out.write("\t\t\t\t\t </div>\n"); out.write("\t\t\t\t\t "); if (showAll) out.print("<input type=\"hidden\" name=\"sudo\" id=\"sudo\" value=\"true\" />"); out.write("\t \t\t\n"); out.write("\t \t</form>\n"); out.write( "\t \t<form id=\"delete_form\" name=\"delete_form\" method=\"post\" enctype=\"multipart/form-data\" onsubmit=\"javascript:return confirmDelete()\" >\n"); out.write( "\t \t\t<select id=\"upload_info\" onchange=\"populate()\" name=\"upload_info\"><option value=\"new\">Upload New File</option><option value=\"newJSON\">Upload New JSON</option> "); out.print(populatePreviousUploads(request, response)); out.write("</select>\n"); out.write( "\t \t\t<input type=\"submit\" name=\"deleteButton\" id=\"deleteButton\" class=\"hidden\" value=\"Delete\" />\n"); out.write("\t \t\t<input type=\"hidden\" name=\"deleteId\" id=\"deleteId\" />\n"); out.write("\t \t\t<input type=\"hidden\" name=\"deleteFile\" id=\"deleteFile\" />\n"); out.write("\t\t\t\t\t "); if (showAll) out.print("<input type=\"hidden\" name=\"sudo\" id=\"sudo\" value=\"true\" />"); out.write("\t \t\t\n"); out.write("\t \t</form>\n"); out.write( "\t <form id=\"upload_form\" name=\"upload_form\" method=\"post\" enctype=\"multipart/form-data\" onsubmit=\"javascript:return validate_fields();\" >\n"); out.write( "\t <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"padding-left:10px; padding-right:10px\">\n"); out.write("\t <tr>\n"); out.write("\t <td colspan=\"2\" align=\"center\"></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write("\t <td>Title:</td>\n"); out.write( "\t <td><input type=\"text\" name=\"title\" id=\"title\" size=\"39\" /></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write("\t <td>Description:</td>\n"); out.write( "\t <td><textarea rows=\"4\" cols=\"30\" name=\"description\" id=\"description\" ></textarea></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr id=\"typerow\">\n"); out.write("\t <td>Type:</td>\n"); out.write( "\t <td><input type=\"text\" name=\"type\" id=\"type\" size=\"39\" /></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write("\t \t<td>Communities:</td>\n"); out.write("\t \t<td>"); out.print(communityList); out.write("</td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write("\t \t<td id=\"owner_text\">Owner:</td>\n"); out.write("\t \t<td>\n"); out.write( "\t <input type=\"text\" name=\"owner\" id=\"owner\" readonly=\"readonly\" size=\"25\" />\n"); out.write("\t \t</td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write("\t <td>File:</td>\n"); out.write("\t <td><input type=\"file\" name=\"file\" id=\"file\" /></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr id=\"url_row\" class=\"hide\">\n"); out.write("\t \t<td>Share URL:</td>\n"); out.write( "\t \t<td><input type=\"text\" name=\"share_url\" id=\"share_url\" readonly=\"readonly\" size=\"38\"/>\n"); out.write( "\t \t<input type=\"button\" onclick=\"showResults()\" value=\"View\"/>\n"); out.write("\t \t</td>\n"); out.write("\t \t<td></td>\n"); out.write("\t </tr>\n"); out.write("\t <tr>\n"); out.write( "\t <td colspan=\"2\" style=\"text-align:right\"><input type=\"submit\" value=\"Submit\" /></td>\n"); out.write("\t </tr>\n"); out.write("\t </table>\n"); out.write("\t\t\t\t\t<input type=\"hidden\" name=\"created\" id=\"created\" />\n"); out.write("\t\t\t\t\t<input type=\"hidden\" name=\"DBId\" id=\"DBId\" />\n"); out.write("\t\t\t\t\t<input type=\"hidden\" name=\"fileUrl\" id=\"fileUrl\" />\n"); out.write("\t\t\t\t\t<input type=\"hidden\" name=\"binary\" id=\"binary\" />\n"); out.write("\t\t\t\t\t "); if (showAll) out.print("<input type=\"hidden\" name=\"sudo\" id=\"sudo\" value=\"true\" />"); out.write("\t \t\t\n"); out.write("\t\t\t\t</form>\n"); out.write("\t </div>\n"); out.write("\t <form id=\"logout_form\" name=\"logout_form\" method=\"post\">\n"); out.write( "\t \t<input type=\"submit\" name=\"logout\" id = \"logout\" value=\"Log Out\" />\n"); out.write("\t </form>\n"); out.write("\t </div>\n"); out.write("\t </p>\n"); out.write("\t\n"); } } else if (isLoggedIn == false) { //localCookie =(request.getParameter("local") != null); //System.out.println("LocalCookie = " + localCookie.toString()); String errorMsg = ""; if (request.getParameter("logintext") != null || request.getParameter("passwordtext") != null) { if (logMeIn(request.getParameter("logintext"), request.getParameter("passwordtext"), request, response)) { showAll = (request.getParameter("sudo") != null); out.println("<meta http-equiv=\"refresh\" content=\"0\">"); out.println("Login Success"); } else { errorMsg = "Log in Failed, Please Try again"; } } out.write("\n"); out.write("\n"); out.write("<script>\n"); out.write("\tfunction validate_fields()\n"); out.write("\t{\n"); out.write("\t\tuname = document.getElementById('logintext').value;\n"); out.write("\t\tpword = document.getElementById('passwordtext').value;\n"); out.write("\t\t\n"); out.write("\t\tif (uname == \"\")\n"); out.write("\t\t{\n"); out.write("\t\t\talert('Please provide your username.');\n"); out.write("\t\t\treturn false;\n"); out.write("\t\t}\n"); out.write("\t\tif (pword == \"\")\n"); out.write("\t\t{\n"); out.write("\t\t\talert('Please provide your password.');\n"); out.write("\t\t\treturn false;\n"); out.write("\t\t}\n"); out.write("\t}\n"); out.write("\n"); out.write("\n"); out.write("</script>\n"); out.write( "\t<div id=\"login_outter_div\" name=\"login_outter_div\" align=\"center\" style=\"width:100%\" >\n"); out.write( " \t<div id=\"login_div\" name=\"login_div\" style=\"border-style:solid; border-color:#999999; border-radius: 10px; width:450px; margin:auto\">\n"); out.write(" \t<h2>Login</h2>\n"); out.write( " <form id=\"login_form\" name=\"login_form\" method=\"post\" onsubmit=\"javascript:return validate_fields();\" >\n"); out.write( " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"padding-left:10px\">\n"); out.write(" <tr>\n"); out.write(" <td>User Name</td>\n"); out.write(" <td> </td>\n"); out.write(" <td>Password</td>\n"); out.write(" </tr>\n"); out.write(" <tr>\n"); out.write( " <td><input type=\"text\" name=\"logintext\" id=\"logintext\" width=\"190px\" /></td>\n"); out.write(" <td> </td>\n"); out.write( " <td><input type=\"password\" name=\"passwordtext\" id=\"passwordtext\" width=\"190px\" /></td>\n"); out.write(" </tr>\n"); out.write(" <tr>\n"); out.write( " <td colspan=\"3\" align=\"right\"><input name=\"Login\" type=\"submit\" value=\"Login\" /></td>\n"); out.write(" </tr>\n"); out.write(" </table>\n"); out.write("\t\t\t</form>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write("\t<div style=\"color: red; text-align: center;\"> "); out.print(errorMsg); out.write(" </div>\n"); } out.write("\n"); out.write(" \n"); out.write(" \n"); out.write("</body>\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
From source file:talonetl.getproperties_0_2.getProperties.java
public void tFileInputXML_1Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputXML_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*from www .j av a2s. c o m*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; tMysqlInput_1Process(globalMap); tMysqlInput_5Process(globalMap); tMysqlInput_3Process(globalMap); row1Struct row1 = new row1Struct(); stateInfoStruct stateInfo = new stateInfoStruct(); row2Struct row2 = new row2Struct(); row3Struct row3 = new row3Struct(); row5Struct row5 = new row5Struct(); loadNewStateInfoStruct loadNewStateInfo = new loadNewStateInfoStruct(); propertyDataStruct propertyData = new propertyDataStruct(); mappedDataStruct mappedData = new mappedDataStruct(); loadDataStruct loadData = new loadDataStruct(); row9Struct row9 = new row9Struct(); row14Struct row14 = new row14Struct(); mainPropertyDataLoadStruct mainPropertyDataLoad = new mainPropertyDataLoadStruct(); /** * [tFlowToIterate_1 begin ] start */ int NB_ITERATE_tFileInputJSON_1 = 0; // for statistics ok_Hash.put("tFlowToIterate_1", false); start_Hash.put("tFlowToIterate_1", System.currentTimeMillis()); currentComponent = "tFlowToIterate_1"; int tos_count_tFlowToIterate_1 = 0; int nb_line_tFlowToIterate_1 = 0; int counter_tFlowToIterate_1 = 0; /** * [tFlowToIterate_1 begin ] stop */ /** * [tMysqlOutput_1 begin ] start */ ok_Hash.put("tMysqlOutput_1", false); start_Hash.put("tMysqlOutput_1", System.currentTimeMillis()); currentComponent = "tMysqlOutput_1"; int tos_count_tMysqlOutput_1 = 0; int nb_line_tMysqlOutput_1 = 0; int nb_line_update_tMysqlOutput_1 = 0; int nb_line_inserted_tMysqlOutput_1 = 0; int nb_line_deleted_tMysqlOutput_1 = 0; int nb_line_rejected_tMysqlOutput_1 = 0; int deletedCount_tMysqlOutput_1 = 0; int updatedCount_tMysqlOutput_1 = 0; int insertedCount_tMysqlOutput_1 = 0; int rejectedCount_tMysqlOutput_1 = 0; String tableName_tMysqlOutput_1 = "PROPERTY_DATA"; boolean whetherReject_tMysqlOutput_1 = false; java.util.Calendar calendar_tMysqlOutput_1 = java.util.Calendar.getInstance(); calendar_tMysqlOutput_1.set(1, 0, 1, 0, 0, 0); long year1_tMysqlOutput_1 = calendar_tMysqlOutput_1.getTime().getTime(); calendar_tMysqlOutput_1.set(10000, 0, 1, 0, 0, 0); long year10000_tMysqlOutput_1 = calendar_tMysqlOutput_1.getTime().getTime(); long date_tMysqlOutput_1; java.sql.Connection conn_tMysqlOutput_1 = null; java.util.Map<String, routines.system.TalendDataSource> dataSources_tMysqlOutput_1 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != dataSources_tMysqlOutput_1) { conn_tMysqlOutput_1 = dataSources_tMysqlOutput_1.get("").getConnection(); } else { String dbProperties_tMysqlOutput_1 = "noDatetimeStringSync=true"; String url_tMysqlOutput_1 = null; if (dbProperties_tMysqlOutput_1 == null || dbProperties_tMysqlOutput_1.trim().length() == 0) { url_tMysqlOutput_1 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + "rewriteBatchedStatements=true"; } else { String properties_tMysqlOutput_1 = "noDatetimeStringSync=true"; if (!properties_tMysqlOutput_1.contains("rewriteBatchedStatements")) { properties_tMysqlOutput_1 += "&rewriteBatchedStatements=true"; } url_tMysqlOutput_1 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + properties_tMysqlOutput_1; } String dbUser_tMysqlOutput_1 = "dbAdmin"; String dbPwd_tMysqlOutput_1 = "1nn0s2013"; java.lang.Class.forName("org.gjt.mm.mysql.Driver"); conn_tMysqlOutput_1 = java.sql.DriverManager.getConnection(url_tMysqlOutput_1, dbUser_tMysqlOutput_1, dbPwd_tMysqlOutput_1); } conn_tMysqlOutput_1.setAutoCommit(false); int commitEvery_tMysqlOutput_1 = 10000; int commitCounter_tMysqlOutput_1 = 0; int count_tMysqlOutput_1 = 0; String insert_tMysqlOutput_1 = "INSERT INTO `" + "PROPERTY_DATA" + "` (`ID`,`UUID`,`PROP_NAME`,`PRICE`,`SQFT`,`DESCRIPTION`,`NUM_BEDS`,`NUM_BATHS`,`TYPE`,`STATUS`,`STATE_INFO_ID`,`DATA_SOURCE_ID`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; int batchSize_tMysqlOutput_1 = 100; int batchSizeCounter_tMysqlOutput_1 = 0; java.sql.PreparedStatement pstmt_tMysqlOutput_1 = conn_tMysqlOutput_1 .prepareStatement(insert_tMysqlOutput_1); /** * [tMysqlOutput_1 begin ] stop */ /** * [tMap_8 begin ] start */ ok_Hash.put("tMap_8", false); start_Hash.put("tMap_8", System.currentTimeMillis()); currentComponent = "tMap_8"; int tos_count_tMap_8 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_8__Struct { } Var__tMap_8__Struct Var__tMap_8 = new Var__tMap_8__Struct(); // ############################### // ############################### // # Outputs initialization mainPropertyDataLoadStruct mainPropertyDataLoad_tmp = new mainPropertyDataLoadStruct(); // ############################### /** * [tMap_8 begin ] stop */ /** * [tJavaRow_3 begin ] start */ ok_Hash.put("tJavaRow_3", false); start_Hash.put("tJavaRow_3", System.currentTimeMillis()); currentComponent = "tJavaRow_3"; int tos_count_tJavaRow_3 = 0; int nb_line_tJavaRow_3 = 0; /** * [tJavaRow_3 begin ] stop */ /** * [tJoin_3 begin ] start */ ok_Hash.put("tJoin_3", false); start_Hash.put("tJoin_3", System.currentTimeMillis()); currentComponent = "tJoin_3"; int tos_count_tJoin_3 = 0; final java.util.Map<getCurrentPropertiesStruct, getCurrentPropertiesStruct> tHash_tJoin_3 = (java.util.Map<getCurrentPropertiesStruct, getCurrentPropertiesStruct>) globalMap .get("tHash_getCurrentProperties"); class Util_tJoin_3 { getCurrentPropertiesStruct lookupValue = null; getCurrentPropertiesStruct getCurrentPropertiesHashKey = new getCurrentPropertiesStruct(); public boolean isJoined(loadDataStruct mainRow) { getCurrentPropertiesHashKey.PROP_NAME = mainRow.PROP_NAME; getCurrentPropertiesHashKey.hashCodeDirty = true; lookupValue = tHash_tJoin_3.get(getCurrentPropertiesHashKey); if (lookupValue != null) { return true; } return false; } } Util_tJoin_3 util_tJoin_3 = new Util_tJoin_3(); int nb_line_tJoin_3 = 0; /** * [tJoin_3 begin ] stop */ /** * [tMap_4 begin ] start */ ok_Hash.put("tMap_4", false); start_Hash.put("tMap_4", System.currentTimeMillis()); currentComponent = "tMap_4"; int tos_count_tMap_4 = 0; // ############################### // # Lookup's keys initialization org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<custDataStruct> tHash_Lookup_custData = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<custDataStruct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<custDataStruct>) globalMap .get("tHash_Lookup_custData")); custDataStruct custDataHashKey = new custDataStruct(); custDataStruct custDataDefault = new custDataStruct(); // ############################### // ############################### // # Vars initialization class Var__tMap_4__Struct { } Var__tMap_4__Struct Var__tMap_4 = new Var__tMap_4__Struct(); // ############################### // ############################### // # Outputs initialization loadDataStruct loadData_tmp = new loadDataStruct(); // ############################### /** * [tMap_4 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row6Struct> tHash_Lookup_row6 = null; org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row6Struct> tHash_Lookup_Cache_row6 = org.talend.designer.components.lookup.memory.AdvancedMemoryLookup .<row6Struct>getLookup( org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.UNIQUE_MATCH); org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row6Struct> tHash_Lookup_Real_row6 = null; row6Struct row6HashKey = new row6Struct(); row6Struct row6Default = new row6Struct(); // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization mappedDataStruct mappedData_tmp = new mappedDataStruct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tMap_2 begin ] start */ ok_Hash.put("tMap_2", false); start_Hash.put("tMap_2", System.currentTimeMillis()); currentComponent = "tMap_2"; int tos_count_tMap_2 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_2__Struct { } Var__tMap_2__Struct Var__tMap_2 = new Var__tMap_2__Struct(); // ############################### // ############################### // # Outputs initialization stateInfoStruct stateInfo_tmp = new stateInfoStruct(); propertyDataStruct propertyData_tmp = new propertyDataStruct(); // ############################### /** * [tMap_2 begin ] stop */ /** * [tFileInputXML_1 begin ] start */ ok_Hash.put("tFileInputXML_1", false); start_Hash.put("tFileInputXML_1", System.currentTimeMillis()); currentComponent = "tFileInputXML_1"; int tos_count_tFileInputXML_1 = 0; int nb_line_tFileInputXML_1 = 0; String os_tFileInputXML_1 = System.getProperty("os.name").toLowerCase(); boolean isWindows_tFileInputXML_1 = false; if (os_tFileInputXML_1.indexOf("windows") > -1 || os_tFileInputXML_1.indexOf("nt") > -1) { isWindows_tFileInputXML_1 = true; } class XML_API_tFileInputXML_1 { public boolean isDefNull(String[] node) throws javax.xml.transform.TransformerException { if (node[0] != null && node[1] != null && ("true").equals(node[1])) { return true; } return false; } public boolean isMissing(String[] node) throws javax.xml.transform.TransformerException { return node[0] == null ? true : false; } public boolean isEmpty(String[] node) throws javax.xml.transform.TransformerException { if (node[0] != null) { return node[0].length() == 0; } return false; } } XML_API_tFileInputXML_1 xml_api_tFileInputXML_1 = new XML_API_tFileInputXML_1(); String[] queryPaths_tFileInputXML_1 = new String[] { "name", "name" + "/@xsi:nil", "../media/images/image/url", "../media/images/image/url" + "/@xsi:nil", "../media/images/image/title", "../media/images/image/title" + "/@xsi:nil", "pba__propertytype__c", "pba__propertytype__c" + "/@xsi:nil", "rented_status__c", "rented_status__c" + "/@xsi:nil", "zipcode__c", "zipcode__c" + "/@xsi:nil", "pba__city_pb__c", "pba__city_pb__c" + "/@xsi:nil", "pba__description_pb__c", "pba__description_pb__c" + "/@xsi:nil", "term_2__c", "term_2__c" + "/@xsi:nil", "term_1__c", "term_1__c" + "/@xsi:nil", "pba__status__c", "pba__status__c" + "/@xsi:nil", "year_built__c", "year_built__c" + "/@xsi:nil", "pba__address_pb__c", "pba__address_pb__c" + "/@xsi:nil", "financed_net_yield_1__c", "financed_net_yield_1__c" + "/@xsi:nil", "monthly_cash_flow_with_financing_2__c", "monthly_cash_flow_with_financing_2__c" + "/@xsi:nil", "financed_net_yield_2__c", "financed_net_yield_2__c" + "/@xsi:nil", "monthly_cash_flow_with_financing_1__c", "monthly_cash_flow_with_financing_1__c" + "/@xsi:nil", "interest_rate_2__c", "interest_rate_2__c" + "/@xsi:nil", "interest_rate_1__c", "interest_rate_1__c" + "/@xsi:nil", "monthly_cash_flow__c", "monthly_cash_flow__c" + "/@xsi:nil", "noi__c", "noi__c" + "/@xsi:nil", "noi_with_financing_2__c", "noi_with_financing_2__c" + "/@xsi:nil", "noi_with_financing_1__c", "noi_with_financing_1__c" + "/@xsi:nil", "price_per_ft__c", "price_per_ft__c" + "/@xsi:nil", "price__c", "price__c" + "/@xsi:nil", "yearly_interest_payment_1__c", "yearly_interest_payment_1__c" + "/@xsi:nil", "monthly_interest_payment_2__c", "monthly_interest_payment_2__c" + "/@xsi:nil", "interest_payment_1__c", "interest_payment_1__c" + "/@xsi:nil", "down_payment_2__c", "down_payment_2__c" + "/@xsi:nil", "down_payment_1__c", "down_payment_1__c" + "/@xsi:nil", "cash_net_yield__c", "cash_net_yield__c" + "/@xsi:nil", "monthly_management__c", "monthly_management__c" + "/@xsi:nil", "management__c", "management__c" + "/@xsi:nil", "monthly_insurance__c", "monthly_insurance__c" + "/@xsi:nil", "insurance__c", "insurance__c" + "/@xsi:nil", "taxes__c", "taxes__c" + "/@xsi:nil", "monthly_taxes__c", "monthly_taxes__c" + "/@xsi:nil", "monthlyrent__c", "monthlyrent__c" + "/@xsi:nil", "annual_rents__c", "annual_rents__c" + "/@xsi:nil", "est_of_market_value__c", "est_of_market_value__c" + "/@xsi:nil", "est_value_per_rent_multiplier__c", "est_value_per_rent_multiplier__c" + "/@xsi:nil", "estimated_value__c", "estimated_value__c" + "/@xsi:nil", "est_replacement_cost_per_sq_ft__c", "est_replacement_cost_per_sq_ft__c" + "/@xsi:nil", "est_replacement_cost__c", "est_replacement_cost__c" + "/@xsi:nil", "pba__totalarea_pb__c", "pba__totalarea_pb__c" + "/@xsi:nil", "bedrooms__c", "bedrooms__c" + "/@xsi:nil", "bathrooms__c", "bathrooms__c" + "/@xsi:nil" }; boolean[] asXMLs_tFileInputXML_1 = new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }; String str_tFileInputXML_1 = ""; String[] node_tFileInputXML_1 = null; org.talend.xml.sax.SAXLooper looper_tFileInputXML_1 = new org.talend.xml.sax.SAXLooper( "/result/listings/listing/data", queryPaths_tFileInputXML_1, asXMLs_tFileInputXML_1); looper_tFileInputXML_1.setEncoding("UTF-8"); Object filename_tFileInputXML_1 = null; try { filename_tFileInputXML_1 = ((java.io.InputStream) globalMap.get("tFileFetch_1_INPUT_STREAM")); } catch (Exception e) { System.err.println(e.getMessage()); } if (filename_tFileInputXML_1 != null && filename_tFileInputXML_1 instanceof String && filename_tFileInputXML_1.toString().startsWith("//")) { if (!isWindows_tFileInputXML_1) { filename_tFileInputXML_1 = filename_tFileInputXML_1.toString().replaceFirst("//", "/"); } } if (filename_tFileInputXML_1 instanceof java.io.InputStream) { looper_tFileInputXML_1.parse((java.io.InputStream) filename_tFileInputXML_1); } else { looper_tFileInputXML_1.parse(String.valueOf(filename_tFileInputXML_1)); } java.util.Iterator<java.util.Map<String, String>> it_tFileInputXML_1 = looper_tFileInputXML_1 .iterator(); while (it_tFileInputXML_1.hasNext()) { java.util.Map<String, String> row_tFileInputXML_1 = it_tFileInputXML_1.next(); nb_line_tFileInputXML_1++; row1 = null; boolean whetherReject_tFileInputXML_1 = false; row1 = new row1Struct(); try { str_tFileInputXML_1 = row_tFileInputXML_1.get("name"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("name" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.name = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.name = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.name = null; } else { row1.name = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("../media/images/image/url"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("../media/images/image/url" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.image_url = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.image_url = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.image_url = null; } else { row1.image_url = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("../media/images/image/title"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("../media/images/image/title" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.image_title = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.image_title = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.image_title = null; } else { row1.image_title = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__propertytype__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__propertytype__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__propertytype__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.pba__propertytype__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__propertytype__c = null; } else { row1.pba__propertytype__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("rented_status__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("rented_status__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.rented_status__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.rented_status__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.rented_status__c = null; } else { row1.rented_status__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("zipcode__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("zipcode__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.zipcode__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.zipcode__c = null; } else { row1.zipcode__c = ParserUtils.parseTo_Integer(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__city_pb__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__city_pb__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__city_pb__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.pba__city_pb__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__city_pb__c = null; } else { row1.pba__city_pb__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__description_pb__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__description_pb__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__description_pb__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.pba__description_pb__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__description_pb__c = null; } else { row1.pba__description_pb__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("term_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("term_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.term_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.term_2__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.term_2__c = null; } else { row1.term_2__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("term_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("term_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.term_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.term_1__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.term_1__c = null; } else { row1.term_1__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__status__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__status__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__status__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.pba__status__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__status__c = null; } else { row1.pba__status__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("year_built__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("year_built__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.year_built__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.year_built__c = null; } else { row1.year_built__c = ParserUtils.parseTo_Integer(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__address_pb__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__address_pb__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__address_pb__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.pba__address_pb__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__address_pb__c = null; } else { row1.pba__address_pb__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("financed_net_yield_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("financed_net_yield_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.financed_net_yield_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.financed_net_yield_1__c = null; } else { row1.financed_net_yield_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_cash_flow_with_financing_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_cash_flow_with_financing_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_cash_flow_with_financing_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_cash_flow_with_financing_2__c = null; } else { row1.monthly_cash_flow_with_financing_2__c = ParserUtils .parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("financed_net_yield_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("financed_net_yield_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.financed_net_yield_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.financed_net_yield_2__c = null; } else { row1.financed_net_yield_2__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_cash_flow_with_financing_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_cash_flow_with_financing_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_cash_flow_with_financing_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_cash_flow_with_financing_1__c = null; } else { row1.monthly_cash_flow_with_financing_1__c = ParserUtils .parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("interest_rate_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("interest_rate_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.interest_rate_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.interest_rate_2__c = null; } else { row1.interest_rate_2__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("interest_rate_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("interest_rate_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.interest_rate_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.interest_rate_1__c = null; } else { row1.interest_rate_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_cash_flow__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_cash_flow__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_cash_flow__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_cash_flow__c = null; } else { row1.monthly_cash_flow__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("noi__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("noi__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.noi__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.noi__c = null; } else { row1.noi__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("noi_with_financing_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("noi_with_financing_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.noi_with_financing_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.noi_with_financing_2__c = null; } else { row1.noi_with_financing_2__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("noi_with_financing_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("noi_with_financing_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.noi_with_financing_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.noi_with_financing_1__c = null; } else { row1.noi_with_financing_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("price_per_ft__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("price_per_ft__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.price_per_ft__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.price_per_ft__c = null; } else { row1.price_per_ft__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("price__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("price__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.price__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.price__c = null; } else { row1.price__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("yearly_interest_payment_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("yearly_interest_payment_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.yearly_interest_payment_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.yearly_interest_payment_1__c = null; } else { row1.yearly_interest_payment_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_interest_payment_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_interest_payment_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_interest_payment_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_interest_payment_2__c = null; } else { row1.monthly_interest_payment_2__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("interest_payment_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("interest_payment_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.interest_payment_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.interest_payment_1__c = null; } else { row1.interest_payment_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("down_payment_2__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("down_payment_2__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.down_payment_2__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.down_payment_2__c = null; } else { row1.down_payment_2__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("down_payment_1__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("down_payment_1__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.down_payment_1__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.down_payment_1__c = null; } else { row1.down_payment_1__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("cash_net_yield__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("cash_net_yield__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.cash_net_yield__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.cash_net_yield__c = null; } else { row1.cash_net_yield__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_management__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_management__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_management__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_management__c = null; } else { row1.monthly_management__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("management__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("management__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.management__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.management__c = null; } else { row1.management__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_insurance__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_insurance__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_insurance__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_insurance__c = null; } else { row1.monthly_insurance__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("insurance__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("insurance__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.insurance__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.insurance__c = null; } else { row1.insurance__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("taxes__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("taxes__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.taxes__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.taxes__c = null; } else { row1.taxes__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthly_taxes__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthly_taxes__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthly_taxes__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthly_taxes__c = null; } else { row1.monthly_taxes__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("monthlyrent__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("monthlyrent__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.monthlyrent__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.monthlyrent__c = null; } else { row1.monthlyrent__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("annual_rents__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("annual_rents__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.annual_rents__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.annual_rents__c = null; } else { row1.annual_rents__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("est_of_market_value__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("est_of_market_value__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.est_of_market_value__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.est_of_market_value__c = null; } else { row1.est_of_market_value__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("est_value_per_rent_multiplier__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("est_value_per_rent_multiplier__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.est_value_per_rent_multiplier__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.est_value_per_rent_multiplier__c = null; } else { row1.est_value_per_rent_multiplier__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("estimated_value__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("estimated_value__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.estimated_value__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1)) { row1.estimated_value__c = ""; } else if (xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.estimated_value__c = null; } else { row1.estimated_value__c = str_tFileInputXML_1; } str_tFileInputXML_1 = row_tFileInputXML_1.get("est_replacement_cost_per_sq_ft__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("est_replacement_cost_per_sq_ft__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.est_replacement_cost_per_sq_ft__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.est_replacement_cost_per_sq_ft__c = null; } else { row1.est_replacement_cost_per_sq_ft__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("est_replacement_cost__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("est_replacement_cost__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.est_replacement_cost__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.est_replacement_cost__c = null; } else { row1.est_replacement_cost__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("pba__totalarea_pb__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("pba__totalarea_pb__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.pba__totalarea_pb__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.pba__totalarea_pb__c = null; } else { row1.pba__totalarea_pb__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("bedrooms__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("bedrooms__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.bedrooms__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.bedrooms__c = null; } else { row1.bedrooms__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } str_tFileInputXML_1 = row_tFileInputXML_1.get("bathrooms__c"); node_tFileInputXML_1 = new String[] { str_tFileInputXML_1, row_tFileInputXML_1.get("bathrooms__c" + "/@xsi:nil") }; if (xml_api_tFileInputXML_1.isDefNull(node_tFileInputXML_1)) { row1.bathrooms__c = null; } else if (xml_api_tFileInputXML_1.isEmpty(node_tFileInputXML_1) || xml_api_tFileInputXML_1.isMissing(node_tFileInputXML_1)) { row1.bathrooms__c = null; } else { row1.bathrooms__c = ParserUtils.parseTo_Float(str_tFileInputXML_1); } } catch (Exception e) { whetherReject_tFileInputXML_1 = true; System.err.println(e.getMessage()); row1 = null; } /** * [tFileInputXML_1 begin ] stop */ /** * [tFileInputXML_1 main ] start */ currentComponent = "tFileInputXML_1"; tos_count_tFileInputXML_1++; /** * [tFileInputXML_1 main ] stop */ // Start of branch "row1" if (row1 != null) { /** * [tMap_2 main ] start */ currentComponent = "tMap_2"; boolean hasCasePrimitiveKeyWithNull_tMap_2 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_2 = false; boolean mainRowRejected_tMap_2 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_2__Struct Var = Var__tMap_2;// ############################### // ############################### // # Output tables stateInfo = null; propertyData = null; // # Output table : 'stateInfo' stateInfo_tmp.zipcode__c = row1.zipcode__c; stateInfo_tmp.pba__city_pb__c = row1.pba__city_pb__c; stateInfo = stateInfo_tmp; // # Output table : 'propertyData' propertyData_tmp.name = row1.name; propertyData_tmp.image_url = row1.image_url; propertyData_tmp.image_title = row1.image_title; propertyData_tmp.pba__propertytype__c = row1.pba__propertytype__c; propertyData_tmp.rented_status__c = row1.rented_status__c; propertyData_tmp.zipcode__c = row1.zipcode__c; propertyData_tmp.pba__city_pb__c = row1.pba__city_pb__c; propertyData_tmp.pba__description_pb__c = row1.pba__description_pb__c; propertyData_tmp.term_2__c = row1.term_2__c; propertyData_tmp.term_1__c = row1.term_1__c; propertyData_tmp.pba__status__c = row1.pba__status__c; propertyData_tmp.year_built__c = row1.year_built__c; propertyData_tmp.pba__address_pb__c = row1.pba__address_pb__c; propertyData_tmp.financed_net_yield_1__c = row1.financed_net_yield_1__c; propertyData_tmp.monthly_cash_flow_with_financing_2__c = row1.monthly_cash_flow_with_financing_2__c; propertyData_tmp.financed_net_yield_2__c = row1.financed_net_yield_2__c; propertyData_tmp.monthly_cash_flow_with_financing_1__c = row1.monthly_cash_flow_with_financing_1__c; propertyData_tmp.interest_rate_2__c = row1.interest_rate_2__c; propertyData_tmp.interest_rate_1__c = row1.interest_rate_1__c; propertyData_tmp.monthly_cash_flow__c = row1.monthly_cash_flow__c; propertyData_tmp.noi__c = row1.noi__c; propertyData_tmp.noi_with_financing_2__c = row1.noi_with_financing_2__c; propertyData_tmp.noi_with_financing_1__c = row1.noi_with_financing_1__c; propertyData_tmp.price_per_ft__c = row1.price_per_ft__c; propertyData_tmp.price__c = row1.price__c; propertyData_tmp.yearly_interest_payment_1__c = row1.yearly_interest_payment_1__c; propertyData_tmp.monthly_interest_payment_2__c = row1.monthly_interest_payment_2__c; propertyData_tmp.interest_payment_1__c = row1.interest_payment_1__c; propertyData_tmp.down_payment_2__c = row1.down_payment_2__c; propertyData_tmp.down_payment_1__c = row1.down_payment_1__c; propertyData_tmp.cash_net_yield__c = row1.cash_net_yield__c; propertyData_tmp.monthly_management__c = row1.monthly_management__c; propertyData_tmp.management__c = row1.management__c; propertyData_tmp.monthly_insurance__c = row1.monthly_insurance__c; propertyData_tmp.insurance__c = row1.insurance__c; propertyData_tmp.taxes__c = row1.taxes__c; propertyData_tmp.monthly_taxes__c = row1.monthly_taxes__c; propertyData_tmp.monthlyrent__c = row1.monthlyrent__c; propertyData_tmp.annual_rents__c = row1.annual_rents__c; propertyData_tmp.est_of_market_value__c = row1.est_of_market_value__c; propertyData_tmp.est_value_per_rent_multiplier__c = row1.est_value_per_rent_multiplier__c; propertyData_tmp.estimated_value__c = row1.estimated_value__c; propertyData_tmp.est_replacement_cost_per_sq_ft__c = row1.est_replacement_cost_per_sq_ft__c; propertyData_tmp.est_replacement_cost__c = row1.est_replacement_cost__c; propertyData_tmp.pba__totalarea_pb__c = row1.pba__totalarea_pb__c; propertyData_tmp.bedrooms__c = row1.bedrooms__c; propertyData_tmp.bathrooms__c = row1.bathrooms__c; propertyData = propertyData_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_2 = false; tos_count_tMap_2++; /** * [tMap_2 main ] stop */ // Start of branch "stateInfo" if (stateInfo != null) { /** * [tFlowToIterate_1 main ] start */ currentComponent = "tFlowToIterate_1"; globalMap.put("zipCode", stateInfo.zipcode__c); nb_line_tFlowToIterate_1++; counter_tFlowToIterate_1++; globalMap.put("tFlowToIterate_1_CURRENT_ITERATION", counter_tFlowToIterate_1); tos_count_tFlowToIterate_1++; /** * [tFlowToIterate_1 main ] stop */ NB_ITERATE_tFileInputJSON_1++; iterateLoop++; /** * [tMysqlOutput_4 begin ] start */ ok_Hash.put("tMysqlOutput_4", false); start_Hash.put("tMysqlOutput_4", System.currentTimeMillis()); currentComponent = "tMysqlOutput_4"; int tos_count_tMysqlOutput_4 = 0; int nb_line_tMysqlOutput_4 = 0; int nb_line_update_tMysqlOutput_4 = 0; int nb_line_inserted_tMysqlOutput_4 = 0; int nb_line_deleted_tMysqlOutput_4 = 0; int nb_line_rejected_tMysqlOutput_4 = 0; int deletedCount_tMysqlOutput_4 = 0; int updatedCount_tMysqlOutput_4 = 0; int insertedCount_tMysqlOutput_4 = 0; int rejectedCount_tMysqlOutput_4 = 0; String tableName_tMysqlOutput_4 = "STATE_INFO"; boolean whetherReject_tMysqlOutput_4 = false; java.util.Calendar calendar_tMysqlOutput_4 = java.util.Calendar.getInstance(); calendar_tMysqlOutput_4.set(1, 0, 1, 0, 0, 0); long year1_tMysqlOutput_4 = calendar_tMysqlOutput_4.getTime().getTime(); calendar_tMysqlOutput_4.set(10000, 0, 1, 0, 0, 0); long year10000_tMysqlOutput_4 = calendar_tMysqlOutput_4.getTime().getTime(); long date_tMysqlOutput_4; java.sql.Connection conn_tMysqlOutput_4 = null; java.util.Map<String, routines.system.TalendDataSource> dataSources_tMysqlOutput_4 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != dataSources_tMysqlOutput_4) { conn_tMysqlOutput_4 = dataSources_tMysqlOutput_4.get("").getConnection(); } else { String dbProperties_tMysqlOutput_4 = "noDatetimeStringSync=true"; String url_tMysqlOutput_4 = null; if (dbProperties_tMysqlOutput_4 == null || dbProperties_tMysqlOutput_4.trim().length() == 0) { url_tMysqlOutput_4 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + "rewriteBatchedStatements=true"; } else { String properties_tMysqlOutput_4 = "noDatetimeStringSync=true"; if (!properties_tMysqlOutput_4.contains("rewriteBatchedStatements")) { properties_tMysqlOutput_4 += "&rewriteBatchedStatements=true"; } url_tMysqlOutput_4 = "jdbc:mysql://" + "192.168.1.254" + ":" + "3306" + "/" + "TALONDB" + "?" + properties_tMysqlOutput_4; } String dbUser_tMysqlOutput_4 = "dbAdmin"; String dbPwd_tMysqlOutput_4 = "1nn0s2013"; java.lang.Class.forName("org.gjt.mm.mysql.Driver"); conn_tMysqlOutput_4 = java.sql.DriverManager.getConnection(url_tMysqlOutput_4, dbUser_tMysqlOutput_4, dbPwd_tMysqlOutput_4); } conn_tMysqlOutput_4.setAutoCommit(false); int commitEvery_tMysqlOutput_4 = 1; int commitCounter_tMysqlOutput_4 = 0; int count_tMysqlOutput_4 = 0; String insert_tMysqlOutput_4 = "INSERT INTO `" + "STATE_INFO" + "` (`ID`,`STATE`,`CITY`,`ZIP`) VALUES (?,?,?,?)"; int batchSize_tMysqlOutput_4 = 1; int batchSizeCounter_tMysqlOutput_4 = 0; java.sql.PreparedStatement pstmt_tMysqlOutput_4 = conn_tMysqlOutput_4 .prepareStatement(insert_tMysqlOutput_4); /** * [tMysqlOutput_4 begin ] stop */ /** * [tMap_3 begin ] start */ ok_Hash.put("tMap_3", false); start_Hash.put("tMap_3", System.currentTimeMillis()); currentComponent = "tMap_3"; int tos_count_tMap_3 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_3__Struct { } Var__tMap_3__Struct Var__tMap_3 = new Var__tMap_3__Struct(); // ############################### // ############################### // # Outputs initialization loadNewStateInfoStruct loadNewStateInfo_tmp = new loadNewStateInfoStruct(); // ############################### /** * [tMap_3 begin ] stop */ /** * [tJoin_1 begin ] start */ ok_Hash.put("tJoin_1", false); start_Hash.put("tJoin_1", System.currentTimeMillis()); currentComponent = "tJoin_1"; int tos_count_tJoin_1 = 0; final java.util.Map<row4Struct, row4Struct> tHash_tJoin_1 = (java.util.Map<row4Struct, row4Struct>) globalMap .get("tHash_row4"); class Util_tJoin_1 { row4Struct lookupValue = null; row4Struct row4HashKey = new row4Struct(); public boolean isJoined(row3Struct mainRow) { row4HashKey.ZIP = mainRow.zip; row4HashKey.hashCodeDirty = true; lookupValue = tHash_tJoin_1.get(row4HashKey); if (lookupValue != null) { return true; } return false; } } Util_tJoin_1 util_tJoin_1 = new Util_tJoin_1(); int nb_line_tJoin_1 = 0; /** * [tJoin_1 begin ] stop */ /** * [tJavaRow_1 begin ] start */ ok_Hash.put("tJavaRow_1", false); start_Hash.put("tJavaRow_1", System.currentTimeMillis()); currentComponent = "tJavaRow_1"; int tos_count_tJavaRow_1 = 0; int nb_line_tJavaRow_1 = 0; /** * [tJavaRow_1 begin ] stop */ /** * [tFileInputJSON_1 begin ] start */ ok_Hash.put("tFileInputJSON_1", false); start_Hash.put("tFileInputJSON_1", System.currentTimeMillis()); currentComponent = "tFileInputJSON_1"; int tos_count_tFileInputJSON_1 = 0; class JSONUtil_tFileInputJSON_1 { public int getData(String query, javax.script.Invocable invocableEngine, java.util.List<org.json.simple.JSONArray> jsonResultList, int recordMaxSize) { try { // only 2 types: String/Boolean String resultObj = invocableEngine.invokeFunction("jsonPath", query) .toString(); if (!"false".equals(resultObj)) { org.json.simple.JSONArray resultArray = (org.json.simple.JSONArray) org.json.simple.JSONValue .parse(resultObj); jsonResultList.add(resultArray); if (recordMaxSize != -1 && recordMaxSize != resultArray.size()) { // just give an error, don't // stop System.err.println( "The Json resource datas maybe have some problems, please make sure the data structure with the same fields."); } recordMaxSize = Math.max(recordMaxSize, resultArray.size()); } else { System.err.println("Can't find any data with JSONPath " + query); // add null to take a place in // List(buffer) jsonResultList.add(null); } } catch (Exception e) { e.printStackTrace(); } return recordMaxSize; } void setRowValue_0(row2Struct row2, java.util.List<org.json.simple.JSONArray> JSONResultList_tFileInputJSON_1, int nbResultArray_tFileInputJSON_1) throws java.io.UnsupportedEncodingException { if (JSONResultList_tFileInputJSON_1.get(0) != null && nbResultArray_tFileInputJSON_1 < JSONResultList_tFileInputJSON_1 .get(0).size() && JSONResultList_tFileInputJSON_1.get(0) .get(nbResultArray_tFileInputJSON_1) != null) { row2.city = JSONResultList_tFileInputJSON_1.get(0) .get(nbResultArray_tFileInputJSON_1).toString(); } else { row2.city = null; } if (JSONResultList_tFileInputJSON_1.get(1) != null && nbResultArray_tFileInputJSON_1 < JSONResultList_tFileInputJSON_1 .get(1).size() && JSONResultList_tFileInputJSON_1.get(1) .get(nbResultArray_tFileInputJSON_1) != null) { row2.state = JSONResultList_tFileInputJSON_1.get(1) .get(nbResultArray_tFileInputJSON_1).toString(); } else { row2.state = null; } if (JSONResultList_tFileInputJSON_1.get(2) != null && nbResultArray_tFileInputJSON_1 < JSONResultList_tFileInputJSON_1 .get(2).size() && JSONResultList_tFileInputJSON_1.get(2) .get(nbResultArray_tFileInputJSON_1) != null) { row2.country = JSONResultList_tFileInputJSON_1.get(2) .get(nbResultArray_tFileInputJSON_1).toString(); } else { row2.country = null; } } } int nb_line_tFileInputJSON_1 = 0; javax.script.ScriptEngineManager scriptEngineMgr_tFileInputJSON_1 = new javax.script.ScriptEngineManager(); javax.script.ScriptEngine jsEngine_tFileInputJSON_1 = scriptEngineMgr_tFileInputJSON_1 .getEngineByName("JavaScript"); if (jsEngine_tFileInputJSON_1 == null) { System.err.println("No script engine found for JavaScript"); } java.io.InputStream jsonis_tFileInputJSON_1 = com.jsonpath.test.ReadJar.class .getResource("json.js").openStream(); jsEngine_tFileInputJSON_1.eval(new java.io.BufferedReader( new java.io.InputStreamReader(jsonis_tFileInputJSON_1))); java.io.InputStream jsonpathis_tFileInputJSON_1 = com.jsonpath.test.ReadJar.class .getResource("jsonpath.js").openStream(); jsEngine_tFileInputJSON_1.eval(new java.io.BufferedReader( new java.io.InputStreamReader(jsonpathis_tFileInputJSON_1))); java.net.URL url_tFileInputJSON_1 = new java.net.URL( "http://ziptasticapi.com/" + ((Integer) globalMap.get("zipCode"))); java.net.URLConnection urlConn_tFileInputJSON_1 = url_tFileInputJSON_1.openConnection(); java.io.InputStreamReader fr_tFileInputJSON_1 = new java.io.InputStreamReader( urlConn_tFileInputJSON_1.getInputStream(), "UTF-8"); java.lang.Object jsonText_tFileInputJSON_1 = org.json.simple.JSONValue .parse(fr_tFileInputJSON_1); jsEngine_tFileInputJSON_1.eval("var obj=" + jsonText_tFileInputJSON_1.toString()); java.util.List<org.json.simple.JSONArray> JSONResultList_tFileInputJSON_1 = new java.util.ArrayList<org.json.simple.JSONArray>(); int recordMaxSize_tFileInputJSON_1 = -1; javax.script.Invocable invocableEngine_tFileInputJSON_1 = (javax.script.Invocable) jsEngine_tFileInputJSON_1; JSONUtil_tFileInputJSON_1 jsonUtil_tFileInputJSON_1 = new JSONUtil_tFileInputJSON_1(); recordMaxSize_tFileInputJSON_1 = jsonUtil_tFileInputJSON_1.getData("city", invocableEngine_tFileInputJSON_1, JSONResultList_tFileInputJSON_1, recordMaxSize_tFileInputJSON_1); recordMaxSize_tFileInputJSON_1 = jsonUtil_tFileInputJSON_1.getData("state", invocableEngine_tFileInputJSON_1, JSONResultList_tFileInputJSON_1, recordMaxSize_tFileInputJSON_1); recordMaxSize_tFileInputJSON_1 = jsonUtil_tFileInputJSON_1.getData("country", invocableEngine_tFileInputJSON_1, JSONResultList_tFileInputJSON_1, recordMaxSize_tFileInputJSON_1); for (int nbResultArray_tFileInputJSON_1 = 0; nbResultArray_tFileInputJSON_1 < recordMaxSize_tFileInputJSON_1; nbResultArray_tFileInputJSON_1++) { nb_line_tFileInputJSON_1++; jsonUtil_tFileInputJSON_1.setRowValue_0(row2, JSONResultList_tFileInputJSON_1, nbResultArray_tFileInputJSON_1); /** * [tFileInputJSON_1 begin ] stop */ /** * [tFileInputJSON_1 main ] start */ currentComponent = "tFileInputJSON_1"; tos_count_tFileInputJSON_1++; /** * [tFileInputJSON_1 main ] stop */ /** * [tJavaRow_1 main ] start */ currentComponent = "tJavaRow_1"; // Code generated according to input schema and // output schema row3.city = row2.city; row3.state = row2.state; row3.country = row2.country; row3.zip = ((Integer) globalMap.get("zipCode")); nb_line_tJavaRow_1++; tos_count_tJavaRow_1++; /** * [tJavaRow_1 main ] stop */ /** * [tJoin_1 main ] start */ currentComponent = "tJoin_1"; row5 = null; row5 = new row5Struct(); row5.city = row3.city; row5.state = row3.state; row5.country = row3.country; row5.zip = row3.zip; if (util_tJoin_1.isJoined(row3)) { row5 = null; } else { } // ///////////////////// tos_count_tJoin_1++; /** * [tJoin_1 main ] stop */ // Start of branch "row5" if (row5 != null) { /** * [tMap_3 main ] start */ currentComponent = "tMap_3"; boolean hasCasePrimitiveKeyWithNull_tMap_3 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_3 = false; boolean mainRowRejected_tMap_3 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_3__Struct Var = Var__tMap_3;// ############################### // ############################### // # Output tables loadNewStateInfo = null; // # Output table : 'loadNewStateInfo' loadNewStateInfo_tmp.ID = 0; loadNewStateInfo_tmp.STATE = row5.state; loadNewStateInfo_tmp.CITY = row5.city; loadNewStateInfo_tmp.ZIP = row5.zip; loadNewStateInfo = loadNewStateInfo_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_3 = false; tos_count_tMap_3++; /** * [tMap_3 main ] stop */ // Start of branch "loadNewStateInfo" if (loadNewStateInfo != null) { /** * [tMysqlOutput_4 main ] start */ currentComponent = "tMysqlOutput_4"; whetherReject_tMysqlOutput_4 = false; pstmt_tMysqlOutput_4.setInt(1, loadNewStateInfo.ID); if (loadNewStateInfo.STATE == null) { pstmt_tMysqlOutput_4.setNull(2, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_4.setString(2, loadNewStateInfo.STATE); } if (loadNewStateInfo.CITY == null) { pstmt_tMysqlOutput_4.setNull(3, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_4.setString(3, loadNewStateInfo.CITY); } pstmt_tMysqlOutput_4.setInt(4, loadNewStateInfo.ZIP); pstmt_tMysqlOutput_4.addBatch(); nb_line_tMysqlOutput_4++; batchSizeCounter_tMysqlOutput_4++; if (batchSize_tMysqlOutput_4 <= batchSizeCounter_tMysqlOutput_4) { try { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : pstmt_tMysqlOutput_4 .executeBatch()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : e.getUpdateCounts()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; System.err.println(e.getMessage()); } batchSizeCounter_tMysqlOutput_4 = 0; } commitCounter_tMysqlOutput_4++; if (commitEvery_tMysqlOutput_4 <= commitCounter_tMysqlOutput_4) { try { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : pstmt_tMysqlOutput_4 .executeBatch()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : e.getUpdateCounts()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; System.out.println(e.getMessage()); } conn_tMysqlOutput_4.commit(); commitCounter_tMysqlOutput_4 = 0; } tos_count_tMysqlOutput_4++; /** * [tMysqlOutput_4 main ] stop */ } // End of branch "loadNewStateInfo" } // End of branch "row5" /** * [tFileInputJSON_1 end ] start */ currentComponent = "tFileInputJSON_1"; } globalMap.put("tFileInputJSON_1_NB_LINE", nb_line_tFileInputJSON_1); ok_Hash.put("tFileInputJSON_1", true); end_Hash.put("tFileInputJSON_1", System.currentTimeMillis()); /** * [tFileInputJSON_1 end ] stop */ /** * [tJavaRow_1 end ] start */ currentComponent = "tJavaRow_1"; globalMap.put("tJavaRow_1_NB_LINE", nb_line_tJavaRow_1); ok_Hash.put("tJavaRow_1", true); end_Hash.put("tJavaRow_1", System.currentTimeMillis()); /** * [tJavaRow_1 end ] stop */ /** * [tJoin_1 end ] start */ currentComponent = "tJoin_1"; ok_Hash.put("tJoin_1", true); end_Hash.put("tJoin_1", System.currentTimeMillis()); /** * [tJoin_1 end ] stop */ /** * [tMap_3 end ] start */ currentComponent = "tMap_3"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_3", true); end_Hash.put("tMap_3", System.currentTimeMillis()); /** * [tMap_3 end ] stop */ /** * [tMysqlOutput_4 end ] start */ currentComponent = "tMysqlOutput_4"; try { if (batchSizeCounter_tMysqlOutput_4 != 0) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : pstmt_tMysqlOutput_4.executeBatch()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; } } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : e.getUpdateCounts()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; System.err.println(e.getMessage()); } batchSizeCounter_tMysqlOutput_4 = 0; try { if (pstmt_tMysqlOutput_4 != null) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : pstmt_tMysqlOutput_4.executeBatch()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; } } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_4 = 0; for (int countEach_tMysqlOutput_4 : e.getUpdateCounts()) { countSum_tMysqlOutput_4 += (countEach_tMysqlOutput_4 < 0 ? 0 : countEach_tMysqlOutput_4); } insertedCount_tMysqlOutput_4 += countSum_tMysqlOutput_4; System.out.println(e.getMessage()); } if (pstmt_tMysqlOutput_4 != null) { pstmt_tMysqlOutput_4.close(); } conn_tMysqlOutput_4.commit(); conn_tMysqlOutput_4.close(); nb_line_deleted_tMysqlOutput_4 = nb_line_deleted_tMysqlOutput_4 + deletedCount_tMysqlOutput_4; nb_line_update_tMysqlOutput_4 = nb_line_update_tMysqlOutput_4 + updatedCount_tMysqlOutput_4; nb_line_inserted_tMysqlOutput_4 = nb_line_inserted_tMysqlOutput_4 + insertedCount_tMysqlOutput_4; nb_line_rejected_tMysqlOutput_4 = nb_line_rejected_tMysqlOutput_4 + rejectedCount_tMysqlOutput_4; globalMap.put("tMysqlOutput_4_NB_LINE", nb_line_tMysqlOutput_4); globalMap.put("tMysqlOutput_4_NB_LINE_UPDATED", nb_line_update_tMysqlOutput_4); globalMap.put("tMysqlOutput_4_NB_LINE_INSERTED", nb_line_inserted_tMysqlOutput_4); globalMap.put("tMysqlOutput_4_NB_LINE_DELETED", nb_line_deleted_tMysqlOutput_4); globalMap.put("tMysqlOutput_4_NB_LINE_REJECTED", nb_line_rejected_tMysqlOutput_4); ok_Hash.put("tMysqlOutput_4", true); end_Hash.put("tMysqlOutput_4", System.currentTimeMillis()); /** * [tMysqlOutput_4 end ] stop */ } // End of branch "stateInfo" // Start of branch "propertyData" if (propertyData != null) { row9 = null; /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ///////////////////////////////////////////// // Starting Lookup Table "row6" // ///////////////////////////////////////////// boolean forceLooprow6 = false; row6Struct row6ObjectFromLookup = null; if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020 hasCasePrimitiveKeyWithNull_tMap_1 = false; Object exprKeyValue_row6__ZIP = propertyData.zipcode__c; if (exprKeyValue_row6__ZIP == null) { hasCasePrimitiveKeyWithNull_tMap_1 = true; } else { row6HashKey.ZIP = (int) (Integer) exprKeyValue_row6__ZIP; } row6HashKey.hashCodeDirty = true; if (!hasCasePrimitiveKeyWithNull_tMap_1) { // G_TM_M_091 tHash_Lookup_Cache_row6.lookup(row6HashKey); if (tHash_Lookup_Cache_row6.hasNext()) { // G_TM_M_835 tHash_Lookup_row6 = tHash_Lookup_Cache_row6; } // G_TM_M_834 else { // G_TM_M_835 tMysqlInput_2Process(globalMap); tHash_Lookup_row6 = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row6Struct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row6Struct>) globalMap .get("tHash_Lookup_row6")); tHash_Lookup_row6.initGet(); tHash_Lookup_row6.lookup(row6HashKey); } // G_TM_M_835 } // G_TM_M_091 if (hasCasePrimitiveKeyWithNull_tMap_1 || !tHash_Lookup_row6.hasNext()) { // G_TM_M_090 rejectedInnerJoin_tMap_1 = true; } // G_TM_M_090 } // G_TM_M_020 if (tHash_Lookup_row6 != null && tHash_Lookup_row6.getCount(row6HashKey) > 1) { // G // 071 // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'row6' and it contains more one result from keys : row6.ZIP = '" // + row6HashKey.ZIP + "'"); } // G 071 row6Struct row6 = null; row6Struct fromLookup_row6 = null; row6 = row6Default; if (tHash_Lookup_row6 != null && tHash_Lookup_row6.hasNext()) { // G 099 fromLookup_row6 = tHash_Lookup_row6.next(); } // G 099 if (fromLookup_row6 != null) { row6 = fromLookup_row6; } if (tHash_Lookup_Cache_row6 != tHash_Lookup_row6) { tHash_Lookup_Cache_row6.put(row6); } // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1;// ############################### // ############################### // # Output tables mappedData = null; if (!rejectedInnerJoin_tMap_1) { // # Output table : 'mappedData' mappedData_tmp.PROP_NAME = propertyData.name; mappedData_tmp.PRICE = propertyData.price__c; mappedData_tmp.SQFT = "1500"; mappedData_tmp.DESCRIPTION = propertyData.pba__description_pb__c; mappedData_tmp.NUM_BEDS = propertyData.bedrooms__c; mappedData_tmp.NUM_BATHS = propertyData.bathrooms__c; mappedData_tmp.STATE_INFO_ID = row6.ID; mappedData_tmp.customer = context.cusomterName; mappedData_tmp.status = propertyData.pba__status__c; mappedData_tmp.type = propertyData.pba__propertytype__c; mappedData = mappedData_tmp; } // closing inner join bracket (2) // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "mappedData" if (mappedData != null) { row9 = null; /** * [tMap_4 main ] start */ currentComponent = "tMap_4"; boolean hasCasePrimitiveKeyWithNull_tMap_4 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_4 = false; boolean mainRowRejected_tMap_4 = false; // ///////////////////////////////////////////// // Starting Lookup Table "custData" // ///////////////////////////////////////////// boolean forceLoopcustData = false; custDataStruct custDataObjectFromLookup = null; if (!rejectedInnerJoin_tMap_4) { // G_TM_M_020 hasCasePrimitiveKeyWithNull_tMap_4 = false; custDataHashKey.CUST_NAME = mappedData.customer; custDataHashKey.hashCodeDirty = true; tHash_Lookup_custData.lookup(custDataHashKey); if (!tHash_Lookup_custData.hasNext()) { // G_TM_M_090 rejectedInnerJoin_tMap_4 = true; } // G_TM_M_090 } // G_TM_M_020 if (tHash_Lookup_custData != null && tHash_Lookup_custData.getCount(custDataHashKey) > 1) { // G // 071 // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'custData' and it contains more one result from keys : custData.CUST_NAME = '" // + custDataHashKey.CUST_NAME + "'"); } // G 071 custDataStruct custData = null; custDataStruct fromLookup_custData = null; custData = custDataDefault; if (tHash_Lookup_custData != null && tHash_Lookup_custData.hasNext()) { // G // 099 fromLookup_custData = tHash_Lookup_custData.next(); } // G 099 if (fromLookup_custData != null) { custData = fromLookup_custData; } // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_4__Struct Var = Var__tMap_4;// ############################### // ############################### // # Output tables loadData = null; if (!rejectedInnerJoin_tMap_4) { // # Output table : 'loadData' loadData_tmp.PROP_NAME = mappedData.PROP_NAME; loadData_tmp.PRICE = mappedData.PRICE; loadData_tmp.SQFT = mappedData.SQFT; loadData_tmp.DESCRIPTION = mappedData.DESCRIPTION; loadData_tmp.NUM_BEDS = mappedData.NUM_BEDS; loadData_tmp.NUM_BATHS = mappedData.NUM_BATHS; loadData_tmp.TYPE = mappedData.type; loadData_tmp.STATUS = mappedData.status; loadData_tmp.STATE_INFO_ID = mappedData.STATE_INFO_ID; loadData_tmp.DATA_SOURCE_ID = custData.DATA_SOURCE_ID; loadData = loadData_tmp; } // closing inner join bracket (2) // ############################### } // end of Var scope rejectedInnerJoin_tMap_4 = false; tos_count_tMap_4++; /** * [tMap_4 main ] stop */ // Start of branch "loadData" if (loadData != null) { row9 = null; /** * [tJoin_3 main ] start */ currentComponent = "tJoin_3"; row9 = null; row9 = new row9Struct(); row9.PROP_NAME = loadData.PROP_NAME; row9.PRICE = loadData.PRICE; row9.SQFT = loadData.SQFT; row9.DESCRIPTION = loadData.DESCRIPTION; row9.NUM_BEDS = loadData.NUM_BEDS; row9.NUM_BATHS = loadData.NUM_BATHS; row9.TYPE = loadData.TYPE; row9.STATUS = loadData.STATUS; row9.STATE_INFO_ID = loadData.STATE_INFO_ID; row9.DATA_SOURCE_ID = loadData.DATA_SOURCE_ID; if (util_tJoin_3.isJoined(loadData)) { row9 = null; } else { } // ///////////////////// tos_count_tJoin_3++; /** * [tJoin_3 main ] stop */ // Start of branch "row9" if (row9 != null) { /** * [tJavaRow_3 main ] start */ currentComponent = "tJavaRow_3"; // Code generated according to input // schema and output schema System.out.println( "***** Loading New Property Data for:" + row9.PROP_NAME + " *****"); row14.PROP_NAME = row9.PROP_NAME; row14.PRICE = row9.PRICE; row14.SQFT = row9.SQFT; row14.DESCRIPTION = row9.DESCRIPTION; row14.NUM_BEDS = row9.NUM_BEDS; row14.NUM_BATHS = row9.NUM_BATHS; row14.TYPE = row9.TYPE; row14.STATUS = row9.STATUS; row14.STATE_INFO_ID = row9.STATE_INFO_ID; row14.DATA_SOURCE_ID = row9.DATA_SOURCE_ID; row14.PROP_UUID = UUID.randomUUID().toString(); nb_line_tJavaRow_3++; tos_count_tJavaRow_3++; /** * [tJavaRow_3 main ] stop */ /** * [tMap_8 main ] start */ currentComponent = "tMap_8"; boolean hasCasePrimitiveKeyWithNull_tMap_8 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_8 = false; boolean mainRowRejected_tMap_8 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_8__Struct Var = Var__tMap_8;// ############################### // ############################### // # Output tables mainPropertyDataLoad = null; // # Output table : // 'mainPropertyDataLoad' mainPropertyDataLoad_tmp.ID = 0; mainPropertyDataLoad_tmp.UUID = row14.PROP_UUID; mainPropertyDataLoad_tmp.PROP_NAME = row14.PROP_NAME; mainPropertyDataLoad_tmp.PRICE = row14.PRICE; mainPropertyDataLoad_tmp.SQFT = row14.SQFT; mainPropertyDataLoad_tmp.DESCRIPTION = row14.DESCRIPTION; mainPropertyDataLoad_tmp.NUM_BEDS = row14.NUM_BEDS; mainPropertyDataLoad_tmp.NUM_BATHS = row14.NUM_BATHS; mainPropertyDataLoad_tmp.TYPE = row14.TYPE; mainPropertyDataLoad_tmp.STATUS = row14.STATUS; mainPropertyDataLoad_tmp.STATE_INFO_ID = row14.STATE_INFO_ID; mainPropertyDataLoad_tmp.DATA_SOURCE_ID = row14.DATA_SOURCE_ID; mainPropertyDataLoad = mainPropertyDataLoad_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_8 = false; tos_count_tMap_8++; /** * [tMap_8 main ] stop */ // Start of branch // "mainPropertyDataLoad" if (mainPropertyDataLoad != null) { /** * [tMysqlOutput_1 main ] start */ currentComponent = "tMysqlOutput_1"; whetherReject_tMysqlOutput_1 = false; pstmt_tMysqlOutput_1.setInt(1, mainPropertyDataLoad.ID); if (mainPropertyDataLoad.UUID == null) { pstmt_tMysqlOutput_1.setNull(2, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(2, mainPropertyDataLoad.UUID); } if (mainPropertyDataLoad.PROP_NAME == null) { pstmt_tMysqlOutput_1.setNull(3, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(3, mainPropertyDataLoad.PROP_NAME); } pstmt_tMysqlOutput_1.setFloat(4, mainPropertyDataLoad.PRICE); if (mainPropertyDataLoad.SQFT == null) { pstmt_tMysqlOutput_1.setNull(5, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(5, mainPropertyDataLoad.SQFT); } if (mainPropertyDataLoad.DESCRIPTION == null) { pstmt_tMysqlOutput_1.setNull(6, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(6, mainPropertyDataLoad.DESCRIPTION); } pstmt_tMysqlOutput_1.setFloat(7, mainPropertyDataLoad.NUM_BEDS); pstmt_tMysqlOutput_1.setFloat(8, mainPropertyDataLoad.NUM_BATHS); if (mainPropertyDataLoad.TYPE == null) { pstmt_tMysqlOutput_1.setNull(9, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(9, mainPropertyDataLoad.TYPE); } if (mainPropertyDataLoad.STATUS == null) { pstmt_tMysqlOutput_1.setNull(10, java.sql.Types.VARCHAR); } else { pstmt_tMysqlOutput_1.setString(10, mainPropertyDataLoad.STATUS); } pstmt_tMysqlOutput_1.setInt(11, mainPropertyDataLoad.STATE_INFO_ID); pstmt_tMysqlOutput_1.setInt(12, mainPropertyDataLoad.DATA_SOURCE_ID); pstmt_tMysqlOutput_1.addBatch(); nb_line_tMysqlOutput_1++; batchSizeCounter_tMysqlOutput_1++; if (batchSize_tMysqlOutput_1 <= batchSizeCounter_tMysqlOutput_1) { try { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1 .executeBatch()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; System.err.println(e.getMessage()); } batchSizeCounter_tMysqlOutput_1 = 0; } commitCounter_tMysqlOutput_1++; if (commitEvery_tMysqlOutput_1 <= commitCounter_tMysqlOutput_1) { try { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1 .executeBatch()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; System.out.println(e.getMessage()); } conn_tMysqlOutput_1.commit(); commitCounter_tMysqlOutput_1 = 0; } tos_count_tMysqlOutput_1++; /** * [tMysqlOutput_1 main ] stop */ } // End of branch // "mainPropertyDataLoad" } // End of branch "row9" } // End of branch "loadData" } // End of branch "mappedData" } // End of branch "propertyData" } // End of branch "row1" /** * [tFileInputXML_1 end ] start */ currentComponent = "tFileInputXML_1"; } try { looper_tFileInputXML_1.handleTaskResponse(); } catch (Exception e) { System.err.println(e.getMessage()); } globalMap.put("tFileInputXML_1_NB_LINE", nb_line_tFileInputXML_1); ok_Hash.put("tFileInputXML_1", true); end_Hash.put("tFileInputXML_1", System.currentTimeMillis()); /** * [tFileInputXML_1 end ] stop */ /** * [tMap_2 end ] start */ currentComponent = "tMap_2"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_2", true); end_Hash.put("tMap_2", System.currentTimeMillis()); /** * [tMap_2 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing if (tHash_Lookup_row6 != null) { tHash_Lookup_row6.endGet(); } globalMap.remove("tHash_Lookup_row6"); tHash_Lookup_Cache_row6.endGet(); tHash_Lookup_Cache_row6 = null; tHash_Lookup_Real_row6 = null; // ############################### ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tMap_4 end ] start */ currentComponent = "tMap_4"; // ############################### // # Lookup hashes releasing if (tHash_Lookup_custData != null) { tHash_Lookup_custData.endGet(); } globalMap.remove("tHash_Lookup_custData"); // ############################### ok_Hash.put("tMap_4", true); end_Hash.put("tMap_4", System.currentTimeMillis()); /** * [tMap_4 end ] stop */ /** * [tJoin_3 end ] start */ currentComponent = "tJoin_3"; ok_Hash.put("tJoin_3", true); end_Hash.put("tJoin_3", System.currentTimeMillis()); /** * [tJoin_3 end ] stop */ /** * [tJavaRow_3 end ] start */ currentComponent = "tJavaRow_3"; globalMap.put("tJavaRow_3_NB_LINE", nb_line_tJavaRow_3); ok_Hash.put("tJavaRow_3", true); end_Hash.put("tJavaRow_3", System.currentTimeMillis()); /** * [tJavaRow_3 end ] stop */ /** * [tMap_8 end ] start */ currentComponent = "tMap_8"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_8", true); end_Hash.put("tMap_8", System.currentTimeMillis()); /** * [tMap_8 end ] stop */ /** * [tMysqlOutput_1 end ] start */ currentComponent = "tMysqlOutput_1"; try { if (batchSizeCounter_tMysqlOutput_1 != 0) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1.executeBatch()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; } } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; System.err.println(e.getMessage()); } batchSizeCounter_tMysqlOutput_1 = 0; try { if (pstmt_tMysqlOutput_1 != null) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1.executeBatch()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; } } catch (java.sql.BatchUpdateException e) { int countSum_tMysqlOutput_1 = 0; for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) { countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0 : countEach_tMysqlOutput_1); } insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1; System.out.println(e.getMessage()); } if (pstmt_tMysqlOutput_1 != null) { pstmt_tMysqlOutput_1.close(); } conn_tMysqlOutput_1.commit(); conn_tMysqlOutput_1.close(); nb_line_deleted_tMysqlOutput_1 = nb_line_deleted_tMysqlOutput_1 + deletedCount_tMysqlOutput_1; nb_line_update_tMysqlOutput_1 = nb_line_update_tMysqlOutput_1 + updatedCount_tMysqlOutput_1; nb_line_inserted_tMysqlOutput_1 = nb_line_inserted_tMysqlOutput_1 + insertedCount_tMysqlOutput_1; nb_line_rejected_tMysqlOutput_1 = nb_line_rejected_tMysqlOutput_1 + rejectedCount_tMysqlOutput_1; globalMap.put("tMysqlOutput_1_NB_LINE", nb_line_tMysqlOutput_1); globalMap.put("tMysqlOutput_1_NB_LINE_UPDATED", nb_line_update_tMysqlOutput_1); globalMap.put("tMysqlOutput_1_NB_LINE_INSERTED", nb_line_inserted_tMysqlOutput_1); globalMap.put("tMysqlOutput_1_NB_LINE_DELETED", nb_line_deleted_tMysqlOutput_1); globalMap.put("tMysqlOutput_1_NB_LINE_REJECTED", nb_line_rejected_tMysqlOutput_1); ok_Hash.put("tMysqlOutput_1", true); end_Hash.put("tMysqlOutput_1", System.currentTimeMillis()); /** * [tMysqlOutput_1 end ] stop */ /** * [tFlowToIterate_1 end ] start */ currentComponent = "tFlowToIterate_1"; globalMap.put("tFlowToIterate_1_NB_LINE", nb_line_tFlowToIterate_1); ok_Hash.put("tFlowToIterate_1", true); end_Hash.put("tFlowToIterate_1", System.currentTimeMillis()); /** * [tFlowToIterate_1 end ] stop */ } // end the resume if (resumeEntryMethodName == null || globalResumeTicket) { resumeUtil.addLog("CHECKPOINT", "CONNECTION:SUBJOB_OK:tFileInputXML_1:OnSubjobOk", "", Thread.currentThread().getId() + "", "", "", "", "", ""); } tJava_1Process(globalMap); } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } finally { // free memory for "tJoin_3" globalMap.put("tHash_getCurrentProperties", null); // free memory for "tMap_4" globalMap.put("tHash_Lookup_custData", null); // free memory for "tMap_1" globalMap.put("tHash_Lookup_row6", null); // free memory for "tJoin_1" globalMap.put("tHash_row4", null); } globalMap.put("tFileInputXML_1_SUBPROCESS_STATE", 1); }