com.google.appengine.api.datastore.Entity.setUnindexedProperty()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中com.google.appengine.api.datastore.Entity.setUnindexedProperty()方法的一些代码示例,展示了Entity.setUnindexedProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setUnindexedProperty()方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Entity
类名称:Entity
方法名:setUnindexedProperty

Entity.setUnindexedProperty介绍

暂无

代码示例

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
public Entity toEntity() {
 Entity entity = toProtoEntity();
 entity.setProperty(JOB_KEY_PROPERTY, jobKey);
 entity.setUnindexedProperty(TYPE_PROPERTY, type.toString());
 entity.setUnindexedProperty(RELEASED_PROPERTY, released);
 entity.setUnindexedProperty(WAITING_ON_KEYS_PROPERTY, waitingOnKeys);
 entity.setUnindexedProperty(WAITING_ON_GROUP_SIZES_PROPERTY, waitingOnGroupSizes);
 return entity;
}

代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine

private static void setProperty(Entity entity, String name, Object value, boolean unindexed) {
  if (unindexed) {
    entity.setUnindexedProperty(name, value);
  } else {
    entity.setProperty(name, value);
  }
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
public Entity toEntity() {
 Entity entity = toProtoEntity();
 entity.setUnindexedProperty(SHARD_ID_PROPERTY, shardId);
 entity.setUnindexedProperty(VALUE_PROPERTY, new Blob(value));
 return entity;
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

/**
 * <p>Sets the embedded null indexes property in an entity, which tracks which elements
 * of a collection are null.  For a base of "foo.bar", the state
 * property will be "foo.bar^null".  The value, if present, will be a list of indexes
 * in an embedded collection which are null.</p>
 * 
 * <p>If there are no nulls, this property does not need to be set.</p>
 */
public static void setNullIndexes(Entity entity, Path subPath, Collection<Integer> value)
{
  String path = getNullIndexPath(subPath);
  entity.setUnindexedProperty(path, value);
}

代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine

static public void copyProperties(Entity src, Entity dest) {
 for (Map.Entry<String, Object> entry : getPropertyMap(src).entrySet()) {
  // barf
  if (entry.getValue() != null &&
    entry.getValue().getClass().getName().equals("com.google.appengine.api.datastore.Entity$UnindexedValue")) {
   dest.setUnindexedProperty(entry.getKey(), src.getProperty(entry.getKey()));
  } else {
   dest.setProperty(entry.getKey(), entry.getValue());
  }
 }
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
public Entity toEntity() {
 Entity entity = toProtoEntity();
 entity.setProperty(JOB_KEY_PROPERTY, jobKey);
 entity.setProperty(JOB_CLASS_NAME_PROPERTY, jobClassName);
 entity.setUnindexedProperty(INSTANCE_VALUE_PROPERTY, value);
 entity.setUnindexedProperty(JOB_DISPLAY_NAME_PROPERTY, jobDisplayName);
 return entity;
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
public Entity toEntity() {
 Entity entity = toProtoEntity();
 entity.setUnindexedProperty(FILLED_PROPERTY, filled);
 if (null != fillTime) {
  entity.setUnindexedProperty(FILL_TIME_PROPERTY, fillTime);
 }
 if (null != sourceJobKey) {
  entity.setProperty(SOURCE_JOB_KEY_PROPERTY, sourceJobKey);
 }
 entity.setProperty(WAITING_ON_ME_PROPERTY, waitingOnMeKeys);
 if (serializedVersion != null) {
  entity.setUnindexedProperty(VALUE_PROPERTY, serializedVersion);
 } else {
  try {
   entity.setUnindexedProperty(VALUE_PROPERTY,
     PipelineManager.getBackEnd().serializeValue(this, value));
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
 return entity;
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
 public Entity toEntity() {
  Entity entity = toProtoEntity();
  entity.setUnindexedProperty(PAYLOAD_PROPERTY, new Blob(payload));
  return entity;
 }
}

代码示例来源:origin: org.vesalainen.dsql/dsql

@Override
public void set(Entity r, String column, Object value)
{
  if (r.isUnindexedProperty(column))
  {
    r.setUnindexedProperty(column, value);
  }
  else
  {
    r.setProperty(column, value);
  }
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

public Entity toEntity(T pojo, Objectify ofy)
{
  SubclassInfo<T> info = this.getConcrete(pojo);
  Entity ent = info.metadata.toEntity(pojo, ofy);
  
  // Now put the discriminator value in entity
  if (info.discriminator != null)
    ent.setUnindexedProperty(DISCRIMINATOR_PROPERTY, info.discriminator);
  
  if (!info.indexedDiscriminators.isEmpty())
    ent.setProperty(DISCRIMINATOR_INDEX_PROPERTY, info.indexedDiscriminators);
  
  return ent;
}

代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine

/**
 * Translates Acid House {@code Lock} entity to Google App Engine Datastore 
 * entity with the specified {@code Key} of parent.
 * 
 * @param lock Acid House {@code Lock} entity.
 * @param parent The {@code Key} of parent.
 * @return Google App Engine Datastore entity translated from Acid House 
 * {@code Lock} entity.
 */
public static Entity toEntity(Lock lock, com.google.appengine.api.datastore.Key parent) {
  Entity entity = new Entity(LOCK_KIND, lock.id(), parent);
  entity.setUnindexedProperty(TRANSACTION_PROPERTY, lock.transaction());
  entity.setUnindexedProperty(TIMESTAMP_PROPERTY, lock.timestamp());
  return entity;
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

protected Entity toProtoEntity() {
 Entity entity = new Entity(key);
 entity.setProperty(ROOT_JOB_KEY_PROPERTY, rootJobKey);
 if (generatorJobKey != null) {
  entity.setProperty(GENERATOR_JOB_PROPERTY, generatorJobKey);
 }
 if (graphGUID != null) {
  entity.setUnindexedProperty(GRAPH_GUID_PROPERTY, graphGUID);
 }
 return entity;
}

代码示例来源:origin: com.google.appengine.tools/appengine-pipeline

@Override
 public Entity toEntity() {
  try {
   Entity entity = toProtoEntity();
   byte[] serializedException = SerializationUtils.serialize(exception);
   entity.setUnindexedProperty(EXCEPTION_PROPERTY, new Blob(serializedException));
   return entity;
  } catch (IOException e) {
   throw new RuntimeException("Failed to serialize exception for " + getKey(), e);
  }
 }
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

/** 
 * Sets property on the entity correctly for the values of this.path and this.indexed.
 * @param path TODO
 */
protected void setEntityProperty(Entity entity, Object value, Path path, boolean index)
{
  if (index)
    entity.setProperty(path.toPathString(), value);
  else
    entity.setUnindexedProperty(path.toPathString(), value);
}

代码示例来源:origin: bedatadriven/activityinfo

private Entity updateDouble(Entity blockEntity, int recordOffset, double doubleValue) {
  Blob valueArray = (Blob) blockEntity.getProperty(valuesProperty);
  valueArray = DoubleValueArray.update(valueArray, recordOffset, doubleValue);
  blockEntity.setUnindexedProperty(formatProperty, REAL64_STORAGE);
  blockEntity.setProperty(valuesProperty, valueArray);
  return blockEntity;
}

代码示例来源:origin: bedatadriven/activityinfo

private Entity updateInt(Entity blockEntity, int recordOffset, int read) {
  Blob valueArray = (Blob) blockEntity.getProperty(valuesProperty);
  valueArray = IntValueArray.update(valueArray, recordOffset, read);
  blockEntity.setUnindexedProperty(formatProperty, INT32_STORAGE);
  blockEntity.setProperty(valuesProperty, valueArray);
  return blockEntity;
}

代码示例来源:origin: bedatadriven/activityinfo

private Entity migrateToDoubleAndUpdate(Entity blockEntity, int recordOffset, double doubleValue) {
  Blob valueArray = (Blob) blockEntity.getProperty(valuesProperty);
  int previousLength = IntValueArray.length(valueArray);
  int length = Math.max(previousLength, recordOffset + 1);
  byte[] updated = ValueArrays.allocate(length, DoubleValueArray.BYTES);
  ByteBuffer source = ValueArrays.asBuffer(valueArray);
  ByteBuffer target = ValueArrays.asBuffer(updated);
  for (int i = 0; i < length; i++) {
    if(i == recordOffset) {
      target.putDouble(i * DoubleValueArray.BYTES, doubleValue);
    } else if(i < previousLength) {
      target.putDouble(i * DoubleValueArray.BYTES, IntValueArray.toDouble(source.getInt(i * IntValueArray.BYTES)));
    } else {
      target.putDouble(i * DoubleValueArray.BYTES, Double.NaN);
    }
  }
  blockEntity.setUnindexedProperty(formatProperty, REAL64_STORAGE);
  blockEntity.setProperty(valuesProperty, valueArray);
  return blockEntity;
}

代码示例来源:origin: feroult/yawp

private void setEntityProperty(ObjectHolder objectHolder, Entity entity, FieldModel fieldModel) {
  Object value = getFieldValue(fieldModel, objectHolder);
  if (!fieldModel.hasIndex()) {
    entity.setUnindexedProperty(fieldModel.getName(), value);
    return;
  }
  if (fieldModel.isIndexNormalizable()) {
    entity.setProperty(NORMALIZED_FIELD_PREFIX + fieldModel.getName(), normalizeValue(value));
    entity.setUnindexedProperty(fieldModel.getName(), value);
    return;
  }
  entity.setProperty(fieldModel.getName(), value);
}

代码示例来源:origin: com.google.http-client/google-http-client-appengine

@Override
public AppEngineDataStore<V> set(String key, V value) throws IOException {
 Preconditions.checkNotNull(key);
 Preconditions.checkNotNull(value);
 lock.lock();
 try {
  Entity entity = new Entity(getId(), key);
  entity.setUnindexedProperty(FIELD_VALUE, new Blob(IOUtils.serialize(value)));
  dataStoreService.put(entity);
  if (memcache != null) {
   memcache.put(key, value, memcacheExpiration);
  }
 } finally {
  lock.unlock();
 }
 return this;
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

@Test
public void testSingleDefault() throws EntityNotFoundException, InterruptedException {
  clearData(kindName);
  Transaction tx = service.beginTransaction();
  Entity newRec = new Entity(kindName);
  newRec.setProperty("check", "4100331");
  newRec.setProperty("step", "added");
  Key key = service.put(tx, newRec);
  tx.commit();
  Entity qRec = service.get(key);
  assertEquals("4100331", qRec.getProperty("check"));
  tx = service.beginTransaction();
  qRec = service.get(key);
  qRec.setUnindexedProperty("step", "update");
  service.put(tx, newRec);
  tx.rollback();
  qRec = service.get(key);
  assertEquals("added", qRec.getProperty("step"));
}

相关文章