本文整理了Java中com.google.appengine.api.datastore.Entity.hasProperty()
方法的一些代码示例,展示了Entity.hasProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.hasProperty()
方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Entity
类名称:Entity
方法名:hasProperty
暂无
代码示例来源:origin: org.vesalainen.dsql/dsql
@Override
public boolean activate(Entity data)
{
return data.hasProperty(SubjectProperty);
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
public final void set(Object toPojo, Object value, LoadContext context)
{
if (this.collisionPaths != null)
for (String collPath: this.collisionPaths)
if (context.getEntity().hasProperty(collPath))
throw new IllegalStateException("Tried to load the same field twice. Check the path " + collPath + " in entity " + context.getEntity().toString());
this.safeSet(toPojo, value, context);
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public JobInstanceRecord(Entity entity) {
super(entity);
jobKey = (Key) entity.getProperty(JOB_KEY_PROPERTY);
jobClassName = (String) entity.getProperty(JOB_CLASS_NAME_PROPERTY);
if (entity.hasProperty(JOB_DISPLAY_NAME_PROPERTY)) {
jobDisplayName = (String) entity.getProperty(JOB_DISPLAY_NAME_PROPERTY);
} else {
jobDisplayName = jobClassName;
}
if (entity.hasProperty(INSTANCE_BYTES_PROPERTY)) {
value = entity.getProperty(INSTANCE_BYTES_PROPERTY);
} else {
value = entity.getProperty(INSTANCE_VALUE_PROPERTY);
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
protected int getSizeUsingChildKeysInParent(ObjectProvider op) {
Entity ownerEntity = getOwnerEntity(op);
// Child keys are stored in field in owner Entity
String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), ownerMemberMetaData);
if (ownerEntity.hasProperty(propName)) {
Object value = ownerEntity.getProperty(propName);
if (value == null) {
return 0;
}
List<Key> keys = (List<Key>) value;
return keys.size();
}
return 0;
}
代码示例来源:origin: org.vesalainen.dsql/dsql
@Override
public Updateable<Entity, Object> getUpdateable(Entity entity, String property, Object value)
assert entity.hasProperty(property) && !(entity.getProperty(property) instanceof RawValue);
boolean indexed = false;
ColumnMetadata cm = statistics.getProperty(entity.getKind(), property);
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
public Iterator iterator(ObjectProvider op) {
ExecutionContext ec = op.getExecutionContext();
if (MetaDataUtils.readRelatedKeysFromParent(storeMgr, ownerMemberMetaData)) {
// Get child keys from property in owner Entity if the property exists
Entity datastoreEntity = getOwnerEntity(op);
String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), ownerMemberMetaData);
if (datastoreEntity.hasProperty(propName)) {
return getChildrenFromParentField(op, ec, -1, -1).listIterator();
} else {
if (MetaDataUtils.isOwnedRelation(ownerMemberMetaData, storeMgr)) {
// Not yet got the property in the parent, so this entity has not yet been migrated to latest storage version
NucleusLogger.PERSISTENCE.info("Collection at field " + ownerMemberMetaData.getFullFieldName() + " of " + op +
" not yet migrated to latest storage version, so reading elements via the parent key");
}
}
}
if (MetaDataUtils.isOwnedRelation(ownerMemberMetaData, storeMgr)) {
// Get child keys by doing a query with the owner as the parent Entity
ApiAdapter apiAdapter = ec.getApiAdapter();
Key parentKey = EntityUtils.getPrimaryKeyAsKey(apiAdapter, op);
return getChildrenUsingParentQuery(parentKey, Collections.<Query.FilterPredicate>emptyList(),
Collections.<Query.SortPredicate>emptyList(), ec).iterator();
} else {
return Utils.newArrayList().listIterator();
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
Entity datastoreEntity = getOwnerEntity(op);
String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), ownerMemberMetaData);
if (datastoreEntity.hasProperty(propName)) {
Object value = datastoreEntity.getProperty(propName);
if (value == null) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (cmd.hasDiscriminatorStrategy()) {
String disProp = EntityUtils.getDiscriminatorPropertyName(storeMgr.getIdentifierFactory(), cmd.getDiscriminatorMetaDataForTable());
if (disProp != null && entity.hasProperty(disProp)) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (datastoreEntity.hasProperty(propName)) {
if (indexedList) {
return getChildrenFromParentField(op, ec, startIdx, endIdx).listIterator();
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (ownerEntity.hasProperty(propName)) {
Object value = ownerEntity.getProperty(propName);
if (value == null) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
Entity datastoreEntity = getOwnerEntity(op);
String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), ownerMemberMetaData);
if (datastoreEntity.hasProperty(propName)) {
Object value = datastoreEntity.getProperty(propName);
if (value == null || (value instanceof Collection && ((Collection)value).isEmpty())) {
代码示例来源:origin: bedatadriven/activityinfo
if(block.hasProperty(PREFIX_POOL_PROPERTY) && block.hasProperty(PREFIX_OFFSET_PROPERTY)) {
prefixPool = StringPools.toArray((Blob) block.getProperty(PREFIX_POOL_PROPERTY));
prefixOffsets = ((Blob)block.getProperty(PREFIX_OFFSET_PROPERTY)).getBytes();
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
public int lastIndexOf(ObjectProvider op, Object element) {
ExecutionContext ec = op.getExecutionContext();
validateElementForReading(ec, element);
ObjectProvider elementOP = ec.findObjectProvider(element);
Key elementKey = EntityUtils.getPrimaryKeyAsKey(ec.getApiAdapter(), elementOP);
if (elementKey == null) {
// Not persistent
return -1;
}
if (MetaDataUtils.readRelatedKeysFromParent(storeMgr, ownerMemberMetaData)) {
// Return the position using the field of List<Key> in the owner
String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), ownerMemberMetaData);
Entity ownerEntity = getOwnerEntity(op);
if (ownerEntity.hasProperty(propName)) {
Object value = ownerEntity.getProperty(propName);
if (value == null) {
return -1;
}
List<Key> keys = (List<Key>) value;
return keys.lastIndexOf(elementKey);
}
}
// Owned relation in earlier storage version so use parentKey to determine membership of list (only present once)
return indexOf(op, element);
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testEntity() {
for (String ns : namespaceDat) {
NamespaceManager.set(ns);
Query query = new Query(kindName);
Entity readRec = service.prepare(query).asIterator().next();
assertEquals(ns, readRec.getNamespace());
String appId = readRec.getAppId();
appId = appId.substring(appId.indexOf("~") + 1);
assertEquals(SystemProperty.applicationId.get(), appId);
assertTrue(readRec.hasProperty("jobType"));
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (datastoreEntity.hasProperty(propName)) {
Object value = datastoreEntity.getProperty(propName);
if (value == null) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (ownerEntity.hasProperty(propName)) {
Object value = ownerEntity.getProperty(propName);
if (value == null) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (!entity.hasProperty(name)) {
throw new NucleusObjectNotFoundException(
"Could not retrieve entity of kind " + key.getKind() + " with key " + key);
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (!entity.hasProperty(propName)) {
if (!entity.hasProperty(propName)) {
AbstractClassMetaData childCmd = mmd.getCollection().getElementClassMetaData(clr, nucCtx.getMetaDataManager());
String childKindName = EntityUtils.getKindName(storeMgr.getIdentifierFactory(), childCmd);
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (Relation.isRelationMultiValued(relationType)) {
String propName = getPropertyNameForMember(mmd);
if (datastoreEntity.hasProperty(propName)) {
if (mmd.hasCollection()) {
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
if (datastoreEntity.hasProperty(propName)) {
Object value = datastoreEntity.getProperty(propName);
if (value == null) {
内容来源于网络,如有侵权,请联系作者删除!