@Override
 public void updateFrom(SimpleIndexHits<T> newValue, RestAPI restApi) {
   this.hits = newValue.hits;
   this.iterator = this.hits.iterator();
   this.size = newValue.size;
   this.entityExtractor = restApi.createExtractor();
 }
 public SimpleIndexHits(
     Collection<Object> hits, int size, Class<T> entityType, final RestAPI restApi) {
   this.hits = hits;
   this.entityType = entityType;
   this.iterator = this.hits.iterator();
   this.size = size;
   this.entityExtractor = restApi.createExtractor();
 }
示例#3
0
 // TODO: This is broken investigate
 private void doBatchUpdate(
     String table, final String key, final HashMap<String, ByteIterator> values) {
   IndexHits<Node> hits = index().get("_id", key);
   Node node = hits.getSingle();
   final long id = node.getId();
   RestAPI restAPI = ((RestGraphDatabase) gds).getRestAPI();
   restAPI.executeBatch(
       new BatchCallback<Object>() {
         @Override
         public Object recordBatch(RestAPI batchRestApi) {
           Node node = batchRestApi.getNodeById(id);
           for (String k : values.keySet()) {
             node.setProperty(k, values.get(k).toArray());
           }
           return node;
         }
       });
 }
示例#4
0
 public void doBatchInsert(
     String table, final String key, final HashMap<String, ByteIterator> values) {
   RestAPI restAPI = ((RestGraphDatabase) gds).getRestAPI();
   restAPI.executeBatch(
       new BatchCallback<Object>() {
         @Override
         public Object recordBatch(RestAPI batchRestApi) {
           Map<String, Object> map = ImmutableMap.of("_id", (Object) key);
           Node node = batchRestApi.createNode(map);
           RestIndex<Node> index = batchRestApi.getIndex(NODE_INDEX_NAME);
           batchRestApi.addToIndex(node, index, "_id", key);
           for (String k : values.keySet()) {
             node.setProperty(k, values.get(k).toArray());
           }
           return node;
         }
       });
 }
 public SimpleIndexHits(long batchId, Class<T> entityType, final RestAPI restApi) {
   this.entityType = entityType;
   this.entityExtractor = restApi.createExtractor();
 }