1 5 package xdoclet.modules.ejb.dd; 6 7 import java.util.Collection ; 8 import java.util.Iterator ; 9 10 import xjavadoc.*; 11 import xdoclet.XDocletException; 12 import xdoclet.XmlSubTask; 13 import xdoclet.modules.ejb.entity.CmpTagsHandler; 14 15 22 public abstract class AbstractEjbDeploymentDescriptorSubTask extends XmlSubTask 23 { 24 private final static int DONT_CARE = 0; 25 private final static int CMP_2_X = 1; 26 private final static int CMP_1_X = 2; 27 28 34 protected boolean atLeastOneCmpEntityBeanExists() throws XDocletException 35 { 36 return atLeastOneCmpEntityBeanExists(DONT_CARE); 37 } 38 39 45 protected boolean atLeastOneCmp1EntityBeanExists() throws XDocletException 46 { 47 return atLeastOneCmpEntityBeanExists(CMP_1_X); 48 } 49 50 56 protected boolean atLeastOneCmp2EntityBeanExists() throws XDocletException 57 { 58 return atLeastOneCmpEntityBeanExists(CMP_2_X); 59 } 60 61 68 private boolean atLeastOneCmpEntityBeanExists(int cmpVersion) throws XDocletException 69 { 70 Collection classes = getXJavaDoc().getSourceClasses(); 71 72 for (Iterator i = classes.iterator(); i.hasNext(); ) { 73 XClass clazz = (XClass) i.next(); 74 75 if (CmpTagsHandler.isEntityCmp(clazz) && 76 (cmpVersion == DONT_CARE || 77 (cmpVersion == CMP_2_X && CmpTagsHandler.isUsingCmp2Impl(clazz)) || 78 (cmpVersion == CMP_1_X && !CmpTagsHandler.isUsingCmp2Impl(clazz)))) { 79 return true; 80 } 81 } 82 83 return false; 84 } 85 } 86 | Popular Tags |