本文整理匯總了Java中com.google.appengine.api.datastore.EntityNotFoundException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityNotFoundException.printStackTrace方法的具體用法?Java EntityNotFoundException.printStackTrace怎麽用?Java EntityNotFoundException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.appengine.api.datastore.EntityNotFoundException
的用法示例。
在下文中一共展示了EntityNotFoundException.printStackTrace方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: delete
import com.google.appengine.api.datastore.EntityNotFoundException; //導入方法依賴的package包/類
public void delete() {
if (entity == null) {
try {
entity = getMatchingEntity();
} catch (final EntityNotFoundException e) {
e.printStackTrace();
}
}
if (entity != null) {
deleteEntityByKey(entity);
entity = null;
} else {
// TODO Log error
}
}
示例2: read
import com.google.appengine.api.datastore.EntityNotFoundException; //導入方法依賴的package包/類
public void read() {
if (entity == null) {
try {
entity = getMatchingEntity();
} catch (final EntityNotFoundException e) {
e.printStackTrace();
}
}
if (entity != null) {
readPropertiesFromEntity(entity);
}
}
示例3: update
import com.google.appengine.api.datastore.EntityNotFoundException; //導入方法依賴的package包/類
public void update() {
if (entity == null) {
try {
entity = getMatchingEntity();
} catch (final EntityNotFoundException e) {
e.printStackTrace();
}
}
if (entity != null) {
putEntityInStore(entity);
} else {
// TODO Log error
}
}
示例4: doGet
import com.google.appengine.api.datastore.EntityNotFoundException; //導入方法依賴的package包/類
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, "html/pages, html/snippets");
ve.init();
VelocityContext context = new VelocityContext();
Pair<Entity, UserCookie> infoAndCookie = init(context, req);
UserCookie userCookie = infoAndCookie.y;
boolean loggedIn = (boolean) context.get("loggedIn");
if (loggedIn && userCookie.isAdmin()) {
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Key key = KeyFactory.createKey("registration", Long.parseLong(req.getParameter("key")));
try {
Entity registration = datastore.get(key);
Map<String, Object> props = registration.getProperties();
String[] propNames = {"schoolName", "name", "email", "paid", "classification", "studentData", "schoolLevel"};
for (String propName : propNames) {
context.put(propName, props.get(propName));
}
context.put("account", "yes".equals(props.get("account")));
context.put("studentData", ((Text) props.get("studentData")).getValue());
context.put("coach".equals(props.get("registrationType")) ? "coach" : "student", true);
Entity contestInfo = infoAndCookie.x;
context.put("price", contestInfo.getProperty("price"));
context.put("key", key);
context.put("levels", contestInfo.getProperty("levels"));
context.put("Level", Level.class);
close(context, ve.getTemplate("editRegistration.html"), resp);
}
catch (EntityNotFoundException e) {
e.printStackTrace();
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid registration entity key " + key.toString());
}
}
else {
resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Contest Administrator privileges required for that operation");
}
}