List of usage examples for javax.ejb EJBException EJBException
public EJBException(Exception ex)
From source file:edu.harvard.i2b2.oauth2.AuthTokenService.java
public AuthToken createAuthToken(String authCode, String resourceUserId, String i2b2Token, String clientRedirectUri, String clientId, String state, String scope, String i2b2Project, String patientId) {//from w w w.j av a 2 s .co m try { AuthToken tok = new AuthToken(); tok.setAuthorizationCode(authCode); tok.setResourceUserId(resourceUserId); tok.setI2b2Token(i2b2Token); tok.setClientRedirectUri(clientRedirectUri); tok.setClientId(clientId); tok.setState(state); tok.setScope(scope); tok.setI2b2Project(i2b2Project); tok.setCreatedDate(new Date()); tok.setExpiryDate(DateUtils.addMinutes(new Date(), 30)); tok.setI2b2Url(serverConfig.GetString(ConfigParameter.i2b2Url)); tok.setI2b2Domain(serverConfig.GetString(ConfigParameter.i2b2Domain)); tok.setPatient(patientId); logger.info("Created authToken.." + tok.toString()); //em.getTransaction().begin(); em.persist(tok); //em.getTransaction().commit(); logger.info("Persisted authToken" + tok.toString()); return tok; } catch (Exception ex) { logger.error(ex.getMessage(), ex); //em.getTransaction().rollback(); throw new EJBException(ex.getMessage()); } }
From source file:edu.harvard.i2b2.fhirserver.ejb.AccessTokenBean.java
public AccessToken createAccessToken(String authCode, String resourceUserId, String i2b2Token, String i2b2Project, String clientId, String scope) { try {/* w ww. j a v a 2 s.c om*/ AccessToken tok = new AccessToken(); tok.setTokenString(authCode); tok.setResourceUserId(resourceUserId); tok.setI2b2Token(i2b2Token); tok.setI2b2Project(i2b2Project); tok.setClientId(clientId); tok.setScope(scope); tok.setCreatedDate(new Date()); tok.setExpiryDate(DateUtils.addMinutes(new Date(), 30)); logger.info("Created .." + tok.toString()); em.getTransaction().begin(); em.persist(tok); em.getTransaction().commit(); logger.info("Persisted " + tok.toString()); return tok; } catch (Exception ex) { logger.error(ex.getMessage(), ex); em.getTransaction().rollback(); throw new EJBException(ex.getMessage()); } }
From source file:edu.harvard.i2b2.fhirserver.ejb.AuthTokenBean.java
public List<AuthToken> getAuthTokens() { try {// w w w.j a v a 2 s .c o m em.getTransaction().begin(); List<AuthToken> tokens = em.createQuery("from AuthToken").getResultList(); em.getTransaction().commit(); return tokens; } catch (Exception e) { logger.error(e.getMessage(), e); em.getTransaction().rollback(); throw new EJBException(e.getMessage()); } }
From source file:edu.harvard.i2b2.oauth2.AuthTokenService.java
public List<AuthToken> getAuthTokens() { try {/*ww w .ja v a 2 s . c o m*/ //em.getTransaction().begin(); List<AuthToken> tokens = em.createQuery("from AuthToken").getResultList(); //em.getTransaction().commit(); return tokens; } catch (Exception e) { logger.error(e.getMessage(), e); //em.getTransaction().rollback(); throw new EJBException(e.getMessage()); } }
From source file:com.geodetix.geo.dao.PostGisGeometryDAOImpl.java
/** * PostGIS implementation of the /*from ww w . j a va 2 s . c o m*/ * {@link com.geodetix.geo.ejb.GeometryBean#ejbCreate(org.postgis.Geometry, java.lang.String)} * method. * * @return the primary key of the persisted bean. * @param ejb the bean to persist. * @throws javax.ejb.CreateException launched if an EJB creation error is encountered. * @throws javax.ejb.EJBException launched if a generic EJB error is encountered. */ public java.lang.Integer create(com.geodetix.geo.ejb.GeometryBean ejb) throws javax.ejb.CreateException, javax.ejb.EJBException { PreparedStatement pstm = null; Connection con = null; try { con = this.dataSource.getConnection(); pstm = con.prepareStatement(PostGisGeometryDAO.EJB_CREATE_STATEMENT); pstm.setInt(1, ejb.getId()); pstm.setObject(2, new PGgeometry((Geometry) ejb.getGeometry())); pstm.setString(3, ejb.getDescription()); if (pstm.executeUpdate() != 1) { throw new CreateException("Failed to add EJB to database"); } return ejb.getId(); } catch (SQLException se) { throw new EJBException(se); } finally { try { if (pstm != null) { pstm.close(); } } catch (Exception e) { } try { if (con != null) { con.close(); } } catch (Exception e) { } } }
From source file:de.juwimm.cms.authorization.model.UserHbmImpl.java
/** * @return UserValue Object// www . j a va2s. c o m * @see de.juwimm.cms.authorization.model.UserHbm#getUserValue() */ @Override public de.juwimm.cms.authorization.vo.UserValue getUserValue() { UserValue value = new UserValue(); try { value.setUserName(getUserId()); value.setFirstName(getFirstName()); value.setLastName(getLastName()); value.setMasterRoot(isMasterRoot()); value.setEmail(getEmail()); value.setConfigXML(getConfigXML()); value.setLoginDate(getLoginDate()); } catch (Exception e) { throw new EJBException(e); } return value; }
From source file:edu.harvard.i2b2.fhirserver.ejb.AuthTokenBean.java
public void removeAuthToken(AuthToken authToken) { try {//w ww. j a v a 2 s .c om em.getTransaction().begin(); logger.info("deleting from db:" + authToken); em.remove(authToken); em.getTransaction().commit(); } catch (Exception e) { logger.error(e.getMessage(), e); em.getTransaction().rollback(); throw new EJBException(e.getMessage()); } }
From source file:edu.harvard.i2b2.oauth2.AuthTokenService.java
public void removeAuthToken(AuthToken authToken) { try {//from www .j a v a2 s. co m //em.getTransaction().begin(); logger.info("deleting from db:" + authToken); em.remove(authToken); //em.getTransaction().commit(); } catch (Exception e) { logger.error(e.getMessage(), e); //em.getTransaction().rollback(); throw new EJBException(e.getMessage()); } }
From source file:edu.harvard.iq.dvn.core.study.Study.java
public Study(VDC vdc, VDCUser creator, StudyVersion.VersionState versionState, Template initTemplate) { if (vdc == null) { throw new EJBException("Cannot create study with null VDC"); }//from ww w. ja v a 2s . c om this.setOwner(vdc); if (initTemplate == null) { setTemplate(vdc.getDefaultTemplate()); } else { this.setTemplate(initTemplate); } StudyVersion sv = new StudyVersion(); sv.setVersionNumber(new Long(1)); sv.setVersionState(versionState); sv.setStudy(this); sv.setMetadata(new Metadata(template.getMetadata(), false, false)); sv.getMetadata().setStudyVersion(sv); studyVersions = new ArrayList<StudyVersion>(); studyVersions.add(sv); //if (vdc != null) { // vdc.getOwnedStudies().add(this); //} // commented the lines above: with the EJB caching off, // getOwnedStudies results in actually looking up the studies // in the database, then looking up the metadata, the studylock, and // a couple of other things *for every study in the DV*; resulting // in 5*N SQL queries where N = number of studies already in the DV! // -L.A. this.setCreator(creator); this.setLastUpdater(creator); }
From source file:de.juwimm.cms.authorization.model.UserHbmImpl.java
/** * @see de.juwimm.cms.authorization.model.UserHbm#setUserValue(de.juwimm.cms.authorization.vo.UserValue) *//*from w w w .j a v a2 s.com*/ @Override public void setUserValue(de.juwimm.cms.authorization.vo.UserValue value) { try { setFirstName(value.getFirstName()); setLastName(value.getLastName()); setMasterRoot(value.isMasterRoot()); setEmail(value.getEmail()); setConfigXML(value.getConfigXML()); setLoginDate(value.getLoginDate()); } catch (Exception e) { throw new EJBException(e); } }