本文整理了Java中com.google.appengine.api.datastore.Entity.getKind()
方法的一些代码示例,展示了Entity.getKind()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getKind()
方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Entity
类名称:Entity
方法名:getKind
暂无
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
private static String extractType(Entity entity) {
return entity.getKind();
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
private Entity makeCopy(Entity entity) {
// We don't check key when we look for changes so it's
// ok that the copy doesn't have its key set.
Entity copy = new Entity(entity.getKind());
EntityUtils.copyProperties(entity, copy);
return copy;
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
/**
* Ensures that the given value is not null. Throws
* {@link NullPointerException} with a helpful error message if it is.
*/
private Object checkAssignmentToNotNullField(Object val, int fieldNumber) {
if (val != null) {
// not null so no problem
return val;
}
// Put together a really helpful error message
AbstractMemberMetaData mmd = getMetaData(fieldNumber);
String propertyName = getPropertyNameForMember(mmd);
final String msg = String.format(ILLEGAL_NULL_ASSIGNMENT_ERROR_FORMAT,
datastoreEntity.getKind(), datastoreEntity.getKey(), propertyName,
mmd.getFullFieldName());
throw new NullPointerException(msg);
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
void storePKIdField(int fieldNumber, Object value) {
AbstractMemberMetaData mmd = getMetaData(fieldNumber);
if (!mmd.getType().equals(Long.class)) {
throw new NucleusFatalUserException(
"Field with \"" + DatastoreManager.PK_ID + "\" extension must be of type Long");
}
Key key = null;
if (value != null) {
key = KeyFactory.createKey(datastoreEntity.getKind(), (Long) value);
}
storeKeyPK(key);
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
/**
* Constructor.
* @param op ObjectProvider for the object being handled.
* @param datastoreEntity Entity to represent this object
* @param fieldNumbers Field numbers that will be processed (optional, null means all fields).
*/
protected DatastoreFieldManager(ObjectProvider op, Entity datastoreEntity, int[] fieldNumbers) {
this.ec = op.getExecutionContext();
this.datastoreEntity = datastoreEntity;
this.fieldManagerStateStack.addFirst(new FieldManagerState(op));
DatastoreManager storeManager = (DatastoreManager) ec.getStoreManager();
this.typeConversionUtils = storeManager.getTypeConversionUtils();
// Sanity check
String expectedKind = EntityUtils.determineKind(op.getClassMetaData(), ec);
if (!expectedKind.equals(datastoreEntity.getKind())) {
throw new NucleusException(
"ObjectProvider is for <" + expectedKind + "> but key is for <" + datastoreEntity.getKind()
+ ">. One way this can happen is if you attempt to fetch an object of one type using"
+ " a Key of a different type.").setFatal();
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
/**
* Convenience method to return an Entity with the same properties as the input Entity but with the
* specified parent.
* @param parentKey Key for the parent
* @param originalEntity The original Entity
* @return The new Entity
*/
public static Entity recreateEntityWithParent(Key parentKey, Entity originalEntity) {
Entity entity = null;
if (originalEntity.getKey().getName() != null) {
entity = new Entity(originalEntity.getKind(), originalEntity.getKey().getName(), parentKey);
} else {
entity = new Entity(originalEntity.getKind(), parentKey);
}
EntityUtils.copyProperties(originalEntity, entity);
return entity;
}
代码示例来源:origin: feroult/yawp
@Override
public void deleteAll(String namespace) {
NamespaceManager.set(namespace);
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query query = new Query();
PreparedQuery pq = datastore.prepare(query);
for (Entity entity : pq.asIterable()) {
String kind = entity.getKind();
if (kind.startsWith("__") && !kind.contains("yawp")) {
continue;
}
datastore.delete(entity.getKey());
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
private void storePKNameField(int fieldNumber, String value) {
// TODO(maxr) make sure the pk is an encoded string
AbstractMemberMetaData mmd = getMetaData(fieldNumber);
if (!mmd.getType().equals(String.class)) {
throw new NucleusFatalUserException(
"Field with \"" + DatastoreManager.PK_ID + "\" extension must be of type String");
}
Key key = null;
if (value != null) {
key = KeyFactory.createKey(datastoreEntity.getParent(), datastoreEntity.getKind(), value);
}
storeKeyPK(key);
}
代码示例来源:origin: PeterKnego/LeanEngine-Server
public static JsonNode entityToJson(Entity entity) throws LeanException {
ObjectNode json = getObjectMapper().createObjectNode();
json.put("_id", entity.getKey().getId());
json.putPOJO("_kind", entity.getKind());
json.putPOJO("_account", entity.getProperty("_account"));
Map<String, Object> props = entity.getProperties();
for (Map.Entry<String, Object> prop : props.entrySet()) {
addTypedNode(json, prop.getKey(), prop.getValue());
}
return json;
}
代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine
Iterator<Entity> iterator = entities.iterator();
Entity entity = iterator.next();
String kind = entity.getKind();
代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine
if (tx.getKind().equals(TRANSACTION_KIND)) {
transaction = new AppEngineGlobalTransaction(tx.getKey().getName(), null, null);
} else if (tx.getKind().equals(LOG_KIND)) {
logs.put(tx.getKey().getId(), tx);
代码示例来源:origin: org.vesalainen.dsql/dsql
ColumnMetadata cm = statistics.getProperty(entity.getKind(), property);
if (cm != null)
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
private void storePrimaryKey(int fieldNumber, Object value) {
AbstractMemberMetaData mmd = getMetaData(fieldNumber);
if (mmd.getType().equals(long.class)) {
Key key = null;
if (mmd.getValueStrategy() == IdentityStrategy.IDENTITY) {
// Key being generated by datastore so put null key in
key = null;
} else {
key = KeyFactory.createKey(datastoreEntity.getKind(), (Long) value);
}
storeKeyPK(key);
} else if (mmd.getType().equals(Long.class)) {
Key key = null;
if (value != null) {
// TODO This is actually against the JDO/JPA specs; having IDENTITY strategy means the DB will (always) choose
key = KeyFactory.createKey(datastoreEntity.getKind(), (Long) value);
}
storeKeyPK(key);
} else if (mmd.getType().equals(Key.class)) {
Key key = (Key) value;
if (key != null && key.getParent() != null && parentAlreadySet) {
throw new NucleusFatalUserException(PARENT_ALREADY_SET);
}
storeKeyPK((Key) value);
} else {
throw exceptionForUnexpectedKeyType("Primary key", fieldNumber);
}
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
str.append(", ");
NucleusLogger.DATASTORE_NATIVE.debug("Putting entity of kind " + entity.getKind() +
" with key " + entity.getKey() + " as {" + str.toString() + "}");
代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine
if (entity.getKind().equals(Translation.LOCK_KIND)) {
throw new ConcurrentModificationException(
"Entity corresponding to [" + k + "] is processed under a transaction");
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
private void storeKeyPK(Key key) {
if (key != null && !datastoreEntity.getKind().equals(key.getKind())) {
throw new NucleusFatalUserException(
"Attempt was made to set the primary key of an entity with kind "
+ datastoreEntity.getKind() + " to a key with kind " + key.getKind());
内容来源于网络,如有侵权,请联系作者删除!