xdoclet.modules.ejb.entity
Class PersistentTagsHandler

java.lang.Object
  extended by xdoclet.template.TemplateTagHandler
      extended by xdoclet.XDocletTagSupport
          extended by xdoclet.modules.ejb.EjbTagsHandler
              extended by xdoclet.modules.ejb.entity.EntityTagsHandler
                  extended by xdoclet.modules.ejb.entity.CmpTagsHandler
                      extended by xdoclet.modules.ejb.entity.PersistentTagsHandler

public class PersistentTagsHandler
extends CmpTagsHandler

Version:
$Revision: 1.23 $
Author:
Ara Abrahamian (ara_e@email.com)
xdoclet.taghandler
namespace = "EjbPersistent"
created
Oct 16, 2001

Field Summary
 
Fields inherited from class xdoclet.modules.ejb.EjbTagsHandler
ALL, LOCAL_SUFFIX, SERVICE_ENDPOINT, SERVICE_ENDPOINT_SUFFIX
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
PersistentTagsHandler()
           
 
Method Summary
static java.lang.String fieldList(xjavadoc.XClass clazz, java.lang.String inclTag, java.lang.String exclTag, int type, java.lang.String valueObject, boolean superclasses)
          Returns comma-separated list of fields, excluding fields that have tags of exclTag list, including fields that have tags of inclTag list.
 void forAllPersistentFields(java.lang.String template, java.util.Properties attributes)
          Evaluates the body for each persistent field.
protected  void forAllPersistentMatchedFields(java.lang.String template, java.lang.String include_tags, java.lang.String exclude_tags, boolean superclasses, java.lang.String valueObject)
          Generate only for all Persisted Fields matching a specific XTag or Persisted fields that do not match a specific Tag
protected  java.lang.String[] getPkFieldsInHeader()
          Returns an array containing ejb:pk-field tags defined in class level.
 void ifHasAtLeastOnePersistentField(java.lang.String template)
          Evaluates the body if the class has at least one persistent field.
 void ifHasAtLeastOnePkField(java.lang.String template)
          Evaluates the body if the class has at least one primary key field.
static boolean isPersistentField(xjavadoc.XMethod method)
          Returns true if method is a persistent field, false otherwise.
static boolean isPkField(xjavadoc.XMethod method)
          Returns true if method is a primary key field, false otherwise.
static boolean isPkFieldInHeader(xjavadoc.XClass clazz)
          Returns true if clazz has ejb:pk-field defined.
static boolean isValueObjectField(xjavadoc.XClass clazz, xjavadoc.XMethod method, java.lang.String valueObject)
          Gets the ValueObjectField attribute of the PersistentTagsHandler class
 java.lang.String persistentfieldList(java.util.Properties attributes)
          Returns a string containing comma-separated list of persistent fields with their types.
 java.lang.String persistentfieldNameValueList()
          Returns a string containing comma-separated list of persistent fields without their types in fieldname="value" format.
 java.lang.String persistentfieldNameValueList(java.util.Properties attributes)
          Returns a string containing comma-separated list of persistent fields without their types in fieldname="value" format.
 
Methods inherited from class xdoclet.modules.ejb.entity.CmpTagsHandler
dbmsColumn, dbmsTable, entityCmpClass, fieldName, forAllCmpEntityBeans, forAllCmpFields, getEntityCmpClassFor, getEntityCmpClassPattern, getFieldNameFor, ifEntityIsCmp, ifIsPersistent, ifNotUsingCmp2, ifUsingCmp2, isEntityCmp, isUsingCmp2Impl
 
Methods inherited from class xdoclet.modules.ejb.entity.EntityTagsHandler
forAllEjbSelectMethods, forAllEntityBeans, ifEntity, isEjbSelectMethod, isEntity, persistenceType, reentrant
 
Methods inherited from class xdoclet.modules.ejb.EjbTagsHandler
beanType, choosePackage, concreteFullClassName, ejbExternalRefName, ejbName, ejbRefName, ejbRefName, extendsFromFor, forAllBeans, getDependentClassFor, getDependentClassTagName, getEjb, getEjbIdFor, getEjbNameFor, getEjbSpec, getShortEjbNameFor, hasTransaction, id, ifIsAConcreteEJBean, ifLocalEjb, ifNotLocalEjb, ifNotRemoteEjb, ifNotServiceEndpointEjb, ifRemoteEjb, ifServiceEndpointEjb, isAConcreteEJBean, isEjb, isLocalEjb, isOnlyLocalEjb, isOnlyRemoteEjb, isOnlyServiceEndpointEjb, isRemoteEjb, isServiceEndpointEjb, prefixWithEjbSlash, shortEjbName, shouldTraverseSuperclassForDependentClass, symbolicClassName
 
Methods inherited from class xdoclet.XDocletTagSupport
delimit, expandClassName, generate, getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getDocletContext, getEngine, getExpandedDelimitedTagValue, getTagValue, getTagValue, getTagValue, hasHavingClassTag, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage
 
Methods inherited from class xdoclet.template.TemplateTagHandler
getXJavaDoc, setXJavaDoc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentTagsHandler

public PersistentTagsHandler()
Method Detail

isPersistentField

public static boolean isPersistentField(xjavadoc.XMethod method)
Returns true if method is a persistent field, false otherwise. Persistent fields are getter methods marked with a ejb:persistent-field tag.

Parameters:
method - Description of Parameter
Returns:
The PersistentField value

isValueObjectField

public static boolean isValueObjectField(xjavadoc.XClass clazz,
                                         xjavadoc.XMethod method,
                                         java.lang.String valueObject)
                                  throws XDocletException
Gets the ValueObjectField attribute of the PersistentTagsHandler class

Parameters:
clazz - Describe what the parameter does
method - Describe what the parameter does
valueObject - Describe what the parameter does
Returns:
The ValueObjectField value
Throws:
XDocletException

isPkField

public static boolean isPkField(xjavadoc.XMethod method)
Returns true if method is a primary key field, false otherwise. PK fields are getter methods marked with a ejb:pk-field tag.

Parameters:
method - Description of Parameter
Returns:
The PkField value

isPkFieldInHeader

public static boolean isPkFieldInHeader(xjavadoc.XClass clazz)
Returns true if clazz has ejb:pk-field defined.

Parameters:
clazz - Description of Parameter
Returns:
The PkFieldInHeader value

fieldList

public static java.lang.String fieldList(xjavadoc.XClass clazz,
                                         java.lang.String inclTag,
                                         java.lang.String exclTag,
                                         int type,
                                         java.lang.String valueObject,
                                         boolean superclasses)
                                  throws XDocletException
Returns comma-separated list of fields, excluding fields that have tags of exclTag list, including fields that have tags of inclTag list. If name_value_out is true, then the list is in fieldname="value" format.

Parameters:
clazz - Description of Parameter
inclTag - Fields that have at least of the tags of this comma-separated list are used.
exclTag - Fields that don't have all of the tags of this comma-separated list are used.
type - Type of return (0: comma separated list - 1: field=value comma separated list - 2: getter comma sperated list, 3: comma separated name list)
valueObject -
superclasses -
Returns:
Description of the Returned Value
Throws:
XDocletException
To do:
This method only takes the field of the current class. I think it's ok. Any objection ?

ifHasAtLeastOnePkField

public void ifHasAtLeastOnePkField(java.lang.String template)
                            throws XDocletException
Evaluates the body if the class has at least one primary key field.

Parameters:
template - The body of the block tag
Throws:
XDocletException
doc.tag
type = "block"

ifHasAtLeastOnePersistentField

public void ifHasAtLeastOnePersistentField(java.lang.String template)
                                    throws XDocletException
Evaluates the body if the class has at least one persistent field.

Parameters:
template - The body of the block tag
Throws:
XDocletException
doc.tag
type = "block"

forAllPersistentFields

public void forAllPersistentFields(java.lang.String template,
                                   java.util.Properties attributes)
                            throws XDocletException
Evaluates the body for each persistent field. If only-pk="true" then use only primary keys, if not-pk="true" then use only persistent fields that are not primary keys. By default use all regardless of being primary key field or not.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException
See Also:
forAllPersistentMatchedFields(java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String)
doc.tag
type = "block"
doc.param
name = "superclasses" optional = "true" values = "true,false" description = "Include * persistent fields of superclasses. True by default.", name = "valueobject" optional = "true" description = "If present, only loop over fields * with a matching \@ejb.value-object tag.", name = "only-pk" optional = "true" values = "true,false" description = "If true, only loop * over the persistent fields that are in the primary key. False by default.", name = "not-pk" optional = "true" values = "true,false" description = "If true, only loop * over the persistent fields that are not in the primary key. False by default."

persistentfieldNameValueList

public java.lang.String persistentfieldNameValueList(java.util.Properties attributes)
                                              throws XDocletException
Returns a string containing comma-separated list of persistent fields without their types in fieldname="value" format.

Parameters:
attributes -
Returns:
A string containing comma-separated list of persistent fields with their types like an ordinary method parameter definition.
Throws:
XDocletException
See Also:
fieldList(XClass, String, String, int, String, boolean)
doc.tag
type = "content"

persistentfieldList

public java.lang.String persistentfieldList(java.util.Properties attributes)
                                     throws XDocletException
Returns a string containing comma-separated list of persistent fields with their types.

Parameters:
attributes -
Returns:
A string containing comma-separated list of persistent fields without their types.
Throws:
XDocletException
See Also:
fieldList(XClass, String, String, int, String, boolean)
doc.tag
type = "content"

persistentfieldNameValueList

public java.lang.String persistentfieldNameValueList()
                                              throws XDocletException
Returns a string containing comma-separated list of persistent fields without their types in fieldname="value" format.

Returns:
A string containing comma-separated list of persistent fields with their types like an ordinary method parameter definition.
Throws:
XDocletException
See Also:
fieldList(XClass, String, String, int, String, boolean)
doc.tag
type = "content"

getPkFieldsInHeader

protected java.lang.String[] getPkFieldsInHeader()
                                          throws XDocletException
Returns an array containing ejb:pk-field tags defined in class level.

Returns:
The PkFieldsInHeader value
Throws:
XDocletException

forAllPersistentMatchedFields

protected void forAllPersistentMatchedFields(java.lang.String template,
                                             java.lang.String include_tags,
                                             java.lang.String exclude_tags,
                                             boolean superclasses,
                                             java.lang.String valueObject)
                                      throws XDocletException
Generate only for all Persisted Fields matching a specific XTag or Persisted fields that do not match a specific Tag

Parameters:
template - The body of the block tag
include_tags - only fields having these tags
exclude_tags - only fields not having these tags
superclasses - traverse superclasses too
valueObject -
Throws:
XDocletException
See Also:
forAllPersistentFields(java.lang.String,java.util.Properties)

http://xdoclet.sourceforge.net/