本文整理了Java中com.google.appengine.api.datastore.Entity.setProperty()
方法的一些代码示例,展示了Entity.setProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setProperty()
方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Entity
类名称:Entity
方法名:setProperty
暂无
代码示例来源:origin: stackoverflow.com
Entity loginEntity = new Entity("login", id);
loginEntity.setProperty("password", "admin@123");
datastore.put(loginEntity);
代码示例来源: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: 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.orm/datanucleus-appengine
public void setObject(Object datastoreEntity, int paramIndex, Object value) {
if (paramIndex != StoreFieldManager.IS_FK_VALUE) {
// Most of the time we want to just set the given value on the entity, but if this is a foreign key value we
// want to just swallow the update. The reason is that we only maintain fks as parents in the key itself.
// The updates we'll swallow are DataNucleus adding "hidden" back pointers to parent objects.
// We don't want these. The back pointer is the parent of the key itself.
((Entity) datastoreEntity).setProperty(getPropertyName(), 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: PeterKnego/LeanEngine-Server
public static void saveSettings(Map<String, Object> newSettings) {
// there is only one instance of LeanEngineSettings so the same ID=1 is always used
Entity leanEntity = new Entity("_settings", 1);
for (String propName : newSettings.keySet()) {
leanEntity.setProperty(propName, newSettings.get(propName));
}
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
datastore.put(leanEntity);
LeanEngineSettings.settings = newSettings;
}
代码示例来源:origin: com.google.oauth-client/google-oauth-client-appengine
@Override
public void store(String userId, Credential credential) {
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity entity = new Entity(KIND, userId);
entity.setProperty("accessToken", credential.getAccessToken());
entity.setProperty("refreshToken", credential.getRefreshToken());
entity.setProperty("expirationTimeMillis", credential.getExpirationTimeMilliseconds());
datastore.put(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: GoogleCloudPlatform/appengine-tck
public void putMarker(String marker) {
Entity entity = new Entity(entityName);
entity.setProperty(TEST_RUN_ID, testRunId);
entity.setProperty(EXECUTED_AT, System.currentTimeMillis());
entity.setProperty(MARKER, marker);
saveEntity(entity);
}
代码示例来源: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: bedatadriven/activityinfo
@Override
public Entity update(Entity blockEntity, int recordOffset, @Nullable FieldValue fieldValue) {
Blob strings = (Blob) blockEntity.getProperty("ids");
int length = StringPools.size(strings);
// since we only ever update when adding a new record, we should be able to simply append to the string pool
if(recordOffset != length) {
throw new IllegalStateException("length = " + length + ", recordOffset = " + recordOffset);
}
blockEntity.setProperty("ids", StringPools.appendString(strings, ((TextValue) fieldValue).asString()));
return blockEntity;
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
protected Entity createTestEntity(String kind) {
Entity entity = new Entity(kind);
entity.setProperty("text", "Some text.");
return entity;
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
protected Entity createTestEntity(String kind, Key key) {
Entity entity = new Entity(kind, key);
entity.setProperty("text", "Some text.");
return entity;
}
代码示例来源: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: GoogleCloudPlatform/appengine-tck
protected Entity createTestEntity(String kind, long id) {
Key key = KeyFactory.createKey(kind, id);
Entity entity = new Entity(key);
entity.setProperty("text", "Some text.");
return entity;
}
代码示例来源: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: GoogleCloudPlatform/appengine-tck
@Test(expected = IllegalStateException.class)
public void testClosedTx() throws InterruptedException {
clearData(kindName);
Transaction tx = service.beginTransaction();
Entity newRec = new Entity(kindName);
newRec.setProperty("check", "4100331");
newRec.setProperty("stamp", new Date());
service.put(newRec);
tx.commit();
service.put(tx, new Entity(kindName));
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test(expected = ApiDeadlineExceededException.class)
public void testDeadlineConfig() {
DatastoreServiceConfig config = DatastoreServiceConfig.Builder.withDeadline(0.00001);
DatastoreService ds = DatastoreServiceFactory.getDatastoreService(config);
assertNotNull(ds);
Entity g1 = new Entity("test");
g1.setProperty("deadline", "0.00001");
ds.put(g1);
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testAllocateChild() {
Entity parent = new Entity(ALLOCATE_IDS_ENTITY);
parent.setProperty("name", "parent-" + System.currentTimeMillis());
Key parentKey = service.put(parent);
final int allocateSize = 10;
KeyRange range = service.allocateIds(parentKey, ALLOCATE_IDS_ENTITY, allocateSize);
Entity child = new Entity(range.getStart());
Key key = service.put(child);
// child with allocated key should have correct parent.
Assert.assertEquals(parentKey, key.getParent());
}
内容来源于网络,如有侵权,请联系作者删除!