// checks if the User key is a object of the persistent user subclass public void checkUKey(PersistenceManager pm) { List<Admin> admins = (List<Admin>) pm.newQuery(Admin.class).execute(); // current User key String cUkey = getUkey(); // set userKey null this.userKey = null; if (admins.size() != 0) { for (Admin admin : admins) { String ukey = "" + admin.getKey().getId(); if (ukey.equals(cUkey)) { // resets userKey if the user is found in correct subclass this.userKey = cUkey; } } } }
// Retrieves the user object // and gets the full user name public void user(PersistenceManager pm) { long adminKey = Long.parseLong(getUkey()); admin = pm.getObjectById(Admin.class, adminKey); this.userName = admin.getFirstName() + " " + admin.getLastName(); }