protected Document walkEcmPath(Operator op, Operand rvalue) { if (op != Operator.EQ && op != Operator.NOTEQ) { throw new QueryParseException(NXQL.ECM_PATH + " requires = or <> operator"); } if (!(rvalue instanceof StringLiteral)) { throw new QueryParseException(NXQL.ECM_PATH + " requires literal path as right argument"); } String path = ((StringLiteral) rvalue).value; if (path.length() > 1 && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } String id = pathResolver.getIdForPath(path); if (id == null) { // no such path // TODO XXX do better return new Document(MONGODB_ID, "__nosuchid__"); } if (op == Operator.EQ) { return new Document(idKey, id); } else { return new Document(idKey, new Document(QueryOperators.NE, id)); } }
protected Boolean walkEcmPath(Operator op, Operand rvalue) { if (op != Operator.EQ && op != Operator.NOTEQ) { throw new QueryParseException(NXQL.ECM_PATH + " requires = or <> operator"); } if (!(rvalue instanceof StringLiteral)) { throw new QueryParseException(NXQL.ECM_PATH + " requires literal path as right argument"); } String path = ((StringLiteral) rvalue).value; if (path.length() > 1 && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } String id = pathResolver.getIdForPath(path); Object right = walkReference(new Reference(NXQL.ECM_UUID)); if (id == null) { return FALSE; } Boolean eq = eq(id, right); return op == Operator.EQ ? eq : not(eq); }
protected Boolean walkStartsWithPath(String path) { // resolve path String ancestorId = pathResolver.getIdForPath(path); // don't return early on null ancestorId, we want to walk all references deterministically Object[] ancestorIds = (Object[]) walkReference(new Reference(NXQL_ECM_ANCESTOR_IDS)); if (ancestorId == null) { // no such path return FALSE; } if (ancestorIds == null) { // placeless return FALSE; } for (Object id : ancestorIds) { if (ancestorId.equals(id)) { return TRUE; } } return FALSE; }
protected Document walkStartsWithPath(String path) { // resolve path String ancestorId = pathResolver.getIdForPath(path); if (ancestorId == null) { // no such path // TODO XXX do better return new Document(MONGODB_ID, "__nosuchid__"); } return new Document(DBSDocument.KEY_ANCESTOR_IDS, ancestorId); }