List of usage examples for javax.ejb TransactionAttributeType SUPPORTS
TransactionAttributeType SUPPORTS
To view the source code for javax.ejb TransactionAttributeType SUPPORTS.
Click Source Link
REQUIRED
case. From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//from w ww. j a v a 2s.co m public List<UserDataVO> findUserByEmail(Admin admin, String email) throws AuthorizationDeniedException { if (log.isTraceEnabled()) { log.trace(">findUserByEmail(" + email + ")"); } if (log.isDebugEnabled()) { log.debug("Looking for user with email: " + email); } final List<UserData> result = UserData.findBySubjectEmail(entityManager, email); if (result.size() == 0) { if (log.isDebugEnabled()) { log.debug("Cannot find user with Email='" + email + "'"); } } final List<UserDataVO> returnval = new ArrayList<UserDataVO>(); for (final UserData data : result) { if (getGlobalConfiguration(admin).getEnableEndEntityProfileLimitations()) { // Check if administrator is authorized to view user. if (!authorizedToEndEntityProfile(admin, data.getEndEntityProfileId(), AccessRulesConstants.VIEW_RIGHTS)) { continue; } } if (!authorizedToCA(admin, data.getCaId())) { continue; } returnval.add(data.toUserDataVO()); } if (log.isTraceEnabled()) { log.trace("<findUserByEmail(" + email + ")"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//from w w w. j a va 2s . c o m public void checkIfCertificateBelongToUser(Admin admin, BigInteger certificatesnr, String issuerdn) throws AuthorizationDeniedException { if (log.isTraceEnabled()) { log.trace(">checkIfCertificateBelongToUser(" + certificatesnr.toString(16) + ")"); } if (!WebConfiguration.getRequireAdminCertificateInDatabase()) { if (log.isTraceEnabled()) { log.trace("<checkIfCertificateBelongToUser Configured to ignore if cert belongs to user."); } return; } String username = certificateStoreSession.findUsernameByCertSerno(admin, certificatesnr, issuerdn); if (username != null) { if (UserData.findByUsername(entityManager, username) == null) { String msg = intres.getLocalizedMessage("ra.errorcertnouser", issuerdn, certificatesnr.toString(16)); logSession.log(admin, LogConstants.INTERNALCAID, LogConstants.MODULE_RA, new Date(), null, null, LogConstants.EVENT_ERROR_ADMINISTRATORLOGGEDIN, msg); throw new AuthorizationDeniedException(msg); } } if (log.isTraceEnabled()) { log.trace("<checkIfCertificateBelongToUser()"); } }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/*from w ww. j av a2 s.co m*/ public Collection<UserDataVO> findAllUsersByStatus(Admin admin, int status) throws FinderException { if (log.isTraceEnabled()) { log.trace(">findAllUsersByStatus(" + status + ")"); } if (log.isDebugEnabled()) { log.debug("Looking for users with status: " + status); } Query query = new Query(Query.TYPE_USERQUERY); query.add(UserMatch.MATCH_WITH_STATUS, BasicMatch.MATCH_TYPE_EQUALS, Integer.toString(status)); Collection<UserDataVO> returnval = null; try { returnval = query(admin, query, false, null, null, 0); } catch (IllegalQueryException e) { } if (log.isDebugEnabled()) { log.debug("found " + returnval.size() + " user(s) with status=" + status); } if (log.isTraceEnabled()) { log.trace("<findAllUsersByStatus(" + status + ")"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//w w w . ja v a2 s . co m public Collection<UserDataVO> findAllUsersByCaId(Admin admin, int caid) { if (log.isTraceEnabled()) { log.trace(">findAllUsersByCaId(" + caid + ")"); } if (log.isDebugEnabled()) { log.debug("Looking for users with caid: " + caid); } Query query = new Query(Query.TYPE_USERQUERY); query.add(UserMatch.MATCH_WITH_CA, BasicMatch.MATCH_TYPE_EQUALS, Integer.toString(caid)); Collection<UserDataVO> returnval = null; try { returnval = query(admin, query, false, null, null, 0); } catch (IllegalQueryException e) { // Ignore ?? log.debug("Illegal query", e); returnval = new ArrayList<UserDataVO>(); } if (log.isDebugEnabled()) { log.debug("found " + returnval.size() + " user(s) with caid=" + caid); } if (log.isTraceEnabled()) { log.trace("<findAllUsersByCaId(" + caid + ")"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@SuppressWarnings("unchecked") @TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/* w w w. j a va2 s. c o m*/ public List<UserDataVO> findUsers(List<Integer> caIds, long timeModified, int status) { String queryString = "SELECT a FROM UserData a WHERE (a.timeModified <=:timeModified) AND (a.status=:status)"; if (caIds.size() > 0) { queryString += " AND (a.caId=:caId0"; for (int i = 1; i < caIds.size(); i++) { queryString += " OR a.caId=:caId" + i; } queryString += ")"; } if (log.isDebugEnabled()) { log.debug("Checking for " + caIds.size() + " CAs"); log.debug("Generated query string: " + queryString); } javax.persistence.Query query = entityManager.createQuery(queryString); query.setParameter("timeModified", timeModified); query.setParameter("status", status); if (caIds.size() > 0) { for (int i = 0; i < caIds.size(); i++) { query.setParameter("caId" + i, caIds.get(i)); } } final List<UserData> queryResult = (List<UserData>) query.getResultList(); final List<UserDataVO> ret = new ArrayList<UserDataVO>(queryResult.size()); for (UserData userData : queryResult) { ret.add(userData.toUserDataVO()); } return ret; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/* w w w . ja v a 2s . c o m*/ public Collection<UserDataVO> findAllUsersWithLimit(Admin admin) { if (log.isTraceEnabled()) { log.trace(">findAllUsersWithLimit()"); } Collection<UserDataVO> returnval = null; try { returnval = query(admin, null, true, null, null, 0); } catch (IllegalQueryException e) { } if (log.isTraceEnabled()) { log.trace("<findAllUsersWithLimit()"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/* ww w .j a v a 2 s . c om*/ public List<UserDataVO> findAllBatchUsersByStatusWithLimit(int status) { if (log.isTraceEnabled()) { log.trace(">findAllUsersByStatusWithLimit()"); } final List<UserData> userDataList = UserData.findAllBatchUsersByStatus(entityManager, status, UserAdminConstants.MAXIMUM_QUERY_ROWCOUNT); final List<UserDataVO> returnval = new ArrayList<UserDataVO>(userDataList.size()); for (UserData ud : userDataList) { UserDataVO userDataVO = ud.toUserDataVO(); if (userDataVO.getPassword() != null && userDataVO.getPassword().length() > 0) { returnval.add(userDataVO); } } if (log.isTraceEnabled()) { log.trace("<findAllUsersByStatusWithLimit()"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/*from w ww. ja va 2 s . c om*/ public Collection<UserDataVO> query(Admin admin, Query query, String caauthorizationstring, String endentityprofilestring, int numberofrows) throws IllegalQueryException { return query(admin, query, true, caauthorizationstring, endentityprofilestring, numberofrows); }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//w ww. j a va 2s. com public boolean checkForEndEntityProfileId(Admin admin, int endentityprofileid) { if (log.isTraceEnabled()) { log.trace(">checkForEndEntityProfileId(" + endentityprofileid + ")"); } long count = UserData.countByEndEntityProfileId(entityManager, endentityprofileid); if (log.isTraceEnabled()) { log.trace("<checkForEndEntityProfileId(" + endentityprofileid + "): " + count); } return count > 0; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override// w ww . ja v a 2 s. c om public boolean checkForCAId(Admin admin, int caid) { if (log.isTraceEnabled()) { log.trace(">checkForCAId()"); } return UserData.countByCaId(entityManager, caid) > 0; }