public abstract class SuperUser { protected String userName; protected String firstName; protected String lastName; public SuperUser(String uName, String fName, String lName) throws InvalidUserException { userName = uName; firstName = fName; lastName = lName; if (userName == null || userName.equals("")) { throw new Shared.Exceptions.InvalidUserException("User with empty username"); } } public String getUserName() { return userName; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String toString() { return this.getClass() + " Username = " + userName + " first name = " + firstName + " last name = " + lastName; } } ================================================================================== public class UserSignature extends SuperUser { private String password; private TreeMap applications; private int hashcode; public UserSignature(Element userElement) throws InvalidUserException { super(userElement.getAttribute("username").trim(), userElement.getAttribute("firstname").trim(), userElement.getAttribute("lastname").trim()); password = userElement.getAttribute("password").trim(); NodeList nodes = userElement.getElementsByTagName("application"); applications = new TreeMap(); for (int i = 0; i < nodes.getLength(); i++) { Element e = (Element)nodes.item(i); applications.put(e.getAttribute("name").trim(), e.getAttribute("role").trim()); } hashcode = userName.hashCode(); } public UserSignature(Task t) throws InvalidUserException { try { super(t.getUserName(), "", ""); } catch (InvalidUserException iue) { throw new InvalidTaskException(); } hashcode = userName.hashCode(); } public int hashCode() { return hashcode; } public boolean containsApplication(String appName) { return applications.containsKey(appName); } public boolean checkPassword(String apassword) { if (apassword != null) { return apassword.equals(password); } else return false; } public String toString() { return super.toString() + applications.toString(); } }