Example usage for javax.ejb TransactionAttributeType SUPPORTS

List of usage examples for javax.ejb TransactionAttributeType SUPPORTS

Introduction

In this page you can find the example usage for javax.ejb TransactionAttributeType SUPPORTS.

Prototype

TransactionAttributeType SUPPORTS

To view the source code for javax.ejb TransactionAttributeType SUPPORTS.

Click Source Link

Document

If the client calls with a transaction context, the container performs the same steps as described in the REQUIRED case.

Usage

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override/*from w  ww .j a v  a2  s  .c o m*/
public CA getCANoLog(final AuthenticationToken admin, final int caid)
        throws CADoesntExistsException, AuthorizationDeniedException {
    if (!authorizedToCANoLogging(admin, caid)) {
        String msg = intres.getLocalizedMessage("caadmin.notauthorizedtoca", admin.toString(),
                Integer.valueOf(caid));
        throw new AuthorizationDeniedException(msg);
    }
    return getCAInternal(caid, null, true);
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@Override
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public CA getCAForEdit(final AuthenticationToken admin, final int caid)
        throws CADoesntExistsException, AuthorizationDeniedException {
    CA ca = getCAInternal(caid, null, false);
    if (!authorizedToCA(admin, ca.getCAId())) {
        String msg = intres.getLocalizedMessage("caadmin.notauthorizedtoca", admin.toString(),
                Integer.valueOf(caid));
        throw new AuthorizationDeniedException(msg);
    }//from   w w w. j av  a 2  s  . com
    return ca;
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@Override
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public CA getCAForEdit(final AuthenticationToken admin, final String name)
        throws CADoesntExistsException, AuthorizationDeniedException {
    CA ca = getCAInternal(-1, name, false);
    if (!authorizedToCA(admin, ca.getCAId())) {
        String msg = intres.getLocalizedMessage("caadmin.notauthorizedtoca", admin.toString(), name);
        throw new AuthorizationDeniedException(msg);
    }//from   w  ww  .  java  2 s.c o  m
    return ca;
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override//from w  w w  .  jav a2s . co m
public CAInfo getCAInfo(final AuthenticationToken admin, final String name)
        throws CADoesntExistsException, AuthorizationDeniedException {
    // Authorization is handled by getCA
    return getCA(admin, name).getCAInfo();
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override/*w w w. j av  a 2s .c o m*/
public CAInfo getCAInfo(final AuthenticationToken admin, final int caid)
        throws CADoesntExistsException, AuthorizationDeniedException {
    // Authorization is handled by getCA
    return getCA(admin, caid).getCAInfo();
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override//from w  w  w  . j  av a  2 s  .c o  m
public CAInfo getCAInfoInternal(final int caid) throws CADoesntExistsException {
    return getCAInternal(caid, null, true).getCAInfo();
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override/*from www .j  a  v  a  2  s. co m*/
public CAInfo getCAInfoInternal(final int caid, final String name, boolean fromCache)
        throws CADoesntExistsException {
    return getCAInternal(caid, name, fromCache).getCAInfo();
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override
public List<Integer> getAllCaIds() {
    return CAData.findAllCaIds(entityManager);
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override/*from   w ww .  j a  v  a 2s  .  c  o  m*/
public List<String> getActiveCANames(final AuthenticationToken admin) {
    return new ArrayList<String>(getActiveCAIdToNameMap(admin).values());
}

From source file:org.cesecore.certificates.ca.CaSessionBean.java

@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override/*w  ww . j av  a2  s  .co  m*/
public Map<Integer, String> getActiveCAIdToNameMap(final AuthenticationToken authenticationToken) {
    final HashMap<Integer, String> returnval = new HashMap<Integer, String>();
    for (int caId : getAllCaIds()) {
        if (authorizedToCA(authenticationToken, caId)) {
            CAInfo caInfo;
            try {
                caInfo = getCAInfoInternal(caId);
                if (caInfo.getStatus() == CAConstants.CA_ACTIVE) {
                    returnval.put(caInfo.getCAId(), caInfo.getName());
                }
            } catch (CADoesntExistsException e) {
                //NOPMD: This can never happen
            }
        }
    }

    return returnval;
}