List of usage examples for java.lang String concat
public String concat(String str)
From source file:Controller.FileAction.java
public String downloadFile() throws FileNotFoundException { f = fdao.getFileById(id);//from w ww. ja v a 2s . com String filePath = ServletActionContext.getServletContext().getRealPath("/"); int a = filePath.indexOf("\\build\\web"); filePath = filePath.substring(0, a); filePath = filePath.concat("/web/task/"); filePath = filePath.concat(Integer.toString(f.getuId())).concat("/"); filePath = filePath.concat(f.getfName()); fileInputStream = new FileInputStream(new File(filePath)); fileName = f.getfName(); return "success"; }
From source file:com.anite.ocelot.CachedPrintWriter.java
/** * {@inheritDoc}//from w w w .ja va2 s . com */ public void write(String s, int off, int len) { if (log.isInfoEnabled()) { log.info("write String off len"); } String n = ""; if (off > 0) { n = n.concat(buf.substring(0, off) + s + buf.substring(off + 1, buf.length())); } else { n = n.concat(s); } buf = n; super.write(s, off, len); }
From source file:lucee.runtime.chart.PieSectionLegendLabelGeneratorImpl.java
private void reorganize(StringBuilder sb, StringList list, StringBuilder rest) { // fill rest// w ww. j a v a2 s. co m String item; while (list.hasNext()) { item = list.next(); rest.append(list.delimiter()); rest.append(item); } StringList words = ListUtil.toWordList(rest.toString()); StringBuffer line = new StringBuffer(); while (words.hasNext()) { item = words.next(); if (line.length() > 0 && metrics.stringWidth(item.concat(" ").concat(line.toString())) > with) { if (sb.length() > 0) sb.append('\n'); sb.append(line); //print.out("line:"+line); line = new StringBuffer(item); } else { //item=words.next(); if (line.length() > 0) line.append(words.delimiter() == 0 ? ' ' : words.delimiter()); line.append(item); } } if (line.length() > 0) { if (sb.length() > 0) sb.append('\n'); sb.append(line); } }
From source file:com.webbfontaine.valuewebb.search.PortFinder.java
public String select(String str) { String sql = "select rimmPort from RimmPort rimmPort where " + "lower(rimmPort.cod) like lower(concat(:codParam, '%')) and "; if (FR.equals(Utils.getLanguage())) { sql += "lower(rimmPort.dscFr) like lower(concat(:dscParam, '%')) "; } else {/*from w w w . j av a2s . c om*/ sql += "lower(rimmPort.dsc) like lower(concat(:dscParam, '%')) "; } if (str.equals("")) { sql = sql.concat("order by rimmPort.cod, rimmPort.dsc"); } else { sql = sql.concat( "and substr(lower(rimmPort.cod), 0, 2) = lower(:str) order by rimmPort.cod, rimmPort.dsc"); } Query query = entityManager.createQuery(sql).setParameter("codParam", rimmCriteria.getCod()) .setParameter("dscParam", rimmCriteria.getDsc()); if (!str.equals("")) { query.setParameter("str", str); } resultList = Utils.setDirectRead(query).setMaxResults(Constants.MAX_RECORDS_IN_ATTACHED_FINDER) .getResultList(); return null; }
From source file:com.denimgroup.threadfix.framework.impl.rails.RailsControllerParser.java
private void addMethodParam(String stringValue) { for (String s : tokenQueue) { // .new .create, Model.attr1, Model.attr2 if ((s.endsWith(".new") || s.endsWith(".create")) && s.toLowerCase().startsWith(stringValue)) { for (String p : modelMap.get(stringValue)) { String param = stringValue.concat(".").concat(p); if (currentCtrlMethod.getMethodParams() == null || !currentCtrlMethod.getMethodParams().contains(param)) { currentCtrlMethod.addMethodParam(param); }/*from w w w. j ava 2 s.co m*/ } return; } } if (currentCtrlMethod.getMethodParams() == null || !currentCtrlMethod.getMethodParams().contains(stringValue)) { currentCtrlMethod.addMethodParam(stringValue); } }
From source file:com.liferay.portlet.StrutsResourceBundle.java
@Override protected Object handleGetObject(String key) { if (key == null) { throw new NullPointerException(); }// w w w. j av a 2 s . co m if ((key.equals(JavaConstants.JAVAX_PORTLET_DESCRIPTION) || key.equals(JavaConstants.JAVAX_PORTLET_KEYWORDS) || key.equals(JavaConstants.JAVAX_PORTLET_LONG_TITLE) || key.equals(JavaConstants.JAVAX_PORTLET_SHORT_TITLE) || key.equals(JavaConstants.JAVAX_PORTLET_TITLE))) { key = key.concat(StringPool.PERIOD).concat(_portletName); } String value = StringUtils.EMPTY; try { value = ResourceBundleUtil.getString(_locale, key); } catch (Exception e) { _logger.error(e.getMessage()); } if (StringUtils.isBlank(value)) LanguageUtil.get(_locale, key); if ((value == null) && ResourceBundleThreadLocal.isReplace()) { value = ResourceBundleUtil.NULL_VALUE; } return value; }
From source file:com.dgwave.osrs.OsrsClient.java
private String getSignature(String xml) { String signature = new String(); try {/* ww w.ja va 2 s.c o m*/ MessageDigest md5 = MessageDigest.getInstance("MD5"); String concat = xml + OsrsConfig.getValue("osrs.key"); concat = bytesToHex(md5.digest(concat.getBytes())); signature = bytesToHex(md5.digest(concat.concat(OsrsConfig.getValue("osrs.key")).getBytes())); } catch (Exception ex) { logger.warn("Error generating signature: ", ex); } return signature; }
From source file:org.opencastproject.userdirectory.jpa.JpaUserAndRoleProvider.java
/** * {@inheritDoc}/*w w w . j av a 2s. c o m*/ * * @see org.opencastproject.security.api.UserProvider#loadUser(java.lang.String) */ @Override public User loadUser(String userName) { String orgId = securityService.getOrganization().getId(); Object user = cache.get(userName.concat(DELIMITER).concat(orgId)); if (user == nullToken) { return null; } else { return (User) user; } }
From source file:com.activecq.tools.flipbook.components.impl.FlipbookServiceImpl.java
public List<Resource> getPages(final Resource resource) throws RepositoryException { final ResourceResolver resourceResolver = resource.getResourceResolver(); final PageManager pageManager = resourceResolver.adaptTo(PageManager.class); final List<Resource> pages = new ArrayList<Resource>(); final Map<String, String> map = new HashMap<String, String>(); map.put("type", "cq:Component"); map.put("orderby", "@jcr:title"); map.put("orderby.sort", "asc"); map.put("p.offset", "0"); // Cowardly refusing to return more than 10000 results // If you have more than 10,000 components something is seriously wrong // with your design approach map.put("p.limit", String.valueOf(MAX_RESULTS)); final Query query = queryBuilder.createQuery(PredicateGroup.create(map), resourceResolver.adaptTo(Session.class)); final SearchResult result = query.getResult(); for (Hit hit : result.getHits()) { final ValueMap props = hit.getProperties(); final String path = hit.getPath(); boolean hide = true; for (final String validPathPrefix : this.getPaths(pageManager.getContainingPage(resource))) { if (StringUtils.startsWith(path, validPathPrefix.concat("/"))) { hide = false;/*from w ww . j a v a 2 s.com*/ } } if (!hide) { if (!this.getShowHidden(resource.adaptTo(ValueMap.class))) { hide = StringUtils.equals(props.get("componentGroup", HIDDEN_COMPONENT_GROUP), ""); } } if (!hide) { hide = props.get("hideInFlipbook", false); } if (!hide) { pages.add(hit.getResource()); } } return pages; }
From source file:com.pactera.edg.am.metamanager.extractor.dao.impl.DeconstructorDaoImpl.java
private String getInstanceId(String rootId, Map<String, String> deleteData, Map<String, String> pathInstanceCache) { String path = ""; String parentId = rootId;/*ww w .j a v a 2s .c o m*/ try { for (Iterator<String> pathIter = deleteData.keySet().iterator(); pathIter.hasNext();) { // String pathKey = pathIter.next(); // CODE?? String pathCode = deleteData.get(pathKey); path = path.concat(pathCode).concat(separator); if (pathInstanceCache.containsKey(path)) { parentId = pathInstanceCache.get(path); } else { Map<?, ?> map = super.getJdbcTemplate().queryForMap(GenSqlUtil.getSql("FIND_CHILD_METADATA"), new Object[] { parentId, pathKey, pathCode }); if (map == null || map.size() == 0) { // ??????? return null; } // ?,? // System.out.println("" + parentId + ",:" + pathKey + ",CODE:" + pathCode + ",?ID" // + map.get("INSTANCE_ID")); parentId = (String) map.get("INSTANCE_ID"); pathInstanceCache.put(path, parentId); } } } catch (EmptyResultDataAccessException e) { // ???NULL return null; } if (parentId != rootId) return parentId; return null; }