Class PersistenceClassElement

    • Field Detail

      • APPLICATION_IDENTITY

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

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

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

      • 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 Detail

      • 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
      • 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.
      • 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:
        setObjectIdentityType(int), APPLICATION_IDENTITY
      • 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:
        setObjectIdentityType(int), APPLICATION_IDENTITY
      • 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:
        getFields()
      • 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:
        getRelationships(), getField(java.lang.String)
      • 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