本文整理汇总了Java中com.google.appengine.api.datastore.Entity.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getKey方法的具体用法?Java Entity.getKey怎么用?Java Entity.getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Entity
的用法示例。
在下文中一共展示了Entity.getKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
@Override
public void process() {
UserService userService = UserServiceFactory.getUserService();
// Step 1: Add Text into DB.
Entity textEntity = getNewEntity();
textEntity.setProperty("rawText", new Text(text));
textEntity.setProperty("user",
userService.getCurrentUser().getNickname());
textEntity.setProperty("date", new Date());
putIntoDatabase(textEntity);
Key parentKey = textEntity.getKey();
factory.setParentKey(parentKey);
// Step 2: Call other processors.
factory.createTypePredictor().process();
factory.createKnowledgeGraphBuilder().process();
factory.createSummaryGenerator().process();
}
示例2: toModel
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
@Override
public <T> T toModel(Class<T> entityClass, Entity entity) {
try {
T instance = entityClass.newInstance();
Field idField = getIdField(entityClass);
Key key = entity.getKey();
Object id = (key.getName() != null ? key.getName() : key.getId());
idField.set(instance, id);
Map<String, Object> properties = entity.getProperties();
for (Map.Entry<String, Object> entry : properties.entrySet()) {
Field field = ReflectionUtils.findRequiredField(entityClass, entry.getKey());
ReflectionUtils.setField(field, instance, entry.getValue());
}
return instance;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
示例3: TextQuery
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
public TextQuery(Entity textEntity, int limit) {
Key parentKey = textEntity.getKey();
KnowledgeQuery kq = new KnowledgeQuery(parentKey);
List<KnowledgeNodeDataStore> keywords = kq.getTop3KeyWords();
List<List<KnowledgeNodeDataStore>> knowledgeNodeDataStoreList =
kq.getListOfKnowledgeNodes();
List<AnnotatedSentence> annotatedSentenceList =
new SummaryQuery(parentKey).getAnnotatedSentences(limit);
textDataStore = new TextDataStore(textEntity, keywords,
knowledgeNodeDataStoreList,
annotatedSentenceList, limit);
}