00001
00027 package org.objectweb.jonas_ejb.deployment.api;
00028
00029 import java.lang.reflect.Method;
00030 import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
00031
00038 public class MethodJdbcCmp1Desc extends MethodDesc {
00039
00040 protected String whereClause = null;
00041 protected int whereClauseStatus = APPLY_TO_BEAN;
00042
00046 public MethodJdbcCmp1Desc(BeanDesc beanDesc,Method meth,int index) {
00047 super(beanDesc,meth,index);
00048 }
00049
00055 void overwriteJdbcWhereClause(String jdbcWhereClause,int status)
00056 throws DeploymentDescException {
00057 if (status<this.whereClauseStatus)
00058 return;
00059
00060 char[] iwc = jdbcWhereClause.toCharArray();
00061 char[] owc = new char[iwc.length];
00062 for (int i = 0; i < iwc.length; i++) {
00063 if (Character.isWhitespace(iwc[i])) {
00064 owc[i] = ' ';
00065 } else {
00066 owc[i] = iwc[i];
00067 }
00068 }
00069 whereClause = new String(owc);
00070 whereClauseStatus = status;
00071 }
00072
00077 public boolean hasWhereClause(){
00078 return whereClause!=null;
00079 }
00080
00085 public String getWhereClause(){
00086 if (whereClause==null) {
00087 throw new Error("No whereClause defined for this method");
00088 }
00089 return whereClause;
00090 }
00091
00095 public int getWhereClauseStatus(){
00096 return whereClauseStatus;
00097 }
00098
00103 public String toString() {
00104 StringBuffer ret = new StringBuffer();
00105 ret.append(super.toString());
00106 if (hasWhereClause()) {
00107 ret.append("\ngetWhereClause()="+getWhereClause());
00108 ret.append("\ngetWhereClauseStatus()="+APPLY_TO[getWhereClauseStatus()]);
00109 }
00110 return ret.toString();
00111 }
00112
00113 }