List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:com.krawler.spring.exportFunctionality.exportDAOImpl.java
public ByteArrayOutputStream getPdfData(JSONArray gridmap, HttpServletRequest request, JSONObject obj) throws ServiceException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = null;/*from ww w. java 2 s .c om*/ Document document = null; try { String colHeader = ""; String colHeaderFinal = ""; String fieldListFinal = ""; String fieldList = ""; String width = ""; String align = ""; String xtype = ""; String alignFinal = ""; String xtypeFinal = ""; String widthFinal = ""; String colHeaderArrStr[] = null; String dataIndexArrStr[] = null; String widthArrStr[] = null; String alignArrStr[] = null; String xtypeArrStr[] = null; String htmlCode = ""; String advStr = ""; int strLength = 0; float totalWidth = 0; config = new com.krawler.utils.json.base.JSONObject(request.getParameter("config")); if (request.getParameter("searchJson") != null && !request.getParameter("searchJson").equals("")) { JSONObject json = new JSONObject(request.getParameter("searchJson")); JSONArray advSearch = json.getJSONArray("root"); for (int i = 0; i < advSearch.length(); i++) { JSONObject key = advSearch.getJSONObject(i); String value = ""; String name = key.getString("columnheader"); name = URLDecoder.decode(name); name.trim(); if (name.contains("*")) { name = name.substring(0, name.indexOf("*") - 1); } if (name.contains("(") && name.charAt(name.indexOf("(") + 1) == '&') { htmlCode = name.substring(name.indexOf("(") + 3, name.length() - 2); char temp = (char) Integer.parseInt(htmlCode, 10); htmlCode = Character.toString(temp); if (htmlCode.equals("$")) { String currencyid = sessionHandlerImpl.getCurrencyID(request); String currency = currencyRender(key.getString("combosearch"), currencyid); name = name.substring(0, name.indexOf("(") - 1); name = name + "(" + htmlCode + ")"; value = currency; } else { name = name.substring(0, name.indexOf("(") - 1); value = name + " " + htmlCode; } } else { value = key.getString("combosearch"); } advStr += name + " : " + value + ","; } advStr = advStr.substring(0, advStr.length() - 1); config.remove("subtitles"); config.put("subtitles", "Filtered By: " + advStr); } if (request.getParameter("frm") != null && !request.getParameter("frm").equals("")) { KWLDateFormat dateFormat = (KWLDateFormat) hibernateTemplate.load(KWLDateFormat.class, sessionHandlerImplObj.getDateFormatID(request)); String prefDate = dateFormat.getJavaForm(); Date from = new Date(Long.parseLong(request.getParameter("frm"))); Date to = new Date(Long.parseLong(request.getParameter("to"))); config.remove("subtitles"); String timeFormatId = sessionHandlerImplObj.getUserTimeFormat(request); String timeZoneDiff = sessionHandlerImplObj.getTimeZoneDifference(request); config.put("subtitles", "Filtered By: From : " + authHandler.getPrefDateFormatter(timeFormatId, timeZoneDiff, prefDate).format(from) + " To : " + authHandler.getPrefDateFormatter(timeFormatId, timeZoneDiff, prefDate).format(to)); } Rectangle rec = null; if (config.getBoolean("landscape")) { Rectangle recPage = new Rectangle(PageSize.A4.rotate()); recPage.setBackgroundColor(new java.awt.Color(Integer.parseInt(config.getString("bgColor"), 16))); document = new Document(recPage, 15, 15, 30, 30); rec = document.getPageSize(); totalWidth = rec.getWidth(); } else { Rectangle recPage = new Rectangle(PageSize.A4); recPage.setBackgroundColor(new java.awt.Color(Integer.parseInt(config.getString("bgColor"), 16))); document = new Document(recPage, 15, 15, 30, 30); rec = document.getPageSize(); totalWidth = rec.getWidth(); } writer = PdfWriter.getInstance(document, baos); writer.setPageEvent(new EndPage()); document.open(); if (config.getBoolean("showLogo")) { addComponyLogo(document, request); } addTitleSubtitle(document); if (gridmap != null) { for (int i = 0; i < gridmap.length(); i++) { JSONObject temp = gridmap.getJSONObject(i); colHeader += URLDecoder.decode(temp.getString("title"), "utf-8"); if (colHeader.indexOf("*") != -1) { colHeader = colHeader.substring(0, colHeader.indexOf("*") - 1) + ","; } else { colHeader += ","; } fieldList += temp.getString("header").replace("$$", "#") + ",";// handled case for custom report. Because dataindex field have "#" symbol and while exporting data URL will break if having # symbol. So replaced # with $$ at JS side and reverted this change at Java side if (!config.getBoolean("landscape")) { int totalWidth1 = (int) ((totalWidth / gridmap.length()) - 5.00); width += "" + totalWidth1 + ","; //resize according to page view[potrait] } else { width += temp.getString("width") + ","; } if (temp.optString("align").equals("")) { align += "none" + ","; } else { align += temp.getString("align") + ","; } if (temp.optString("xtype").equals("")) { xtype += "none" + ","; } else { xtype += temp.getString("xtype") + ","; } } strLength = colHeader.length() - 1; colHeaderFinal = colHeader.substring(0, strLength); strLength = fieldList.length() - 1; fieldListFinal = fieldList.substring(0, strLength); strLength = width.length() - 1; widthFinal = width.substring(0, strLength); strLength = align.length() - 1; alignFinal = align.substring(0, strLength); strLength = xtype.length() - 1; xtypeFinal = xtype.substring(0, strLength); colHeaderArrStr = colHeaderFinal.split(","); dataIndexArrStr = fieldListFinal.split(","); widthArrStr = widthFinal.split(","); alignArrStr = alignFinal.split(","); xtypeArrStr = xtypeFinal.split(","); } else { fieldList = request.getParameter("header"); colHeader = URLDecoder.decode(request.getParameter("title")); width = request.getParameter("width"); align = request.getParameter("align"); xtype = request.getParameter("xtype"); colHeaderArrStr = colHeader.split(","); dataIndexArrStr = fieldList.split(","); widthArrStr = width.split(","); alignArrStr = align.split(","); xtypeArrStr = xtype.split(","); } JSONArray store = null; if (obj.isNull("coldata")) { store = obj.getJSONArray("data"); } else { store = obj.getJSONArray("coldata"); } addTable(0, colHeaderArrStr.length, 0, store.length(), store, dataIndexArrStr, colHeaderArrStr, widthArrStr, alignArrStr, xtypeArrStr, document); } catch (DocumentException ex) { errorMsg = ex.getMessage(); throw ServiceException.FAILURE("exportDAOImpl.getPdfData", ex); } catch (JSONException e) { errorMsg = e.getMessage(); throw ServiceException.FAILURE("exportDAOImpl.getPdfData", e); } catch (Exception e) { errorMsg = e.getMessage(); throw ServiceException.FAILURE("exportDAOImpl.getPdfData", e); } finally { if (document != null) { document.close(); } if (writer != null) { writer.close(); } } return baos; }
From source file:egovframework.rte.fdl.string.EgovStringUtil.java
/** * Convert a camel case string to underscore * representation./*from www . j a va2s. c o m*/ * @param camelCase * Camel case name. * @return Underscore representation of the camel * case string. */ public static String convertToUnderScore(String camelCase) { String result = ""; for (int i = 0; i < camelCase.length(); i++) { char currentChar = camelCase.charAt(i); // This is starting at 1 so the result does // not end up with an // underscore at the begin of the value if (i > 0 && Character.isUpperCase(currentChar)) { result = result.concat("_"); } result = result.concat(Character.toString(currentChar).toLowerCase()); } return result; }
From source file:de.tudarmstadt.ukp.clarin.webanno.automation.util.AutomationUtil.java
private static StringBuffer getMiraLine(Sentence sentence, AnnotationFeature aLayerFeature, AutomationTypeAdapter aAdapter) throws CASException { StringBuffer sb = new StringBuffer(); String tag = ""; List<String> annotations = new ArrayList<String>(); Map<Integer, String> multAnno = null; if (aLayerFeature != null) { if (aLayerFeature.getLayer().isMultipleTokens()) { multAnno = ((SpanAdapter) aAdapter).getMultipleAnnotation(sentence, aLayerFeature); } else {// ww w .ja va2 s . co m annotations = aAdapter.getAnnotation(sentence.getCAS().getJCas(), aLayerFeature, sentence.getBegin(), sentence.getEnd()); } } int i = 0; for (Token token : selectCovered(sentence.getCAS().getJCas(), Token.class, sentence.getBegin(), sentence.getEnd())) { String word = token.getCoveredText(); char[] words = word.toCharArray(); String prefix1 = "", prefix2 = "", prefix3 = "", prefix4 = "", suffix1 = "", suffix2 = "", suffix3 = "", suffix4 = ""; if (aLayerFeature == null || aLayerFeature.getLayer().isLockToTokenOffset()) { prefix1 = Character.toString(words[0]) + " "; prefix2 = (words.length > 1 ? prefix1.trim() + (Character.toString(words[1]).trim().equals("") ? "__nil__" : Character.toString(words[1])) : "__nil__") + " "; prefix3 = (words.length > 2 ? prefix2.trim() + (Character.toString(words[2]).trim().equals("") ? "__nil__" : Character.toString(words[2])) : "__nil__") + " "; prefix4 = (words.length > 3 ? prefix3.trim() + (Character.toString(words[3]).trim().equals("") ? "__nil__" : Character.toString(words[3])) : "__nil__") + " "; suffix1 = Character.toString(words[words.length - 1]) + " "; suffix2 = (words.length > 1 ? (Character.toString(words[words.length - 2]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 2])) + suffix1.trim() : "__nil__") + " "; suffix3 = (words.length > 2 ? (Character.toString(words[words.length - 3]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 3])) + suffix2.trim() : "__nil__") + " "; suffix4 = (words.length > 3 ? (Character.toString(words[words.length - 4]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 4])) + suffix3.trim() : "__nil__") + " "; } String nl = "\n"; if (aLayerFeature != null) { if (aLayerFeature.getLayer().isMultipleTokens()) { tag = multAnno.get(getAddr(token)) == null ? "O" : multAnno.get(getAddr(token)); } else { tag = annotations.size() == 0 ? NILL : annotations.get(i); i++; } } sb.append(word + " " + prefix1 + prefix2 + prefix3 + prefix4 + suffix1 + suffix2 + suffix3 + suffix4 + tag + nl); } return sb; }
From source file:net.sf.extjwnl.princeton.file.PrincetonRandomAccessDictionaryFile.java
private String renderIndexWord(IndexWord indexWord) { ArrayList<PointerType> pointerTypes = new ArrayList<PointerType>(); //find all the pointers that come from this word for (Synset synset : indexWord.getSenses()) { for (Pointer pointer : synset.getPointers()) { if (pointer.isLexical() && !indexWord.getLemma().equals(((Word) pointer.getSource()).getLemma().toLowerCase())) { continue; }/*from w w w .java 2s . com*/ //WN TRICK //see makedb.c line 370 PointerType pt = pointer.getType(); char c = pointer.getType().getKey().charAt(0); if (';' == c || '-' == c || '@' == c || '~' == c) { pt = PointerType.getPointerTypeForKey(Character.toString(c)); } if (!pointerTypes.contains(pt)) { pointerTypes.add(pt); } } } Collections.sort(pointerTypes); //sort senses and find out tagged sense count int tagSenseCnt = indexWord.sortSenses(); int estLength = indexWord.getLemma().length() + 1 //lemma + 2 //pos + 2 * (offsetLength + 1) //synset_cnt + sense_cnt + 1 + offsetLength//p_cnt + 3 * pointerTypes.size()//ptrs, each max 2 chars + 1 space + offsetLength + 1//tagsense_cnt + (offsetLength + 1) * indexWord.getSenses().size() + 2; //lemma pos synset_cnt p_cnt [ptr_symbol...] sense_cnt tagsense_cnt synset_offset [synset_offset...] StringBuilder result = new StringBuilder(estLength); result.append(indexWord.getLemma().replace(' ', '_')); result.append(" "); result.append(indexWord.getPOS().getKey()).append(" ");//pos result.append(Integer.toString(indexWord.getSenses().size())).append(" ");//synset_cnt result.append(Integer.toString(pointerTypes.size())).append(" ");//p_cnt for (PointerType pointerType : pointerTypes) { result.append(pointerType.getKey()).append(" "); } result.append(Integer.toString(indexWord.getSenses().size())).append(" ");//sense_cnt result.append(Integer.toString(tagSenseCnt)).append(" ");//tagsense_cnt for (Synset synset : indexWord.getSenses()) { formatOffset(synset.getOffset(), offsetLength, result); result.append(" ");//synset_offset } result.append(" "); return result.toString(); }
From source file:edu.emory.cci.aiw.i2b2etl.ksb.I2b2KnowledgeSourceBackend.java
public String getRacePropertyValueSetDelimiter() { return Character.toString(racePropertyValueSetDelimiter); }
From source file:com.krawler.spring.crm.common.crmManagerDAOImpl.java
@Override public String currencySymbol(String currencyid) throws ServiceException { try {//w ww .j a v a 2s . c o m String symbol = ""; KWLCurrency cur = (KWLCurrency) get(KWLCurrency.class, currencyid); if (!currencyid.equals("5")) { symbol = cur.getHtmlcode(); char temp = (char) Integer.parseInt(symbol, 16); symbol = Character.toString(temp); } else { symbol = "Rs"; } return symbol; } catch (Exception e) { return ""; } }
From source file:com.mirth.connect.donkey.server.data.jdbc.JdbcDao.java
@Override public void updateStatus(ConnectorMessage connectorMessage, Status previousStatus) { logger.debug(connectorMessage.getChannelId() + "/" + connectorMessage.getMessageId() + "/" + connectorMessage.getMetaDataId() + ": updating status from " + previousStatus.getStatusCode() + " to " + connectorMessage.getStatus().getStatusCode()); try {/* ww w . j av a 2 s .c o m*/ // don't decrement the previous status if it was RECEIVED if (previousStatus == Status.RECEIVED) { previousStatus = null; } transactionStats.update(connectorMessage.getChannelId(), connectorMessage.getMetaDataId(), connectorMessage.getStatus(), previousStatus); PreparedStatement statement = prepareStatement("updateStatus", connectorMessage.getChannelId()); statement.setString(1, Character.toString(connectorMessage.getStatus().getStatusCode())); statement.setInt(2, connectorMessage.getMetaDataId()); statement.setLong(3, connectorMessage.getMessageId()); statement.setString(4, connectorMessage.getServerId()); if (statement.executeUpdate() == 0) { throw new DonkeyDaoException( "Failed to update connector message status, the connector message was removed from this server."); } } catch (SQLException e) { throw new DonkeyDaoException(e); } }
From source file:com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.GUIComponents.XYSequencing.java
public void generateFOVs() { if (autoGenerateFOVsCheck.isSelected()) { ArrayList<FOV> fovs = new ArrayList<FOV>(); ArrayList<FOV> preexisting = new ArrayList<FOV>(tableModel_.getData()); tableModel_.clearAllData();//from www . ja v a2s .c o m for (int cols = 0; cols < pp_.getPlateColumns(); cols++) { ArrayList<Boolean> temp = pmdp_.wellsSelected_.get(cols); for (int rows = 0; rows < pp_.getPlateRows(); rows++) { if (temp.get(rows)) { String wellString = Character.toString((char) (65 + rows)) + Integer.toString(cols + 1); if (FOVPatternCombo.getSelectedIndex() == 0) { // spiral pattern fovs = generateSpiral(Integer.parseInt(noFOVsField.getText()), wellString); } else { fovs = generateRing(Integer.parseInt(noFOVsField.getText()), wellString); } for (FOV fov : fovs) { if (preexisting.contains(fov)) { // int ind = preexisting.indexOf(fov); fov.setGroup(preexisting.get(preexisting.indexOf(fov)).getGroup()); } else { fov.setGroup(groupDescField.getText()); } tableModel_.addRow(fov); // xyzmi_.fovXYtoStageXY(fov); } doZStackGeneration(getZStackParams()); // tableModel_.addRow(new FOV(wellString, pp_, 0)); } } } } }
From source file:de.tudarmstadt.ukp.clarin.webanno.automation.util.AutomationUtil.java
private static StringBuffer getMiraLineForTabSep(String aToken, String aFeature) throws CASException { StringBuffer sb = new StringBuffer(); char[] words = aToken.toCharArray(); String prefix1 = Character.toString(words[0]) + " "; String prefix2 = (words.length > 1 ? prefix1.trim() + (Character.toString(words[1]).trim().equals("") ? "__nil__" : Character.toString(words[1])) : "__nil__") + " "; String prefix3 = (words.length > 2 ? prefix2.trim() + (Character.toString(words[2]).trim().equals("") ? "__nil__" : Character.toString(words[2])) : "__nil__") + " "; String prefix4 = (words.length > 3 ? prefix3.trim() + (Character.toString(words[3]).trim().equals("") ? "__nil__" : Character.toString(words[3])) : "__nil__") + " "; String suffix1 = Character.toString(words[words.length - 1]) + " "; String suffix2 = (words.length > 1 ? (Character.toString(words[words.length - 2]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 2])) + suffix1.trim() : "__nil__") + " "; String suffix3 = (words.length > 2 ? (Character.toString(words[words.length - 3]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 3])) + suffix2.trim() : "__nil__") + " "; String suffix4 = (words.length > 3 ? (Character.toString(words[words.length - 4]).trim().equals("") ? "__nil__" : Character.toString(words[words.length - 4])) + suffix3.trim() : "__nil__") + " "; String nl = "\n"; sb.append(aToken + " " + prefix1 + prefix2 + prefix3 + prefix4 + suffix1 + suffix2 + suffix3 + suffix4 + aFeature + nl);/*from w w w.j a v a2s. c o m*/ return sb; }