0

Hello;
I am trying to build a JDesktopApp
The structure of a Session in a web app:
a user logs in and a session specific to the user is saved.(basically).
My question is dealing with a Desktop app. If a user logs in can the same concept be used? I am thinking in terms of if there are many different people using app at the same time.
Just yes or no would get me started. I have the MVC structure setup but have to learn how to use it.

additionally:
I have reached a point where I would need someone to help.

I have app and data base now but trying to connect it and use properties to initialize setup of app depending on a user group.

If there is some interested in helping please contact me.

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by ceyesuma
0

I guess what I am asking is if this code in general could work by saving Objects pertaining to the user so somehow it could get saved and revisited or allow several people access to database as apposed to just the simple return of strings at login? Again the code is not working at all but is the structure one to build on? or is it not possible
to treat objects as a kind of session?

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package schoolAppModel;

/**
 *
 * @author depot
 */
public class LoginInfo implements java.io.Serializable{
private String user;
private String password;

    public LoginInfo(){

    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

   

}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package schoolAppModel;

import schoolAppModel.LoginInfo;

/**
 *
 * @author depot
 */
public class UserGroupInfo extends LoginInfo{
    private String user;
    private boolean student;
    private boolean teacher;
    private boolean admin;
    private boolean payee;
    public UserGroupInfo(){

    }

    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;
    }
    
    


}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package schoolAppView;

import schoolAppModel.UserGroupInfo;

/**
 *
 * @author depot
 */
public class UserGroupInfoBean extends UserGroupInfo{

}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package schoolAppView;

import javax.security.auth.login.LoginException;
import schoolAppModel.LoginInfo;
import schoolAppModel.ModelUtils;
import schoolAppModel.User;
import schoolAppModel.UserGroupInfo;
import schoolAppModel.err.IncorrectPasswordException;
import schoolAppModel.err.UnknownSubscriberException;

/**
 *
 * @author depot
 */
public class LoginInfoBean extends LoginInfo {

    private String userName = null;
    private String profile = null;

    public String loginAction(String userName) {
        this.userName = userName;
        //temporary does not work       

        // try {
        UserGroupInfoBean userCanidate = (UserGroupInfoBean) ViewUtils.eval(userName);
        User userGroup = (User) ModelUtils.getUserDAO();
        userGroup.setLoggedIn(true);
        ModelUtils.copy(userCanidate, userGroup);
        /*} catch (LoginException x) {
        ViewUtils.addExceptionMessage(x);
        return null;
        } catch (UnknownUserException x) {
        ViewUtils.addExceptionMessage(x);
        return null;
        } catch (IncorrectPasswordException x) {
        ViewUtils.addExceptionMessage(x);
        return null;
        }
         */

        return "profile";
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.