Methods Summary |
---|
private void | addField(java.lang.String ejbName, java.lang.String fieldName)
HashMap fieldMap = (HashMap)ejbFieldMap.get(ejbName);
if (fieldMap == null) {
fieldMap = new HashMap();
ejbFieldMap.put(ejbName, fieldMap);
}
fieldMap.put(fieldName, fieldName);
|
public boolean | applyDefaultUnknownPKClassStrategy(java.lang.String ejbName)Returns flag whether the mapping conversion should apply the default
strategy for dealing with unknown primary key classes. This method will
only be called when {@link #generateFields} returns true .
IASEjbCMPEntityDescriptor ejbDesc =
(IASEjbCMPEntityDescriptor)ejbDescMap.get(ejbName);
String keyClassName = ejbDesc.getPrimaryKeyClassName();
return keyClassName != null &&
keyClassName.equals(Object.class.getName());
|
public boolean | ensureValidation()Returns the flag whether the mapping conversion should validate
all fields against schema columns.
return ensureValidation;
|
public boolean | generateFields()Returns the flag whether the mapping conversion should generate
relationship fields and primary key fields to support run-time.
The version field is always created even {@link #generateFields} is
false because it holds version column information.
return generateFields;
|
public java.lang.Object[] | getFields(java.lang.String ejbName)If {@link #generateFields} is true , then this method will
return an array of cmp + cmr + pseudo cmr fields, otherwise
the method will return an array of cmp + cmr fields.
HashMap fieldMap = (HashMap)ejbFieldMap.get(ejbName);
if (fieldMap != null) {
List fields = new ArrayList(fieldMap.keySet());
if (!generateFields) {
fields.removeAll(getGeneratedRelationships(ejbName));
}
return fields.toArray();
}
return null;
|
public java.lang.String | getGeneratedPKFieldName()Returns the name used for generated primary key fields.
return nameMapper.GENERATED_KEY_FIELD_NAME;
|
public java.util.List | getGeneratedRelationships(java.lang.String ejbName)Returns a list of generated relationship field names.
return nameMapper.getGeneratedRelationshipsForEjbName(ejbName);
|
public java.lang.String | getGeneratedVersionFieldNamePrefix()Returns the prefix used for generated version fields.
return nameMapper.GENERATED_VERSION_FIELD_PREFIX;
|
public java.lang.String | getInverseFieldName(java.lang.String ejbName, java.lang.String fieldName)This method return the fieldName of relation role on the other end.
RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
fieldName, false);
String inverseName = oppRole.getCMRField();
// if we are generating relationships, check for a generated inverse
if ((generateFields) && (inverseName == null))
inverseName = nameMapper.getGeneratedFieldForEjbField(
ejbName, fieldName)[1];
return inverseName;
|
public java.lang.String | getMappedClassName(java.lang.String ejbName)
return nameMapper.getPersistenceClassForEjbName(ejbName);
|
public java.lang.String | getMultiplicity(java.lang.String ejbName, java.lang.String fieldName)getMultiplicity of the other role on the relationship
Please note that multiplicity is JDO style
RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
fieldName, false);
return (oppRole.getIsMany()) ? MANY : ONE;
|
private com.sun.enterprise.deployment.RelationRoleDescriptor | getRealRelationRoleDescriptor(java.lang.String ejbName, java.lang.String cmrFieldName, boolean self)
ArrayList rels = (ArrayList)ejbRelMap.get(ejbName);
for (int i = 0; i < rels.size(); i++) {
RelationshipDescriptor rel = (RelationshipDescriptor)rels.get(i);
RelationRoleDescriptor source = rel.getSource();
RelationRoleDescriptor sink = rel.getSink();
if (ejbName.equals(source.getOwner().getName()) &&
cmrFieldName.equals(source.getCMRField())) {
return (self) ? source : sink;
} else if (ejbName.equals(sink.getOwner().getName()) &&
cmrFieldName.equals(sink.getCMRField())) {
return (self) ? sink : source;
}
}
throw new IllegalArgumentException();
|
private com.sun.enterprise.deployment.RelationRoleDescriptor | getRelationRoleDescriptor(java.lang.String ejbName, java.lang.String cmrFieldName, boolean self)
String myEjbName = ejbName;
String myCMRFieldName = cmrFieldName;
boolean myself = self;
if (isGeneratedRelationship(ejbName, cmrFieldName)) {
String[] nfPair = nameMapper.getEjbFieldForGeneratedField(
ejbName, cmrFieldName);
myEjbName = nfPair[0];
myCMRFieldName = nfPair[1];
myself = !self;
}
return getRealRelationRoleDescriptor(myEjbName, myCMRFieldName, myself);
|
public java.lang.String | getRelationshipFieldContent(java.lang.String ejbName, java.lang.String fieldName)
RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
fieldName, false);
return oppRole.getOwner().getName();
|
public java.lang.String | getRelationshipFieldType(java.lang.String ejbName, java.lang.String fieldName)This API will only be called from MappingFile when multiplicity is Many
on the other role.
if (isGeneratedRelationship(ejbName, fieldName)) {
return java.util.Collection.class.getName();
} else {
PersistenceDescriptor pers =
(PersistenceDescriptor)ejbPerDescMap.get(ejbName);
return pers.getCMRFieldReturnType(fieldName);
}
|
public boolean | hasField(java.lang.String ejbName, java.lang.String fieldName)If {@link #generateFields} is true , then this method will
check if the field is one of the cmp + cmr + pseudo cmr fields, otherwise
the method will check if the field is one of the cmp + cmr fields.
if (!generateFields && isGeneratedRelationship(ejbName, fieldName))
return false;
else {
HashMap fieldMap = (HashMap)ejbFieldMap.get(ejbName);
return (fieldMap != null) ?
(fieldMap.get(fieldName) != null) : false;
}
|
public boolean | isGeneratedField(java.lang.String ejbName, java.lang.String fieldName)Returns true if the field is generated. There are three
types of generated fields: generated relationships, unknown primary key
fields, and version consistency fields.
return nameMapper.isGeneratedField(ejbName, fieldName);
|
public boolean | isGeneratedRelationship(java.lang.String ejbName, java.lang.String fieldName)
return nameMapper.isGeneratedEjbRelationship(ejbName, fieldName);
|
public boolean | isKey(java.lang.String ejbName, java.lang.String fieldName, boolean candidate)The boolean argument candidate is ignored in this case.
HashMap keyMap = (HashMap)ejbKeyMap.get(ejbName);
return (keyMap != null) ? (keyMap.get(fieldName) != null) : false;
|
public boolean | relatedObjectsAreDeleted(java.lang.String beanName, java.lang.String fieldName)
RelationRoleDescriptor oppRole = getRelationRoleDescriptor(beanName, fieldName, false);
return oppRole.getCascadeDelete();
|
public void | setEnsureValidation(boolean isValidating)Sets the flag whether the mapping conversion should validate all fields
against schema columns.
ensureValidation = isValidating;
|
public void | setGenerateFields(boolean generateFields)Sets the flag whether the mapping conversion should generate relationship
fields, primary key fields, and version fields to support run-time.
this.generateFields = generateFields;
|