package cbe.inserting.model; import org.apache.commons.codec.digest.DigestUtils; import cbe.inserting.model.auto._User; public class User extends _User { public boolean isAdmin() { if (getAdmin() != null && getAdmin() == Boolean.TRUE) return true; else return false; } /** * Override the default setPassword() method generated by Cayenne to * automatically hash the plain-text password before storing it in the * database. * * @see cbe.inserting.model.auto._User#setPassword(java.lang.String) */ @Override public void setPassword(String unencryptedPassword) { // A real password handler would do more than this. Read: // http://www.owasp.org/index.php/Hashing_Java super.setPassword(DigestUtils.shaHex(unencryptedPassword)); } }