當前位置: 首頁>>代碼示例>>Java>>正文


Java Objectify.delete方法代碼示例

本文整理匯總了Java中com.googlecode.objectify.Objectify.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java Objectify.delete方法的具體用法?Java Objectify.delete怎麽用?Java Objectify.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.googlecode.objectify.Objectify的用法示例。


在下文中一共展示了Objectify.delete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addUserFileContents

import com.googlecode.objectify.Objectify; //導入方法依賴的package包/類
private void addUserFileContents(Objectify datastore, String userId, String fileName, byte[] content) {
  UserFileData ufd = datastore.find(userFileKey(userKey(userId), fileName));
  byte [] empty = new byte[] { (byte)0x5b, (byte)0x5d }; // "[]" in bytes
  if (ufd == null) {          // File doesn't exist
    if (fileName.equals(StorageUtil.USER_BACKPACK_FILENAME) &&
      Arrays.equals(empty, content)) {
      return;                 // Nothing to do
    }
    ufd = new UserFileData();
    ufd.fileName = fileName;
    ufd.userKey = userKey(userId);
  } else {
    if (fileName.equals(StorageUtil.USER_BACKPACK_FILENAME) &&
      Arrays.equals(empty, content)) {
      // Storing an empty backback, just delete the file
      datastore.delete(userFileKey(userKey(userId), fileName));
      return;
    }
  }
  ufd.content = content;
  datastore.put(ufd);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:23,代碼來源:ObjectifyStorageIo.java

示例2: removeFilesFromProject

import com.googlecode.objectify.Objectify; //導入方法依賴的package包/類
private void removeFilesFromProject(Objectify datastore, long projectId,
    FileData.RoleEnum role, boolean changeModDate, String... fileNames) {
  Key<ProjectData> projectKey = projectKey(projectId);
  List<Key<FileData>> filesToRemove = new ArrayList<Key<FileData>>();
  for (String fileName : fileNames) {
    Key<FileData> key = projectFileKey(projectKey, fileName);
    memcache.delete(key.getString()); // Remove it from memcache (if it is there)
    FileData fd = datastore.find(key);
    if (fd != null) {
      if (fd.role.equals(role)) {
        filesToRemove.add(projectFileKey(projectKey, fileName));
      } else {
        throw CrashReport.createAndLogError(LOG, null,
            collectProjectErrorInfo(null, projectId, fileName),
            new IllegalStateException("File role change is not supported"));
      }
    }
  }
  datastore.delete(filesToRemove);  // batch delete
  if (changeModDate) {
    updateProjectModDate(datastore, projectId, false);
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:24,代碼來源:ObjectifyStorageIo.java

示例3: cleanupNonces

import com.googlecode.objectify.Objectify; //導入方法依賴的package包/類
public void cleanupNonces() {
  Objectify datastore = ObjectifyService.begin();
  // We do not use runJobWithRetries because if we fail here, we will be
  // called again the next time someone attempts to download a built APK
  // via a QR Code.
  try {
    datastore.delete(datastore.query(NonceData.class)
      .filter("timestamp <", new Date((new Date()).getTime() - 3600*3*1000L))
      .limit(10).fetchKeys());
  } catch (Exception ex) {
      LOG.log(Level.WARNING, "Exception during cleanupNonces", ex);
  }

}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:15,代碼來源:ObjectifyStorageIo.java

示例4: cleanuppwdata

import com.googlecode.objectify.Objectify; //導入方法依賴的package包/類
@Override
public void cleanuppwdata() {
  Objectify datastore = ObjectifyService.begin();
  // We do not use runJobWithRetries because if we fail here, we will be
  // called again the next time someone attempts to set a password
  // Note: we remove data after 24 hours.
  try {
    datastore.delete(datastore.query(PWData.class)
      .filter("timestamp <", new Date((new Date()).getTime() - 3600*24*1000L))
      .limit(10).fetchKeys());
  } catch (Exception ex) {
      LOG.log(Level.WARNING, "Exception during cleanupNonces", ex);
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:15,代碼來源:ObjectifyStorageIo.java


注:本文中的com.googlecode.objectify.Objectify.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。