1 19 20 package org.netbeans.modules.j2ee.ddloaders.multiview; 21 22 import org.netbeans.modules.j2ee.dd.api.ejb.MethodParams; 23 import org.netbeans.modules.j2ee.dd.api.ejb.Query; 24 import org.netbeans.modules.j2ee.dd.api.ejb.QueryMethod; 25 26 import java.lang.reflect.Modifier ; 27 import java.util.Collection ; 28 import java.util.List ; 29 import java.util.LinkedList ; 30 import java.util.Iterator ; 31 32 35 public class QueryMethodHelper { 36 37 final Query query; 38 private final EntityHelper entityHelper; 39 private boolean isSelectMethod; 40 44 public QueryMethodHelper(EntityHelper helper, Query query) { 45 this.query = query; 46 this.entityHelper = helper; 47 isSelectMethod = query.getQueryMethod().getMethodName().startsWith(EntityHelper.Queries.SELECT_PREFIX); 48 init(); 49 } 50 51 protected void init() { 52 QueryMethod queryMethod = query.getQueryMethod(); 53 List parameters = getQueryMethodParams(queryMethod); 54 String methodName = queryMethod.getMethodName(); 55 } 60 61 65 public String getMethodName() { 66 return query.getQueryMethod().getMethodName(); 67 } 68 69 public String getReturnType() { 70 return null; 86 } 87 88 public boolean returnsCollection() { 89 return "java.util.Collection".equals(getReturnType()); } 91 92 public String getResultInterface() { 93 96 QueryMethod queryMethod = query.getQueryMethod(); 97 List parameters = getQueryMethodParams(queryMethod); 98 String methodName = queryMethod.getMethodName(); 99 return null; 117 } 118 119 private List getQueryMethodParams(QueryMethod queryMethod) { 120 String [] methodParam = queryMethod.getMethodParams().getMethodParam(); 121 List params = new LinkedList (); 122 for (int i = 0; i < methodParam.length; i++) { 123 } 125 return params; 126 } 127 128 public void removeQuery() { 129 init(); 130 entityHelper.removeQuery(query); 134 } 135 136 191 private void updateQuery(Query query) { 192 this.query.setQueryMethod(query.getQueryMethod()); 193 this.query.setDescription(query.getDefaultDescription()); 194 this.query.setEjbQl(query.getEjbQl()); 195 entityHelper.modelUpdatedFromUI(); 196 } 197 198 212 254 public QueryMethod getQueryMethod() { 255 return query.getQueryMethod(); 256 } 257 258 public String getEjbQl() { 259 return query.getEjbQl(); 260 } 261 262 public String getDefaultDescription() { 263 return query.getDefaultDescription(); 264 } 265 } 266 | Popular Tags |