xdoclet.ejb.tags
Class RelationTagsHandler

java.lang.Object
  |
  +--xdoclet.template.TemplateTagHandler
        |
        +--xdoclet.XDocletTagSupport
              |
              +--xdoclet.ejb.tags.EjbTagsHandler
                    |
                    +--xdoclet.ejb.tags.RelationTagsHandler
Direct Known Subclasses:
JBossRelationTagsHandler, WeblogicRelationTagsHandler

public class RelationTagsHandler
extends EjbTagsHandler

Version:
$Revision: 1.20 $
Author:
Aslak Hellesøy, Ara Abrahamian (ara_e@email.com)

Inner Class Summary
 class RelationTagsHandler.RelationHolder
          Holds class/method of the two end points of a relationship.
 
Field Summary
protected static RelationTagsHandler.RelationHolder currentRelation
          The current relation, set by forAllRelationships and used by forAllRelationshipRoles.
protected static java.util.Map relationMap
          A map containing all relations.
 
Fields inherited from class xdoclet.ejb.tags.EjbTagsHandler
LOCAL_SUFFIX
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
RelationTagsHandler()
           
 
Method Summary
 void forAllRelationships(java.lang.String template)
          Evaluates the body block for each relationship.
 void ifHasLeftRoleName(java.lang.String template)
           
 void ifHasRelationships(java.lang.String template)
          Evaluates the body if at least one of the classes has an ejb:relation tag, otherwise not.
 void ifHasRightRoleName(java.lang.String template)
           
 void ifIsBidirectional(java.lang.String template)
           
 void ifIsLeftMany(java.lang.String template)
           
 void ifIsMany2Many(java.lang.String template)
          Evaluates the body block if the current relationship is a many to many type, meaning, both sides of the relation returns java.util.Collection or java.util.Set.
 void ifIsNotACollection(java.lang.String template)
          Evaluates the body block if current method's return type is not a java.util.Collection or java.util.Set.
 void ifIsOne2Many(java.lang.String template)
          Evaluates the body block if the current relationship is a one to many type, meaning, ONLY ONE side of the relation returns java.util.Collection or java.util.Set.
 void ifIsOne2One(java.lang.String template)
          Evaluates the body block if the current relationship is a one to one type, meaning, neither side of the relation returns java.util.Collection or java.util.Set.
 void ifIsRightMany(java.lang.String template)
           
 void ifIsUnidirectional(java.lang.String template)
           
 void ifLeftCascadeDelete(java.lang.String template)
          Evaluates the body if the left side of this relation has cascade-delete=yes
 void ifNotIsMany2Many(java.lang.String template)
          Evaluates the body block if the current relationship IS NOT a many to many type, meaning, at least one side of the relation does not return java.util.Collection or java.util.Set.
 void ifNotIsOne2Many(java.lang.String template)
          Evaluates the body block if the current relationship IS NOT a one to many type, meaning, either both sides, or neither side of the relation returns java.util.Collection or java.util.Set.
 void ifNotIsOne2One(java.lang.String template)
          Evaluates the body block if the current relationship IS NOT a one to one type, meaning, at least one side of the relation returns java.util.Collection or java.util.Set.
 void ifRightCascadeDelete(java.lang.String template)
          Evaluates the body if the right side of this relation has cascade-delete=yes, or the left side has target-relation cascade-delete="yes"
protected  boolean isBidirectional()
           
protected  boolean isMany2Many()
           
protected  boolean isOne2Many()
           
protected  boolean isOne2One()
           
protected  boolean isSetOrCollection(java.lang.String type)
          Returns true if current method's return type is a java.util.Collection or java.util.Set, false otherwise.
 java.lang.String leftEJBName()
          Returns the EJB Name of the left side of this relationship
 java.lang.String leftFieldName()
           
 java.lang.String leftFieldType()
           
 java.lang.String leftMultiplicity()
           
 java.lang.String leftRoleName()
           
 java.lang.String relationComment()
           
 java.lang.String relationName()
           
 java.lang.String rightEJBName()
          Returns the EJB Name of the right side of this relationship
 java.lang.String rightFieldName()
           
 java.lang.String rightFieldType()
           
 java.lang.String rightMultiplicity()
           
 java.lang.String rightRoleName()
           
 
Methods inherited from class xdoclet.ejb.tags.EjbTagsHandler
beanType, choosePackage, concreteFullClassName, ejbExternalRefName, ejbName, ejbRefName, extendsFromFor, forAllBeans, getDependentClassFor, getDependentClassTagName, getEjbIdFor, getEjbNameFor, getEjbSpec, getShortEjbNameFor, hasPermission, hasTransaction, id, ifIsAConcreteEJBean, ifLocalEjb, ifNotLocalEjb, ifNotRemoteEjb, ifRemoteEjb, isAConcreteEJBean, isEjb, isLocalEjb, isOnlyLocalEjb, isOnlyRemoteEjb, isRemoteEjb, prefixWithEjbSlash, shortEjbName, shouldTraverseSuperclassForDependentClass, symbolicClassName
 
Methods inherited from class xdoclet.XDocletTagSupport
getClassTagValue, getClassTagValue, getConstructorTagValue, getCurrentClass, getCurrentConstructor, getCurrentField, getCurrentMethod, getCurrentPackage, getCurrentTag, getDocletContext, getFieldTagValue, getFieldTagValue, getMethodTagValue, getMethodTagValue, getParameterValue, getParameterValue, getTagValue, getTagValue, getTagValue, invalidParamValueFound, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, parsePropertyString, popCurrentClass, pushCurrentClass, replaceProperties, setCurrentClass, setCurrentConstructor, setCurrentField, setCurrentMethod, setCurrentPackage, setCurrentTag, tokenizeValue
 
Methods inherited from class xdoclet.template.TemplateTagHandler
generate, getContext, getEngine, getParser, setContext, setEngine, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relationMap

protected static java.util.Map relationMap
A map containing all relations.

currentRelation

protected static RelationTagsHandler.RelationHolder currentRelation
The current relation, set by forAllRelationships and used by forAllRelationshipRoles. It somehow is like the current index for the forAllRelationships loop.
See Also:
forAllRelationships(java.lang.String), #forAllRelationshipRoles(java.lang.String)
Constructor Detail

RelationTagsHandler

public RelationTagsHandler()
Method Detail

ifLeftCascadeDelete

public void ifLeftCascadeDelete(java.lang.String template)
                         throws XDocletException
Evaluates the body if the left side of this relation has cascade-delete=yes
Parameters:
template - The body of the block tag
Throws:
XDocletException -  

ifRightCascadeDelete

public void ifRightCascadeDelete(java.lang.String template)
                          throws XDocletException
Evaluates the body if the right side of this relation has cascade-delete=yes, or the left side has target-relation cascade-delete="yes"
Parameters:
template - The body of the block tag
Throws:
XDocletException -  

leftEJBName

public java.lang.String leftEJBName()
                             throws XDocletException
Returns the EJB Name of the left side of this relationship
Returns:
Left side's EJB name
Throws:
XDocletException -  

rightEJBName

public java.lang.String rightEJBName()
                              throws XDocletException
Returns the EJB Name of the right side of this relationship
Returns:
Right side's EJB name
Throws:
XDocletException -  

ifHasRelationships

public void ifHasRelationships(java.lang.String template)
                        throws XDocletException
Evaluates the body if at least one of the classes has an ejb:relation tag, otherwise not.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception

relationName

public java.lang.String relationName()
                              throws XDocletException
Returns:
the name of the current relation
Throws:
XDocletException -  

forAllRelationships

public void forAllRelationships(java.lang.String template)
                         throws XDocletException
Evaluates the body block for each relationship. Relations are denoted by ejb:relation for the getter method of the cmr-field.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
CmpTagsHandler.isEntityCmp(com.sun.javadoc.ClassDoc), PersistentTagsHandler.isPersistentField(com.sun.javadoc.MethodDoc), MethodTagsHandler.isGetter(java.lang.String), isSetOrCollection(java.lang.String)

ifIsLeftMany

public void ifIsLeftMany(java.lang.String template)
                  throws XDocletException

ifIsRightMany

public void ifIsRightMany(java.lang.String template)
                   throws XDocletException

leftFieldName

public java.lang.String leftFieldName()
                               throws XDocletException

rightFieldName

public java.lang.String rightFieldName()
                                throws XDocletException

leftFieldType

public java.lang.String leftFieldType()
                               throws XDocletException

rightFieldType

public java.lang.String rightFieldType()
                                throws XDocletException

ifIsNotACollection

public void ifIsNotACollection(java.lang.String template)
                        throws XDocletException
Evaluates the body block if current method's return type is not a java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

relationComment

public java.lang.String relationComment()

ifIsOne2One

public void ifIsOne2One(java.lang.String template)
                 throws XDocletException
Evaluates the body block if the current relationship is a one to one type, meaning, neither side of the relation returns java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifNotIsOne2One

public void ifNotIsOne2One(java.lang.String template)
                    throws XDocletException
Evaluates the body block if the current relationship IS NOT a one to one type, meaning, at least one side of the relation returns java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifIsOne2Many

public void ifIsOne2Many(java.lang.String template)
                  throws XDocletException
Evaluates the body block if the current relationship is a one to many type, meaning, ONLY ONE side of the relation returns java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifNotIsOne2Many

public void ifNotIsOne2Many(java.lang.String template)
                     throws XDocletException
Evaluates the body block if the current relationship IS NOT a one to many type, meaning, either both sides, or neither side of the relation returns java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifIsMany2Many

public void ifIsMany2Many(java.lang.String template)
                   throws XDocletException
Evaluates the body block if the current relationship is a many to many type, meaning, both sides of the relation returns java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifNotIsMany2Many

public void ifNotIsMany2Many(java.lang.String template)
                      throws XDocletException
Evaluates the body block if the current relationship IS NOT a many to many type, meaning, at least one side of the relation does not return java.util.Collection or java.util.Set. Used by forAllRelationships.
Parameters:
template - The body of the block tag
Throws:
XDocletException - Description of Exception
See Also:
forAllRelationships(java.lang.String)

ifIsBidirectional

public void ifIsBidirectional(java.lang.String template)
                       throws XDocletException

ifIsUnidirectional

public void ifIsUnidirectional(java.lang.String template)
                        throws XDocletException

ifHasLeftRoleName

public void ifHasLeftRoleName(java.lang.String template)
                       throws XDocletException

ifHasRightRoleName

public void ifHasRightRoleName(java.lang.String template)
                        throws XDocletException

leftRoleName

public java.lang.String leftRoleName()
                              throws XDocletException

rightRoleName

public java.lang.String rightRoleName()
                               throws XDocletException

leftMultiplicity

public java.lang.String leftMultiplicity()
                                  throws XDocletException

rightMultiplicity

public java.lang.String rightMultiplicity()
                                   throws XDocletException

isSetOrCollection

protected boolean isSetOrCollection(java.lang.String type)
Returns true if current method's return type is a java.util.Collection or java.util.Set, false otherwise.
Parameters:
type - Description of Parameter
Returns:
true if Collection or Set

isMany2Many

protected boolean isMany2Many()
                       throws XDocletException

isOne2One

protected boolean isOne2One()
                     throws XDocletException

isOne2Many

protected boolean isOne2Many()
                      throws XDocletException

isBidirectional

protected boolean isBidirectional()
                           throws XDocletException