List of usage examples for java.lang Integer toString
public String toString()
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the utcspo job data json.//from w w w . j a v a 2 s. c o m * @param jsonArray the json array * @param timeZone the time zone */ public static void printUTCSPOJobDataJson(JSONArray jsonArray, String timeZone) { DriverConfig.setLogString("Json Grid", true); DriverConfig.setLogString( "=============================================================================================================================", true); DriverConfig.setLogString( "| Start Time | End Time | Delta EE | MO BlackOut | MO Cuttoff | MO Recovery |", true); DriverConfig.setLogString( "=============================================================================================================================", true); int loopVal = 0; for (int i = 0; i < jsonArray.length(); i++) { try { if (loopVal != 0) { DriverConfig.setLogString( "=============================================================================================================================", true); } JSONObject jsonObj = jsonArray.getJSONObject(i); String startCal = (String) jsonObj.get("start"); String endcal = (String) jsonObj.get("end"); Double deltaEE = (Double) jsonObj.get("deltaEE"); Integer moBlackOut = (Integer) jsonObj.get("moBlackOut"); String moCutoff = (String) jsonObj.get("moCutoff"); Double moRecovery = (Double) jsonObj.get("moRecovery"); DriverConfig.setLogString( "| " + addSpace(startCal, 26) + "| " + addSpace(endcal, 25) + "| " + addSpace(deltaEE.toString(), 11) + "| " + addSpace(moBlackOut.toString(), 14) + "| " + addSpace(moCutoff, 25) + "| " + addSpace(moRecovery.toString(), 12) + "|", true); loopVal++; } catch (JSONException e) { e.printStackTrace(); } } DriverConfig.setLogString( "=============================================================================================================================", true); }
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the spo job data json./*from www . ja v a 2 s. com*/ * @param jsonArray the json array */ public static void printMockSPOJobDataJson(JSONArray jsonArray) { DriverConfig.setLogString("Json Grid", true); DriverConfig.setLogString( "=============================================================================================================================", true); DriverConfig.setLogString( "| Start Time | End Time | Delta EE | MO BlackOut | MO Cuttoff | MO Recovery |", true); DriverConfig.setLogString( "=============================================================================================================================", true); int loopVal = 0; for (int i = 0; i < jsonArray.length(); i++) { try { if (loopVal != 0) { DriverConfig.setLogString( "=============================================================================================================================", true); } JSONObject jsonObj = jsonArray.getJSONObject(i); String startCal = (String) jsonObj.get("start"); String endCal = (String) jsonObj.get("end"); Double deltaEE = (Double) jsonObj.get("deltaEE"); Integer moBlackOut = (Integer) jsonObj.get("moBlackOut"); String moCutoff = (String) jsonObj.get("moCutoff"); Integer moRecovery = (Integer) jsonObj.get("moRecovery"); DriverConfig.setLogString( "| " + addSpace(startCal, 26) + "| " + addSpace(endCal, 25) + "| " + addSpace(deltaEE.toString(), 11) + "| " + addSpace(moBlackOut.toString(), 14) + "| " + addSpace(moCutoff, 25) + "| " + addSpace(moRecovery.toString(), 12) + "|", true); loopVal++; } catch (JSONException e) { e.printStackTrace(); } } DriverConfig.setLogString( "=============================================================================================================================", true); }
From source file:com.mobilefirst.fiberlink.WebServiceRequest.java
/** * prettyFormatXML translates the input xml and creates the indentation you would like to achieve * @param input: XML String//from w ww . ja v a 2 s. com * @param indent: Integer for how much indent to specify */ public static String prettyFormatXML(String input, Integer indent) { try { Source xmlInput = new StreamSource(new StringReader(input)); StringWriter stringWriter = new StringWriter(); StreamResult xmlOutput = new StreamResult(stringWriter); TransformerFactory transformerFactory = TransformerFactory.newInstance(); //transformerFactory.setAttribute("indent-number", indent); javax.xml.transform.Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", indent.toString()); transformer.transform(xmlInput, xmlOutput); return xmlOutput.getWriter().toString(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:edu.ku.brc.specify.datamodel.Attachment.java
/** * @param objAttachment//w w w . ja v a 2 s . c om * @return */ public static String getIdentityTitle(final ObjectAttachmentIFace<?> objAttachment) { if (objAttachment != null) { Attachment attachment = objAttachment.getAttachment(); if (attachment != null) { String title = attachment.getTitle(); if (StringUtils.isNotEmpty(title)) { return title; } String fileName = attachment.getOrigFilename(); fileName = FilenameUtils.getName(fileName); if (StringUtils.isNotEmpty(fileName)) { return fileName; } } } Integer id = ((FormDataObjIFace) objAttachment).getId(); return id != null ? id.toString() : "N/A"; }
From source file:com.aurel.track.util.GeneralUtils.java
/** * Creates an array of String from an Set of Integers * @param arrIDs//from w w w. j a va 2 s .c o m * @return */ public static String[] createStringArrFromCollection(Collection<Integer> integerCollection) { if (integerCollection == null) { return null; } String[] strArr = new String[integerCollection.size()]; Iterator<Integer> iterator = integerCollection.iterator(); int i = 0; Integer value = null; while (iterator.hasNext()) { value = iterator.next(); strArr[i++] = (value == null ? null : value.toString()); } return strArr; }
From source file:com.sammyun.util.DateUtil.java
/** * ?? ??? 2012-01-01?/*from w w w . ja v a2 s . c o m*/ * * @param date ? YY-MM * @param isEnd ? * @return * @see [?#?#?] */ public static String parseEarlyEndMonth(String date, boolean isEnd) { // ? if (!isEnd) { return date.concat("-01"); } else { String[] yearMonths = date.split("-"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, Integer.valueOf(yearMonths[0])); cal.set(Calendar.MONTH, Integer.valueOf(yearMonths[1]) - 1); // ? Integer maxDate = cal.getActualMaximum(Calendar.DATE); return date.concat("-".concat(maxDate.toString())); } }
From source file:Main.java
License:asdf
public static ArrayList<String> filter(String[] input, String filter, Integer maxlinelength) { init();//ww w.j a va 2s. com //include both uppercase and lowercase letters in filter //example: asdF becomes asdfASDF filter = filter.toLowerCase() + filter.toUpperCase(); ArrayList<String> array = new ArrayList<String>(); String charstring; String filteredstring = ""; boolean lastwasspace = true; // ensure that text does not begin with a // space Integer counter = 0; for (String s : input) { //terminate with space - add a space between lines s += " "; for (Character c : s.toCharArray()) { charstring = c.toString(); //prevent doublespace; //break lines on spaces, when line meets or exceeds maxlinelength if (c == ' ') { if (lastwasspace) { // ignore double spaces } else { lastwasspace = true; if (filter.contains(charstring)) { filteredstring += " "; } //if filter doesn't contain " ", //we'll add one anyway every few words else { counter++; Log.e("", counter.toString()); if (counter == 4) { counter = 0; filteredstring += " "; Log.e("", "space"); } } // add and reset only if adding the next string will // exceed length limit if (filteredstring.length() >= maxlinelength) { array.add(filteredstring); filteredstring = ""; } } } else if (filter.contains(charstring)) { lastwasspace = false; filteredstring += charstring; if (Character.getNumericValue(c.charValue()) >= 0) chartotals[Character.getNumericValue(c.charValue())]++; } } } array.add(filteredstring); // for (int i = 0; i < chartotals.length; i++) // System.out.println(String.valueOf(i) + " " + chartotals[i]); //calculate total number of letters totalcharcount = 0; for (String s : array) totalcharcount += s.length(); return array; }
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the test case grid./*from w ww. j av a2 s . c om*/ * @param testCaseMap the test case map */ public static void printTestCaseGrid(TreeMap<Integer, TestMethodDetails> testCaseMap) { try { DriverConfig.setLogString("Test Case Grid", true); DriverConfig.setLogString( "========================================================================================================", true); DriverConfig.setLogString( "| S.No. | Test Case Name | ID |", true); DriverConfig.setLogString( "========================================================================================================", true); Iterator<Entry<Integer, TestMethodDetails>> testCaseIterator = testCaseMap.entrySet().iterator(); Integer serialNo = 1; while (testCaseIterator.hasNext()) { Entry<Integer, TestMethodDetails> pairs = testCaseIterator.next(); TestMethodDetails testNgDetails = pairs.getValue(); String testMethod = testNgDetails.getTestCaseName(); String value = testNgDetails.getTestLinkId(); if (value == null || value.isEmpty()) { value = "--"; } DriverConfig.setLogString("| " + addSpace(serialNo.toString(), 9) + "| " + addSpace(testMethod, 63) + "| " + addSpace(value, 25) + "| ", true); serialNo++; } DriverConfig.setLogString( "========================================================================================================", true); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:controllers.Send.java
public static Result confirmBillPayment() { Form<models.forms.CashInForm> transactionForm = form(models.forms.CashInForm.class) .bindFromRequest(request()); String err = null;/* w ww . ja v a 2 s . c o m*/ if (transactionForm.hasErrors()) { Logger.debug("Transaction form errors: " + transactionForm.errorsAsJson()); return ok(confirm.render("Transaction information is invalid", null)); } String tokenRequest = transactionForm.get().trackingId; String token = SessionHelper.getToken(); Logger.debug("Request param token : " + tokenRequest + " >< " + token); SessionHelper.removeToken(); if (!token.equals(tokenRequest)) { Logger.debug("Invalid Token Request, route to send form!!!"); return redirect(routes.Send.createBillPayment()); } transactionForm.get().inquiry = new TransactionInquiry(); transactionForm.get().inquiry.idToken = transactionForm.data().get("idToken") != null ? transactionForm.data().get("idToken") : ""; models.User user = SessionHelper.getUser(); transactionForm.get().supervisor = user.supervisor; if ((transactionForm.get().sender.idToken != null) && (!transactionForm.get().sender.idToken.isEmpty())) { models.Customer sender = models.Customer.findByToken(transactionForm.get().sender.idToken); if (sender.getStatistic(1).hasExceedSendLimit(transactionForm.get().senderAmount)) { //flash("error", "Sender customer "+sender.fullName()+" has exceeded its customer limit"); err = "Sender customer " + sender.fullName() + " has exceeded its customer limit"; } } if (SessionHelper.getUser().agentHasExceedSendLimit(transactionForm.get().senderAmount)) { err = "Sender agent has exceeded its credit limit"; } if (transactionForm.get().channel.code.equals("10")) { Corporate corporate = Corporate.find.byId(transactionForm.get().corporate.code); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date birthDate = null; try { birthDate = simpleDateFormat.parse("1980-01-01"); } catch (ParseException e) { e.printStackTrace(); } Customer customerSender = null; Customer customerBeneficiary = null; try { customerSender = Customer.find.where().eq("firstName", corporate.name).eq("lastName", "SENDER") .eq("phoneNumber", corporate.phoneNumber).eq("personalIdType", "OTHER") .eq("personalId", corporate.licenseNumber).eq("birthDate", birthDate).setMaxRows(1) .findUnique(); System.out.println("SENDER : " + Json.toJson(customerSender)); customerBeneficiary = Customer.find.where().eq("firstName", corporate.name) .eq("lastName", "BENEFICIARY").eq("phoneNumber", corporate.phoneNumber) .eq("personalIdType", "OTHER").eq("personalId", corporate.licenseNumber) .eq("birthDate", birthDate).setMaxRows(1).findUnique(); System.out.println("BENEFICIARY : " + Json.toJson(customerBeneficiary)); } catch (Exception e) { } String customerIdSender = customerSender != null ? customerSender.idToken : ""; String customerIdBeneficiary = customerBeneficiary != null ? customerBeneficiary.idToken : ""; System.out.println("SENDER ID : " + customerIdSender); System.out.println("BENEFICIARY ID : " + customerIdBeneficiary); transactionForm.get().sender.idToken = customerIdSender; transactionForm.data().put("sender.firstName", corporate.name); transactionForm.data().put("sender.lastName", "SENDER"); transactionForm.data().put("sender.phoneNumber", corporate.phoneNumber); transactionForm.data().put("sender.country.code", corporate.country.code); transactionForm.data().put("sender.personalIdType", "OTHER"); transactionForm.data().put("sender.personalId", corporate.licenseNumber); transactionForm.data().put("sender.birthDate", "1980-01-01"); transactionForm.get().beneficiary.idToken = customerIdBeneficiary; transactionForm.data().put("beneficiary.firstName", corporate.name); transactionForm.data().put("beneficiary.lastName", "BENEFICIARY"); transactionForm.data().put("beneficiary.phoneNumber", corporate.phoneNumber); transactionForm.data().put("beneficiary.country.code", corporate.country.code); transactionForm.data().put("beneficiary.personalIdType", "OTHER"); transactionForm.data().put("beneficiary.personalId", corporate.licenseNumber); transactionForm.data().put("beneficiary.birthDate", "1980-01-01"); Integer denom = Integer.parseInt(transactionForm.get().billPayment.selectDenom) + 1; transactionForm.data().put("billPayment.selectDenom", denom.toString()); System.out.println("SENDER ID : " + transactionForm.get().sender.idToken); System.out.println("BENEFICIARY ID : " + transactionForm.get().beneficiary.idToken); } return ok(confirm_bill_payment.render(err, transactionForm)); }
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.IntegerDataConverter.java
@Override public String valueToString(Integer value) { return value != null ? value.toString() : ""; }