use of com.orientechnologies.orient.core.command.OCommandRequest in project orientdb by orientechnologies.
the class OIndexRemote method keyCursor.
@Override
public OIndexKeyCursor keyCursor() {
final OCommandRequest cmd = formatCommand(QUERY_KEYS, name);
final Collection<ODocument> result = getDatabase().command(cmd).execute();
return new OIndexKeyCursor() {
private final Iterator<ODocument> documentIterator = result.iterator();
@Override
public Object next(int prefetchSize) {
if (!documentIterator.hasNext())
return null;
final ODocument value = documentIterator.next();
return value.field("key");
}
};
}
use of com.orientechnologies.orient.core.command.OCommandRequest in project orientdb by orientechnologies.
the class OIndexRemote method clear.
public OIndexRemote<T> clear() {
final OCommandRequest cmd = formatCommand(QUERY_CLEAR, name);
getDatabase().command(cmd).execute();
return this;
}
use of com.orientechnologies.orient.core.command.OCommandRequest in project orientdb by orientechnologies.
the class OIndexRemote method getEntries.
public Collection<ODocument> getEntries(final Collection<?> iKeys, int maxEntriesToFetch) {
if (maxEntriesToFetch < 0)
return getEntries(iKeys);
final StringBuilder params = new StringBuilder(128);
if (!iKeys.isEmpty()) {
params.append("?");
for (int i = 1; i < iKeys.size(); i++) {
params.append(", ?");
}
}
final OCommandRequest cmd = formatCommand(QUERY_GET_ENTRIES + QUERY_GET_VALUES_LIMIT + maxEntriesToFetch, name, params.toString());
return getDatabase().command(cmd).execute(iKeys.toArray());
}
use of com.orientechnologies.orient.core.command.OCommandRequest in project orientdb by orientechnologies.
the class OIndexRemote method getEntries.
public Collection<ODocument> getEntries(final Collection<?> iKeys) {
final StringBuilder params = new StringBuilder(128);
if (!iKeys.isEmpty()) {
params.append("?");
for (int i = 1; i < iKeys.size(); i++) {
params.append(", ?");
}
}
final OCommandRequest cmd = formatCommand(QUERY_GET_ENTRIES, name, params.toString());
return (Collection<ODocument>) getDatabase().command(cmd).execute(iKeys.toArray());
}
use of com.orientechnologies.orient.core.command.OCommandRequest in project orientdb by orientechnologies.
the class OIndexRemote method remove.
public boolean remove(final Object iKey, final OIdentifiable iRID) {
final int deleted;
if (iRID != null) {
if (iRID.getIdentity().isNew())
throw new OIndexException("Cannot remove values in manual indexes against remote protocol during a transaction. Temporary RID cannot be managed at server side");
final OCommandRequest cmd = formatCommand(QUERY_REMOVE2, name);
deleted = (Integer) getDatabase().command(cmd).execute(iKey, iRID);
} else {
final OCommandRequest cmd = formatCommand(QUERY_REMOVE, name);
deleted = (Integer) getDatabase().command(cmd).execute(iKey);
}
return deleted > 0;
}
Aggregations