List of usage examples for javax.ejb ObjectNotFoundException ObjectNotFoundException
public ObjectNotFoundException(String message)
From source file:com.geodetix.geo.dao.PostGisGeometryDAOImpl.java
/** * PostGIS implementation of the // w w w.ja v a 2 s. c o m * {@link com.geodetix.geo.interfaces.GeometryLocalHome#findByPrimaryKey(java.lang.Integer)} * method * * * @return the found bean's prymary key. * @param primaryKey primary key of searching bean. * @throws javax.ejb.FinderException launched if an error occours during the search operation. */ public java.lang.Integer findByPrimaryKey(java.lang.Integer primaryKey) throws javax.ejb.FinderException { PreparedStatement pstm = null; Connection con = null; ResultSet result = null; try { con = this.dataSource.getConnection(); pstm = con.prepareStatement(PostGisGeometryDAO.FIND_BY_PRIMARY_KEY_STATEMENT); pstm.setInt(1, primaryKey.intValue()); result = pstm.executeQuery(); if (!result.next()) { throw new ObjectNotFoundException("Cannot find Geometry Bean with id = " + primaryKey); } } catch (SQLException se) { throw new EJBException(se); } finally { try { if (result != null) { result.close(); } } catch (Exception e) { } try { if (pstm != null) { pstm.close(); } } catch (Exception e) { } try { if (con != null) { con.close(); } } catch (Exception e) { } } return primaryKey; }
From source file:org.ejbca.core.ejb.ra.EndEntityManagementSessionBean.java
@Override public void cleanUserCertDataSN(EndEntityInformation data) throws ObjectNotFoundException { if (log.isTraceEnabled()) { log.trace(">cleanUserCertDataSN: " + data.getUsername()); }/*from w w w . j a v a 2 s. c o m*/ try { cleanUserCertDataSN(data.getUsername()); } catch (FinderException e) { String msg = intres.getLocalizedMessage("authentication.usernotfound", data.getUsername()); log.info(msg); throw new ObjectNotFoundException(e.getMessage()); } catch (ApprovalException e) { // Should never happen log.error("ApprovalException: ", e); throw new EJBException(e); } catch (WaitingForApprovalException e) { // Should never happen log.error("WaitingForApprovalException: ", e); throw new EJBException(e); } if (log.isTraceEnabled()) { log.trace("<cleanUserCertDataSN: " + data.getUsername()); } }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@Override public void cleanUserCertDataSN(UserDataVO data) throws ObjectNotFoundException { if (log.isTraceEnabled()) { log.trace(">cleanUserCertDataSN: " + data.getUsername()); }// w w w . j a v a2s. c o m // This admin can be the public web user, which may not be allowed to // change status, // this is a bit ugly, but what can a man do... Admin statusadmin = Admin.getInternalAdmin(); try { cleanUserCertDataSN(statusadmin, data.getUsername()); } catch (FinderException e) { String msg = intres.getLocalizedMessage("authentication.usernotfound", data.getUsername()); logSession.log(statusadmin, statusadmin.getCaId(), LogConstants.MODULE_CA, new Date(), data.getUsername(), null, LogConstants.EVENT_INFO_USERAUTHENTICATION, msg); throw new ObjectNotFoundException(e.getMessage()); } catch (AuthorizationDeniedException e) { // Should never happen log.error("AuthorizationDeniedException: ", e); throw new EJBException(e); } catch (ApprovalException e) { // Should never happen log.error("ApprovalException: ", e); throw new EJBException(e); } catch (WaitingForApprovalException e) { // Should never happen log.error("ApprovalException: ", e); throw new EJBException(e); } if (log.isTraceEnabled()) { log.trace("<cleanUserCertDataSN: " + data.getUsername()); } }