com.sun.jdo.api.persistence.model.jdo.impl
Class PersistenceClassElementImpl

java.lang.Object
  extended by com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
      extended by com.sun.jdo.api.persistence.model.jdo.impl.PersistenceClassElementImpl
All Implemented Interfaces:
PersistenceClassElement.Impl, PersistenceElement.Impl, PersistenceElementProperties

public class PersistenceClassElementImpl
extends PersistenceElementImpl
implements PersistenceClassElement.Impl

Version:
%I%
Author:
raccah

Field Summary
 
Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
ADD, REMOVE, SET
 
Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElementProperties
PROP_CARDINALITY, PROP_COLLECTION_CLASS, PROP_DELETE_ACTION, PROP_ELEMENT_CLASS, PROP_FIELDS, PROP_GROUPS, PROP_IDENTITY, PROP_INVERSE_FIELD, PROP_KEY_CLASS, PROP_KEY_FIELD, PROP_MODIFIED, PROP_NAME, PROP_PERSISTENCE, PROP_PREFETCH, PROP_SENSITIVITY, PROP_UPDATE_ACTION
 
Constructor Summary
PersistenceClassElementImpl()
          Create new PersistenceClassElementImpl with no corresponding name.
PersistenceClassElementImpl(String name)
          Creates new PersistenceClassElementImpl with the corresponding name
 
Method Summary
 void changeConcurrencyGroups(ConcurrencyGroupElement[] groups, int action)
          Change the set of concurrency groups.
 void changeFields(PersistenceFieldElement[] fields, int action)
          Change the set of fields.
protected  void firePropertyChange(String name, Object o, Object n)
          Fires property change event.
protected  void fireVetoableChange(String name, Object o, Object n)
          Fires vetoable change event.
 ConcurrencyGroupElement getConcurrencyGroup(String name)
          Find a concurrency group by name.
 ConcurrencyGroupElement[] getConcurrencyGroups()
          Get all concurrency groups.
 PersistenceFieldElement getField(String name)
          Find a field by name.
 PersistenceElementCollection getFieldCollection()
          Returns the field collection of this class element.
 PersistenceFieldElement[] getFields()
          Get all fields.
 PersistenceElementCollection getGroupCollection()
          Returns the concurrency group collection of this class element.
 String getKeyClass()
          Get the fully qualified name of the primary key class for this class element.
 int getObjectIdentityType()
          Get the object identity type of this class element.
 boolean isModified()
          Gets the modified flag for this persistence class.
 void setFieldCollection(PersistenceElementCollection collection)
          Set the field collection of this class element to the supplied collection.
 void setGroupCollection(PersistenceElementCollection collection)
          Set the concurrency group collection of this class element to the supplied collection.
 void setKeyClass(String name)
          Set the primary key class for this class element.
 void setModified(boolean flag)
          Set the modified flag for this persistence class to flag.
 void setObjectIdentityType(int type)
          Set the object identity type of this class element.
 
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
 

Constructor Detail

PersistenceClassElementImpl

public PersistenceClassElementImpl()
Create new PersistenceClassElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.


PersistenceClassElementImpl

public PersistenceClassElementImpl(String name)
Creates new PersistenceClassElementImpl with the corresponding name

Parameters:
name - the name of the element
Method Detail

firePropertyChange

protected final void firePropertyChange(String name,
                                        Object o,
                                        Object n)
Fires property change event. This method overrides that of PersistenceElementImpl to update the persistence class element's modified status.

Overrides:
firePropertyChange in class PersistenceElementImpl
Parameters:
name - property name
o - old value
n - new value

fireVetoableChange

protected final void fireVetoableChange(String name,
                                        Object o,
                                        Object n)
                                 throws PropertyVetoException
Fires vetoable change event. This method overrides that of PersistenceElementImpl to give listeners a chance to block changes on the persistence class element modified status.

Overrides:
fireVetoableChange in class PersistenceElementImpl
Parameters:
name - property name
o - old value
n - new value
Throws:
PropertyVetoException - when the change is vetoed by a listener

isModified

public boolean isModified()
Gets the modified flag for this persistence class.

Specified by:
isModified in interface PersistenceClassElement.Impl
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.

Specified by:
setModified in interface PersistenceClassElement.Impl
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.

Specified by:
getObjectIdentityType in interface PersistenceClassElement.Impl
Returns:
the object identity type, one of PersistenceClassElement.APPLICATION_IDENTITY, PersistenceClassElement.DATABASE_IDENTITY, or PersistenceClassElement.UNMANAGED_IDENTITY. The default is APPLICATION_IDENTITY.

setObjectIdentityType

public void setObjectIdentityType(int type)
                           throws ModelException
Set the object identity type of this class element.

Specified by:
setObjectIdentityType in interface PersistenceClassElement.Impl
Parameters:
type - - an integer indicating the object identity type, one of: PersistenceClassElement.APPLICATION_IDENTITY, PersistenceClassElement.DATABASE_IDENTITY, or PersistenceClassElement.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

Specified by:
getKeyClass in interface PersistenceClassElement.Impl
Returns:
the fully qualified key class name, null if the identity type is not managed by the application
See Also:
setObjectIdentityType(int), PersistenceClassElement.APPLICATION_IDENTITY

setKeyClass

public void setKeyClass(String name)
                 throws ModelException
Set the primary key class for this class element.

Specified by:
setKeyClass in interface PersistenceClassElement.Impl
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), PersistenceClassElement.APPLICATION_IDENTITY

changeFields

public void changeFields(PersistenceFieldElement[] fields,
                         int action)
                  throws ModelException
Change the set of fields.

Specified by:
changeFields in interface PersistenceClassElement.Impl
Parameters:
fields - the new fields
action - PersistenceElement.Impl.ADD, PersistenceElement.Impl.REMOVE, or PersistenceElement.Impl.SET
Throws:
ModelException - if impossible

getFields

public PersistenceFieldElement[] getFields()
Get all fields.

Specified by:
getFields in interface PersistenceClassElement.Impl
Returns:
the fields

getField

public PersistenceFieldElement getField(String name)
Find a field by name.

Specified by:
getField in interface PersistenceClassElement.Impl
Parameters:
name - the name to match
Returns:
the field, or null if it does not exist

changeConcurrencyGroups

public void changeConcurrencyGroups(ConcurrencyGroupElement[] groups,
                                    int action)
                             throws ModelException
Change the set of concurrency groups.

Specified by:
changeConcurrencyGroups in interface PersistenceClassElement.Impl
Parameters:
groups - the new concurrency groups
action - PersistenceElement.Impl.ADD, PersistenceElement.Impl.REMOVE, or PersistenceElement.Impl.SET
Throws:
ModelException - if impossible

getConcurrencyGroups

public ConcurrencyGroupElement[] getConcurrencyGroups()
Get all concurrency groups.

Specified by:
getConcurrencyGroups in interface PersistenceClassElement.Impl
Returns:
the concurrency groups

getConcurrencyGroup

public ConcurrencyGroupElement getConcurrencyGroup(String name)
Find a concurrency group by name.

Specified by:
getConcurrencyGroup in interface PersistenceClassElement.Impl
Parameters:
name - the name to match
Returns:
the concurrency group, or null if it does not exist

getFieldCollection

public PersistenceElementCollection getFieldCollection()
Returns the field collection of this class element. This method should only be used internally and for cloning and archiving.

Returns:
the field collection of this class element

setFieldCollection

public void setFieldCollection(PersistenceElementCollection collection)
Set the field collection of this class element to the supplied collection. This method should only be used internally and for cloning and archiving.

Parameters:
collection - the field collection of this class element

getGroupCollection

public PersistenceElementCollection getGroupCollection()
Returns the concurrency group collection of this class element. This method should only be used internally and for cloning and archiving.

Returns:
the concurrency group collection of this class element

setGroupCollection

public void setGroupCollection(PersistenceElementCollection collection)
Set the concurrency group collection of this class element to the supplied collection. This method should only be used internally and for cloning and archiving.

Parameters:
collection - the concurrency group collection of this class element


Copyright © 2012 GlassFish Community. All Rights Reserved.