gov.nih.nci.caarray.services.util
Class EJBUtils

java.lang.Object
  extended by gov.nih.nci.caarray.services.util.EJBUtils

public final class EJBUtils
extends java.lang.Object

Author:
dickersc

Constructor Summary
EJBUtils()
           
 
Method Summary
static java.lang.Object checkSecurity(Extendable obj, java.lang.String[] requiredRoles)
          Check if the user is authorized to access this object
static java.lang.Object checkSecurityForUpdate(long id, java.lang.Class objectClass, java.lang.String[] requiredRoles, ManagerDB mgrDB)
           
static java.lang.Object checkSecurityForUpdate(java.lang.Object obj, java.lang.String[] requiredRoles)
           
static ProtectionGroupData[] getProtectionGroupsFromObject(SecuredElementItf itf)
           
static java.lang.String getUserName(javax.ejb.SessionContext sessionCtx)
           
static Extendable retrieve(long id, java.lang.Class objectClass, ManagerDB mgrDB)
          Get the object to be sure it exists.
static java.lang.Object retrieveAndCheckSecurity(long id, java.lang.Class objectClass, java.lang.String[] requiredRoles, ManagerDB mgrDB)
           
static void rollbackUserTx(ManagerDB mgrDB, TransactionHandler tx)
           
static void rollbackUserTx(ManagerDB mgrDB, javax.transaction.UserTransaction tx)
           
static void setProtectionGroups(ProtectionGroupData[] protectionGroups, java.lang.String securedElemId)
           
static void updateProtectionGroups(ProtectionGroupData[] protectionGroups, java.lang.String securedElemId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBUtils

public EJBUtils()
Method Detail

rollbackUserTx

public static void rollbackUserTx(ManagerDB mgrDB,
                                  javax.transaction.UserTransaction tx)
Parameters:
mgrDB -
tx -

rollbackUserTx

public static void rollbackUserTx(ManagerDB mgrDB,
                                  TransactionHandler tx)
Parameters:
mgrDB -
tx -

retrieveAndCheckSecurity

public static java.lang.Object retrieveAndCheckSecurity(long id,
                                                        java.lang.Class objectClass,
                                                        java.lang.String[] requiredRoles,
                                                        ManagerDB mgrDB)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

retrieve

public static Extendable retrieve(long id,
                                  java.lang.Class objectClass,
                                  ManagerDB mgrDB)
                           throws java.lang.Exception
Get the object to be sure it exists.

Parameters:
id -
objectClass -
mgrDB -
Returns:
Throws:
ObjectNotExistException
java.lang.Exception

checkSecurity

public static java.lang.Object checkSecurity(Extendable obj,
                                             java.lang.String[] requiredRoles)
                                      throws GeneralException,
                                             AccessDeniedException
Check if the user is authorized to access this object

Parameters:
obj -
requiredRoles -
Returns:
Throws:
GeneralException
AccessDeniedException

checkSecurityForUpdate

public static java.lang.Object checkSecurityForUpdate(long id,
                                                      java.lang.Class objectClass,
                                                      java.lang.String[] requiredRoles,
                                                      ManagerDB mgrDB)
                                               throws GeneralException,
                                                      ObjectNotExistException,
                                                      AccessDeniedException
Throws:
GeneralException
ObjectNotExistException
AccessDeniedException

checkSecurityForUpdate

public static java.lang.Object checkSecurityForUpdate(java.lang.Object obj,
                                                      java.lang.String[] requiredRoles)
                                               throws GeneralException,
                                                      ObjectNotExistException,
                                                      AccessDeniedException
Throws:
GeneralException
ObjectNotExistException
AccessDeniedException

getProtectionGroupsFromObject

public static ProtectionGroupData[] getProtectionGroupsFromObject(SecuredElementItf itf)
                                                           throws GeneralException
Throws:
GeneralException

updateProtectionGroups

public static void updateProtectionGroups(ProtectionGroupData[] protectionGroups,
                                          java.lang.String securedElemId)
                                   throws GeneralException
Parameters:
experimentData -
Throws:
GeneralException

setProtectionGroups

public static void setProtectionGroups(ProtectionGroupData[] protectionGroups,
                                       java.lang.String securedElemId)
                                throws GeneralException
Throws:
GeneralException

getUserName

public static final java.lang.String getUserName(javax.ejb.SessionContext sessionCtx)