Hello

When I login as instructor data from db is put into the model (Instructor.java) because the instrutorBean extends the model Intructor.java

Is this copy(object sourc, object dest) doing anything? I would like to be able to have several people logged in at the same time is this possible?

if (profile.equals("instr_")) {
                    Instructor instructor = new Instructor();
                    DerbyDAOFactory f = new DerbyDAOFactory();
                    ConnectInstructorDAO instructorDAO = (ConnectInstructorDAO) f.getInstructorUserDAO();
                    InstructorBean instructorBean = instructorDAO.select(user,password,profile);
                    //instructorBean.setLoggedIn(true);
                    //ModelUtils.copy(instructorBean, instructor);

                }
public static void copy(Object source, Object dest) {
        try {
            Class sourceClass = source.getClass();
            Class destClass = dest.getClass();
            BeanInfo info = Introspector.getBeanInfo(sourceClass);
            PropertyDescriptor props[] = info.getPropertyDescriptors();
            Object noParams[] = new Object[0];
            Object oneParam[] = new Object[1];
            for (int i = 0; i < props.length; i++) {
                Method getter = props[i].getReadMethod();
                if (getter == null) {
                    continue;
                }
                Object value = getter.invoke(source, noParams);
                Method setter = props[i].getWriteMethod();
                if (setter != null && sourceClass != destClass) {
                    try {
                        setter = destClass.getMethod(
                                setter.getName(),
                                setter.getParameterTypes());
                    } catch (NoSuchMethodException x) {
                        setter = null;
                    }
                }
                if (setter != null) {
                    oneParam[0] = value;
                    setter.invoke(dest, oneParam);
                }
            }

Is there some thing wrong with my configuration of athe adminBean? It is not excepted as a source in my copy method.

public class AdminBean extends Admin{

    public transient boolean loggedIn = false;

    public boolean isLoggedIn() {
        return loggedIn;
    }

    public void setLoggedIn(boolean loggedIn) {
        this.loggedIn = loggedIn;

    }

}
public class Admin extends LoginInfo implements java.io.Serializable{
    
    public boolean student;
    public boolean teacher;
    public boolean admin;
    public boolean payee;
    public String uid;
   
    public String fName;
    public String lName;
    public String mName;
    public String gender;
    public Date startDate;
    public Date endDate;
    public int age;
    public String address;
    public String state;
    public int zip;
    public int areaCode;
    public int phone;
    public String payeeUid;
    public String location;
    public Double payRate;
    public int bookNum;
    public String stuUid;
    public int rate;


    public boolean isAdmin() {
        return admin;
    }

    public void setAdmin(boolean admin) {
        this.admin = admin;
    }

    public boolean isPayee() {
        return payee;
    }

    public void setPayee(boolean payee) {
        this.payee = payee;
    }

    public boolean isStudent() {
        return student;
    }

    public void setStudent(boolean student) {
        this.student = student;
    }

    public boolean isTeacher() {
        return teacher;
    }

    public void setTeacher(boolean teacher) {
        this.teacher = teacher;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(int areaCode) {
        this.areaCode = areaCode;
    }

    public int getBookNum() {
        return bookNum;
    }

    public void setBookNum(int bookNum) {
        this.bookNum = bookNum;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getlName() {
        return lName;
    }

    public void setlName(String lName) {
        this.lName = lName;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getmName() {
        return mName;
    }

    public void setmName(String mName) {
        this.mName = mName;
    }

    public Double getPayRate() {
        return payRate;
    }

    public void setPayRate(Double payRate) {
        this.payRate = payRate;
    }

    public String getPayeeUid() {
        return payeeUid;
    }

    public void setPayeeUid(String payeeUid) {
        this.payeeUid = payeeUid;
    }

    public int getPhone() {
        return phone;
    }

    public void setPhone(int phone) {
        this.phone = phone;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getStuUid() {
        return stuUid;
    }

    public void setStuUid(String stuUid) {
        this.stuUid = stuUid;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public int getZip() {
        return zip;
    }

    public void setZip(int zip) {
        this.zip = zip;
    }

    public String getfName() {
        return fName;
    }

    public void setfName(String fName) {
        this.fName = fName;
    }

    public int getRate() {
        return rate;
    }

    public void setRate(int rate) {
        this.rate = rate;
    }
    
    
    
    


}
This article has been dead for over six months. Start a new discussion instead.