@Override public Query setLimit(int limit) { this.query.setLimit(limit); return this; }
@Override public Query setLimit(int limit) { return getWrappedQuery().setLimit(limit); }
private long getLastUsedId() throws QueryException { this.logger.debug("getLastUsedId()"); long crtMaxID = 0; Query q = this.qm.createQuery("select family.identifier " + "from Document doc, " + " doc.object(PhenoTips.FamilyClass) as family " + "where family.identifier is not null " + "order by family.identifier desc", Query.XWQL).setLimit(1); List<Long> crtMaxIDList = q.execute(); if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) { crtMaxID = crtMaxIDList.get(0); } crtMaxID = Math.max(crtMaxID, 0); return crtMaxID; }
@Override protected long getLastUsedId() { this.logger.debug("getLastUsedId()"); long crtMaxID = 0; try { Query q = this.qm.createQuery("select family.identifier " + "from Document doc, " + " doc.object(PhenoTips.FamilyClass) as family " + "where family.identifier is not null " + "order by family.identifier desc", Query.XWQL).setLimit(1); List<Long> crtMaxIDList = q.execute(); if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) { crtMaxID = crtMaxIDList.get(0); } crtMaxID = Math.max(crtMaxID, 0); } catch (QueryException ex) { this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage()); } return crtMaxID; }
@Override protected long getLastUsedId() { long crtMaxID = 0; try { Query q = this.qm.createQuery( "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient" + " where patient.identifier is not null order by patient.identifier desc", Query.XWQL).setLimit(1); List<Long> crtMaxIDList = q.execute(); if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) { crtMaxID = crtMaxIDList.get(0); } crtMaxID = Math.max(crtMaxID, 0); } catch (QueryException ex) { this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage()); } return crtMaxID; } }
@Override protected long getLastUsedId() { long crtMaxID = 0; try { Query q = this.qm.createQuery( "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient" + " where patient.identifier is not null order by patient.identifier desc", Query.XWQL).setLimit(1); List<Long> crtMaxIDList = q.execute(); if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) { crtMaxID = crtMaxIDList.get(0); } crtMaxID = Math.max(crtMaxID, 0); } catch (QueryException ex) { this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage()); } return crtMaxID; } }
private List<String> runQuery(String queryString, String input, int resultsLimit) { String formattedInput = String.format(PhenotipsFamilyExport.INPUT_FORMAT, input); // Query patients Query query = null; List<String> queryResults = null; try { query = this.qm.createQuery(queryString, Query.XWQL); query.setLimit(resultsLimit); query.bindValue(PhenotipsFamilyExport.INPUT_PARAMETER, formattedInput); queryResults = query.execute(); } catch (QueryException e) { this.logger.error("Error while performing patiets query: [{}] ", e.getMessage()); return Collections.emptyList(); } return queryResults; }
protected long getLastUsedId() { long crtMaxID = 0; try { Query q = this.qm.createQuery( "select doc.name from Document doc, doc.object(" + this.localSerializer.serialize(getEntityXClassReference()) + ") as entity where doc.space = :space order by doc.name desc", Query.XWQL).bindValue("space", this.getDataSpace().getName()).setLimit(1); List<String> crtMaxIDList = q.execute(); if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) { crtMaxID = Integer.parseInt(crtMaxIDList.get(0).replaceAll("\\D++", "")); } crtMaxID = Math.max(crtMaxID, 0); } catch (QueryException ex) { this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage()); } return crtMaxID; }
protected long getLastUsedId() { long crtMaxID = 0; try { Query q = this.qm.createQuery( "select doc.name from Document doc, doc.object(" + this.localSerializer.serialize(getEntityXClassReference()) + ") as entity where doc.space = :space order by doc.name desc", Query.XWQL).bindValue("space", this.getDataSpace().getName()).setLimit(1); List<String> crtMaxIDList = q.execute(); if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) { crtMaxID = Integer.parseInt(crtMaxIDList.get(0).replaceAll("\\D++", "")); } crtMaxID = Math.max(crtMaxID, 0); } catch (QueryException ex) { this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage()); } return crtMaxID; }
private List<String> runQuery(String queryString, String formattedInput, int resultsLimit) { Query query = null; List<String> queryResults = null; try { query = this.qm.createQuery(queryString, Query.XWQL); if (resultsLimit > 0) { query.setLimit(resultsLimit); query.setOffset(0); } if (StringUtils.isNotBlank(formattedInput)) { query.bindValue(UsersAndGroups.INPUT_PARAMETER, formattedInput); } queryResults = query.execute(); } catch (QueryException e) { this.logger.error("Error while performing query: [{}] ", queryString, e.getMessage()); return Collections.emptyList(); } return queryResults; }
@Override public List<Event> getRecentPersonalMessages(DocumentReference author, int limit, int offset) { List<Event> result = new ArrayList<Event>(); try { Query q = this.qm.createQuery( "where event.application = 'MessageStream' and event.type = 'personalMessage'" + " and event.user = :user order by event.date desc", Query.XWQL); q.bindValue("user", this.serializer.serialize(author)); q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0); result = this.stream.searchEvents(q); } catch (QueryException ex) { LOG.warn("Failed to search personal messages: {}", ex.getMessage()); } return result; }
@Override public List<Event> getRecentMessagesForGroup(DocumentReference group, int limit, int offset) { List<Event> result = new ArrayList<Event>(); try { Query q = this.qm.createQuery( "where event.application = 'MessageStream' and event.type = 'groupMessage'" + " and event.stream = :group order by event.date desc", Query.XWQL); q.bindValue("group", this.serializer.serialize(group)); q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0); result = this.stream.searchEvents(q); } catch (QueryException ex) { LOG.warn("Failed to search group messages: {}", ex.getMessage()); } return result; }
queryResult = queryManager.createQuery(query, Query.XWQL).bindValue("space", spaceName).bindValue("name", pageName) .setLimit(number).bindValue("language", "").setOffset(start).execute();
@Override public List<Event> getRecentDirectMessages(int limit, int offset) { List<Event> result = new ArrayList<Event>(); try { Query q = this.qm.createQuery( "where event.application = 'MessageStream' and event.type = 'directMessage'" + " and event.stream = :targetUser order by event.date desc", Query.XWQL); q.bindValue("targetUser", this.serializer.serialize(this.bridge.getCurrentUserReference())); q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0); result = this.stream.searchEvents(q); } catch (QueryException ex) { LOG.warn("Failed to search direct messages: {}", ex.getMessage()); } return result; }
List<String> childPageFullNames = queryManager.createQuery(queryString, Query.XWQL).bindValue("parent", doc.getFullName()).setOffset(start) .setLimit(number).execute();
queryManager.getNamedQuery("getSpaces").setOffset(start).setLimit(number).execute();
queryManager.createQuery(query, Query.XWQL).bindValue("className", className).setLimit(number) .setOffset(start).execute();
query = queryManager.createQuery(select + whereClause + orderBy, Query.HQL).setLimit(LIMIT); countQuery = queryManager.createQuery(whereClause, Query.HQL).addFilter(countFilter);
.setLimit(queryLimit) .bindValue("className", className) .setWiki(classReference.getWikiReference().getName())