00001
00002
00003
00004
00005
00006
00007 package org.openmobileis.examples.mycrm.data.jdbc;
00008
00009 import java.sql.ResultSet;
00010
00011 import org.openmobileis.common.context.ApplicationContext;
00012 import org.openmobileis.common.context.ApplicationContextManager;
00013 import org.openmobileis.common.util.database.AbstractQueryManager;
00014 import org.openmobileis.common.util.exception.DatabaseException;
00015 import org.openmobileis.common.util.exception.ServiceException;
00016
00023 public class MyCrmUserManagerDBQuery extends AbstractQueryManager {
00024
00025 protected static String queryGetUserId = "SELECT code_rep FROM user where login='%0%' AND password='%1%'";
00026 protected static String queryValidateUser = "SELECT code_rep FROM user where code_rep='%0%'";
00027
00028 private static String queryGetUser = "SELECT code_rep, login, password FROM user WHERE code_rep='%0%'";
00029
00030 protected static String queryUpdateUser = "UPDATE user "
00031 +"SET login='%0%', password='%1%' "
00032 +" WHERE code_rep='%2%'";
00033
00037 public MyCrmUserManagerDBQuery() {
00038 super();
00039 }
00040
00041
00042
00043
00044 public void create(String[] parameters) throws ServiceException {
00045 throw new UnsupportedOperationException("can't create user, create representant instead");
00046 }
00047
00048
00049
00050
00051 public void delete(String[] parameters) throws ServiceException {
00052 throw new UnsupportedOperationException("can't delete user, delete representant instead");
00053 }
00054
00055
00056
00057
00058 public void update(String[] parameters) throws DatabaseException {
00059 this.executeUpdate(MyCrmUserManagerDBQuery.queryUpdateUser, parameters);
00060 }
00061
00062 public ResultSet getUserIDWithloginPass (String parameters[]) throws DatabaseException {
00063 return (this.executeQuery(queryGetUserId, parameters));
00064 }
00065
00066 public ResultSet getValidateUserID (String parameters[]) throws DatabaseException {
00067 return (this.executeQuery(queryValidateUser, parameters));
00068 }
00069
00070 public ResultSet getUser (String parameters[]) throws DatabaseException {
00071 return (this.executeQuery(queryGetUser, parameters));
00072 }
00073
00074 }