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


Java JDOObjectNotFoundException类代码示例

本文整理汇总了Java中javax.jdo.JDOObjectNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java JDOObjectNotFoundException类的具体用法?Java JDOObjectNotFoundException怎么用?Java JDOObjectNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JDOObjectNotFoundException类属于javax.jdo包,在下文中一共展示了JDOObjectNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMaterial

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public IMaterial getMaterial(Long materialId) throws ServiceException {
  xLogger.fine("Entering getMaterial");
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    //Get the material object from the database
    IMaterial material = JDOUtils.getObjectById(IMaterial.class, materialId, pm);
    //If we get here, it means the material exists
    material = pm.detachCopy(material);
    xLogger.fine("Exiting getMaterial");
    return material;
  } catch (JDOObjectNotFoundException e) {
    xLogger.warn("getMaterial: FAILED!!! Material {0} does not exist in the database", materialId,
        e);
    throw new ServiceException(
        messages.getString("material") + " " + materialId + " " + backendMessages
            .getString("error.notfound"));
  } finally {
    pm.close();
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:21,代码来源:MaterialCatalogServiceImpl.java

示例2: getHandlingUnit

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
@Override
public IHandlingUnit getHandlingUnit(Long handlingUnitId) throws ServiceException {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    IHandlingUnit material = JDOUtils.getObjectById(IHandlingUnit.class, handlingUnitId, pm);
    material = pm.detachCopy(material);
    return material;
  } catch (JDOObjectNotFoundException e) {
    xLogger.warn("get handling unit: FAILED!!! Handling unit {0} does not exist in the database",
        handlingUnitId, e);
    throw new ServiceException(
        "Handling unit " + handlingUnitId + " " + backendMessages.getString("error.notfound"));
  } finally {
    pm.close();
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:17,代码来源:HandlingUnitServiceImpl.java

示例3: getKioskLink

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
 * Get a given kiosk link
 */
public IKioskLink getKioskLink(String linkId) throws ObjectNotFoundException, ServiceException {
  xLogger.fine("Entered getKioskLink");
  IKioskLink link = null;
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    link = JDOUtils.getObjectById(IKioskLink.class, linkId, pm);
    link = pm.detachCopy(link);
  } catch (JDOObjectNotFoundException e) {
    throw new ObjectNotFoundException(e.getMessage());
  } finally {
    pm.close();
  }

  xLogger.fine("Exiting getKioskLink");
  return link;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:20,代码来源:EntitiesServiceImpl.java

示例4: getConfiguration

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
 * Get domain-specific configurtion, if domain is specified
 */
public IConfig getConfiguration(String key, Long domainId)
    throws ObjectNotFoundException, ServiceException {
  if (key == null || key.isEmpty()) {
    throw new ServiceException("Invalid key: " + key);
  }
  IConfig config = null;
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    String realKey = getRealKey(key, domainId);
    config = JDOUtils.getObjectById(IConfig.class, realKey, pm);
    config = pm.detachCopy(config);
  } catch (JDOObjectNotFoundException e) {
    xLogger.warn("Config object not found for key: {0}", key);
    throw new ObjectNotFoundException(e);
  } finally {
    pm.close();
  }

  return config;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:24,代码来源:ConfigurationMgmtServiceImpl.java

示例5: getLog

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public static IMessageLog getLog(String jobId, String address) throws MessageHandlingException {
  if (jobId == null && address == null) {
    throw new MessageHandlingException("Invalid input parameters when getting message log");
  }
  IMessageLog mlog = null;
  PersistenceManager pm = PMF.get().getPersistenceManager();
  String msg = null;
  try {
    String key = JDOUtils.createMessageLogKey(jobId, address);
    mlog = JDOUtils.getObjectById(IMessageLog.class, key, pm);
    mlog = pm.detachCopy(mlog);
  } catch (JDOObjectNotFoundException e) {
    msg =
        "Message log with key '" + JDOUtils.createMessageLogKey(jobId, address) + "' not found ["
            + e.getMessage() + "]";
  } finally {
    pm.close();
  }
  if (msg != null) {
    throw new MessageHandlingException(msg);
  }
  return mlog;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:24,代码来源:MessageUtil.java

示例6: removeMultipartMsg

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public static void removeMultipartMsg(String id) throws MessageHandlingException {
  if (id == null || id.isEmpty()) {
    throw new MessageHandlingException("Invalid ID");
  }
  PersistenceManager pm = PMF.get().getPersistenceManager();
  String err = null;
  try {
    IMultipartMsg mmsg = JDOUtils.getObjectById(IMultipartMsg.class, id, pm);
    removeMultipartMsg(mmsg);
  } catch (JDOObjectNotFoundException e) {
    err = e.getMessage();
  } finally {
    pm.close();
  }
  if (err != null) {
    throw new MessageHandlingException(err);
  }

}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:20,代码来源:MessageUtil.java

示例7: updateUploaded

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public void updateUploaded(IUploaded u) throws ServiceException, ObjectNotFoundException {
  if (u == null) {
    throw new ServiceException("Nothing to update");
  }
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    IUploaded uploaded = JDOUtils.getObjectById(IUploaded.class, u.getId(), pm);
    uploaded.setBlobKey(u.getBlobKey());
    uploaded.setDescription(u.getDescription());
    uploaded.setDomainId(u.getDomainId());
    uploaded.setFileName(u.getFileName());
    uploaded.setLocale(u.getLocale());
    uploaded.setTimeStamp(u.getTimeStamp());
    uploaded.setType(u.getType());
    uploaded.setUserId(u.getUserId());
    uploaded.setVersion(u.getVersion());
    uploaded.setJobId(u.getJobId());
    uploaded.setJobStatus(u.getJobStatus());
  } catch (JDOObjectNotFoundException e) {
    throw new ObjectNotFoundException(e.getMessage());
  } finally {
    pm.close();
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:25,代码来源:UploadServiceImpl.java

示例8: convertJdoAccessException

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
 * Convert the given JDOException to an appropriate exception from the
 * {@code org.springframework.dao} hierarchy.
 * <p>The most important cases like object not found or optimistic locking failure
 * are covered here. For more fine-granular conversion, JdoTransactionManager
 * supports sophisticated translation of exceptions via a JdoDialect.
 * @param ex JDOException that occured
 * @return the corresponding DataAccessException instance
 * @see JdoTransactionManager#convertJdoAccessException
 * @see JdoDialect#translateException
 */
public static DataAccessException convertJdoAccessException(JDOException ex) {
	if (ex instanceof JDOObjectNotFoundException) {
		throw new JdoObjectRetrievalFailureException((JDOObjectNotFoundException) ex);
	}
	if (ex instanceof JDOOptimisticVerificationException) {
		throw new JdoOptimisticLockingFailureException((JDOOptimisticVerificationException) ex);
	}
	if (ex instanceof JDODataStoreException) {
		return new JdoResourceFailureException((JDODataStoreException) ex);
	}
	if (ex instanceof JDOFatalDataStoreException) {
		return new JdoResourceFailureException((JDOFatalDataStoreException) ex);
	}
	if (ex instanceof JDOUserException) {
		return new JdoUsageException((JDOUserException) ex);
	}
	if (ex instanceof JDOFatalUserException) {
		return new JdoUsageException((JDOFatalUserException) ex);
	}
	// fallback
	return new JdoSystemException(ex);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:PersistenceManagerFactoryUtils.java

示例9: getCustomer

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
    * Get a Customer instance from the datastore given the user's email.
    * The method uses this email to obtain the Customer key.
    * @param email
    * 			: the customer's email address
    * @return customer instance, null if customer is not found
    */
public static Customer getCustomer(Email email) {		
	PersistenceManager pm = PMF.get().getPersistenceManager();
	Key key = KeyFactory.createKey(Customer.class.getSimpleName(), 
                                      email.getEmail());
	
	Customer customer;
	try  {
		customer = pm.getObjectById(Customer.class, key);
	}
	catch (JDOObjectNotFoundException e) {
		return null;
	}
	pm.close();
	return customer;
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:23,代码来源:CustomerManager.java

示例10: getStation

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
    * Get a Station instance from the datastore given the user's email.
    * The method uses this email to obtain the Station key.
    * @param email
    * 			: the Station's email address
    * @return Station instance, null if Station is not found
    */
public static Station getStation(Email email) {		
	PersistenceManager pm = PMF.get().getPersistenceManager();
	Key key = KeyFactory.createKey(Station.class.getSimpleName(), 
                                      email.getEmail());
	
	Station station;
	try  {
		station = pm.getObjectById(Station.class, key);
	}
	catch (JDOObjectNotFoundException e) {
		return null;
	}
	pm.close();
	return station;
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:23,代码来源:StationManager.java

示例11: getAdministrator

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
    * Get a Administrator instance from the datastore given the user's email.
    * The method uses this email to obtain the Administrator key.
    * @param email
    * 			: the administrator's email address
    * @return administrator instance, null if administrator is not found
    */
public static Administrator getAdministrator(Email email) {		
	PersistenceManager pm = PMF.get().getPersistenceManager();
	Key key = KeyFactory.createKey(Administrator.class.getSimpleName(), 
                                      email.getEmail());
	
	Administrator administrator;
	try  {
		administrator = pm.getObjectById(Administrator.class, key);
	}
	catch (JDOObjectNotFoundException e) {
		return null;
	}
	pm.close();
	return administrator;
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:23,代码来源:AdministratorManager.java

示例12: findBySanitizedTitle

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public Article findBySanitizedTitle(String sanitizedTitle) {
	Article article = null;

	try {
		Query query = pm.newQuery(Article.class);
		query.setFilter("sanitizedTitle == sanitizedTitleParam");
		query.declareParameters("String sanitizedTitleParam");
		List<Article> articles = (List<Article>) query
				.execute(sanitizedTitle);
		if (articles.size() == 1) {
			article = articles.get(0);
		}
	} catch (JDOObjectNotFoundException e) {
		LOGGER.warning(e.getMessage());
	}

	return article;
}
 
开发者ID:santiagolizardo,项目名称:jerba,代码行数:19,代码来源:ArticleManager.java

示例13: findByYearMonth

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public List<Article> findByYearMonth(int year, int month) {
	List<Article> articles = new ArrayList<>();

	Calendar calendar = Calendar.getInstance();
	calendar.set(Calendar.YEAR, year);
	calendar.set(Calendar.MONTH, month - 1);
	calendar.set(Calendar.DAY_OF_MONTH, 1);
	Date fromDate = calendar.getTime();

	calendar.add(Calendar.MONTH, 1);
	Date toDate = calendar.getTime();

	try {
		Query query = pm.newQuery(Article.class);
		query.setFilter("publicationDate >= fromDateParam && publicationDate < toDateParam");
		query.declareImports("import java.util.Date");
		query.declareParameters("Date fromDateParam, Date toDateParam");
		articles = (List<Article>) query.execute(fromDate, toDate);
	} catch (JDOObjectNotFoundException e) {
		LOGGER.warning(e.getMessage());
	}

	return articles;
}
 
开发者ID:santiagolizardo,项目名称:jerba,代码行数:25,代码来源:ArticleManager.java

示例14: convertJdoAccessException

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
 * Convert the given JDOException to an appropriate exception from the
 * {@code org.springframework.dao} hierarchy.
 * <p>The most important cases like object not found or optimistic locking
 * failure are covered here. For more fine-granular conversion, JdoAccessor and
 * JdoTransactionManager support sophisticated translation of exceptions via a
 * JdoDialect.
 * @param ex JDOException that occured
 * @return the corresponding DataAccessException instance
 * @see JdoAccessor#convertJdoAccessException
 * @see JdoTransactionManager#convertJdoAccessException
 * @see JdoDialect#translateException
 */
public static DataAccessException convertJdoAccessException(JDOException ex) {
	if (ex instanceof JDOObjectNotFoundException) {
		throw new JdoObjectRetrievalFailureException((JDOObjectNotFoundException) ex);
	}
	if (ex instanceof JDOOptimisticVerificationException) {
		throw new JdoOptimisticLockingFailureException((JDOOptimisticVerificationException) ex);
	}
	if (ex instanceof JDODataStoreException) {
		return new JdoResourceFailureException((JDODataStoreException) ex);
	}
	if (ex instanceof JDOFatalDataStoreException) {
		return new JdoResourceFailureException((JDOFatalDataStoreException) ex);
	}
	if (ex instanceof JDOUserException) {
		return new JdoUsageException((JDOUserException) ex);
	}
	if (ex instanceof JDOFatalUserException) {
		return new JdoUsageException((JDOFatalUserException) ex);
	}
	// fallback
	return new JdoSystemException(ex);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:36,代码来源:PersistenceManagerFactoryUtils.java

示例15: getBlog

import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Blog getBlog()
{
  if( blog != null ) return blog;
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {
    Query q = pm.newQuery( Blog.class );
    q.setFilter("userId == :userId");
    q.setRange(0, 1);
    List<Blog> blogs = (List<Blog>)q.execute(getId());

    if( blogs.isEmpty() ) return null;
    blog = blogs.get(0);
    return blog;
  } catch( JDOObjectNotFoundException e ) {
    return null;
  } finally {
    pm.close();
  }
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:21,代码来源:User.java


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