package com.aesthete.swingobjects.showcase;
import com.aesthete.swingobjects.fw.common.ErrorSeverity;
import com.aesthete.swingobjects.fw.common.SwingObjectsException;
import com.aesthete.swingobjects.fw.common.scope.ReqScopeConstants;
import com.aesthete.swingobjects.fw.common.util.CommonUtilities;
import com.aesthete.swingobjects.model.ActionMarker;
public class UserAction extends ActionMarker {
public UserAction(ReqScopeConstants scopeKey) {
super(scopeKey);
}
public void logon() {
try {
UserDto dto=(UserDto)scopeObj.getScopeObj();
/*
* This is where you go to your database to confirm that the
* user id and password exists in the database.
*/
if(!dto.getUserId().equals("swingobjects") || !dto.getPassword().equals("12345")) {
throw new SwingObjectsException("error.logonfailed", ErrorSeverity.ERROR, null, UserAction.class);
}
CommonUtilities.updateWaitDialogBoxMessage("\nChecking database...");
Thread.sleep(4000);
CommonUtilities.updateWaitDialogBoxMessage("Done");
dto.setUserName("SwingObjects User 1");
} catch(SwingObjectsException e){
scopeObj.setErrorObj(e);
}catch (Exception e) {
scopeObj.setErrorObj(new SwingObjectsException("error.severe.SF001", ErrorSeverity.SEVERE, null, e, UserAction.class));
}
}
}