use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyAPI method clear.
public PropertyKey.PropertyKeyWithTask clear(PropertyKey propertyKey) {
if (this.client.apiVersionLt("0.65")) {
throw new NotSupportException("action clear on property key");
}
String id = propertyKey.name();
Map<String, Object> params = ImmutableMap.of("action", "clear");
Object pkey = this.checkCreateOrUpdate(propertyKey);
RestResult result = this.client.put(this.path(), id, pkey, params);
return result.readObject(PropertyKey.PropertyKeyWithTask.class);
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.
the class InMemoryDBTable method query.
@Override
public Iterator<BackendEntry> query(BackendSession session, Query query) {
String page = query.page();
if (page != null && !page.isEmpty()) {
throw new NotSupportException("paging by InMemoryDBStore");
}
Map<Id, BackendEntry> rs = this.store;
if (query instanceof IdPrefixQuery) {
IdPrefixQuery pq = (IdPrefixQuery) query;
rs = this.queryByIdPrefix(pq.start(), pq.inclusiveStart(), pq.prefix(), rs);
}
if (query instanceof IdRangeQuery) {
IdRangeQuery rq = (IdRangeQuery) query;
rs = this.queryByIdRange(rq.start(), rq.inclusiveStart(), rq.end(), rq.inclusiveEnd(), rs);
}
// Query by id(s)
if (query.idsSize() > 0) {
rs = this.queryById(query.ids(), rs);
}
// Query by condition(s)
if (query.conditionsSize() > 0) {
ConditionQuery condQuery = (ConditionQuery) query;
if (condQuery.containsScanRelation()) {
return this.queryByRange(condQuery);
}
rs = this.queryByFilter(query.conditions(), rs);
}
Iterator<BackendEntry> iterator = rs.values().iterator();
long offset = query.offset() - query.actualOffset();
if (offset >= rs.size()) {
query.goOffset(rs.size());
return QueryResults.emptyIterator();
}
if (offset > 0L) {
query.goOffset(offset);
iterator = this.skipOffset(iterator, offset);
}
if (!query.noLimit() && query.total() < rs.size()) {
iterator = this.dropTails(iterator, query.limit());
}
return iterator;
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.
the class Reflection method registerMethodsToFilter.
public static void registerMethodsToFilter(Class<?> containingClass, String... methodNames) {
if (REGISTER_METHODS_TO_FILTER_MOTHOD == null) {
throw new NotSupportException("Reflection.registerMethodsToFilterMethod()");
}
try {
REGISTER_METHODS_TO_FILTER_MOTHOD.setAccessible(true);
REGISTER_METHODS_TO_FILTER_MOTHOD.invoke(REFLECTION_CLAZZ, containingClass, methodNames);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new HugeException("Failed to register class '%s' methods to filter: %s", containingClass, Arrays.toString(methodNames));
}
}
Aggregations