User: ara_e_w
Date: 02/04/12 14:01:58
Modified: core/src/xdoclet/ejb EntityPkSubTask.java
Log:
fork=false works fine :-)
Revision Changes Path
1.27 +90 -83 xdoclet/core/src/xdoclet/ejb/EntityPkSubTask.java
Index: EntityPkSubTask.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/EntityPkSubTask.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- EntityPkSubTask.java 5 Apr 2002 13:15:29 -0000 1.26
+++ EntityPkSubTask.java 12 Apr 2002 21:01:58 -0000 1.27
@@ -8,33 +8,20 @@
import org.apache.log4j.Category;
-import xdoclet.TemplateSubTask;
import xdoclet.XDocletException;
-import xdoclet.XDocletTagSupport;
import xdoclet.ejb.tags.PkTagsHandler;
import xdoclet.tags.PackageTagsHandler;
import xdoclet.util.Log;
import xdoclet.util.Translator;
-import java.io.File;
-
/**
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Oct 15, 2001
- * @version $Revision: 1.26 $
+ * @version $Revision: 1.27 $
*/
-public class EntityPkSubTask extends AbstractEjbCodeGeneratorSubTask {
-
- /**
- * A configuration parameter for specifying the entity bean primary class name
- * pattern. By default the value is used for deciding the entity bean primary
- * class name. {0} in the value mean current class's symbolic name which for an
- * EJBean is the EJB name.
- *
- * @see #getEntityPkClassPattern()
- */
- protected String entityPkClassPattern;
+public class EntityPkSubTask extends AbstractEjbCodeGeneratorSubTask
+{
/**
* @todo-javadoc Describe the field
*/
@@ -49,39 +36,38 @@
*/
protected static String DEFAULT_TEMPLATE_FILE = "/xdoclet/ejb/entitypk.j";
+ /**
+ * A configuration parameter for specifying the entity bean primary class name
+ * pattern. By default the value is used for deciding the entity bean primary
+ * class name. {0} in the value mean current class's symbolic name which for an
+ * EJBean is the EJB name.
+ *
+ * @see #getEntityPkClassPattern()
+ */
+ protected String entityPkClassPattern;
/**
* Describe what the EntityPkSubTask constructor does
*
* @todo-javadoc Write javadocs for constructor
*/
- public EntityPkSubTask() {
+ public EntityPkSubTask()
+ {
setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
setDestinationFile(getEntityPkClassPattern() + ".java");
setOfType("javax.ejb.EntityBean");
}
-
- /**
- * Sets the Pattern attribute of the EntityPkSubTask object
- *
- * @param new_pattern The new Pattern value
- */
- public void setPattern(String new_pattern) {
- entityPkClassPattern = new_pattern;
- }
-
-
/**
* Gets the SubTaskName attribute of the EntityPkSubTask object
*
* @return The SubTaskName value
*/
- public String getSubTaskName() {
+ public String getSubTaskName()
+ {
return SUBTASK_NAME;
}
-
/**
* Returns the configuration parameter for specifying the entity bean primary
* class name pattern. By default the value is used for deciding the entity
@@ -92,34 +78,48 @@
* @return The EntityPkClassPattern value
* @see #entityPkClassPattern
*/
- public String getEntityPkClassPattern() {
- if (entityPkClassPattern != null) {
+ public String getEntityPkClassPattern()
+ {
+ if( entityPkClassPattern != null )
+ {
return entityPkClassPattern;
}
- else {
+ else
+ {
return DEFAULT_ENTITY_PK_CLASS_PATTERN;
}
}
+ /**
+ * Sets the Pattern attribute of the EntityPkSubTask object
+ *
+ * @param new_pattern The new Pattern value
+ */
+ public void setPattern( String new_pattern )
+ {
+ entityPkClassPattern = new_pattern;
+ }
/**
* Called to validate configuration parameters.
*
* @exception XDocletException Description of Exception
*/
- public void validateOptions() throws XDocletException {
+ public void validateOptions() throws XDocletException
+ {
super.validateOptions();
- if (getEntityPkClassPattern() == null ||
getEntityPkClassPattern().trim().equals("")) {
+ if( getEntityPkClassPattern() == null ||
getEntityPkClassPattern().trim().equals( "" ) )
+ {
throw new
XDocletException(Translator.getString("parameter_missing_or_empty", new
String[]{"pattern"}));
}
- if (getEntityPkClassPattern().indexOf("{0}") == -1) {
+ if( getEntityPkClassPattern().indexOf( "{0}" ) == -1 )
+ {
throw new
XDocletException(Translator.getString("xdoclet.ejb.Messages",
"pattern_has_no_placeholder"));
}
}
-
/**
* Gets the GeneratedFileName attribute of the EntityPkSubTask object
*
@@ -129,11 +129,11 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- protected String getGeneratedFileName(XClass clazz) throws XDocletException {
+ protected String getGeneratedFileName( XClass clazz ) throws XDocletException
+ {
return
PackageTagsHandler.packageNameAsPathFor(PkTagsHandler.getPkClassFor(getCurrentClass()))
+ ".java";
}
-
/**
* Describe what the method does
*
@@ -145,21 +145,28 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- protected boolean matchesGenerationRules(XClass clazz) throws XDocletException
{
- if (super.matchesGenerationRules(clazz) == false) {
+ protected boolean matchesGenerationRules( XClass clazz ) throws
XDocletException
+ {
+ if( super.matchesGenerationRules( clazz ) == false )
+ {
return false;
}
Category cat = Log.getCategory(EntityPkSubTask.class,
"matchesGenerationRules");
- String pk_class = PkTagsHandler.getPkClassFor(clazz);
+ if( cat.isDebugEnabled() )
+ {
+ cat.debug( "clazz=" + clazz );
+ }
- if ("false".equalsIgnoreCase(clazz.doc().tagAttributeValue("ejb:pk",
"generate", false))) {
+ if( "false".equalsIgnoreCase( clazz.doc().tagAttributeValue( "ejb:pk",
"generate", false ) ) )
+ {
cat.debug("Skip primary key for " + clazz.qualifiedName() + "
because of false generate flag");
return false;
}
- if (PkTagsHandler.classHasPrimkeyField(clazz)) {
+ if( PkTagsHandler.classHasPrimkeyField( clazz ) )
+ {
cat.debug("Skip primary key for " + clazz.qualifiedName() + "
because it has a PK Field.");
return false;
}
@@ -167,7 +174,6 @@
return true;
}
-
/**
* Describe what the method does
*
@@ -175,7 +181,8 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for exception
*/
- protected void engineStarted() throws XDocletException {
+ protected void engineStarted() throws XDocletException
+ {
System.out.println(Translator.getString("xdoclet.ejb.Messages",
"generating_pk_for",
new String[]{getCurrentClass().qualifiedName()}));
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel