@Override public PersistentResource<T> next() { T obj = iterator.next(); return new PersistentResource<>(obj, parent, requestScope.getUUIDFor(obj), requestScope); } };
@Override public PersistentResource<T> next() { T obj = iterator.next(); return new PersistentResource<>(obj, parent, requestScope.getUUIDFor(obj), requestScope); } };
/** * No-op transaction, do nothing. * @param entityClass the type of class to load * @param id - the ID of the object to load. * @param filterExpression - security filters that can be evaluated in the data store. * @param scope - the current request scope. It is optional for the data store to attempt evaluation. * @return a new persistent resource with a new instance of {@code entityClass} */ @Override public Object loadObject(Class<?> entityClass, Serializable id, Optional<FilterExpression> filterExpression, RequestScope scope) { // Loads are supported but empty object (with specified id) is returned. // NOTE: This is primarily useful for enabling objects of solely computed properties to be fetched. Object entity; try { entity = entityClass.newInstance(); } catch (IllegalAccessException | InstantiationException e) { log.error("Could not load object {} through NoopStore", entityClass, e); throw new RuntimeException(e); } String uuid = scope.getUUIDFor(entity); // Side-effecting method of the PersistentResource :( however, it enables us to do this without reinventing // the wheel. Should probably be refactored eventually nonetheless. new PersistentResource<>(entity, null, uuid, scope).setId(id.toString()); return entity; }
} else if (type.isToOne()) { resources = new SingleElementSet( new PersistentResource(val, this, requestScope.getUUIDFor(val), requestScope)); } else { resources.add(new PersistentResource(val, this, requestScope.getUUIDFor(val), requestScope));
} else if (type.isToOne()) { resources = new SingleElementSet( new PersistentResource(val, this, requestScope.getUUIDFor(val), requestScope)); } else { resources.add(new PersistentResource(val, this, requestScope.getUUIDFor(val), requestScope));
PersistentResource inverseResource = new PersistentResource(inverseObj, this, uuid, requestScope); Object inverseRelation = inverseResource.getValueUnchecked(inverseName);
PersistentResource inverseResource = new PersistentResource(inverseObj, this, uuid, requestScope); Object inverseRelation = inverseResource.getValueUnchecked(inverseName);
PersistentResource<T> resource = new PersistentResource(obj, null, requestScope.getUUIDFor(obj), requestScope);
PersistentResource inverseResource = new PersistentResource(inverseEntity, this, uuid, requestScope); Object inverseRelation = inverseResource.getValueUnchecked(inverseField);
PersistentResource<T> resource = new PersistentResource(obj, null, requestScope.getUUIDFor(obj), requestScope);
PersistentResource inverseResource = new PersistentResource(inverseEntity, this, uuid, requestScope); Object inverseRelation = inverseResource.getValueUnchecked(inverseField);
PersistentResource<T> newResource = new PersistentResource<>(obj, parent, id, requestScope);
PersistentResource<T> newResource = new PersistentResource<>(obj, parent, id, requestScope);