Exemplo n.º 1
0
 @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();
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 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;
         }
       });
 }
Exemplo n.º 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;
         }
       });
 }
Exemplo n.º 5
0
 public SimpleIndexHits(long batchId, Class<T> entityType, final RestAPI restApi) {
   this.entityType = entityType;
   this.entityExtractor = restApi.createExtractor();
 }