List of usage examples for org.apache.commons.lang StringUtils substringAfter
public static String substringAfter(String str, String separator)
Gets the substring after the first occurrence of a separator.
From source file:io.ecarf.core.utils.LogParser.java
/** * 03/03/2016 09:53:42 [ INFO] [main] reason.phase2.DoReasonTask9 - Finished reasoning, total inferred triples = 19535679 03/03/2016 09:53:42 [ INFO] [main] reason.phase2.DoReasonTask9 - Total rows retrieved from big data = 30457343 03/03/2016 09:53:42 [ INFO] [main] reason.phase2.DoReasonTask9 - Total processed GBytes = 10.054763808846474 03/03/2016 09:53:42 [ INFO] [main] reason.phase2.DoReasonTask9 - Total process reasoning time (serialization in inf file) = 1.017 min 03/03/2016 09:53:42 [ INFO] [main] reason.phase2.DoReasonTask9 - Total time spent in empty inference cycles = 1.508 min *///from w w w . j a v a2 s. c o m private void extractProcessorReasoningStats(String line, ProcessorStats stats) { if (line.indexOf(R_INFERRED) > -1) { stats.inferred = Integer.parseInt(StringUtils.substringAfter(line, R_INFERRED)); } else if (line.indexOf(R_ROWS) > -1) { stats.bigQueryRows = Integer.parseInt(StringUtils.substringAfter(line, R_ROWS)); } else if (line.indexOf(R_GBYTES) > -1) { stats.bigQueryProcBytes = Double.parseDouble(StringUtils.substringAfter(line, R_GBYTES)); } else if (line.indexOf(R_SERIAL_IN_FILE) > -1) { stats.serialInFile = this.extractAndGetTimer(line, R_SERIAL_IN_FILE); } else if (line.indexOf(R_EMPTY_CYCLE) > -1) { stats.retries = this.extractAndGetTimer(line, R_EMPTY_CYCLE); } }
From source file:com.google.gdt.eclipse.designer.uibinder.parser.UiBinderContext.java
/** * @return all attributes of the element with the given path. *//* w w w. j a v a2 s. c o m*/ public Map<String, Object> getAttributeValues(String path) { Map<String, Object> attribute = Maps.newHashMap(); String pathPrefix = path + " "; for (Entry<String, Object> entry : m_attributeValues.entrySet()) { if (entry.getKey().startsWith(pathPrefix)) { attribute.put(StringUtils.substringAfter(entry.getKey(), pathPrefix), entry.getValue()); } } return attribute; }
From source file:edu.ku.brc.specify.datamodel.busrules.TreeableSearchQueryBuilder.java
@SuppressWarnings("unchecked") public String buildSQL(final Map<String, Object> dataMap, final List<String> fieldNames) { //XXX use SQL instead of HQL, for portability. String queryStr = ""; TreeDefIface<?, ?, ?> treeDef = ((SpecifyAppContextMgr) AppContextMgr.getInstance()) .getTreeDefForClass((Class<? extends Treeable<?, ?, ?>>) nodeInForm.getClass()); Integer treeDefId = treeDef.getTreeDefId(); DBTableInfo tableInfo = DBTableIdMgr.getInstance().getByClassName(nodeInForm.getClass().getName()); String tableName = tableInfo.getName(); // get definition table and primary key column names DBTableInfo defTableInfo = DBTableIdMgr.getInstance() .getByClassName(tableInfo.getRelationshipByName("definition").getClassName()); String defMemberName = defTableInfo.getShortClassName(); defMemberName = defMemberName.substring(0, 1).toLowerCase().concat(defMemberName.substring(1)); cols.clear();//from ww w. j a va 2 s.com StringBuilder colNames = new StringBuilder(); int dspCnt = 0; for (String colName : fieldNames) { if (dspCnt > 0) colNames.append(','); String columnName = colName; String fieldName; if (!colName.startsWith(tableName + ".")) { //columnName = tableName + "." + colName; fieldName = "n." + columnName.substring(0, 1).toLowerCase().concat(columnName.substring(1)); } else { String fld = StringUtils.substringAfter(colName, "."); fieldName = "n." + fld.substring(0, 1).toLowerCase().concat(fld.substring(1)); } colNames.append(fieldName); String baseName = StringUtils.substringAfter(colName, "."); if (StringUtils.isEmpty(baseName)) { baseName = colName; } String colTitle; DBFieldInfo fi = tableInfo.getFieldByColumnName(baseName); if (fi != null) { colTitle = fi.getTitle(); } else { colTitle = baseName; } ERTICaptionInfo col = new ERTICaptionInfo(columnName, colTitle, true, null, dspCnt + 1); cols.add(col); dspCnt++; } StringBuilder orderBy = new StringBuilder(); StringBuilder criteria = new StringBuilder(); int criCnt = 0; for (String colName : dataMap.keySet()) { String data = (String) dataMap.get(colName); if (ESTermParser.getInstance().parse(data.toLowerCase(), true)) { if (StringUtils.isNotEmpty(data)) { List<SearchTermField> fields = ESTermParser.getInstance().getFields(); SearchTermField firstTerm = fields.get(0); String fieldName = colName; if (!colName.startsWith(tableName + ".")) { fieldName = "n." + colName.substring(0, 1).toLowerCase().concat(colName.substring(1)); } else { String fld = StringUtils.substringAfter(colName, "."); fieldName = "n." + fld.substring(0, 1).toLowerCase().concat(fld.substring(1)); } if (criCnt > 0) criteria.append(" OR "); String clause = ESTermParser.getInstance().createWhereClause(firstTerm, null, fieldName); criteria.append(clause); if (criCnt > 0) orderBy.append(','); orderBy.append(fieldName); criCnt++; } } } //no action if no search criteria are present. if (criteria.length() == 0) { return null; } queryStr = "SELECT n.id, " + colNames; queryStr += " from " + tableInfo.getShortClassName() + " n INNER JOIN n.definition d WHERE " + criteria.toString() + " AND d.id = " + treeDefId; Integer nodeId = nodeInForm == null ? null : nodeInForm.getTreeId(); Integer nodeNumber = nodeInForm == null ? null : nodeInForm.getNodeNumber(); Integer highestChildNodeNumber = nodeInForm == null ? null : nodeInForm.getHighestChildNodeNumber(); if (nodeId != null) { queryStr += " and n.id != " + nodeId; } if (rankCombo != null) { Object rank = rankCombo.getValue(); if (rank != null) { queryStr += " and n.rankId < " + ((TreeDefItemIface) rank).getRankId(); } else { int maxRank = 0; for (TreeDefItemIface defItem : treeDef.getTreeDefItems()) { if (defItem.getRankId() > maxRank) { maxRank = defItem.getRankId(); } } queryStr += " and n.rankId < " + maxRank; } } else if (nodeNumber != null && highestChildNodeNumber != null) { //don't allow children to be used as (for example). hybrid parents queryStr += " and (n.nodeNumber not between " + nodeNumber + " and " + highestChildNodeNumber + ")"; } if (accepted) { queryStr += " and n." + getAcceptedBooleanFldName() + " = true"; } if (!StringUtils.isBlank(orderBy.toString())) { queryStr += " ORDER BY " + orderBy.toString(); } //log.debug(queryStr); return queryStr; }
From source file:com.widen.valet.Route53Driver.java
private Zone buildZone(final XMLTag xml) { String id = StringUtils.substringAfter(xml.getText("Id"), "/hostedzone/"); String name = xml.getText("Name"); String callerReference = xml.getText("CallerReference"); String comment = ""; try {//w w w. j a v a 2 s .c o m comment = xml.getText("Config/Comment"); } catch (XMLDocumentException e) { } List<String> nameServers = new ArrayList<String>(); for (XMLTag nsTag : xml.getChilds("//NameServer")) { nameServers.add(nsTag.getTextOrCDATA()); } return new Zone(id, name, callerReference, comment, nameServers); }
From source file:info.magnolia.cms.servlets.EntryServlet.java
/** * @return URI mapping as in ServerInfo// ww w . j av a 2 s. c o m * @param request HttpServletRequest */ private String getURIMap(HttpServletRequest request) { return VirtualURIManager.getInstance() .getURIMapping(StringUtils.substringAfter(request.getRequestURI(), request.getContextPath())); }
From source file:hydrograph.ui.perspective.ApplicationWorkbenchWindowAdvisor.java
/** * This function will be return process ID which running on defined port * */// w w w .ja v a 2 s . com public String getServicePortPID(String portNumber) throws IOException { if (OSValidator.isWindows()) { ProcessBuilder builder = new ProcessBuilder( new String[] { "cmd", "/c", "netstat -a -o -n |findstr :" + portNumber }); Process process = builder.start(); InputStream inputStream = process.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String str = bufferedReader.readLine(); str = StringUtils.substringAfter(str, "LISTENING"); str = StringUtils.trim(str); return str; } return ""; }
From source file:io.ecarf.core.utils.LogParser.java
private double extractAndGetTimer(String line, String after, boolean ignoreMillis) { String timer = StringUtils.substringAfter(line, after); timer = StringUtils.remove(timer, ':'); timer = StringUtils.trim(timer);// w w w . j a v a 2 s. c o m return this.parseStopwatchTime(timer, ignoreMillis); }
From source file:com.rosy.bill.dao.hibernate.HibernateDao.java
private String prepareCountSql(String orgSql) { String fromSql = orgSql;/* w w w .j a va 2 s . c o m*/ //select??order by???count,?. fromSql = "from " + StringUtils.substringAfter(fromSql, "from"); fromSql = StringUtils.substringBefore(fromSql, "order by"); if (StringUtils.contains(fromSql, "group by")) { return " select count(*) from ( select count(*) " + fromSql + ")"; } String countSql = "select count(*) " + fromSql; return countSql; }
From source file:com.prowidesoftware.swift.model.field.SwiftParseUtils.java
/** * Split components of a line using the parameter separator and returns the forth token found or <code>null</code> if * forth component is missing. Two adjacent separators are NOT treated as one. The forth component is assumed as the * last one so its content may have additional separators if present.<br /> * Examples with slash as separator:<ul> * <li>for the literal "abc/def/ghi//ghi" will return null.</li> * <li>for the literal "abc/foo/ghi" will return "null".</li> * <li>for the literal "abc/def/ghi/foo" will return "foo".</li> * <li>for the literal "abc/def/ghi/foo/ghi" will return "foo/ghi".</li> * </ul>/*from w w w.j av a 2s .com*/ * * @param line * @param separator * @return s */ public static String getTokenForthLast(final String line, final String separator) { String result = null; final String s1 = getTokenThirdLast(line, separator); if (StringUtils.isNotBlank(s1)) { result = StringUtils.substringAfter(s1, separator); if (StringUtils.isBlank(result)) { result = null; } } return result; }
From source file:managedBeans.informes.InformeSeparadoMB.java
private int determinarNumSeparado() { int separado; if (!numSeparado.trim().isEmpty()) { try {//from ww w .java 2 s . c o m separado = Integer.parseInt(numSeparado); } catch (Exception e) { if (numSeparado.contains("0")) { String aux = StringUtils.substringAfter(numSeparado, "0"); try { separado = Integer.parseInt(aux); } catch (Exception ex) { separado = 0; } // } } else { separado = 0; } if (separado == 0) { CfgDocumento documento = documentoFacade.buscarDocumentoDeSeparadoBySede(sedeActual); String aux = documento.getPrefijoDoc(); int init = aux.length(); if (init < numSeparado.length()) { aux = numSeparado.substring(init); try { separado = Integer.parseInt(aux); } catch (Exception ex) { separado = 0; } } else { separado = 0; } } } } else { separado = 0; } return separado; }