00001 /* 00002 * Created on 21 janv. 2004 00003 * 00004 * To change the template for this generated file go to 00005 * Window>Preferences>Java>Code Generation>Code and Comments 00006 */ 00007 package org.openmobileis.examples.mycrm.data.jdbc; 00008 00009 import java.sql.ResultSet; 00010 00011 import org.openmobileis.common.util.database.AbstractQueryManager; 00012 import org.openmobileis.common.util.exception.DatabaseException; 00013 import org.openmobileis.common.util.exception.ServiceException; 00014 00021 public class MyCrmUserManagerDBQuery extends AbstractQueryManager { 00022 00023 protected static String queryGetUserId = "SELECT code_rep FROM user where login='%0%' AND password='%1%'"; 00024 protected static String queryValidateUser = "SELECT code_rep FROM user where code_rep='%0%'"; 00025 00026 private static String queryGetUser = "SELECT code_rep, login, password FROM user WHERE code_rep='%0%'"; 00027 00028 protected static String queryUpdateUser = "UPDATE user " 00029 +"SET login='%0%', password='%1%' " 00030 +" WHERE code_rep='%2%'"; 00031 00035 public MyCrmUserManagerDBQuery() { 00036 super(); 00037 } 00038 00039 /* (non-Javadoc) 00040 * @see org.openmobileis.commonserver.database.AbstractQueryManager#create(java.lang.String[]) 00041 */ 00042 public void create(String[] parameters) throws ServiceException { 00043 throw new UnsupportedOperationException("can't create user, create representant instead"); 00044 } 00045 00046 /* (non-Javadoc) 00047 * @see org.openmobileis.commonserver.database.AbstractQueryManager#delete(java.lang.String[]) 00048 */ 00049 public void delete(String[] parameters) throws ServiceException { 00050 throw new UnsupportedOperationException("can't delete user, delete representant instead"); 00051 } 00052 00053 /* (non-Javadoc) 00054 * @see org.openmobileis.commonserver.database.AbstractQueryManager#update(java.lang.String[]) 00055 */ 00056 public void update(String[] parameters) throws DatabaseException { 00057 this.executeUpdate(MyCrmUserManagerDBQuery.queryUpdateUser, parameters); 00058 } 00059 00060 public ResultSet getUserIDWithloginPass (String parameters[]) throws DatabaseException { 00061 return (this.executeQuery(queryGetUserId, parameters)); 00062 } 00063 00064 public ResultSet getValidateUserID (String parameters[]) throws DatabaseException { 00065 return (this.executeQuery(queryValidateUser, parameters)); 00066 } 00067 00068 public ResultSet getUser (String parameters[]) throws DatabaseException { 00069 return (this.executeQuery(queryGetUser, parameters)); 00070 } 00071 00072 }