本文整理汇总了Java中javax.jdo.JDOObjectNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java JDOObjectNotFoundException类的具体用法?Java JDOObjectNotFoundException怎么用?Java JDOObjectNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JDOObjectNotFoundException类属于javax.jdo包,在下文中一共展示了JDOObjectNotFoundException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getHTML
import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
@GET
@Produces("text/html")
public Response getHTML(@PathParam("other") String fullPath) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
// if (fullPath == null || "".equals(fullPath) || fullPath.endsWith("/")) {
// fullPath = "index.html";
// }
DocModel docModel = pm.getObjectById(DocModel.class, fullPath);
return Response.ok(docModel.getHtml()).build();
} catch (JDOObjectNotFoundException e) {
return Response.status(404).build();
} finally {
pm.close();
}
}
开发者ID:dankurka,项目名称:gwt-site-webapp,代码行数:19,代码来源:DocumentationResource.java
示例17: getOrCreateNewAuthor
import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
/**
* Looks in the data store for an author with a matching email. If the
* author does not exist, a new one will be created. The newly created
* author will also have access to a newly created surface.
*
* @param user
* the user for which an author object is needed
* @return an author object
*/
public Author getOrCreateNewAuthor(User user) {
try {
return getAuthor(user.getEmail());
} catch (JDOObjectNotFoundException e) {
final Transaction txA = begin();
final Surface surface = new Surface("My First Surface");
surface.addAuthorName(user.getNickname());
saveSurface(surface);
txA.commit();
final Transaction txB = begin();
final Author author = new Author(user.getEmail(), user.getNickname());
author.addSurface(surface);
saveAuthor(author);
txB.commit();
return author;
}
}
开发者ID:dougkoellmer,项目名称:swarm,代码行数:29,代码来源:Store.java
示例18: createOrIncrement
import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public static void createOrIncrement(String name, int delta) {
PersistenceManager pm = PMF.get().getPersistenceManager();
Counter counter = null;
try {
pm.currentTransaction().begin();
try {
counter = pm.getObjectById(Counter.class, name);
counter.increment(delta);
} catch (JDOObjectNotFoundException e) {
counter = new Counter(name, delta);
pm.makePersistent(counter);
}
pm.currentTransaction().commit();
} finally {
if (pm.currentTransaction().isActive()) {
pm.currentTransaction().rollback();
}
}
}
开发者ID:dougkoellmer,项目名称:swarm,代码行数:20,代码来源:Counter.java
示例19: addAndGet
import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public static int addAndGet(String name, int delta) {
PersistenceManager pm = PMF.get().getPersistenceManager();
NamedCounter counter = null;
try {
pm.setDetachAllOnCommit(true);
pm.currentTransaction().begin();
try {
counter = pm.getObjectById(NamedCounter.class,
KeyFactory.keyToString(getKeyForName(name)));
counter.add(delta);
} catch (JDOObjectNotFoundException e) {
counter = new NamedCounter(name);
counter.add(delta);
pm.makePersistent(counter);
}
pm.currentTransaction().commit();
} finally {
if (pm.currentTransaction().isActive()) {
pm.currentTransaction().rollback();
}
}
return counter.getCount();
}
开发者ID:dougkoellmer,项目名称:swarm,代码行数:26,代码来源:NamedCounterUtils.java
示例20: reset
import javax.jdo.JDOObjectNotFoundException; //导入依赖的package包/类
public static void reset(String name) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
pm.currentTransaction().begin();
try {
NamedCounter counter = pm.getObjectById(NamedCounter.class,
KeyFactory.keyToString(getKeyForName(name)));
pm.deletePersistent(counter);
} catch (JDOObjectNotFoundException e) {
return;
}
pm.currentTransaction().commit();
} finally {
if (pm.currentTransaction().isActive()) {
pm.currentTransaction().rollback();
}
}
}
开发者ID:dougkoellmer,项目名称:swarm,代码行数:20,代码来源:NamedCounterUtils.java
注:本文中的javax.jdo.JDOObjectNotFoundException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论