@Test public void buildsCorrectQueryForSingle() { ArgumentCaptor<OSQLQuery> queryCaptor = ArgumentCaptor.forClass(OSQLQuery.class); browseEntitiesByPropertyInSetAction.execute(db, newHashSet("Test")); verify(db, times(1)).command(queryCaptor.capture()); assertEquals("SELECT * FROM " + ENTITY_NAME + " WHERE " + PROPERTY + " IN [ ? ]", queryCaptor.getValue().getText()); }
public Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values) { checkNotNull(db); checkArgument(values != null && values.size() > 0); String valueFields = values.stream().map(value -> "?").collect(joining(",")); String adjustedQuery = String.format(query, valueFields); Iterable<ODocument> results = db.command(new OSQLSynchQuery<>(adjustedQuery)).execute(values.toArray()); return adapter.transform(results); }
BrowseEntitiesByPropertyInSetAction extends ComponentSupport { public Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values) { checkNotNull(db); checkArgument(values != null && values.size() > 0); String valueFields = values.stream().map(value -> "?").collect(joining(",")); String adjustedQuery = String.format(query, valueFields); Iterable<ODocument> results = db.command(new OSQLSynchQuery<>(adjustedQuery)).execute(values.toArray()); return adapter.transform(results); } }
BrowseEntitiesByPropertyInSetAction extends ComponentSupport { public Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values) { checkNotNull(db); checkArgument(values != null && values.size() > 0); String valueFields = values.stream().map(value -> "?").collect(joining(",")); String adjustedQuery = String.format(query, valueFields); Iterable<ODocument> results = db.command(new OSQLSynchQuery<>(adjustedQuery)).execute(values.toArray()); return adapter.transform(results); } BrowseEntitiesByPropertyInSetAction(final IterableEntityAdapter<T> adapter, final String property); }
BrowseEntitiesByPropertyInSetAction extends ComponentSupport { public Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values) { checkNotNull(db); checkArgument(values != null && values.size() > 0); String valueFields = values.stream().map(value -> "?").collect(joining(",")); String adjustedQuery = String.format(query, valueFields); Iterable<ODocument> results = db.command(new OSQLSynchQuery<>(adjustedQuery)).execute(values.toArray()); return adapter.transform(results); } BrowseEntitiesByPropertyInSetAction(final IterableEntityAdapter<T> adapter, final String property); Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values); @Override String toString(); }
BrowseEntitiesByPropertyInSetAction extends ComponentSupport { public Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values) { checkNotNull(db); checkArgument(values != null && values.size() > 0); String valueFields = values.stream().map(value -> "?").collect(joining(",")); String adjustedQuery = String.format(query, valueFields); Iterable<ODocument> results = db.command(new OSQLSynchQuery<>(adjustedQuery)).execute(values.toArray()); return adapter.transform(results); } BrowseEntitiesByPropertyInSetAction(final IterableEntityAdapter<T> adapter, final String property); Iterable<T> execute(final ODatabaseDocumentTx db, final Collection<? extends Object> values); @Override String toString();  }