Methods Summary |
---|
public void | addConcurrencyGroup(ConcurrencyGroupElement group)Add the supplied group to the collection of concurrency groups for this
class.
addConcurrencyGroups(new ConcurrencyGroupElement[]{group});
|
public void | addConcurrencyGroups(ConcurrencyGroupElement[] groups)Add the supplied groups to the collection of concurrency groups for
this class.
getClassImpl().changeConcurrencyGroups(groups, Impl.ADD);
|
public void | addField(PersistenceFieldElement field)Add the supplied field to the collection of fields maintained by this
holder.
addFields(new PersistenceFieldElement[]{field});
|
public void | addFields(PersistenceFieldElement[] fields)Add the supplied fields to the collection of fields maintained by this
holder.
getClassImpl().changeFields(fields, Impl.ADD);
|
public boolean | containsConcurrencyGroup(ConcurrencyGroupElement group)Tests whether the supplied group is in the collection of groups
maintained by this class.
return (getClassImpl().getConcurrencyGroup(group.getName()) != null);
|
public boolean | containsField(PersistenceFieldElement field)Tests whether the supplied field is in the collection of fields
maintained by this holder.
return (getClassImpl().getField(field.getName()) != null);
|
public static com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement | forName(java.lang.String name, com.sun.jdo.api.persistence.model.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.
return model.getPersistenceClass(name);
|
final com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement$Impl | getClassImpl() return (Impl)getImpl();
|
public ConcurrencyGroupElement | getConcurrencyGroup(java.lang.String name)Returns the concurrency group with the supplied name from the
collection of groups maintained by this class.
return getClassImpl().getConcurrencyGroup(name);
|
public ConcurrencyGroupElement[] | getConcurrencyGroups()Returns the collection of fields groups by this class in the form
of an array.
return getClassImpl().getConcurrencyGroups();
|
public PersistenceFieldElement | getField(java.lang.String name)Returns the field with the supplied name from the collection of fields
maintained by this holder.
return getClassImpl().getField(name);
|
public PersistenceFieldElement[] | getFields()Returns the collection of fields maintained by this holder in the form
of an array.
return getClassImpl().getFields();
|
public java.lang.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 return getClassImpl().getKeyClass();
|
public int | getObjectIdentityType()Get the object identity type of this class element.
return getClassImpl().getObjectIdentityType();
|
public java.lang.String | getPackage()Get the package name of this class element.
String className = getName();
int index = className.lastIndexOf('.");
return ((index != -1) ? className.substring(0, index) : ""); // NOI18N
|
public RelationshipElement | getRelationship(java.lang.String name)Returns the relationship with the supplied name from the collection of
relationships maintained by this holder.
RelationshipElement[] relationships = getRelationships();
int i, count = ((relationships != null) ? relationships.length : 0);
for (i = 0; i < count; i++)
{
RelationshipElement relationship = relationships[i];
if (name.equals(relationship.getName()))
return relationship;
}
return null;
|
public RelationshipElement[] | getRelationships()Returns the subset of the collection of fields which are relationahips.
PersistenceFieldElement[] fields = getFields();
int i, count = ((fields != null) ? fields.length : 0);
ArrayList relationships = new ArrayList(count);
for (i = 0; i < count; i++)
{
PersistenceFieldElement field = fields[i];
if (field instanceof RelationshipElement)
relationships.add(field);
}
count = relationships.size();
return ((RelationshipElement[])relationships.toArray(
new RelationshipElement[count]));
|
public boolean | isModified()Gets the modified flag for this persistence class. return getClassImpl().isModified();
|
public void | removeConcurrencyGroup(ConcurrencyGroupElement group)Remove the supplied group from the collection of concurrency groups for
this class.
removeConcurrencyGroups(new ConcurrencyGroupElement[]{group});
|
public void | removeConcurrencyGroups(ConcurrencyGroupElement[] groups)Removed the supplied groups from the collection of concurrency groups
for this class.
getClassImpl().changeConcurrencyGroups(groups, Impl.REMOVE);
|
public void | removeField(PersistenceFieldElement field)Remove the supplied field from the collection of fields maintained by
this holder.
removeFields(new PersistenceFieldElement[]{field});
|
public void | removeFields(PersistenceFieldElement[] fields)Removed the supplied fields from the collection of fields maintained
by this holder.
int i, count = ((fields != null) ? fields.length : 0);
// first remove the fields from this class
getClassImpl().changeFields(fields, Impl.REMOVE);
// now remove the fields from any concurrency groups
for (i = 0; i < count; i++)
{
PersistenceFieldElement field = fields[i];
ConcurrencyGroupElement[] groups = field.getConcurrencyGroups();
int j, groupCount = ((groups != null) ? groups.length : 0);
for (j = 0; j < groupCount; j++)
groups[j].removeField(field);
}
|
public void | setConcurrencyGroups(ConcurrencyGroupElement[] groups)Sets the collection of concurrency groups maintained by this class to
the contents of the supplied array.
getClassImpl().changeConcurrencyGroups(groups, Impl.SET);
|
public void | setFields(PersistenceFieldElement[] fields)Sets the collection of fields maintained by this holder to the contents
of the supplied array.
getClassImpl().changeFields(fields, Impl.SET);
|
public void | setKeyClass(java.lang.String name)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).
boolean hasValue = (name != null);
if (hasValue)
name = name.trim();
if (hasValue && (name.length() > 0))
{
String className = getName();
boolean hasPrefix = name.startsWith(className);
String nameSuffix = ((hasPrefix) ?
name.substring(className.length()) : name);
if (!hasPrefix || (!nameSuffix.equalsIgnoreCase("Key") && // NOI18N
!nameSuffix.equalsIgnoreCase(".OID") // NOI18N
&& !nameSuffix.equalsIgnoreCase("$OID"))) // NOI18N
{
throw new ModelException(I18NHelper.getMessage(getMessages(),
"jdo.class.key_class_invalid", // NOI18N
new Object[]{name, className}));
}
}
getClassImpl().setKeyClass(name);
|
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. getClassImpl().setModified(flag);
|
public void | setName(java.lang.String name)Set the name of this persistence element. This method overrides
the one in PersistenceElement in order to keep the
{@link #getKeyClass key class} in sync if possible.
String oldName = getName();
super.setName(name);
if (!StringHelper.isEmpty(name))
{
String oldKeyClass = getKeyClass();
// a rename -- set the key class too
if ((oldKeyClass != null) && oldKeyClass.startsWith(oldName))
setKeyClass(name + oldKeyClass.substring(oldName.length()));
}
|
public void | setObjectIdentityType(int type)Set the object identity type of this class element.
getClassImpl().setObjectIdentityType(type);
|