/** * Get the selector name if only one selector exists in the query. * If more than one selector exists, an exception is thrown. * * @param name the property name * @return the selector name */ private String getOnlySelectorName(String propertyName) throws RepositoryException { if (selectors.size() > 1) { throw getSyntaxError("Need to specify the selector name for \"" + propertyName + "\" because the query contains more than one selector."); } return selectors.get(0).getSelectorName(); }
/** * Get the selector name if only one selector exists in the query. * If more than one selector exists, an exception is thrown. * * @param name the property name * @return the selector name */ private String getOnlySelectorName(String propertyName) throws RepositoryException { if (selectors.size() > 1) { throw getSyntaxError("Need to specify the selector name for \"" + propertyName + "\" because the query contains more than one selector."); } return selectors.get(0).getSelectorName(); }
/** * Get the selector name if only one selector exists in the query. * If more than one selector exists, an exception is thrown. * * @param name the property name * @return the selector name */ private String getOnlySelectorName(String propertyName) throws RepositoryException { if (selectors.size() > 1) { throw getSyntaxError("Need to specify the selector name for \"" + propertyName + "\" because the query contains more than one selector."); } return selectors.get(0).getSelectorName(); }
private void append(Selector selector) { appendName(selector.getNodeTypeName()); if (!selector.getSelectorName().equals(selector.getNodeTypeName())) { append(" AS "); appendName(selector.getSelectorName()); } }
private void append(Selector selector) { appendName(selector.getNodeTypeName()); if (!selector.getSelectorName().equals(selector.getNodeTypeName())) { append(" AS "); appendName(selector.getSelectorName()); } }
private void append(Selector selector) { appendName(selector.getNodeTypeName()); if (!selector.getSelectorName().equals(selector.getNodeTypeName())) { append(" AS "); appendName(selector.getSelectorName()); } }
private Set<String> getSelectorNames(Source source) throws RepositoryException { if (source instanceof Selector) { Selector selector = (Selector) source; return Collections.singleton(selector.getSelectorName()); } else if (source instanceof Join) { Join join = (Join) source; Set<String> set = new LinkedHashSet<String>(); set.addAll(getSelectorNames(join.getLeft())); set.addAll(getSelectorNames(join.getRight())); return set; } else { throw new UnsupportedRepositoryOperationException( "Unknown source type: " + source); } }
private Set<String> getSelectorNames(Source source) throws RepositoryException { if (source instanceof Selector) { Selector selector = (Selector) source; return Collections.singleton(selector.getSelectorName()); } else if (source instanceof Join) { Join join = (Join) source; Set<String> set = new LinkedHashSet<String>(); set.addAll(getSelectorNames(join.getLeft())); set.addAll(getSelectorNames(join.getRight())); return set; } else { throw new UnsupportedRepositoryOperationException( "Unknown source type: " + source); } }
private Map<String, NodeType> getSelectorNames(Source source) throws RepositoryException { if (source instanceof Selector) { Selector selector = (Selector) source; return Collections.singletonMap(selector.getSelectorName(), getNodeType(selector)); } else if (source instanceof Join) { Join join = (Join) source; Map<String, NodeType> map = new LinkedHashMap<String, NodeType>(); map.putAll(getSelectorNames(join.getLeft())); map.putAll(getSelectorNames(join.getRight())); return map; } else { throw new UnsupportedRepositoryOperationException( "Unknown source type: " + source); } }
if (c.selectorName == null || c.selectorName .equals(selector.getSelectorName())) { Column column = factory.column(selector .getSelectorName(), null, null); columns.add(column);
private Map<String, NodeType> getSelectorNames(Source source) throws RepositoryException { if (source instanceof Selector) { Selector selector = (Selector) source; return Collections.singletonMap(selector.getSelectorName(), getNodeType(selector)); } else if (source instanceof Join) { Join join = (Join) source; Map<String, NodeType> map = new LinkedHashMap<String, NodeType>(); map.putAll(getSelectorNames(join.getLeft())); map.putAll(getSelectorNames(join.getRight())); return map; } else { throw new UnsupportedRepositoryOperationException( "Unknown source type: " + source); } }
if (c.selectorName == null || c.selectorName .equals(selector.getSelectorName())) { Column column = factory.column(selector .getSelectorName(), null, null); columns.add(column);
if (c.selectorName == null || c.selectorName .equals(selector.getSelectorName())) { Column column = factory.column(selector .getSelectorName(), null, null); columns.add(column);
/** * Test case for {@link QueryObjectModelFactory#selector(String, String)} */ public void testSelector() throws RepositoryException { Selector selector = qf.selector(ntBase, SELECTOR_NAME1); assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName()); assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName()); }
/** * Test case for {@link QueryObjectModelFactory#selector(String, String)} */ public void testSelectorWithName() throws RepositoryException { Selector selector = qf.selector(ntBase, SELECTOR_NAME1); assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName()); assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName()); }
private Constraint getAuthorizationConstraint(final HippoQueryObjectModelFactoryImpl factory, final Source source) throws RepositoryException { final Constraint constraint; if (source instanceof Join) { final Join join = (Join) source; final Constraint leftAuthorization = getAuthorizationConstraint(factory, join.getLeft()); final Constraint rightAuthorization = getAuthorizationConstraint(factory, join.getRight()); constraint = factory.and(leftAuthorization, rightAuthorization); } else { final Selector selector = (Selector) source; constraint = new AuthorizationConstraint(sessionContext, selector.getSelectorName()); } return constraint; }
@Test public void selector() throws RepositoryException { Selector s = f.selector("nodeTypeName", "selectorName"); assertEquals("nodeTypeName", s.getNodeTypeName()); assertEquals("selectorName", s.getSelectorName()); assertEquals("[nodeTypeName] AS [selectorName]", s.toString()); assertEquals("[n]", f.selector("n", null).toString()); }
String name = selector.getSelectorName(); NodeType type = ntManager.getNodeType(selector.getNodeTypeName()); try { row = new SelectorRow(columns, evaluator, selector.getSelectorName(), session.getNodeById(node.getNodeId()), node.getScore());
String name = selector.getSelectorName(); NodeType type = ntManager.getNodeType(selector.getNodeTypeName()); try { row = new SelectorRow(columns, evaluator, selector.getSelectorName(), session.getNodeById(node.getNodeId()), node.getScore());