當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。