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.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/*from w w w . ja v a 2 s. c om*/ public List<Integer> getAuthorizedEndEntityProfileIdsWithMissingCAs(final AuthenticationToken admin) { final ArrayList<Integer> returnval = new ArrayList<Integer>(); final HashSet<Integer> allcaids = new HashSet<Integer>(caSession.getAllCaIds()); allcaids.add(Integer.valueOf(SecConst.ALLCAS)); if (!authSession.isAuthorizedNoLogging(admin, StandardRules.ROLE_ROOT.resource())) { // we can only see profiles with missing CA Ids if we have root rule access return returnval; } try { for (final Entry<Integer, EndEntityProfile> entry : profileCache.getProfileCache(entityManager) .entrySet()) { final String availableCasString = entry.getValue().getValue(EndEntityProfile.AVAILCAS, 0); if (availableCasString != null) { boolean nonExistingCA = false; for (final String caidString : availableCasString.split(EndEntityProfile.SPLITCHAR)) { final int caIdInt = Integer.parseInt(caidString); if (!allcaids.contains(caIdInt)) { nonExistingCA = true; } } if (nonExistingCA) { returnval.add(entry.getKey()); } } } } catch (Exception e) { LOG.error(INTRES.getLocalizedMessage("ra.errorgetids"), e); } return returnval; }
From source file:org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/*from w ww. jav a 2 s. com*/ public EndEntityProfile getEndEntityProfile(final int id) { if (LOG.isTraceEnabled()) { LOG.trace(">getEndEntityProfile(" + id + ")"); } EndEntityProfile returnval = getEndEntityProfileNoClone(id); try { if (returnval != null) { returnval = (EndEntityProfile) returnval.clone(); } } catch (CloneNotSupportedException e) { LOG.error("Should never happen: ", e); throw new RuntimeException(e); } if (LOG.isTraceEnabled()) { LOG.trace("<getEndEntityProfile(id): " + (returnval == null ? "null" : "not null")); } return returnval; }
From source file:org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/* w w w . java2 s .co m*/ public EndEntityProfile getEndEntityProfileNoClone(final int id) { if (LOG.isTraceEnabled()) { LOG.trace(">getEndEntityProfileNoClone(" + id + ")"); } EndEntityProfile returnval = null; if (id == SecConst.EMPTY_ENDENTITYPROFILE) { returnval = new EndEntityProfile(true); } else { // We need to clone the profile, otherwise the cache contents will be modifyable from the outside returnval = profileCache.getProfileCache(entityManager).get(Integer.valueOf(id)); } if (LOG.isTraceEnabled()) { LOG.trace("<getEndEntityProfileNoClone(id): " + (returnval == null ? "null" : "not null")); } return returnval; }
From source file:org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override// ww w .j ava 2s . com public int getEndEntityProfileId(final String profilename) throws EndEntityProfileNotFoundException { if (LOG.isTraceEnabled()) { LOG.trace(">getEndEntityProfileId(" + profilename + ")"); } final Integer id = profileCache.getNameIdMapCache(entityManager).get(profilename.trim()); if (id != null) { int result = id.intValue(); if (LOG.isTraceEnabled()) { LOG.trace("<getEndEntityProfileId(" + profilename + "): " + result); } return result; } else { throw new EndEntityProfileNotFoundException( "End Entity Profile of name \"" + profilename + "\" was not found"); } }
From source file:org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//from w ww.j a v a2 s . c o m public String getEndEntityProfileName(final int id) { if (LOG.isTraceEnabled()) { LOG.trace(">getEndEntityProfilename(" + id + ")"); } final String returnval = profileCache.getIdNameMapCache(entityManager).get(Integer.valueOf(id)); if (LOG.isTraceEnabled()) { LOG.trace("<getEndEntityProfilename(" + id + "): " + returnval); } return returnval; }
From source file:org.ejbca.core.ejb.ra.raadmin.EndEntityProfileSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/*from w ww .j a va2 s .c om*/ public Map<Integer, String> getEndEntityProfileIdToNameMap() { if (LOG.isTraceEnabled()) { LOG.trace("><getEndEntityProfileIdToNameMap"); } return profileCache.getIdNameMapCache(entityManager); }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//from w w w . j ava 2 s .c om public Admin getAdmin(Certificate certificate) { String adminUsername = certificateStoreSession.findUsernameByCertSerno(Admin.getInternalAdmin(), CertTools.getSerialNumber(certificate), CertTools.getIssuerDN(certificate)); String adminEmail = null; if (adminUsername != null) { adminEmail = UserData.findSubjectEmailByUsername(entityManager, adminUsername); } return new Admin(certificate, adminUsername, adminEmail); }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override/* w w w . j a va 2 s .c om*/ public UserDataVO findUser(final Admin admin, final String username) throws AuthorizationDeniedException { if (log.isTraceEnabled()) { log.trace(">findUser(" + username + ")"); } final UserData data = UserData.findByUsername(entityManager, username); if (data == null) { if (log.isDebugEnabled()) { log.debug("Cannot find user with username='" + username + "'"); } } final UserDataVO ret = returnUserDataVO(admin, data, username); if (log.isTraceEnabled()) { log.trace("<findUser(" + username + "): " + (ret == null ? "null" : ret.getDN())); } return ret; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override// w w w .ja va 2s .com public UserDataVO findUserBySubjectAndIssuerDN(final Admin admin, final String subjectdn, final String issuerdn) throws AuthorizationDeniedException { if (log.isTraceEnabled()) { log.trace(">findUserBySubjectAndIssuerDN(" + subjectdn + ", " + issuerdn + ")"); } // String used in SQL so strip it final String dn = CertTools.stringToBCDNString(StringTools.strip(subjectdn)); if (log.isDebugEnabled()) { log.debug("Looking for users with subjectdn: " + dn + ", issuerdn : " + issuerdn); } final UserData data = UserData.findBySubjectDNAndCAId(entityManager, dn, issuerdn.hashCode()); if (data == null) { if (log.isDebugEnabled()) { log.debug("Cannot find user with subjectdn: " + dn + ", issuerdn : " + issuerdn); } } final UserDataVO returnval = returnUserDataVO(admin, data, null); if (log.isTraceEnabled()) { log.trace("<findUserBySubjectAndIssuerDN(" + subjectdn + ", " + issuerdn + ")"); } return returnval; }
From source file:org.ejbca.core.ejb.ra.UserAdminSessionBean.java
@TransactionAttribute(TransactionAttributeType.SUPPORTS) @Override//from w ww .ja va2 s . c o m public UserDataVO findUserBySubjectDN(final Admin admin, final String subjectdn) throws AuthorizationDeniedException { if (log.isTraceEnabled()) { log.trace(">findUserBySubjectDN(" + subjectdn + ")"); } // String used in SQL so strip it final String dn = CertTools.stringToBCDNString(StringTools.strip(subjectdn)); if (log.isDebugEnabled()) { log.debug("Looking for users with subjectdn: " + dn); } final UserData data = UserData.findBySubjectDN(entityManager, dn); if (data == null) { if (log.isDebugEnabled()) { log.debug("Cannot find user with subjectdn: " + dn); } } final UserDataVO returnval = returnUserDataVO(admin, data, null); if (log.isTraceEnabled()) { log.trace("<findUserBySubjectDN(" + subjectdn + ")"); } return returnval; }