}
// XXX: Todo, if we have a relation found by the RelationManager, then we must have
// it's treatment as such, or should be ignored
// Maybe just check if is a EjbUtils.METADATA_METHOD_RELATION_FIELD
Relation relation = getRelationManager().getRelationFor(method, javaClass);
if ((relation != null) ||
((vTag != null) && ((vTag.getAggregate() != null) || (vTag.getCompose() != null)))) {
// This is a value-object relation
// vTag must be non-null, because we need values from it
if ((vTag != null) && ((vTag.getAggregate() != null) ^ (vTag.getCompose() != null))) {
JavaClass relationEjb = null;
Type collectionType = null;
if (relation != null) {
if (!method.equals(relation.getLeftMethod())) {
log.debug(
"Current method doesn't match relations' left method. Reversing relation");
relation = relation.reverse();
if (log.isDebugEnabled()) {
log.debug("Reversed relation is relation=" + relation);
}
}
if (log.isDebugEnabled()) {
log.debug("Using relation information. relation=" + relation);
log.debug("1# Left bean=" +
((relation.getLeftBean() != null)
? relation.getLeftBean().getFullyQualifiedName() : null));
log.debug("1# Rigth bean=" +
((relation.getRightBean() != null)
? relation.getRightBean().getFullyQualifiedName() : null));
}
String relationEjbName = relation.getRightEJBName();
relationEjb = getBeanResolver().findEjbByName(relationEjbName);
collectionType = relation.getLeftMethod().getReturns();
} else {
log.debug("We don't have relation information for this method");
Type returnType = method.getReturns();
Type relationType = null;