本文整理汇总了Java中com.orientechnologies.orient.core.command.OCommandRequest类的典型用法代码示例。如果您正苦于以下问题:Java OCommandRequest类的具体用法?Java OCommandRequest怎么用?Java OCommandRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OCommandRequest类属于com.orientechnologies.orient.core.command包,在下文中一共展示了OCommandRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mockPagesOfComponents
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
private void mockPagesOfComponents() {
OCommandRequest oCommandRequest1 = getCommandRequest(10,
testData(taskOlderThan.minusDays(1), "my.company", "foo", "1.0-SNAPSHOT"),
testData(taskOlderThan.minusDays(2), "my.company", "bar", "2.0-SNAPSHOT"));
OCommandRequest oCommandRequest2 = getCommandRequest(10,
// non-match, not a snapshot
testData(taskOlderThan.minusDays(1), "your.company", "biz", "1.0")
);
OCommandRequest oCommandRequest3 = getCommandRequest(10,
testData(taskOlderThan.minusDays(2), "this.company", "baz", "3.0-SNAPSHOT")
);
OCommandRequest oCommandRequest4 = getCommandRequest(5,
testData(taskOlderThan.minusDays(3), "my.company", "foo", "0.1-SNAPSHOT"),
testData(taskOlderThan.minusDays(6), "your.company", "biz", "1.0-SNAPSHOT"),
// non-match, this is same day
testData(taskOlderThan, "that.company", "fizz", "1.2.3-SNAPSHOT")
);
when(oDatabaseDocumentTx.command(any(OCommandScript.class)))
.thenReturn(oCommandRequest1, oCommandRequest2, oCommandRequest3, oCommandRequest4);
}
示例2: setup
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Before
public void setup() {
when(bucketDocument.getRecord()).thenReturn(bucketDocument);
when(bucketDocument.field("repository_name", String.class)).thenReturn(REPOSITORY_NAME);
when(bucketDocument.getIdentity()).thenReturn(mock(ORID.class));
when(assetDocument.getClassName()).thenReturn("asset");
when(assetDocument.getRecord()).thenReturn(assetDocument);
when(assetDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
when(assetDocument.field("name", String.class)).thenReturn(PATH);
when(assetDocument.field("format", String.class)).thenReturn(FORMAT);
when(componentDocument.getClassName()).thenReturn("component");
when(componentDocument.getRecord()).thenReturn(componentDocument);
when(componentDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
when(componentDocument.getDatabase()).thenReturn(database);
when(componentDocument.getIdentity()).thenReturn(mock(ORID.class));
when(commandRequest.execute(any(Map.class))).thenReturn(Collections.singletonList(assetDocument));
when(database.command(any(OCommandRequest.class))).thenReturn(commandRequest);
underTest = new ContentAuth(contentAuthHelper);
}
示例3: setup
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Before
public void setup() {
when(variableResolverAdapterManager.get(FORMAT)).thenReturn(variableResolverAdapter);
when(variableResolverAdapter.fromDocument(assetDocument)).thenReturn(variableSource);
when(bucketDocument.getRecord()).thenReturn(bucketDocument);
when(bucketDocument.field("repository_name", String.class)).thenReturn(REPOSITORY_NAME);
when(bucketDocument.getIdentity()).thenReturn(mock(ORID.class));
when(assetDocument.getClassName()).thenReturn("asset");
when(assetDocument.getRecord()).thenReturn(assetDocument);
when(assetDocument.field("bucket", OIdentifiable.class)).thenReturn(bucketDocument);
when(assetDocument.field("name", String.class)).thenReturn(PATH);
when(assetDocument.field("format", String.class)).thenReturn(FORMAT);
when(commandRequest.execute(any(Map.class))).thenReturn(Collections.singletonList(assetDocument));
when(database.command(any(OCommandRequest.class))).thenReturn(commandRequest);
underTest = new ContentExpressionFunction(variableResolverAdapterManager, selectorManager, contentAuthHelper);
}
示例4: execute
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Override
public Object execute(final T descriptor, final Object repositoryInstance,
final Object... arguments) throws Throwable {
final SqlCommandDescriptor desc;
final OCommandRequest query;
try {
desc = createQueryDescriptor(descriptor, arguments);
amendCommandDescriptor(desc, descriptor, repositoryInstance, arguments);
query = createQueryCommand(descriptor, desc);
amendCommand(query, descriptor, repositoryInstance, arguments);
} catch (Exception ex) {
throw new CommandMethodException(String.format("Failed to prepare command '%s' execution",
descriptor.command), ex);
}
return executeCommand(descriptor, desc, query);
}
示例5: command
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
public <RET extends OCommandRequest> RET command(final OCommandRequest iCommand)
{
final OObjectDatabaseTx databaseTx = repositorySource.getObjectDatabaseTx();
try
{
return (RET) databaseTx.command(iCommand);
}
finally
{
databaseTx.close();
}
}
示例6: execute
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
public <RET extends List<?>> RET execute(final OCommandRequest iCommand, Object... iArgs)
{
final OObjectDatabaseTx databaseTx = repositorySource.getObjectDatabaseTx();
List<Transaction> list = databaseTx.command(iCommand).execute(iArgs);
try
{
return (RET) detach(databaseTx, list);
}
finally
{
databaseTx.close();
}
}
示例7: executeSQL
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
/**
* Runs SQL query to do things like create properties, indexes, etc...
* @param query
* @return
*/
<T> T executeSQL(String query) {
try {
OCommandSQL sql = new OCommandSQL(query);
OCommandRequest ocr = graphDB.command(sql);
T obj = ocr.<T>execute();
return obj;
} catch (OCommandExecutionException e)
{
throw new StuccoDBException(e);
}
}
示例8: testExecute
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Test
public void testExecute() {
Set<String> params = ImmutableSet.of("1", "2");
ArgumentCaptor<OSQLSynchQuery> argumentCaptor = ArgumentCaptor.forClass(OSQLSynchQuery.class);
OCommandRequest oCommandRequest = mock(OCommandRequest.class);
when(db.command(argumentCaptor.capture())).thenReturn(oCommandRequest);
when(oCommandRequest.execute(params)).thenReturn(newArrayList(new ODocument(), new ODocument()));
List<Entity> results = underTest.execute(db, params);
assertThat(argumentCaptor.getValue().getText(), equalTo("SELECT FROM test WHERE test IN['1','2']"));
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(2));
}
示例9: executeSql
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
public Object executeSql(String sql) {
return executeWithConnectionCheck(() -> {
makeActive();
OCommandRequest command = database.command(new OCommandSQL(sql));
return command.execute();
});
}
示例10: iterateEntries
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
protected Iterator<OIdentifiable> iterateEntries(final OIndex<?> index, final Set<OCompositeKey> keys) {
// Not a string: go straight to the value
if (isRemote) {
// OIndexRemote does not support iterateEntries, and since 2.2 it's hidden behind a delegate
// that doesn't expose getEntries(...), so we had to essentially bring some of its code here.
final StringBuilder params = new StringBuilder(128);
if (!keys.isEmpty()) {
params.append("?");
for (int i = 1; i < keys.size(); i++) {
params.append(", ?");
}
}
final String text = String.format("select from index:%s where key in [%s]", index.getName(), params.toString());
final OCommandRequest cmd = new OCommandSQL(text);
Collection<ODocument> entries = (Collection<ODocument>) idx.getDatabase().getGraph().command(cmd).execute(keys.toArray());
final Iterator<ODocument> itEntries = entries.iterator();
return new Iterator<OIdentifiable>() {
@Override
public boolean hasNext() {
return itEntries.hasNext();
}
@Override
public OIdentifiable next() {
return itEntries.next().field("rid");
}
@Override
public void remove() {
throw new UnsupportedOperationException("iterateEntries iterator");
}
};
} else {
return index.iterateEntries(keys, false);
}
}
示例11: execute
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Override
public <RET> RET execute(OCommandRequest command, Object ... args){
try{
return acquireDb().command(command).execute(args);
}finally {
releaseDb();
}
}
示例12: processListener
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Override
public OCommandResultListener processListener(final OCommandRequest command,
final Object listener,
final Injector injector,
final Class<?> conversionTarget) {
checkExec(command instanceof OLiveQuery,
"Live listener (@%s parameter) can only be used with @%s",
Listen.class.getSimpleName(), LiveQuery.class.getSimpleName());
return wrap(listener, injector, conversionTarget);
}
示例13: amendCommand
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void amendCommand(final OCommandRequest query, final T descriptor,
final Object instance, final Object... arguments) {
for (CommandExtension ext : descriptor.amendExtensions) {
ext.amendCommand(query, descriptor, instance, arguments);
}
}
示例14: processListener
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Override
public OCommandResultListener processListener(final OCommandRequest command,
final Object listener,
final Injector injector,
final Class<?> conversionTarget) {
checkExec(command instanceof OCommandRequestAbstract,
"@%s can't be applied to query, because command object %s doesn't support it",
Listen.class.getSimpleName(), command.getClass().getName());
return wrap(listener, injector, conversionTarget, ((OSQLQuery) command).getText());
}
示例15: createQueryCommand
import com.orientechnologies.orient.core.command.OCommandRequest; //导入依赖的package包/类
@Override
protected OCommandRequest createQueryCommand(final CommandMethodDescriptor descriptor,
final SqlCommandDescriptor desc) {
final boolean blocking = (Boolean) descriptor.extDescriptors.get(EXT_BLOCKING);
// correct listener will be set by @Listen extension
if (blocking) {
return new OSQLAsynchQuery(desc.command);
} else {
return new OSQLNonBlockingQuery(desc.command, null);
}
}