Class LegacyUtils

java.lang.Object
org.kuali.rice.krad.util.LegacyUtils

public final class LegacyUtils extends Object
Exposes legacy detection functionality statically.
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Details

    • isLegacyManaged

      public static boolean isLegacyManaged(Class<?> type)
      Indicates whether the given type is managed by the legacy data framework. Note that it's possible for a given type to managed by both the legacy and the non-legacy data framework, in which case this method will return true as well.
      Parameters:
      type - the type to check
      Returns:
      true if managed by the legacy framework, false otherwise
    • isKradDataManaged

      public static boolean isKradDataManaged(Class<?> type)
      Indicates whether the given type is managed by the non-legacy data framework. Note that it's possible for a given type to managed by both the legacy and the non-legacy data framework, in which case this method will return true as well.
      Parameters:
      type - the type to check
      Returns:
      true if managed by the non-legacy krad-data framework, false otherwise
    • isKnsDocumentEntry

      public static boolean isKnsDocumentEntry(DocumentEntry documentEntry)
      Indicates whether or not the given DocumentEntry represents a legacy KNS document entry.
      Parameters:
      documentEntry - the document entry to check
      Returns:
      true if the given entry is a KNS entry, false otherwise
    • isKnsEnabled

      public static boolean isKnsEnabled()
    • isLegacyDataFrameworkEnabled

      public static boolean isLegacyDataFrameworkEnabled()
      Return whether the legacy data framework is enabled
      Returns:
      whether the legacy data framework is enabled
    • useLegacy

      public static boolean useLegacy(Class<?> dataObjectClass)
      Return whether objects of the given class should be handled via the legacy data framework
      Parameters:
      dataObjectClass - the data object class
      Returns:
      whether objects of the given class should be handled via the legacy data framework
    • useLegacyForObject

      public static boolean useLegacyForObject(Object dataObject)
      Return whether the object should be handled via the legacy data framework
      Parameters:
      dataObject - the data object
      Returns:
      whether the object should be handled via the legacy data framework
    • isInLegacyContext

      public static boolean isInLegacyContext()
      Returns:
      whether we are currently in a legacy calling context
    • beginLegacyContext

      public static void beginLegacyContext()
    • endLegacyContext

      public static void endLegacyContext()
    • doInLegacyContext

      public static <T> T doInLegacyContext(Callable<T> callable) throws Exception
      Performs the specified Callable inside of the legacy context.
      Type Parameters:
      T - the return type of the callable
      Parameters:
      callable - the method to call inside of the new contexts
      Returns:
      the result of the callable
      Throws:
      Exception - any exception thrown during the execution of the context
    • doInLegacyContext

      public static <T> T doInLegacyContext(String documentId, org.kuali.rice.krad.UserSession userSession, Callable<T> callable) throws Exception
      Performs the specified Callable inside of both the legacy context (if necessary as dependent on the documentId) and in new GlobalVariables as specified by the given userSession.
      Type Parameters:
      T - the return type of the callable
      Parameters:
      documentId - id of the document for which to establish the data context
      userSession - the new user session to establish
      callable - the method to call inside of the new contexts
      Returns:
      the result of the callable
      Throws:
      Exception - any exception thrown during the execution of the context