Skip to content

Commit 0acc57d

Browse files
jerjoudpebot
authored andcommitted
deprecated methods -> undeprecated versions. (#428)
1 parent 62df113 commit 0acc57d

File tree

41 files changed

+284
-279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+284
-279
lines changed

appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Greeting(String book, String content, String id, String email) {
5454
}
5555

5656
public Greeting(Entity entity) {
57-
key = entity.hasKey() ? entity.key() : null;
57+
key = entity.hasKey() ? entity.getKey() : null;
5858
authorEmail = entity.contains("authorEmail") ? entity.getString("authorEmail") : null;
5959
authorId = entity.contains("authorId") ? entity.getString("authorId") : null;
6060
date = entity.contains("date") ? entity.getDateTime("date").toDate() : null;
@@ -66,7 +66,7 @@ public void save() {
6666
key = getDatastore().allocateId(makeIncompleteKey()); // Give this greeting a unique ID
6767
}
6868

69-
Builder<Key> builder = FullEntity.builder(key);
69+
Builder<Key> builder = FullEntity.newBuilder(key);
7070

7171
if (authorEmail != null) {
7272
builder.set("authorEmail", authorEmail);
@@ -84,7 +84,7 @@ public void save() {
8484

8585
private IncompleteKey makeIncompleteKey() {
8686
// The book is our ancestor key.
87-
return Key.builder(book.getKey(), "Greeting").build();
87+
return Key.newBuilder(book.getKey(), "Greeting").build();
8888
}
8989

9090
@Override

appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public Key getKey() {
5252
public List<Greeting> getGreetings() {
5353
// This query requires the index defined in index.yaml to work because of the orderBy on date.
5454
EntityQuery query =
55-
Query.entityQueryBuilder()
56-
.kind("Greeting")
57-
.filter(hasAncestor(key))
58-
.orderBy(desc("date"))
59-
.limit(5)
55+
Query.newEntityQueryBuilder()
56+
.setKind("Greeting")
57+
.setFilter(hasAncestor(key))
58+
.setOrderBy(desc("date"))
59+
.setLimit(5)
6060
.build();
6161

6262
QueryResults<Entity> results = getDatastore().run(query);

appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public class Persistence {
2525

2626
public static Datastore getDatastore() {
2727
if (datastore.get() == null) {
28-
datastore.set(DatastoreOptions.builder().projectId("your-project-id-here").build().service());
28+
datastore.set(DatastoreOptions.newBuilder().setProjectId("your-project-id-here")
29+
.build().getService());
2930
}
3031

3132
return datastore.get();
@@ -36,7 +37,7 @@ public static void setDatastore(Datastore datastore) {
3637
}
3738

3839
public static KeyFactory getKeyFactory(Class<?> c) {
39-
return getDatastore().newKeyFactory().kind(c.getSimpleName());
40+
return getDatastore().newKeyFactory().setKind(c.getSimpleName());
4041
}
4142
}
4243
//[END all]

appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class TestUtils {
1818
public static void startDatastore() {
1919
try {
2020
datastore.start();
21-
Persistence.setDatastore(datastore.options().service());
21+
Persistence.setDatastore(datastore.getOptions().getService());
2222
} catch (IOException | InterruptedException e) {
2323
throw new RuntimeException(e);
2424
}
@@ -35,7 +35,8 @@ public static void stopDatastore() {
3535

3636
public static void wipeDatastore() {
3737
Datastore datastore = getDatastore();
38-
QueryResults<Key> guestbooks = datastore.run(Query.keyQueryBuilder().kind("Greeting").build());
38+
QueryResults<Key> guestbooks = datastore.run(Query.newKeyQueryBuilder().setKind("Greeting")
39+
.build());
3940
ArrayList<Key> keys = Lists.newArrayList(guestbooks);
4041

4142
if (!keys.isEmpty()) {

appengine/guestbook-objectify/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<application>your-app-id</application>
44
<version>${appengine.app.version}</version>
55
<threadsafe>true</threadsafe>
6-
6+
77
<system-properties>
88
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
99
</system-properties>

appengine/helloworld-new-plugins/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Use either:
1818
### Running locally
1919

2020
$ mvn appengine:run
21-
21+
2222
### Deploying
2323

2424
$ mvn appengine:deploy
@@ -36,7 +36,7 @@ If you do not have gradle installed, you can run using `./gradlew appengineRun`.
3636

3737
If you do not have gradle installed, you can deploy using `./gradlew appengineDeploy`.
3838

39-
<!--
39+
<!--
4040
## Intelij Idea
4141
Limitations - Appengine Standard support in the Intellij plugin is only available for the Ultimate Edition of Idea.
4242

appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
6161
FileChannel fileChannel = fileInputStream.getChannel();
6262
ByteBuffer byteBuffer = ByteBuffer.allocate((int)fileChannel.size());
6363
fileChannel.read(byteBuffer);
64-
64+
6565
byte[] imageBytes = byteBuffer.array();
6666

6767
// Write the original image to Cloud Storage
@@ -103,7 +103,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
103103
//[END rotate]
104104

105105
// Output some simple HTML to display the images we wrote to Cloud Storage
106-
// in the browser.
106+
// in the browser.
107107
PrintWriter out = resp.getWriter();
108108
out.println("<html><body>\n");
109109
out.println("<img src='//storage.cloud.google.com/" + bucket

appengine/logs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Engine][ae-docs].
66
[log-docs]: https://cloud.google.com/appengine/docs/java/logs/
77
[ae-docs]: https://cloud.google.com/appengine/docs/java/
88

9-
## Running locally
9+
## Running locally
1010

1111
The Logs API only generates output for deployed apps, so this program should not be run locally.
1212

1313
## Deploying
14-
14+
1515
This example uses the
1616
[Maven gcloud plugin](https://cloud.google.com/appengine/docs/java/managed-vms/maven).
1717

appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
// a time, using a Next link to cycle through to the next 5.
3535
public class LogsServlet extends HttpServlet {
3636
@Override
37-
public void doGet(HttpServletRequest req, HttpServletResponse resp)
37+
public void doGet(HttpServletRequest req, HttpServletResponse resp)
3838
throws IOException {
3939

4040
resp.setContentType("text/html");
4141
PrintWriter writer = resp.getWriter();
4242
writer.println("<!DOCTYPE html>");
4343
writer.println("<meta charset=\"utf-8\">");
4444
writer.println("<title>App Engine Logs Sample</title>");
45-
45+
4646
// We use this to break out of our iteration loop, limiting record
4747
// display to 5 request logs at a time.
4848
int limit = 5;
@@ -81,17 +81,17 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
8181
writer.println(String.format("<br>Date: %s", appTime.toString()));
8282
writer.println("<br>Level: " + appLog.getLogLevel() + "<br>");
8383
writer.println("Message: " + appLog.getLogMessage() + "<br> <br>");
84-
}
84+
}
8585

8686
if (++count >= limit) {
8787
break;
8888
}
89-
}
89+
}
9090

9191
// When the user clicks this link, the offset is processed in the
9292
// GET handler and used to cycle through to the next 5 request logs.
9393
writer.println(String.format("<br><a href=\"/?offset=%s\">Next</a>", lastOffset));
94-
}
95-
}
94+
}
95+
}
9696
// [END logs_API_example]
9797

appengine/multitenancy/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<application>your-app-id</application>
44
<version>${appengine.app.version}</version>
55
<threadsafe>true</threadsafe>
6-
6+
77
<system-properties>
88
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
99
</system-properties>

0 commit comments

Comments
 (0)