Class PopulationManager


  • public class PopulationManager
    extends java.lang.Object

    Purpose: This class is used to populate example data into the database, it allows for circular references to be resolved.

    Responsibilities:

    • Allow objects to be registered.
    • Allow objects to be looked up.
    • Store a globally accessible default instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAllObjectsForAbstractClass​(java.lang.Class objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session, java.util.Vector allObjects)
      Add all of the objects of the class and all of its subclasses.
      void addAllObjectsForAbstractClass​(java.lang.Class objectsClass, Session session, java.util.Vector allObjects)
      Add all of the objects of the class and all of its subclasses.
      void addAllObjectsForClass​(java.lang.Class objectsClass, java.util.List allObjects)
      Add all of the objects of the class.
      boolean containsObject​(java.lang.Class objectsClass, java.lang.String objectsName)
      Check if the object is registered given its name.
      boolean containsObject​(java.lang.Object objectToCheck, java.lang.String objectsName)
      Check if the object is registered given its name.
      java.util.Vector getAllClasses()
      Return all of the objects registered.
      java.util.Vector getAllObjects()
      Return all of the objects registered.
      java.util.Vector getAllObjectsForAbstractClass​(java.lang.Class objectsClass)
      Return all of the objects of the class and all of its subclasses.
      java.util.Vector getAllObjectsForAbstractClass​(java.lang.Class objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session)
      Return all of the objects of the class and all of its subclasses.
      java.util.Vector getAllObjectsForClass​(java.lang.Class objectsClass)
      Return all of the objects of the class.
      static PopulationManager getDefaultManager()
      Lazy initialize the default instance.
      java.lang.Object getObject​(java.lang.Class objectsClass, java.lang.String objectsName)
      Return the object registered given its name.
      java.util.Hashtable getRegisteredObjects()
      Return the registered objects.
      java.lang.Object registerObject​(java.lang.Class javaClass, java.lang.Object objectToRegister, java.lang.String objectsName)
      Register the object given its name.
      java.lang.Object registerObject​(java.lang.Object objectToRegister, java.lang.String objectsName)
      Register the object given its name.
      void removeObject​(java.lang.Class classToRemove, java.lang.String objectsName)
      Remove the object given its class and name.
      java.lang.Object removeObject​(java.lang.Object objectToRemove, java.lang.String objectsName)
      Remove the object given its name.
      static void resetDefaultManager()
      Reset the default instance.
      static void setDefaultManager​(PopulationManager theDefaultManager)
      Set the default instance.
      void setRegisteredObjects​(java.util.Hashtable registeredObjects)
      Set the registered objects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • registeredObjects

        protected java.util.Hashtable registeredObjects
        Store the objects registered.
      • defaultManager

        protected static PopulationManager defaultManager
        Store the default instance.
    • Constructor Detail

      • PopulationManager

        public PopulationManager()
    • Method Detail

      • addAllObjectsForAbstractClass

        public void addAllObjectsForAbstractClass​(java.lang.Class objectsClass,
                                                  org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                  java.util.Vector allObjects)
        Add all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
      • addAllObjectsForAbstractClass

        public void addAllObjectsForAbstractClass​(java.lang.Class objectsClass,
                                                  Session session,
                                                  java.util.Vector allObjects)
        Add all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
      • addAllObjectsForClass

        public void addAllObjectsForClass​(java.lang.Class objectsClass,
                                          java.util.List allObjects)
        Add all of the objects of the class.
      • containsObject

        public boolean containsObject​(java.lang.Class objectsClass,
                                      java.lang.String objectsName)
        Check if the object is registered given its name.
      • containsObject

        public boolean containsObject​(java.lang.Object objectToCheck,
                                      java.lang.String objectsName)
        Check if the object is registered given its name.
      • getAllClasses

        public java.util.Vector getAllClasses()
        Return all of the objects registered.
      • getAllObjects

        public java.util.Vector getAllObjects()
        Return all of the objects registered.
      • getAllObjectsForAbstractClass

        public java.util.Vector getAllObjectsForAbstractClass​(java.lang.Class objectsClass)
        Return all of the objects of the class and all of its subclasses.
      • getAllObjectsForAbstractClass

        public java.util.Vector getAllObjectsForAbstractClass​(java.lang.Class objectsClass,
                                                              org.eclipse.persistence.internal.sessions.AbstractSession session)
        Return all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
      • getAllObjectsForClass

        public java.util.Vector getAllObjectsForClass​(java.lang.Class objectsClass)
        Return all of the objects of the class.
      • getDefaultManager

        public static PopulationManager getDefaultManager()
        Lazy initialize the default instance.
      • getObject

        public java.lang.Object getObject​(java.lang.Class objectsClass,
                                          java.lang.String objectsName)
        Return the object registered given its name.
      • getRegisteredObjects

        public java.util.Hashtable getRegisteredObjects()
        Return the registered objects.
      • registerObject

        public java.lang.Object registerObject​(java.lang.Class javaClass,
                                               java.lang.Object objectToRegister,
                                               java.lang.String objectsName)
        Register the object given its name. The objects are represented as a hashtable of hashtables, lazy initialized on the class.
      • registerObject

        public java.lang.Object registerObject​(java.lang.Object objectToRegister,
                                               java.lang.String objectsName)
        Register the object given its name. The objects are represented as a hashtable of hashtables, lazy initialized on the class.
      • removeObject

        public void removeObject​(java.lang.Class classToRemove,
                                 java.lang.String objectsName)
        Remove the object given its class and name.
      • removeObject

        public java.lang.Object removeObject​(java.lang.Object objectToRemove,
                                             java.lang.String objectsName)
        Remove the object given its name.
      • resetDefaultManager

        public static void resetDefaultManager()
        Reset the default instance.
      • setDefaultManager

        public static void setDefaultManager​(PopulationManager theDefaultManager)
        Set the default instance.
      • setRegisteredObjects

        public void setRegisteredObjects​(java.util.Hashtable registeredObjects)
        Set the registered objects.