Skip to content

Commit 64d5903

Browse files
author
Les Vogel
committed
Check style changes
1 parent bd07693 commit 64d5903

File tree

5 files changed

+25
-39
lines changed

5 files changed

+25
-39
lines changed

appengine/guestbook/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<packaging>war</packaging>
66
<version>1.0-SNAPSHOT</version>
77

8-
<groupId>com.example.guestbook</groupId>
8+
<groupId>com.example.appengine</groupId>
99
<artifactId>appengine-guestbook</artifactId>
1010
<properties>
1111
<objectify.version>5.1.5</objectify.version>

appengine/guestbook/src/main/java/com/example/guestbook/Greeting.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import java.lang.String;
2727
import java.util.Date;
28-
import java.util.List;
2928

3029
/**
3130
* The @Entity tells Objectify about our entity. We also register it in {@link OfyHelper}
@@ -43,24 +42,24 @@ public class Greeting {
4342
@Parent Key<Guestbook> theBook;
4443
@Id public Long id;
4544

46-
public String author_email;
47-
public String author_id;
45+
public String authorEmail;
46+
public String authorId;
4847
public String content;
4948
@Index public Date date;
5049

5150
/**
52-
* Simple constructor just sets the date
51+
* Simple constructor just sets the date.
5352
**/
5453
public Greeting() {
5554
date = new Date();
5655
}
5756

5857
/**
59-
* A convenience constructor
58+
* A convenience constructor.
6059
**/
6160
public Greeting(String book, String content) {
6261
this();
63-
if( book != null ) {
62+
if ( book != null ) {
6463
theBook = Key.create(Guestbook.class, book); // Creating the Ancestor key
6564
} else {
6665
theBook = Key.create(Guestbook.class, "default");
@@ -69,12 +68,12 @@ public Greeting(String book, String content) {
6968
}
7069

7170
/**
72-
* Takes all important fields
71+
* Takes all important fields.
7372
**/
7473
public Greeting(String book, String content, String id, String email) {
7574
this(book, content);
76-
author_email = email;
77-
author_id = id;
75+
authorEmail = email;
76+
authorId = id;
7877
}
7978

8079
}

appengine/guestbook/src/main/java/com/example/guestbook/OfyHelper.java

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
/**
22
* Copyright 2014-2015 Google Inc. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
86
* http://www.apache.org/licenses/LICENSE-2.0
97
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
1512
*/
1613
//[START all]
1714
package com.example.guestbook;
1815

19-
import com.googlecode.objectify.Objectify;
20-
import com.googlecode.objectify.ObjectifyFactory;
2116
import com.googlecode.objectify.ObjectifyService;
2217

23-
import javax.servlet.ServletContextListener;
2418
import javax.servlet.ServletContextEvent;
19+
import javax.servlet.ServletContextListener;
2520

2621
/**
2722
* OfyHelper, a ServletContextListener, is setup in web.xml to run before a JSP is run. This is

appengine/guestbook/src/main/java/com/example/guestbook/SignGuestbookServlet.java

+6-14
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,28 @@
1717
//[START all]
1818
package com.example.guestbook;
1919

20-
import com.google.appengine.api.datastore.DatastoreService;
21-
import com.google.appengine.api.datastore.DatastoreServiceFactory;
22-
import com.google.appengine.api.datastore.Entity;
23-
import com.google.appengine.api.datastore.Key;
24-
import com.google.appengine.api.datastore.KeyFactory;
2520
import com.google.appengine.api.users.User;
2621
import com.google.appengine.api.users.UserService;
2722
import com.google.appengine.api.users.UserServiceFactory;
2823

24+
import com.googlecode.objectify.ObjectifyService;
25+
2926
import java.io.IOException;
30-
import java.util.Date;
3127

3228
import javax.servlet.http.HttpServlet;
3329
import javax.servlet.http.HttpServletRequest;
3430
import javax.servlet.http.HttpServletResponse;
3531

36-
import com.googlecode.objectify.ObjectifyService;
37-
3832
/**
39-
* Form Handling Servlet
40-
* Most of the action for this sample is in webapp/guestbook.jsp, which displays the
41-
* {@link Greeting}'s. This servlet has one method
42-
* {@link #doPost(<#HttpServletRequest req#>, <#HttpServletResponse resp#>)} which takes the form
43-
* data and saves it.
33+
* Form Handling Servlet - most of the action for this sample is in webapp/guestbook.jsp,
34+
* which displays the {@link Greeting}'s.
4435
*/
4536
public class SignGuestbookServlet extends HttpServlet {
4637

4738
// Process the http POST of the form
4839
@Override
49-
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
40+
public void doPost(HttpServletRequest req, HttpServletResponse resp)
41+
throws IOException {
5042
Greeting greeting;
5143

5244
UserService userService = UserServiceFactory.getUserService();

appengine/guestbook/src/main/webapp/guestbook.jsp

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
for (Greeting greeting : greetings) {
7373
pageContext.setAttribute("greeting_content", greeting.content);
7474
String author;
75-
if (greeting.author_email == null) {
75+
if (greeting.authorEmail == null) {
7676
author = "An anonymous person";
7777
} else {
78-
author = greeting.author_email;
79-
String author_id = greeting.author_id;
78+
author = greeting.authorEmail;
79+
String author_id = greeting.authorId;
8080
if (user != null && user.getUserId().equals(author_id)) {
8181
author += " (You)";
8282
}

0 commit comments

Comments
 (0)