1 5 package xdoclet.modules.caucho; 6 7 import xjavadoc.XMethod; 8 9 import xdoclet.XDocletException; 10 import xdoclet.modules.ejb.dd.RelationTagsHandler; 11 12 22 public class ResinEjbTagsHandler extends RelationTagsHandler 23 { 24 private final static String RELATION_TAG = "resin-ejb:relation"; 25 26 34 public void ifHasLeftOrderBy(String template) 35 throws XDocletException 36 { 37 if (leftOrderBy() != null) 38 generate(template); 39 } 40 41 49 public void ifHasLeftSqlColumn(String template) 50 throws XDocletException 51 { 52 if (leftSqlColumn() != null) 53 generate(template); 54 } 55 56 64 public void ifHasRightOrderBy(String template) 65 throws XDocletException 66 { 67 if (rightOrderBy() != null) 68 generate(template); 69 } 70 71 79 public void ifHasRightSqlColumn(String template) 80 throws XDocletException 81 { 82 if (rightSqlColumn() != null) 83 generate(template); 84 } 85 86 94 public void ifHasSqlTable(String template) 95 throws XDocletException 96 { 97 if (sqlTable() != null) 98 generate(template); 99 } 100 101 109 public String leftOrderBy() 110 throws XDocletException 111 { 112 if (!currentRelation.isLeftMany()) 113 return null; 114 else 115 return getMethodTagValue(RELATION_TAG, "order-by", true); 116 } 117 118 126 public String leftSqlColumn() 127 throws XDocletException 128 { 129 return getMethodTagValue(RELATION_TAG, "sql-column", true); 130 } 131 132 140 public String rightOrderBy() 141 throws XDocletException 142 { 143 if (!currentRelation.isRightMany()) 144 return null; 145 else 146 return getMethodTagValue(RELATION_TAG, "order-by", false); 147 } 148 149 157 public String rightSqlColumn() 158 throws XDocletException 159 { 160 String rightValue = getMethodTagValue(RELATION_TAG, "sql-column", false); 161 162 if (rightValue != null) 163 return rightValue; 164 else 165 return getMethodTagValue(RELATION_TAG, "target-sql-column", true); 166 } 167 168 176 public String signatureFromMethod() 177 throws XDocletException 178 { 179 XMethod method = getCurrentMethod(); 180 181 if (method == null) 182 throw L.error(L.NO_CURRENT_METHOD); 183 else 184 return method.getNameWithSignature(false); 185 } 186 187 195 public String sqlTable() 196 throws XDocletException 197 { 198 String sqlTable = null; 199 200 if (currentRelation.isLeftMany()) 201 sqlTable = getMethodTagValue(RELATION_TAG, "sql-table", true); 202 if (sqlTable == null && currentRelation.isRightMany()) 203 sqlTable = getMethodTagValue(RELATION_TAG, "sql-table", false); 204 205 return sqlTable; 206 } 207 208 209 private String getMethodTagValue(String tagName, String paramName, boolean left) 210 throws XDocletException 211 { 212 XMethod method = left ? currentRelation.getLeftMethod() : currentRelation.getRightMethod(); 213 214 if (method == null) 215 return null; 216 else 217 return getTagValue(FOR_METHOD, method.getDoc(), tagName, paramName, null, null, false, false); 218 } 219 } 220 | Popular Tags |