本文整理了Java中org.mongodb.morphia.Datastore.get()
方法的一些代码示例,展示了Datastore.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Datastore.get()
方法的具体详情如下:
包路径:org.mongodb.morphia.Datastore
类名称:Datastore
方法名:get
[英]Find the given entities (by id); shorthand for find("_id in", ids)
[中]查找给定实体(按id);查找的简写(“\u id in”,id)
代码示例来源:origin: lmco/streamflow
@Override
public T findById(ID id) {
return datastore.get(persistentClass, id);
}
代码示例来源:origin: de.mhus.lib/mhu-lib-persistence
@SuppressWarnings("unchecked")
@Override
public void reloadObject(DbConnection con, String registryName, Object obj) throws MException {
Object id = datastore.getKey(obj).getId();
Object clone = datastore.get(obj.getClass(), id);
try {
PojoModel model = getModelFor(obj.getClass());
for ( PojoAttribute<Object> f : model) {
Object v = f.get(clone);
f.set(obj, v);
}
} catch (IOException e) {
throw new MException(e);
}
}
代码示例来源:origin: lmco/streamflow
@Override
public boolean exists(ID id) {
return datastore.get(persistentClass, id) != null;
}
代码示例来源:origin: de.mhus.lib/mhu-lib-persistence
@Override
public boolean objectChanged(Object obj) throws MException {
Object id = datastore.getKey(obj).getId();
Object clone = datastore.get(obj.getClass(), id);
try {
PojoModel model = getModelFor(obj.getClass());
for ( PojoAttribute<?> f : model) {
Object v1 = f.get(obj);
Object v2 = f.get(clone);
if (!MSystem.equals(v1, v2)) return true;
}
} catch (IOException e) {
throw new MException(e);
}
return false;
}
代码示例来源:origin: katharsis-project/katharsis-framework
@Override
public Iterable<Task> findAll(Iterable<ObjectId> iterable, QueryParams requestParams) {
return datastore.get(Task.class, iterable);
}
代码示例来源:origin: katharsis-project/katharsis-framework
@Override
public Iterable<Project> findAll(Iterable<ObjectId> iterable, QueryParams requestParams) {
return datastore.get(Project.class, iterable);
}
代码示例来源:origin: com.github.sogyf/goja-mvt
public static <T> T get(Class<T> cls, Object id) {
return _datastore.get(cls, id);
}
代码示例来源:origin: BlackLabs/play-morphia
/**
* Refresh the entity state.
*/
@SuppressWarnings("unchecked")
public <T extends Model> T refresh() {
return (T) ds().get(this);
}
代码示例来源:origin: org.actframework/act-morphia
@Override
public MODEL_TYPE reload(MODEL_TYPE entity) {
return ds().get(entity);
}
代码示例来源:origin: protegeproject/webprotege
public Optional<UserActivityRecord> getUserActivityRecord(UserId userId) {
if(userId.isGuest()) {
return Optional.empty();
}
UserActivityRecord record = datastore.get(UserActivityRecord.class, userId);
return Optional.ofNullable(record);
}
代码示例来源:origin: de.mhus.lib/mhu-lib-persistence
public <T> T getObject(Class<T> clazz, Object ... keys) throws MException {
if (keys == null || keys.length != 1 || keys[0] == null) return null;
return datastore.get(clazz, new ObjectId(String.valueOf(keys[0])));
}
代码示例来源:origin: lievendoclo/cleanarch
public Building findById(String id) {
return toDomain(datastore.get(BuildingDocument.class, id));
}
代码示例来源:origin: RentTheRunway/alchemy
@Override
public void invalidate(String experimentName, Experiment.Builder builder) {
final ExperimentEntity entity = ds.get(ExperimentEntity.class, experimentName);
final Experiment experiment = entity.toExperiment(builder);
if (experiment.isActive()) {
cachedExperiments.put(experimentName, experiment);
} else {
cachedExperiments.remove(experimentName);
}
}
代码示例来源:origin: getheimdall/heimdall
@Override
public <T> T findOne(T object) {
Object idMongo = getValueId(object);
return (T) this.datastore().get(object.getClass(), idMongo);
}
代码示例来源:origin: getheimdall/heimdall
/**
* Finds one specific trace.
*
* @param object LogTraceDTO
* @return Trace found
*/
public LogTrace findOne(LogTrace object) {
Object idMongo = getValueId(object);
return this.datastore().get(object.getClass(), idMongo);
}
代码示例来源:origin: getheimdall/heimdall
@Override
public <T> T findOne(T object) {
Object idMongo = getValueId(object);
return (T) this.datastore().get(object.getClass(), idMongo);
}
代码示例来源:origin: protegeproject/webprotege
@Nonnull
public ApplicationPreferences getApplicationPreferences() {
if(cachedPreferences != null) {
return cachedPreferences;
}
readLock.lock();
try {
ApplicationPreferences applicationPreferences = datastore.get(ApplicationPreferences.class, ApplicationPreferences.ID);
if (applicationPreferences == null) {
applicationPreferences = DefaultApplicationPreferences.get();
datastore.save(applicationPreferences);
}
cachedPreferences = applicationPreferences;
return applicationPreferences;
} finally {
readLock.unlock();
}
}
代码示例来源:origin: protegeproject/webprotege
private UserActivityRecord getByUserId(UserId userId) {
UserActivityRecord record = datastore.get(UserActivityRecord.class, userId);
if (record == null) {
datastore.save(record = UserActivityRecord.get(userId));
}
return record;
}
代码示例来源:origin: org.actframework/act-morphia
@Override
public MODEL_TYPE findById(ID_TYPE id) {
return ds().get(modelType(), id);
}
代码示例来源:origin: protegeproject/webprotege
public Optional<EntityDiscussionThread> setThreadStatus(@Nonnull ThreadId threadId,
@Nonnull Status status) {
datastore.updateFirst(createQueryForThread(threadId), getUpdateOperations().set(STATUS, status));
return Optional.ofNullable(datastore.get(EntityDiscussionThread.class, threadId));
}
内容来源于网络,如有侵权,请联系作者删除!