Sistema di Login teoricamente completo. Nel main la classe LoginData si occupa di fare tutto. Per richiamare chi è loggato basta chiamare il metodo .getUserName. Per richiamre il tipo di account .getType. Per stamapre le info di chi è loggato .getUserDataInfo
This commit is contained in:
49
it/unisa/info13d/Login/LoginData.java
Normal file
49
it/unisa/info13d/Login/LoginData.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package it.unisa.info13d.Login;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created with MONSTER.
|
||||
* User: xgiovio
|
||||
* Date: 17/12/13
|
||||
* Time: 1.47
|
||||
*/
|
||||
public class LoginData {
|
||||
|
||||
public LoginData () throws FileNotFoundException,IOException,ClassNotFoundException{
|
||||
|
||||
LoggedUser logged_user = new LoggedUser();
|
||||
boolean AccountType = true;
|
||||
AccountType = Access.get_access(logged_user);
|
||||
|
||||
type = convert_type (AccountType);
|
||||
username = logged_user.logged_user;
|
||||
|
||||
}
|
||||
|
||||
protected String convert_type (boolean value){
|
||||
if (value == false)
|
||||
return "Admin";
|
||||
return "Client";
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void getUserDataInfo (){
|
||||
|
||||
System.out.println("***************************************");
|
||||
System.out.println("Utente Loggato : " + username);
|
||||
System.out.println("AccoutType : " + type );
|
||||
System.out.println("***************************************");
|
||||
}
|
||||
|
||||
private String username;
|
||||
private String type;
|
||||
}
|
||||
Reference in New Issue
Block a user