Class PersistenceClassElement

java.lang.Object
com.sun.jdo.api.persistence.model.jdo.PersistenceElement
com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement
All Implemented Interfaces:
FieldElementHolder, PersistenceElementProperties, Comparable

public class PersistenceClassElement extends PersistenceElement implements FieldElementHolder
Version:
%I%
Author:
raccah
  • Field Details

    • APPLICATION_IDENTITY

      public static final int APPLICATION_IDENTITY
      Constant representing jdo identity managed by the application.
      See Also:
    • DATABASE_IDENTITY

      public static final int DATABASE_IDENTITY
      Constant representing jdo identity managed by the database.
      See Also:
    • UNMANAGED_IDENTITY

      public static final int UNMANAGED_IDENTITY
      Constant representing unmanaged jdo identity.
      See Also:
  • Constructor Details

    • PersistenceClassElement

      public PersistenceClassElement()
      Create new PersistenceClassElement with no implementation. This constructor should only be used for cloning and archiving.
    • PersistenceClassElement

      public PersistenceClassElement(PersistenceClassElement.Impl impl)
      Create new PersistenceClassElement with the provided implementation. The implementation is responsible for storing all properties of the object.
      Parameters:
      impl - the implementation to use
  • Method Details

    • forName

      public static PersistenceClassElement forName(String name, Model model)
      Returns the persistence class element associated with the class with the given string name, using the given model object to look it up.
      Parameters:
      name - the fully qualified name of the desired class
      model - the model object to be used to look it up
      Returns:
      persistence class element representing the desired class
    • getPackage

      public String getPackage()
      Get the package name of this class element.
      Returns:
      the package
      See Also:
    • isModified

      public boolean isModified()
      Gets the modified flag for this persistence class.
      Returns:
      true if there have been (property) changes to this class, false otherwise.
    • setModified

      public void setModified(boolean flag)
      Set the modified flag for this persistence class to flag. This is usually set to true by property changes and false after a save.
      Parameters:
      flag - if true, this class is marked as modified; if false, it is marked as unmodified.
    • getObjectIdentityType

      public int getObjectIdentityType()
      Get the object identity type of this class element.
      Returns:
      the object identity type, one of APPLICATION_IDENTITY, DATABASE_IDENTITY, or UNMANAGED_IDENTITY
    • setObjectIdentityType

      public void setObjectIdentityType(int type) throws ModelException
      Set the object identity type of this class element.
      Parameters:
      type - - an integer indicating the object identity type, one of: APPLICATION_IDENTITY, DATABASE_IDENTITY, or UNMANAGED_IDENTITY
      Throws:
      ModelException - if impossible
    • getKeyClass

      public String getKeyClass()
      Get the fully qualified name of the primary key class for this class element. This value is only used if getObjectIdentityType returns APPLICATION_IDENTITY
      Returns:
      the fully qualified key class name, null if the identity type is not managed by the application
      See Also:
    • setKeyClass

      public void setKeyClass(String name) throws ModelException
      Set the primary key class for this class element. For now the key class is required to be in the same package with the same name as this class and the suffix "Key" (any capitalization), or an inner class of this class with the name "OID" (any capitalization).
      Parameters:
      name - - the fully qualified name which represents the primary key class. This value is only used if getObjectIdentityType returns APPLICATION_IDENTITY
      Throws:
      ModelException - if impossible
      See Also:
    • setName

      public void setName(String name) throws ModelException
      Set the name of this persistence element. This method overrides the one in PersistenceElement in order to keep the key class in sync if possible.
      Overrides:
      setName in class PersistenceElement
      Parameters:
      name - the name
      Throws:
      ModelException - if impossible
    • addField

      public void addField(PersistenceFieldElement field) throws ModelException
      Add the supplied field to the collection of fields maintained by this holder.
      Specified by:
      addField in interface FieldElementHolder
      Parameters:
      field - the field to be added
      Throws:
      ModelException - if impossible
    • addFields

      public void addFields(PersistenceFieldElement[] fields) throws ModelException
      Add the supplied fields to the collection of fields maintained by this holder.
      Specified by:
      addFields in interface FieldElementHolder
      Parameters:
      fields - the array of fields to be added
      Throws:
      ModelException - if impossible
    • removeField

      public void removeField(PersistenceFieldElement field) throws ModelException
      Remove the supplied field from the collection of fields maintained by this holder.
      Specified by:
      removeField in interface FieldElementHolder
      Parameters:
      field - the field to be removed
      Throws:
      ModelException - if impossible
    • removeFields

      public void removeFields(PersistenceFieldElement[] fields) throws ModelException
      Removed the supplied fields from the collection of fields maintained by this holder.
      Specified by:
      removeFields in interface FieldElementHolder
      Parameters:
      fields - the array of fields to be removed
      Throws:
      ModelException - if impossible
    • getFields

      public PersistenceFieldElement[] getFields()
      Returns the collection of fields maintained by this holder in the form of an array.
      Specified by:
      getFields in interface FieldElementHolder
      Returns:
      the fields maintained by this holder
    • setFields

      public void setFields(PersistenceFieldElement[] fields) throws ModelException
      Sets the collection of fields maintained by this holder to the contents of the supplied array.
      Specified by:
      setFields in interface FieldElementHolder
      Parameters:
      fields - the fields maintained by this holder
      Throws:
      ModelException - if impossible
    • getField

      public PersistenceFieldElement getField(String name)
      Returns the field with the supplied name from the collection of fields maintained by this holder.
      Specified by:
      getField in interface FieldElementHolder
      Parameters:
      name - the name of the field to be found
      Returns:
      the field with the supplied name, null if none exists
    • containsField

      public boolean containsField(PersistenceFieldElement field)
      Tests whether the supplied field is in the collection of fields maintained by this holder.
      Specified by:
      containsField in interface FieldElementHolder
      Parameters:
      field - the field to be tested
    • getRelationships

      public RelationshipElement[] getRelationships()
      Returns the subset of the collection of fields which are relationahips.
      Returns:
      the relationship fields maintained by this holder
      See Also:
    • getRelationship

      public RelationshipElement getRelationship(String name)
      Returns the relationship with the supplied name from the collection of relationships maintained by this holder.
      Parameters:
      name - the name of the relationship to be found
      Returns:
      the relationship with the supplied name, null if none exists
      See Also:
    • addConcurrencyGroup

      public void addConcurrencyGroup(ConcurrencyGroupElement group) throws ModelException
      Add the supplied group to the collection of concurrency groups for this class.
      Parameters:
      group - the concurrency group to be added
      Throws:
      ModelException - if impossible
    • addConcurrencyGroups

      public void addConcurrencyGroups(ConcurrencyGroupElement[] groups) throws ModelException
      Add the supplied groups to the collection of concurrency groups for this class.
      Parameters:
      groups - the array of concurrency groups to be added
      Throws:
      ModelException - if impossible
    • removeConcurrencyGroup

      public void removeConcurrencyGroup(ConcurrencyGroupElement group) throws ModelException
      Remove the supplied group from the collection of concurrency groups for this class.
      Parameters:
      group - the concurrency group to be removed
      Throws:
      ModelException - if impossible
    • removeConcurrencyGroups

      public void removeConcurrencyGroups(ConcurrencyGroupElement[] groups) throws ModelException
      Removed the supplied groups from the collection of concurrency groups for this class.
      Parameters:
      groups - the array of concurrency groups to be removed
      Throws:
      ModelException - if impossible
    • getConcurrencyGroups

      public ConcurrencyGroupElement[] getConcurrencyGroups()
      Returns the collection of fields groups by this class in the form of an array.
      Returns:
      the concurrency groups maintained by this class
    • setConcurrencyGroups

      public void setConcurrencyGroups(ConcurrencyGroupElement[] groups) throws ModelException
      Sets the collection of concurrency groups maintained by this class to the contents of the supplied array.
      Parameters:
      groups - the concurrency groups maintained by this holder
      Throws:
      ModelException - if impossible
    • getConcurrencyGroup

      public ConcurrencyGroupElement getConcurrencyGroup(String name)
      Returns the concurrency group with the supplied name from the collection of groups maintained by this class.
      Parameters:
      name - the name of the concurrency group to be found
      Returns:
      the concurrency group with the supplied name, null if none exists
    • containsConcurrencyGroup

      public boolean containsConcurrencyGroup(ConcurrencyGroupElement group)
      Tests whether the supplied group is in the collection of groups maintained by this class.
      Parameters:
      group - the concurrency group to be tested