当前位置: 首页>>代码示例>>Java>>正文


Java EntityNotFoundException.printStackTrace方法代码示例

本文整理汇总了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
    }
}
 
开发者ID:MattHeard,项目名称:Dendrite,代码行数:16,代码来源:Model.java

示例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);
    }
}
 
开发者ID:MattHeard,项目名称:Dendrite,代码行数:13,代码来源:Model.java

示例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
    }
}
 
开发者ID:MattHeard,项目名称:Dendrite,代码行数:15,代码来源:Model.java

示例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");
	}
}
 
开发者ID:sushain97,项目名称:contestManagement,代码行数:45,代码来源:EditRegistration.java


注:本文中的com.google.appengine.api.datastore.EntityNotFoundException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。