Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.KeyRange


   * @param data
   */
  public void createKey(String kind, Object data) {
    Key key;
    try {
      KeyRange range = createIdRange(kind, data);
      key = range.getStart();
      // This is a 1-length range, so getting start value is by far
      // enough
      idField.set(data, key.getId());
    } catch (Exception e) {
      throw new UnableToSetFieldException(e, idField);
View Full Code Here


   * @param data
   */
  public void createKey(String kind, Object data) {
    Key key;
    try {
      KeyRange range = createIdRange(kind, data);
      key = range.getStart();
      // This is a 1-length range, so getting start value is by far
      // enough
      idField.set(data, key.getId());
    } catch (Exception e) {
      throw new UnableToSetField(e, idField);
View Full Code Here

      // shouldn't happen
      throw new IllegalStateException("sequence name is null");
    }
    DatastoreServiceConfig config = ((DatastoreManager) storeMgr).getDefaultDatastoreServiceConfigForWrites();
    DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config);
    KeyRange range = ds.allocateIds(sequenceName, size);
    // Too bad we can't pass an iterable and construct the ids
    // on demand.
    List<Long> ids = Utils.newArrayList();
    long current = range.getStart().getId();
    for (int i = 0; i < size; i++) {
      ids.add(current + i);
    }
    return new ValueGenerationBlock(ids);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.KeyRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.