/** * Enters the current node. */ public void enter(Value val) { if (val instanceof Parameter) { if (_parameterized != null) { _collected.add(_parameterized); } } else if (val instanceof Path) { _parameterized = ((Path)val).last(); } else { _parameterized = null; } }
/** * Enters the current node. */ public void enter(Value val) { if (val instanceof Parameter) { if (_parameterized != null) { _collected.add(_parameterized); } } else if (val instanceof Path) { _parameterized = ((Path)val).last(); } else { _parameterized = null; } }
/** * Enters the current node. */ public void enter(Value val) { if (val instanceof Parameter) { if (_parameterized != null) { _collected.add(_parameterized); } } else if (val instanceof Path) { _parameterized = ((Path)val).last(); } else { _parameterized = null; } }
/** * Enters the current node. */ public void enter(Value val) { if (val instanceof Parameter) { if (_parameterized != null) { _collected.add(_parameterized); } } else if (val instanceof Path) { _parameterized = ((Path)val).last(); } else { _parameterized = null; } }
private boolean isMultiValuedTraversalAttempt(Path path, String field) { if (path == null) return false; if (path.last() == null) return false; if (path.last().getElement() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData().getField(field) == null) return false; return true; }
private boolean isMultiValuedTraversalAttempt(Path path, String field) { if (path == null) return false; if (path.last() == null) return false; if (path.last().getElement() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData().getField(field) == null) return false; return true; }
private boolean isMultiValuedTraversalAttempt(Path path, String field) { if (path == null) return false; if (path.last() == null) return false; if (path.last().getElement() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData().getField(field) == null) return false; return true; }
private boolean isMultiValuedTraversalAttempt(Path path, String field) { if (path == null) return false; if (path.last() == null) return false; if (path.last().getElement() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData() == null) return false; if (path.last().getElement().getDeclaredTypeMetaData().getField(field) == null) return false; return true; }
protected ClassMetaData resolveClassMetaData(JPQLNode node) { // handle looking up alias names String schemaName = assertSchemaName(node); ClassMetaData cmd = getClassMetaData(schemaName, false); if (cmd != null) return cmd; // we might be referencing a collection field of a subquery's parent if (isPath(node)) { Path path = getPath(node); return getFieldType(path.last()); } // now run again to throw the correct exception return getClassMetaData(schemaName, true); }
protected ClassMetaData resolveClassMetaData(JPQLNode node) { // handle looking up alias names String schemaName = assertSchemaName(node); ClassMetaData cmd = getClassMetaData(schemaName, false); if (cmd != null) return cmd; // we might be referencing a collection field of a subquery's parent if (isPath(node)) { Path path = getPath(node); FieldMetaData fmd = path.last(); cmd = getFieldType(fmd); if (cmd == null && fmd.isElementCollection()) cmd = fmd.getDefiningMetaData(); return cmd; } // now run again to throw the correct exception return getClassMetaData(schemaName, true); }
public static void checkEmbeddable(Value val, String currentQuery) { Path path = val instanceof Path ? (Path) val : null; if (path == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; ValueMetaData vm = fmd.isElementCollection() ? fmd.getElement() : fmd.getValue(); if (vm.getEmbeddedMetaData() != null) { //throw parseException(EX_USER, "bad-predicate", // new Object[]{ currentQuery() }, null); String argStr = _loc.get("bad-predicate", new Object[] {fmd.getName()}).getMessage(); Message msg = _loc.get("parse-error", argStr, currentQuery); throw new UserException(msg, null); } }
public static void checkEmbeddable(Value val, String currentQuery) { Path path = val instanceof Path ? (Path) val : null; if (path == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; ValueMetaData vm = fmd.isElementCollection() ? fmd.getElement() : fmd.getValue(); if (vm.getEmbeddedMetaData() != null) { //throw parseException(EX_USER, "bad-predicate", // new Object[]{ currentQuery() }, null); String argStr = _loc.get("bad-predicate", new Object[] {fmd.getName()}).getMessage(); Message msg = _loc.get("parse-error", argStr, currentQuery); throw new UserException(msg, null); } }
public static void checkEmbeddable(Value val, String currentQuery) { Path path = val instanceof Path ? (Path) val : null; if (path == null) return; FieldMetaData fmd = path.last(); if (fmd == null) return; ValueMetaData vm = fmd.isElementCollection() ? fmd.getElement() : fmd.getValue(); if (vm.getEmbeddedMetaData() != null) { //throw parseException(EX_USER, "bad-predicate", // new Object[]{ currentQuery() }, null); String argStr = _loc.get("bad-predicate", new Object[] {fmd.getName()}).getMessage(); Message msg = _loc.get("parse-error", argStr, currentQuery); throw new UserException(msg, null); } }
/** * Throw proper exception if given value is a collection/map/array. */ protected void assertNotContainer(Value val, StoreQuery q) { // variables represent container elements, not the container itself if (val.isVariable()) return; Class<?> type; if (val instanceof Path) { FieldMetaData fmd = ((Path) val).last(); type = (fmd == null) ? val.getType() : fmd.getDeclaredType(); } else type = val.getType(); switch (JavaTypes.getTypeCode(type)) { case JavaTypes.ARRAY: case JavaTypes.COLLECTION: case JavaTypes.MAP: throw new UserException(_loc.get("container-projection", q.getContext().getQueryString())); } }
/** * Throw proper exception if given value is a collection/map/array. */ protected void assertNotContainer(Value val, StoreQuery q) { // variables represent container elements, not the container itself if (val.isVariable()) return; Class type; if (val instanceof Path) { FieldMetaData fmd = ((Path) val).last(); type = (fmd == null) ? val.getType() : fmd.getDeclaredType(); } else type = val.getType(); switch (JavaTypes.getTypeCode(type)) { case JavaTypes.ARRAY: case JavaTypes.COLLECTION: case JavaTypes.MAP: throw new UserException(_loc.get("container-projection", q.getContext().getQueryString())); } }
protected void evalSetClause(QueryExpressions exps) { // handle SET field = value JPQLNode[] nodes = root().findChildrenByID(JJTUPDATEITEM); for (int i = 0; nodes != null && i < nodes.length; i++) { Path path = getPath(firstChild(nodes[i])); if (path.last().getValue().getEmbeddedMetaData() != null) throw parseException(EX_USER, "cant-bulk-update-embeddable", new Object[]{assemble(firstChild(nodes[i]))}, null); JPQLNode lastChild = lastChild(nodes[i]); Value val = (lastChild.children == null) ? null : getValue(onlyChild(lastChild)); exps.putUpdate(path, val); } }
protected void evalSetClause(QueryExpressions exps) { // handle SET field = value JPQLNode[] nodes = root().findChildrenByID(JJTUPDATEITEM); for (int i = 0; nodes != null && i < nodes.length; i++) { Path path = getPath(firstChild(nodes[i])); if (path.last().getValue().getEmbeddedMetaData() != null) throw parseException(EX_USER, "cant-bulk-update-embeddable", new Object[]{assemble(firstChild(nodes[i]))}, null); JPQLNode lastChild = lastChild(nodes[i]); Value val = (lastChild.children == null) ? null : getValue(onlyChild(lastChild)); exps.putUpdate(path, val); } }
protected void evalSetClause(QueryExpressions exps) { // handle SET field = value JPQLNode[] nodes = root().findChildrenByID(JJTUPDATEITEM); for (int i = 0; nodes != null && i < nodes.length; i++) { Path path = getPath(firstChild(nodes[i])); if (path.last().getValue().getEmbeddedMetaData() != null) throw parseException(EX_USER, "cant-bulk-update-embeddable", new Object[]{assemble(firstChild(nodes[i]))}, null); JPQLNode lastChild = lastChild(nodes[i]); Value val = (lastChild.children == null) ? null : getValue(onlyChild(lastChild)); exps.putUpdate(path, val); } }
protected void evalSetClause(QueryExpressions exps) { // handle SET field = value JPQLNode[] nodes = root().findChildrenByID(JJTUPDATEITEM); for (int i = 0; nodes != null && i < nodes.length; i++) { Path path = getPath(firstChild(nodes[i])); if (path.last().getValue().getEmbeddedMetaData() != null) throw parseException(EX_USER, "cant-bulk-update-embeddable", new Object[]{assemble(firstChild(nodes[i]))}, null); JPQLNode lastChild = lastChild(nodes[i]); Value val = (lastChild.children == null) ? null : getValue(onlyChild(lastChild)); exps.putUpdate(path, val); } }
private Value getGeneralIdentifier(JPQLNode node, boolean verifyEmbeddable) { JPQLNode id = onlyChild(node); Path path = validateMapPath(node, id); if (node.id == JJTKEY) path = (Path) factory.getKey(path); FieldMetaData fld = path.last(); ClassMetaData meta = fld.getKey().getTypeMetaData(); if (verifyEmbeddable && (node.id == JJTKEY && meta != null && fld.getKey().isEmbedded()) || (node.id == JJTVALUE && fld.isElementCollection() && fld.getElement().getEmbeddedMetaData() != null)) { // check basic type if (node.parent.parent.id == JJTGROUPBY) throw parseException(EX_USER, "cant-groupby-key-value-embeddable", new Object[]{ node.id == JJTVALUE ? "VALUE" : "KEY", id.text }, null); else throw parseException(EX_USER, "bad-general-identifier", new Object[]{ node.id == JJTVALUE ? "VALUE" : "KEY", id.text }, null); } return path; }