List of usage examples for org.apache.commons.lang3 StringUtils substringAfter
public static String substringAfter(final String str, final String separator)
Gets the substring after the first occurrence of a separator.
From source file:net.eledge.android.europeana.gui.activity.SearchActivity.java
private String[] splitFacets(String facets) { if (StringUtils.isNotBlank(facets)) { facets = StringUtils.substringAfter(facets, "qf="); return StringUtils.split(facets, "&qf="); }/*from w w w . j a v a 2s. c om*/ return null; }
From source file:com.zhumeng.dream.orm.PropertyFilter.java
/** * ?PropertyFilter/*from w w w. ja va 2s . c o m*/ * * @param filterName * @param value */ public PropertyFilter(final String filterName, final Object value) { String propertyNameStr = StringUtils.substringAfter(filterName, "_"); init(filterName, value, propertyNameStr); matchValues = new Object[1]; matchValues[0] = value; this.matchValue = value; }
From source file:com.fengduo.spark.commons.file.excel.ImportExcel.java
/** * ??//from w w w . j av a 2 s . com * * @param cls * @param groups */ public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException { List<Object[]> annotationList = Lists.newArrayList(); // Get annotation field Field[] fs = cls.getDeclaredFields(); for (Field f : fs) { ExcelField ef = f.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, f }); break; } } } } else { annotationList.add(new Object[] { ef, f }); } } } // Get annotation method Method[] ms = cls.getDeclaredMethods(); for (Method m : ms) { ExcelField ef = m.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, m }); break; } } } } else { annotationList.add(new Object[] { ef, m }); } } } // Field sorting Collections.sort(annotationList, new Comparator<Object[]>() { public int compare(Object[] o1, Object[] o2) { return new Integer(((ExcelField) o1[0]).sort()).compareTo(new Integer(((ExcelField) o2[0]).sort())); }; }); // log.debug("Import column count:"+annotationList.size()); // Get excel data List<E> dataList = Lists.newArrayList(); for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) { E e = (E) cls.newInstance(); int column = 0; Row row = this.getRow(i); StringBuilder sb = new StringBuilder(); for (Object[] os : annotationList) { Object val = this.getCellValue(row, column++); if (val != null) { ExcelField ef = (ExcelField) os[0]; // If is dict type, get dict value // if (StringUtils.isNotBlank(ef.dictType())) { // val = DictUtils.getDictValue(val.toString(), ef.dictType(), ""); // log.debug("Dictionary type value: ["+i+","+colunm+"] " + val); // } // Get param type and type cast Class<?> valType = Class.class; if (os[1] instanceof Field) { valType = ((Field) os[1]).getType(); } else if (os[1] instanceof Method) { Method method = ((Method) os[1]); if ("get".equals(method.getName().substring(0, 3))) { valType = method.getReturnType(); } else if ("set".equals(method.getName().substring(0, 3))) { valType = ((Method) os[1]).getParameterTypes()[0]; } } // log.debug("Import value type: ["+i+","+column+"] " + valType); try { if (valType == String.class) { String s = String.valueOf(val.toString()); if (StringUtils.endsWith(s, ".0")) { val = StringUtils.substringBefore(s, ".0"); } else { val = String.valueOf(val.toString()); } } else if (valType == Integer.class) { val = Double.valueOf(val.toString()).intValue(); } else if (valType == Long.class) { val = Double.valueOf(val.toString()).longValue(); } else if (valType == Double.class) { val = Double.valueOf(val.toString()); } else if (valType == Float.class) { val = Float.valueOf(val.toString()); } else if (valType == Date.class) { val = DateUtil.getJavaDate((Double) val); } else { if (ef.fieldType() != Class.class) { val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString()); } else { val = Class .forName(this.getClass().getName().replaceAll( this.getClass().getSimpleName(), "fieldtype." + valType.getSimpleName() + "Type")) .getMethod("getValue", String.class).invoke(null, val.toString()); } } } catch (Exception ex) { log.info("Get cell value [" + i + "," + column + "] error: " + ex.toString()); val = null; } // set entity value if (os[1] instanceof Field) { Reflections.invokeSetter(e, ((Field) os[1]).getName(), val); } else if (os[1] instanceof Method) { String mthodName = ((Method) os[1]).getName(); if ("get".equals(mthodName.substring(0, 3))) { mthodName = "set" + StringUtils.substringAfter(mthodName, "get"); } Reflections.invokeMethod(e, mthodName, new Class[] { valType }, new Object[] { val }); } } sb.append(val + ", "); } dataList.add(e); log.debug("Read success: [" + i + "] " + sb.toString()); } return dataList; }
From source file:io.apiman.gateway.platforms.vertx3.common.config.VertxEngineConfig.java
protected String getClassname(JsonObject obj, String prefix) { String clazzName = System.getProperty(prefix); // TODO Something of a hack because the constants may assume apiman-gateway prefix, which isn't in the vert.x JSON. String strippedPrefix = StringUtils.substringAfter(prefix, "apiman-gateway."); String filteredPrefix = strippedPrefix.isEmpty() ? prefix : strippedPrefix; if (clazzName == null) return obj.getJsonObject(filteredPrefix, new JsonObject()).getString(GATEWAY_CLASS); return clazzName; }
From source file:com.funtl.framework.smoke.core.commons.excel.ImportExcel.java
/** * ??/*from w w w . j av a 2 s.c om*/ * * @param cls * @param groups */ public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException { List<Object[]> annotationList = Lists.newArrayList(); // Get annotation field Field[] fs = cls.getDeclaredFields(); for (Field f : fs) { ExcelField ef = f.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, f }); break; } } } } else { annotationList.add(new Object[] { ef, f }); } } } // Get annotation method Method[] ms = cls.getDeclaredMethods(); for (Method m : ms) { ExcelField ef = m.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, m }); break; } } } } else { annotationList.add(new Object[] { ef, m }); } } } // Field sorting Collections.sort(annotationList, new Comparator<Object[]>() { public int compare(Object[] o1, Object[] o2) { return new Integer(((ExcelField) o1[0]).sort()).compareTo(new Integer(((ExcelField) o2[0]).sort())); } ; }); //log.debug("Import column count:"+annotationList.size()); // Get excel data List<E> dataList = Lists.newArrayList(); for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) { E e = (E) cls.newInstance(); int column = 0; Row row = this.getRow(i); StringBuilder sb = new StringBuilder(); for (Object[] os : annotationList) { Object val = this.getCellValue(row, column++); if (val != null) { ExcelField ef = (ExcelField) os[0]; // If is dict type, get dict value if (StringUtils.isNotBlank(ef.dictType())) { val = DictUtils.getDictValue(val.toString(), ef.dictType(), ""); //log.debug("Dictionary type value: ["+i+","+colunm+"] " + val); } // Get param type and type cast Class<?> valType = Class.class; if (os[1] instanceof Field) { valType = ((Field) os[1]).getType(); } else if (os[1] instanceof Method) { Method method = ((Method) os[1]); if ("get".equals(method.getName().substring(0, 3))) { valType = method.getReturnType(); } else if ("set".equals(method.getName().substring(0, 3))) { valType = ((Method) os[1]).getParameterTypes()[0]; } } //log.debug("Import value type: ["+i+","+column+"] " + valType); try { if (valType == String.class) { String s = String.valueOf(val.toString()); if (StringUtils.endsWith(s, ".0")) { val = StringUtils.substringBefore(s, ".0"); } else { val = String.valueOf(val.toString()); } } else if (valType == Integer.class) { val = Double.valueOf(val.toString()).intValue(); } else if (valType == Long.class) { val = Double.valueOf(val.toString()).longValue(); } else if (valType == Double.class) { val = Double.valueOf(val.toString()); } else if (valType == Float.class) { val = Float.valueOf(val.toString()); } else if (valType == Date.class) { val = DateUtil.getJavaDate((Double) val); } else { if (ef.fieldType() != Class.class) { val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString()); } else { val = Class .forName(this.getClass().getName().replaceAll( this.getClass().getSimpleName(), "fieldtype." + valType.getSimpleName() + "Type")) .getMethod("getValue", String.class).invoke(null, val.toString()); } } } catch (Exception ex) { log.info("Get cell value [" + i + "," + column + "] error: " + ex.toString()); val = null; } // set entity value if (os[1] instanceof Field) { Reflections.invokeSetter(e, ((Field) os[1]).getName(), val); } else if (os[1] instanceof Method) { String mthodName = ((Method) os[1]).getName(); if ("get".equals(mthodName.substring(0, 3))) { mthodName = "set" + StringUtils.substringAfter(mthodName, "get"); } Reflections.invokeMethod(e, mthodName, new Class[] { valType }, new Object[] { val }); } } sb.append(val + ", "); } dataList.add(e); log.debug("Read success: [" + i + "] " + sb.toString()); } return dataList; }
From source file:com.mirth.connect.client.ui.components.MirthTree.java
/** * Construct a path for a specific node. * /*from w w w . j a v a 2 s. co m*/ * @param parent * @param prefix * @param suffix * @return */ public static StringBuilder constructPath(TreeNode parent, String prefix, String suffix) { StringBuilder sb = new StringBuilder(); sb.insert(0, prefix); MirthTreeNode node = (MirthTreeNode) parent; SerializationType serializationType = node.getSerializationType(); // Get the parent if the leaf was actually passed in instead of the parent. if (node.isLeaf()) { node = (MirthTreeNode) node.getParent(); } /* * MIRTH-3196 - We now assign nodes types as we iterate from child to parent to add more * versatility to namespace drag and drop. The drag and drop can drag nodes, attribute or * namespace attributes so the user should be able to correctly do these now. If a node has * a namespace then will wildcard it. If an ancestor of the node has an implicit namespace * then we will also append a wildcard. The only exception to this is if the implicit * namespace is on the root node, we actually set this to the default namespace in * JavaScriptBuilder. */ LinkedList<PathNode> nodeQ = new LinkedList<PathNode>(); while (node != null && node.getParent() != null) { if (serializationType.equals(SerializationType.JSON) && node.isArrayElement()) { nodeQ.add(new PathNode(String.valueOf(node.getParent().getIndex(node) - 1), PathNode.NodeType.ARRAY_CHILD)); } else { PathNode.NodeType type = PathNode.NodeType.OTHER; if (serializationType.equals(SerializationType.XML)) { type = getXmlNodeType(node); } String nodeValue = node.getValue().replaceAll(" \\(.*\\)", ""); nodeQ.add(new PathNode(nodeValue, type)); if (serializationType.equals(SerializationType.XML)) { int parentIndexValue = getIndexOfNode(node); if (parentIndexValue != -1) { nodeQ.add(nodeQ.size() - 1, new PathNode(String.valueOf(parentIndexValue), PathNode.NodeType.ARRAY_CHILD)); } } } node = (MirthTreeNode) node.getParent(); } boolean foundImplicitNamespace = false; while (!nodeQ.isEmpty()) { PathNode nodeValue = nodeQ.removeLast(); //We start at the parent so if any implicit namespaces are reached then the rest of the nodes should wildcard the namespace boolean includeNamespace = false; PathNode.NodeType type = nodeValue.getType(); //We don't want to include a wildcard for attributes, ns definitions or array indices if (serializationType.equals(SerializationType.XML) && !Arrays .asList(PathNode.NodeType.XML_ATTRIBUTE, PathNode.NodeType.XMLNS_DEFINITION, PathNode.NodeType.XML_PREFIX_DEFINITION, PathNode.NodeType.ARRAY_CHILD) .contains(type)) { if (foundImplicitNamespace) { includeNamespace = true; } else if (type == PathNode.NodeType.XML_XMLNS_NODE) { foundImplicitNamespace = true; includeNamespace = true; } else if (type == PathNode.NodeType.XML_PREFIXED_NODE) { includeNamespace = true; } } if (includeNamespace) { int colonIndex = nodeValue.getValue().indexOf(':') + 1; sb.append(".*::['" + StringUtils.substring(nodeValue.getValue(), colonIndex) + "']"); } else if (serializationType.equals(SerializationType.XML) && type == PathNode.NodeType.XMLNS_DEFINITION) { sb.append(".namespace('')"); } else if (serializationType.equals(SerializationType.XML) && type == PathNode.NodeType.XML_PREFIX_DEFINITION) { sb.append(".namespace('" + StringUtils.substringAfter(nodeValue.getValue(), "@xmlns:") + "')"); } else if (type == PathNode.NodeType.XML_PREFIXED_ATTRIBUTE) { sb.append(".@*::['" + StringUtils.substringAfter(nodeValue.getValue(), ":") + "']"); } else if (type == PathNode.NodeType.ARRAY_CHILD) { sb.append("[" + nodeValue.getValue() + "]"); } else { sb.append("['" + nodeValue.getValue() + "']"); } } if (!serializationType.equals(SerializationType.JSON)) { sb.append(suffix); } return sb; }
From source file:com.joint.base.util.excel.ImportExcel.java
/** * ??/*from www. j a va 2 s. c o m*/ * @param cls * @param groups */ public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException { List<Object[]> annotationList = Lists.newArrayList(); // Get annotation field Field[] fs = cls.getDeclaredFields(); for (Field f : fs) { ExcelField ef = f.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, f }); break; } } } } else { annotationList.add(new Object[] { ef, f }); } } } // Get annotation method Method[] ms = cls.getDeclaredMethods(); for (Method m : ms) { ExcelField ef = m.getAnnotation(ExcelField.class); if (ef != null && (ef.type() == 0 || ef.type() == 2)) { if (groups != null && groups.length > 0) { boolean inGroup = false; for (int g : groups) { if (inGroup) { break; } for (int efg : ef.groups()) { if (g == efg) { inGroup = true; annotationList.add(new Object[] { ef, m }); break; } } } } else { annotationList.add(new Object[] { ef, m }); } } } // Field sorting Collections.sort(annotationList, new Comparator<Object[]>() { public int compare(Object[] o1, Object[] o2) { return new Integer(((ExcelField) o1[0]).sort()).compareTo(new Integer(((ExcelField) o2[0]).sort())); }; }); //log.debug("Import column count:"+annotationList.size()); // Get excel data List<E> dataList = Lists.newArrayList(); for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) { E e = (E) cls.newInstance(); int column = 0; Row row = this.getRow(i); StringBuilder sb = new StringBuilder(); for (Object[] os : annotationList) { Object val = this.getCellValue(row, column++); if (val != null) { ExcelField ef = (ExcelField) os[0]; // If is dict type, get dict value if (StringUtils.isNotBlank(ef.dictType())) { //val = DictUtils.getDictValue(val.toString(), ef.dictType(), ""); //log.debug("Dictionary type value: ["+i+","+colunm+"] " + val); } // Get param type and type cast Class<?> valType = Class.class; if (os[1] instanceof Field) { valType = ((Field) os[1]).getType(); } else if (os[1] instanceof Method) { Method method = ((Method) os[1]); if ("get".equals(method.getName().substring(0, 3))) { valType = method.getReturnType(); } else if ("set".equals(method.getName().substring(0, 3))) { valType = ((Method) os[1]).getParameterTypes()[0]; } } //log.debug("Import value type: ["+i+","+column+"] " + valType); try { if (valType == String.class) { String s = String.valueOf(val.toString()); if (StringUtils.endsWith(s, ".0")) { val = StringUtils.substringBefore(s, ".0"); } else { val = String.valueOf(val.toString()); } } else if (valType == Integer.class) { val = Double.valueOf(val.toString()).intValue(); } else if (valType == Long.class) { val = Double.valueOf(val.toString()).longValue(); } else if (valType == Double.class) { val = Double.valueOf(val.toString()); } else if (valType == Float.class) { val = Float.valueOf(val.toString()); } else if (valType == Date.class) { val = DateUtil.getJavaDate((Double) val); } else { if (ef.fieldType() != Class.class) { val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString()); } else { val = Class .forName(this.getClass().getName().replaceAll( this.getClass().getSimpleName(), "fieldtype." + valType.getSimpleName() + "Type")) .getMethod("getValue", String.class).invoke(null, val.toString()); } } } catch (Exception ex) { log.info("Get cell value [" + i + "," + column + "] error: " + ex.toString()); val = null; } // set entity value if (os[1] instanceof Field) { Reflections.invokeSetter(e, ((Field) os[1]).getName(), val); } else if (os[1] instanceof Method) { String mthodName = ((Method) os[1]).getName(); if ("get".equals(mthodName.substring(0, 3))) { mthodName = "set" + StringUtils.substringAfter(mthodName, "get"); } Reflections.invokeMethod(e, mthodName, new Class[] { valType }, new Object[] { val }); } } sb.append(val + ", "); } dataList.add(e); log.debug("Read success: [" + i + "] " + sb.toString()); } return dataList; }
From source file:fusion.FuseLinkServlet.java
private void metadataKeepConcatLeft(int idx) throws SQLException { Connection virt_conn = vSet.getConnection(); StringBuilder concat_str = new StringBuilder(); for (String s : fs.predsA) { String[] pres = StringUtils.split(s, ","); StringBuilder q = new StringBuilder(); q.append("sparql SELECT * "); String prev_s = "<" + nodeA + ">"; q.append(" WHERE {\n GRAPH <" + tGraph + "metadataA> {"); for (int i = 0; i < pres.length; i++) { q.append(prev_s + " <" + pres[i] + "> ?o" + i + " . "); prev_s = "?o" + i; }//from w w w . j a va 2s. com q.append("} }"); //System.out.println(q.toString()); PreparedStatement stmt; stmt = virt_conn.prepareStatement(q.toString()); ResultSet rs = stmt.executeQuery(); while (rs.next()) { //for (int i = 0; i < pres.length; i++) { String o = rs.getString(pres.length); String simplified = StringUtils.substringAfter(pres[pres.length - 1], "#"); if (simplified.equals("")) { simplified = StringUtils.substring(pres[pres.length - 1], StringUtils.lastIndexOf(pres[pres.length - 1], "/") + 1); } //concat_str.append(simplified+":"+o+" "); concat_str.append(o + " "); //} } //System.out.println(q.toString()); } concat_str.setLength(concat_str.length() - 1); int lastIdx = StringUtils.lastIndexOf(fs.predsA.get(0), ","); String pred = fs.predsA.get(0).substring(0, lastIdx); String[] pres = StringUtils.split(pred, ","); StringBuilder q = new StringBuilder(); q.append("INSERT { GRAPH <" + tGraph + "> { "); String prev_s = "<" + nodeA + ">"; for (int i = 0; i < pres.length - 1; i++) { q.append(prev_s + " <" + pres[i] + "> ?o" + i + " . "); prev_s = "?o" + i; } q.append(prev_s + " ?o" + (pres.length - 1) + " \"" + concat_str + "\""); q.append("} } WHERE {\n GRAPH <" + tGraph + "metadataA> {"); prev_s = "<" + nodeA + ">"; for (int i = 0; i < pres.length; i++) { q.append(prev_s + " <" + pres[i] + "> ?o" + i + " . "); prev_s = "?o" + i; } q.append("} }"); //System.out.println(q.toString()); VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(q.toString(), vSet); vur.exec(); //System.out.println(concat_str); }
From source file:com.norconex.collector.http.url.impl.HtmlLinkExtractor.java
private String toAbsoluteURL(final Referer urlParts, final String newURL) { if (!isValidNewURL(newURL)) { return null; }//from ww w . java 2 s. c o m String url = newURL; if (url.startsWith("//")) { // this is URL relative to protocol url = urlParts.protocol + StringUtils.substringAfter(url, "//"); } else if (url.startsWith("/")) { // this is a URL relative to domain name url = urlParts.absoluteBase + url; } else if (url.startsWith("?") || url.startsWith("#")) { // this is a relative url and should have the full page base url = urlParts.documentBase + url; } else if (!url.contains("://")) { if (urlParts.relativeBase.endsWith("/")) { // This is a URL relative to the last URL segment url = urlParts.relativeBase + url; } else { url = urlParts.relativeBase + "/" + url; } } //TODO have configurable whether to strip anchors. url = StringUtils.substringBefore(url, "#"); if (url.length() > maxURLLength) { LOG.debug("URL length (" + url.length() + ") exeeding " + "maximum length allowed (" + maxURLLength + ") to be extracted. URL (showing first " + LOGGING_MAX_URL_LENGTH + " chars): " + StringUtils.substring(url, 0, LOGGING_MAX_URL_LENGTH) + "..."); return null; } return url; }
From source file:com.thinkbiganalytics.metadata.rest.api.DebugController.java
/** * Prints the nodes of the JCR path given, for debugging. * * @param query the jcr query// w w w . ja v a2 s. co m * @return a printout of the JCR tree */ @GET @Path("jcr-sql") @Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON }) public JcrQueryResult queryJcr(@QueryParam("query") final String query) { this.accessController.checkPermission(AccessController.SERVICES, MetadataAccessControl.ADMIN_METADATA); return metadata.read(() -> { List<List<String>> rows = new ArrayList<>(); Long startTime = System.currentTimeMillis(); JcrQueryResult jcrQueryResult = new JcrQueryResult(); try { Session session = JcrMetadataAccess.getActiveSession(); Workspace workspace = (Workspace) session.getWorkspace(); String explainPlain = JcrQueryUtil.explainPlain(session, query); //start the timer now: startTime = System.currentTimeMillis(); QueryResult result = JcrQueryUtil.query(session, query); jcrQueryResult.setExplainPlan(explainPlain); RowIterator rowItr = result.getRows(); List<JcrQueryResultColumn> columns = new ArrayList<>(); String colsStr = StringUtils.substringAfter(query.toLowerCase(), "select"); colsStr = StringUtils.substringBefore(colsStr, "from"); if (StringUtils.isNotBlank(colsStr)) { colsStr = colsStr.trim(); columns = Arrays.asList(colsStr.split(",")).stream().map(c -> { String columnName = c; if (c.contains("as ")) { columnName = StringUtils.substringAfter(c, "as "); } else if (c.contains(" ")) { columnName = StringUtils.substringAfter(c, " "); } return new JcrQueryResultColumn(columnName); }).collect(Collectors.toList()); } jcrQueryResult.setColumns(columns); while (rowItr.hasNext()) { Row row = rowItr.nextRow(); Value[] rowValues = row.getValues(); if (rowValues != null) { if (rowValues.length != columns.size()) { columns = IntStream.range(0, rowValues.length) .mapToObj(i -> new JcrQueryResultColumn("Column " + i)) .collect(Collectors.toList()); jcrQueryResult.setColumns(columns); } JcrQueryResultRow jcrQueryResultRow = new JcrQueryResultRow(); jcrQueryResult.addRow(jcrQueryResultRow); List<JcrQueryResultColumnValue> jcrQueryResultColumnValues = Arrays.asList(rowValues) .stream().map(v -> { try { String value = v.getString(); return new JcrQueryResultColumnValue(value); } catch (Exception e) { return new JcrQueryResultColumnValue("ERROR: " + e.getMessage()); } }).collect(Collectors.toList()); jcrQueryResultRow.setColumnValues(jcrQueryResultColumnValues); } } } catch (Exception e) { throw new RuntimeException(e); } long totalTime = System.currentTimeMillis() - startTime; jcrQueryResult.setQueryTime(totalTime); return jcrQueryResult; }); }