FileDocCategorySizeDatePackage
RelationRoleDescriptor.javaAPI DocGlassfish v2 API7525Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

RelationRoleDescriptor

public final class RelationRoleDescriptor extends Descriptor
This class contains information about one of the partners in a relationship between EJB2.0 CMP EntityBeans. It represents information in the XML element.
author
Sanjeev Krishnan

Fields Summary
private static com.sun.enterprise.util.LocalStringManagerImpl
localStrings
private EjbCMPEntityDescriptor
owner
private PersistenceDescriptor
pers
private RelationshipDescriptor
relnDesc
private String
roleSourceDescription
private String
cmrField
private String
cmrFieldDescription
private String
cmrFieldType
private boolean
isMany
private RelationRoleDescriptor
partner
private boolean
cascadeDelete
private CMRFieldInfo
cmrFieldInfo
private String
relationRoleName
Constructors Summary
public RelationRoleDescriptor()


      
Methods Summary
public java.lang.StringcomposeReverseCmrFieldName()

        EjbCMPEntityDescriptor cmpDesc = getPartner().getOwner();
        String reverseCmrFieldName = "_" + cmpDesc.getName() + 
            "_" + getPartner().getCMRField();
        return reverseCmrFieldName;
    
public java.lang.StringgetCMRField()

        return cmrField;
    
public java.lang.StringgetCMRFieldDescription()

	if ( cmrFieldDescription == null )
	    cmrFieldDescription = "";
        return cmrFieldDescription;
    
public CMRFieldInfogetCMRFieldInfo()

	if ( cmrFieldInfo == null && pers != null ) 
	    pers.getCMRFieldInfo(); // tell pers to initialize its CMRFieldInfos
	return cmrFieldInfo;
    
public java.lang.StringgetCMRFieldType()

        return cmrFieldType;
    
public booleangetCascadeDelete()

        return cascadeDelete;
    
public booleangetIsMany()

        return isMany;
    
public EjbCMPEntityDescriptorgetOwner()

	return owner;
    
public com.sun.enterprise.deployment.RelationRoleDescriptorgetPartner()
The other role in the relationship I participate in.

        return partner;
    
public PersistenceDescriptorgetPersistenceDescriptor()
May return null if the role-source for this relationship role is a remote-ejb-name

        return pers;
    
public java.lang.StringgetRelationRoleName()

        return relationRoleName;
    
public RelationshipDescriptorgetRelationshipDescriptor()

	return relnDesc;
    
public java.lang.StringgetRoleSourceDescription()

	if ( roleSourceDescription == null )
	    roleSourceDescription = "";
        return roleSourceDescription;
    
private voidinvalidateCMRFieldStuff()

        cmrFieldInfo = null;
        if( pers != null ) {
            pers.invalidate();
        }
    
public voidsetCMRField(java.lang.String cmrField)
Set to NULL to indicate no cmr field

	this.cmrField =  cmrField;
        invalidateCMRFieldStuff();
    
public voidsetCMRFieldDescription(java.lang.String cmrFieldDescription)

        this.cmrFieldDescription = cmrFieldDescription;
    
public voidsetCMRFieldInfo(CMRFieldInfo cmrFieldInfo)

	this.cmrFieldInfo = cmrFieldInfo;
    
public voidsetCMRFieldType(java.lang.String newCmrFieldType)
Only applicable when partner is collection-valued. Set to NULL to indicate no field type is not applicable.

        if( newCmrFieldType == null ) {
            this.cmrFieldType = null; 
            invalidateCMRFieldStuff();
        } else if ( newCmrFieldType.equals("java.util.Collection") 
                    || newCmrFieldType.equals("java.util.Set") ) {
	    this.cmrFieldType =  newCmrFieldType;
            invalidateCMRFieldStuff();
	} else {
	    throw new IllegalArgumentException
                ("cmr-field-type is " + newCmrFieldType + 
                 ", must be java.util.Collection or java.util.Set");
	}
    
public voidsetCascadeDelete(boolean cascadeDelete)

        this.cascadeDelete =  cascadeDelete;
    
public voidsetIsMany(boolean isMany)

        this.isMany =  isMany;
        invalidateCMRFieldStuff();        
    
public voidsetOwner(EjbCMPEntityDescriptor owner)

	this.owner = owner;
        invalidateCMRFieldStuff();
    
public voidsetPartner(com.sun.enterprise.deployment.RelationRoleDescriptor partner)

        this.partner = partner;
    
public voidsetPersistenceDescriptor(PersistenceDescriptor newPers)

        if( this.pers != null ) {
            // first invalidate cmr stuff in original persistence descriptor
            this.pers.invalidate();
        }

        this.pers = newPers;
        if( newPers != null ) {
            this.owner = (EjbCMPEntityDescriptor)newPers.getParentDescriptor();
        }
        invalidateCMRFieldStuff();
    
public voidsetRelationRoleName(java.lang.String relationRoleName)

        this.relationRoleName = relationRoleName;
    
public voidsetRelationshipDescriptor(RelationshipDescriptor relnDesc)

	this.relnDesc = relnDesc;
    
public voidsetRoleSourceDescription(java.lang.String roleSourceDescription)

        this.roleSourceDescription = roleSourceDescription;