Skip to content

Commit ccfbc57

Browse files
committed
We need to check against FullEntity instead of Entity these days
1 parent 04b390b commit ccfbc57

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/main/java/com/googlecode/objectify/ObjectifyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public Objectify ofy() {
374374
* <p>Start a scope of work. This is the outermost scope of work, typically created by the ObjectifyFilter
375375
* or by one of the methods on ObjectifyService. You need one of these to do anything at all.</p>
376376
*/
377-
ObjectifyImpl open() {
377+
public ObjectifyImpl open() {
378378
final ObjectifyImpl objectify = new ObjectifyImpl(this);
379379
stacks.get().add(objectify);
380380
return objectify;

src/main/java/com/googlecode/objectify/cache/EntityMemcache.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.googlecode.objectify.cache;
22

33
import com.google.cloud.datastore.Entity;
4+
import com.google.cloud.datastore.FullEntity;
45
import com.google.cloud.datastore.Key;
56
import com.googlecode.objectify.cache.tmp.Expiration;
67
import com.googlecode.objectify.cache.tmp.IMemcacheServiceFactory;
@@ -99,12 +100,12 @@ public Bucket(Key key, IdentifiableValue iv)
99100
*/
100101
public boolean isEmpty()
101102
{
102-
return !this.isCacheable() || (!this.isNegative() && !(iv.getValue() instanceof Entity));
103+
return !this.isCacheable() || (!this.isNegative() && !(iv.getValue() instanceof FullEntity<?>));
103104
}
104105

105106
/** Get the entity stored at this bucket, possibly the one that was set */
106107
public Entity getEntity() {
107-
if (iv != null && iv.getValue() instanceof Entity)
108+
if (iv != null && iv.getValue() instanceof FullEntity<?>)
108109
return (Entity)iv.getValue();
109110
else
110111
return null;

src/main/java/com/googlecode/objectify/impl/Deferrer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void undefer(final Object keyOrEntity) {
4343
operations.remove((Key<?>)keyOrEntity);
4444
else if (keyOrEntity instanceof com.google.cloud.datastore.Key)
4545
operations.remove(Key.create((com.google.cloud.datastore.Key)keyOrEntity));
46-
else if (keyOrEntity instanceof Entity)
46+
else if (keyOrEntity instanceof FullEntity<?>)
4747
operations.remove(Key.create(((Entity)keyOrEntity).getKey()));
4848
else if (factory().keys().requiresAutogeneratedId(keyOrEntity)) {
4949
autogeneratedIdSaves.remove(keyOrEntity);

src/main/java/com/googlecode/objectify/impl/Keys.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.cloud.datastore.Datastore;
44
import com.google.cloud.datastore.Entity;
5+
import com.google.cloud.datastore.FullEntity;
56
import com.google.cloud.datastore.IncompleteKey;
67
import com.google.cloud.datastore.LongValue;
78
import com.google.cloud.datastore.StringValue;
@@ -85,7 +86,7 @@ else if (keyOrEntity instanceof com.google.cloud.datastore.Key)
8586
return Key.create((com.google.cloud.datastore.Key)keyOrEntity);
8687
else if (keyOrEntity instanceof Ref)
8788
return ((Ref<T>)keyOrEntity).key();
88-
else if (keyOrEntity instanceof Entity)
89+
else if (keyOrEntity instanceof FullEntity<?>)
8990
return Key.create(((Entity)keyOrEntity).getKey());
9091
else
9192
return keyOf((T)keyOrEntity);
@@ -106,7 +107,7 @@ else if (keyOrEntity instanceof Key<?>)
106107
return ((Key<?>)keyOrEntity).getRaw();
107108
else if (keyOrEntity instanceof Ref)
108109
return ((Ref<?>)keyOrEntity).key().getRaw();
109-
else if (keyOrEntity instanceof Entity)
110+
else if (keyOrEntity instanceof FullEntity<?>)
110111
return ((Entity)keyOrEntity).getKey();
111112
else
112113
return rawKeyOf(keyOrEntity);

src/main/java/com/googlecode/objectify/impl/WriteEngine.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.googlecode.objectify.impl;
22

3-
import com.google.cloud.datastore.Entity;
43
import com.google.cloud.datastore.FullEntity;
54
import com.google.common.collect.Lists;
65
import com.googlecode.objectify.Key;
@@ -92,7 +91,7 @@ protected Map<Key<E>, E> wrap(List<com.google.cloud.datastore.Key> base) {
9291
for (E obj: original)
9392
{
9493
com.google.cloud.datastore.Key k = keysIt.next();
95-
if (!(obj instanceof Entity)) {
94+
if (!(obj instanceof FullEntity<?>)) {
9695
KeyMetadata<E> metadata = factory().keys().getMetadataSafe(obj);
9796
if (metadata.isIdGeneratable())
9897
metadata.setLongId(obj, k.getId());

src/test/java/com/googlecode/objectify/test/QueryTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ void filteringByAncestor() throws Exception {
204204
assertThat(list).containsExactly(triv, child).inOrder();
205205
}
206206

207-
/** */
208-
@Test
207+
/** No longer supported by the SDK */
208+
//@Test
209209
void testIN() throws Exception {
210210
final Trivial triv1 = new Trivial("foo", 3);
211211
final Trivial triv2 = new Trivial("bar", 3);
@@ -218,8 +218,8 @@ void testIN() throws Exception {
218218
assertThat(result).containsExactly(triv1, triv2);
219219
}
220220

221-
/** */
222-
@Test
221+
/** IN no longer supported by SDK */
222+
//@Test
223223
void specialKeyFilteringByIN() throws Exception {
224224
final Trivial triv1 = new Trivial("foo", 3);
225225
final Key<Trivial> key1 = ofy().save().entity(triv1).now();
@@ -229,8 +229,8 @@ void specialKeyFilteringByIN() throws Exception {
229229
assertThat(result).containsExactly(triv1);
230230
}
231231

232-
/** */
233-
@Test
232+
/** IN no longer supported by SDK */
233+
//@Test
234234
void testINfilteringWithKeyField() throws Exception {
235235
factory().register(Employee.class);
236236

0 commit comments

Comments
 (0)