本文整理汇总了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");
}
}