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


Java PersistenceManager.deletePersistentAll方法代碼示例

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


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

示例1: deleteUploadedMessage

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
@Override
public void deleteUploadedMessage(String uploadedKey) {
  xLogger.fine("Entered deleteUploadedMessage");
  PersistenceManager pm = null;
  try {
    pm = PMF.get().getPersistenceManager();
    IUploaded uploaded = JDOUtils.getObjectById(IUploaded.class, uploadedKey, pm);
    if (uploaded != null) {
      List<IUploadedMsgLog> msgLogs = getUploadMsgLog(uploadedKey, pm);
      if (msgLogs != null && !msgLogs.isEmpty()) {
        pm.deletePersistentAll(msgLogs);
      }
    }
  } catch (Exception e) {
    xLogger.warn("Error removing msg logs for upload key :{0}", uploadedKey, e);
  } finally {
    if (pm != null) {
      pm.close();
    }
  }
  xLogger.fine("Exiting deleteUploadedMessage");
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:23,代碼來源:DaoUtil.java

示例2: removeInvEventLogs

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
@Override
public List<IInvntryEvntLog> removeInvEventLogs(Long kioskId, Long materialId, Date start,
                                                Date end,
                                                PersistenceManager pm) {
  boolean useLocalPm = false;
  if (pm == null) {
    pm = PMF.get().getPersistenceManager();
    useLocalPm = true;
  }
  try {
    List<IInvntryEvntLog> results = getInvEventLogs(kioskId, materialId, start, end, pm);
    if (results != null && !results.isEmpty()) {
      pm.deletePersistentAll(results);
    }
    return results;
  } finally {
    if (useLocalPm) {
      pm.close();
    }
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:22,代碼來源:InvntryDao.java

示例3: process

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public String process(Long domainId, Results results, String skipCounting, PersistenceManager pm)
    throws ProcessingException {
  try {
    if (results == null) {
      return null;
    }
    // Get results
    List list = results.getResults();

    if (list == null || list.isEmpty()) {
      return null;
    }

    pm.deletePersistentAll(list);
    xLogger
        .info("Deleted {0} objects of type {1} ", list.size(), list.get(0).getClass().getName());
  } catch (Exception e) {
    xLogger
        .severe("{0} when deleting entities in domain {1}: {2}", e.getClass().getName(), domainId,
            e.getMessage(), e);
  }
  return skipCounting;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:26,代碼來源:DeleteProcessor.java

示例4: process

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
/**
 * Process each {@code results} and deletes/updates it and update/remove
 * counter of all its corresponding domain.
 *
 * @param domainId domain id to be removed from results, or delete all {@code results} if it is equal
 *                 to {@code sourceDomainId} in {@code results}
 * @param results  data which need to be updated or deleted
 * @param dummy    unused variable.
 * @param pm       persistent manager used for updating the data store
 * @return null
 */
@Override
public String process(Long domainId, Results results, String dummy, PersistenceManager pm)
    throws ProcessingException {
  if (results == null) {
    xLogger.fine("result is null");
    return null;
  }
  List list = results.getResults();
  if (list == null || list.isEmpty()) {
    return null;
  }
  Object o = list.get(0);
  if (o instanceof IMultiDomain) {
    try {
      Long
          sourceDomainId =
          (Long) o.getClass().getMethod(MethodNameConstants.GET_DOMAIN_ID).invoke(o);
      if (sourceDomainId.equals(domainId)) {
        pm.deletePersistentAll(list);
      } else if (o.getClass().getSimpleName().equals("Material")) {
        removeDomains(list, Collections.singletonList(domainId));
      } else {
        List<Long> niDomains = DomainsUtil.extractNonIntersectingDomainIds(domainId, o);
        removeDomains(list, niDomains);
      }
    } catch (Exception e) {
      xLogger.warn("Error while deleting the domain {1}:", domainId, e);
    }
  } else {
    pm.deletePersistentAll(list);
  }
  return null;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:45,代碼來源:DomainDeleteProcessor.java

示例5: deleteDomainLinks

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
/**
 * Remove domain links
 */
public void deleteDomainLinks(List<String> keys) throws ServiceException {
  xLogger.fine("Entered removeDomainLinks");
  if (keys == null || keys.isEmpty()) {
    throw new IllegalArgumentException("Invalid keys to delete");
  }

  PersistenceManager pm = PMF.get().getPersistenceManager();
  Iterator<String> it = keys.iterator();
  List<IDomainLink> links = new ArrayList<IDomainLink>(keys.size());
  String key = null;
  try {
    while (it.hasNext()) {
      try {
        key = it.next();
        IDomainLink link = JDOUtils.getObjectById(IDomainLink.class, key, pm);
        links.add(link);
        // Get the reverse link
        IDomainLink rLink = JDOUtils.createInstance(IDomainLink.class).loadReverseLink(link);
        links.add(JDOUtils.getObjectById(IDomainLink.class, rLink.getKey(), pm));
        //Remove domains corresponding permissions
        IDomain domain = JDOUtils.getObjectById(IDomain.class, link.getLinkedDomainId(), pm);
        domain.setHasParent(false);
        domain.setHasChild(false);
      } catch (Exception e) {
        xLogger
            .warn("{0} when trying to get domainlink with key {1}: {2}", e.getClass().getName(),
                key, e.getMessage());
      }
    }
    // Delete links (forward and reverse)
    pm.deletePersistentAll(links);
  } finally {
    pm.close();
  }
  xLogger.fine("Exiting removeDoaminLinks");
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:40,代碼來源:DomainsServiceImpl.java

示例6: deleteApprovers

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
/**
 * Delete the approvers from db which are not in the model.
 */
public void deleteApprovers(List<IApprover> approvers, PersistenceManager pm) {
  if (!approvers.isEmpty()) {
    pm.deletePersistentAll(approvers);
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:9,代碼來源:UpdateApproversAction.java

示例7: deleteKioskLinks

import javax.jdo.PersistenceManager; //導入方法依賴的package包/類
/**
 * Delete kiosk links given the link keys, or Ids
 *
 * @param linkIds The unique key of each link (say, as generated by the datastore)
 */
public void deleteKioskLinks(Long domainId, List<String> linkIds, String sUser)
    throws ServiceException {
  xLogger.fine("Entered deleteKioskLinks");

  if (linkIds == null || linkIds.size() == 0) {
    throw new ServiceException("Invalid link Ids");
  }
  sUser = (sUser != null ? sUser : " ");
  String errMsg = null;
  Exception exception = null;
  String linkedKioskName;
  String kioskName;
  String linkType;
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    // Get the kiosk link objects
    List<IKioskLink> kioskLinks = new ArrayList<IKioskLink>();
    for (String linkId : linkIds) {
      IKioskLink kl = JDOUtils.getObjectById(IKioskLink.class, linkId, pm);
      kioskLinks.add(kl);
      linkType = kl.getLinkType();//for auditlog
      // Get the reverse link to delete as well
      IKioskLink
          rlink =
          JDOUtils.getObjectById(IKioskLink.class, JDOUtils
              .createKioskLinkId(kl.getLinkedKioskId(),
                  EntityUtils.getReverseLinkType(kl.getLinkType()), kl.getKioskId()), pm);
      // Get the domain ID of the linked entity
      IKiosk linkedKiosk = JDOUtils.getObjectById(IKiosk.class, kl.getLinkedKioskId());
      kioskName = JDOUtils.getObjectById(IKiosk.class, kl.getKioskId()).getName();//for auditlog
      linkedKioskName = linkedKiosk.getName();//for auditlog
      // Delete the links and remove them from the respective domains (superdomains)
      DomainsUtil.removeFromDomain(kl, domainId, pm);
      DomainsUtil.removeFromDomain(rlink, linkedKiosk.getDomainId(), pm);
      xLogger.info("AUDITLOG\t{0}\t{1}\tENTITY\t " +
              "DELETE RELATION\t{2}\t{3}\tLINKTYPE={4}", domainId, sUser, kioskName,
          linkedKioskName,
          linkType);
    }
    // Delete the kiosk links
    pm.deletePersistentAll(kioskLinks);
  } catch (Exception e) {
    exception = e;
    errMsg = e.getMessage();
  } finally {
    pm.close();
  }
  if (errMsg != null) {
    throw new ServiceException(errMsg, exception);
  }
  xLogger.fine("Exiting deleteKioskLinks");
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:58,代碼來源:EntitiesServiceImpl.java


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