Class KradEclipseLinkCustomizer

java.lang.Object
org.kuali.rice.krad.data.jpa.eclipselink.KradEclipseLinkCustomizer
All Implemented Interfaces:
org.eclipse.persistence.config.SessionCustomizer

public class KradEclipseLinkCustomizer extends Object implements org.eclipse.persistence.config.SessionCustomizer
EclipseLink Session Customizer which understands PortableSequenceGenerator annotations and automatically registers custom EclipseLink Sequences.

Since SessionCustomizers are stateless instances, and because concrete Sequence objects must be registered individually with the EclipseLink session, we lazy generate the Sequence objects using annotation inspection and then register them on each new session using this customizer.

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    buildQueryCustomizers(Class<?> entityClass, Field field, String key)
    Build and populate map of QueryCustomizer annotations.
    void
    customize(org.eclipse.persistence.sessions.Session session)
    protected void
    handleDescriptorModifications(org.eclipse.persistence.sessions.Session session)
    Determines if the class descriptors have been modified for the given session name.
    protected void
    handleDisableVersioning(org.eclipse.persistence.sessions.Session session)
    Checks class descriptors for
    invalid @link
    {@link @DisableVersioning
    } annotations at the class level and removes the version database mapping for optimistic locking.
    protected void
    handleRemoveMapping(org.eclipse.persistence.sessions.Session session)
    Checks class descriptors for
    invalid @link
    {@link @RemoveMapping
    } and RemoveMappings annotations at the class level and removes any specified mappings from the ClassDescriptor.
    protected void
    loadFieldSequences(Class<?> entityClass, List<PortableSequenceGenerator> sequenceGenerators)
    Loads any field-based sequences from the given type.
    protected void
    loadQueryCustomizers(org.eclipse.persistence.sessions.Session session)
    Load Query Customizer based on annotations on fields and call customizer to modify descriptor.
    protected List<org.eclipse.persistence.sequencing.Sequence>
    loadSequences(org.eclipse.persistence.sessions.Session session)
    Gets any Sequence from the session.
    protected List<RemoveMapping>
    scanForRemoveMappings(org.eclipse.persistence.descriptors.ClassDescriptor classDescriptor)
    Gets any RemoveMappings out of the given ClassDescriptor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KradEclipseLinkCustomizer

      public KradEclipseLinkCustomizer()
  • Method Details

    • customize

      public void customize(org.eclipse.persistence.sessions.Session session) throws Exception
      Specified by:
      customize in interface org.eclipse.persistence.config.SessionCustomizer
      Throws:
      Exception
    • loadQueryCustomizers

      protected void loadQueryCustomizers(org.eclipse.persistence.sessions.Session session)
      Load Query Customizer based on annotations on fields and call customizer to modify descriptor.
      Parameters:
      session - the EclipseLink session.
    • buildQueryCustomizers

      protected void buildQueryCustomizers(Class<?> entityClass, Field field, String key)
      Build and populate map of QueryCustomizer annotations.
      Parameters:
      entityClass - the type of the entity.
      field - the field to process.
      key - the id to store the customizer under.
    • handleDescriptorModifications

      protected void handleDescriptorModifications(org.eclipse.persistence.sessions.Session session)
      Determines if the class descriptors have been modified for the given session name.
      Parameters:
      session - the current session.
    • handleDisableVersioning

      protected void handleDisableVersioning(org.eclipse.persistence.sessions.Session session)
      Checks class descriptors for
      invalid @link
      {@link @DisableVersioning
      } annotations at the class level and removes the version database mapping for optimistic locking.
      Parameters:
      session - the current session.
    • handleRemoveMapping

      protected void handleRemoveMapping(org.eclipse.persistence.sessions.Session session)
      Checks class descriptors for
      invalid @link
      {@link @RemoveMapping
      } and RemoveMappings annotations at the class level and removes any specified mappings from the ClassDescriptor.
      Parameters:
      session - the current session.
    • scanForRemoveMappings

      protected List<RemoveMapping> scanForRemoveMappings(org.eclipse.persistence.descriptors.ClassDescriptor classDescriptor)
      Gets any RemoveMappings out of the given ClassDescriptor.
      Parameters:
      classDescriptor - the ClassDescriptor to scan.
      Returns:
      a list of RemoveMappings from the given ClassDescriptor.
    • loadSequences

      protected List<org.eclipse.persistence.sequencing.Sequence> loadSequences(org.eclipse.persistence.sessions.Session session)
      Gets any Sequence from the session.
      Parameters:
      session - the current session.
      Returns:
      a list of Sequences.
    • loadFieldSequences

      protected void loadFieldSequences(Class<?> entityClass, List<PortableSequenceGenerator> sequenceGenerators)
      Loads any field-based sequences from the given type.
      Parameters:
      entityClass - the type of the entity.
      sequenceGenerators - the current list of sequence generators.