* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.usermgt;
-import org.wamblee.persistence.AbstractPersistent;
-
+import org.wamblee.security.AbstractPersistent;
import org.wamblee.security.encryption.MessageDigester;
import org.wamblee.usermgt.UserMgtException.Reason;
import java.util.Set;
import java.util.TreeSet;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
/**
* Represents a user. The methods for managing the groups of the user have
* package scope. Managing the groups of the user should be done through the
* {@link org.wamblee.usermgt.UserAdministration} interface.
*/
-public class User extends AbstractPersistent implements Serializable,
+@Entity
+@Table(name = "SEC_USER")
+public class User implements Serializable,
Comparable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long primaryKey;
+
+ @Version
+ private int version;
+
/**
* User name.
*/
/**
* Groups the user belongs to.
*/
+ @ManyToMany
private Set<Group> groups;
/**
* Password validator.
*/
+ @Transient
private NameValidator passwordValidator;
/**
* Password encoder.
*/
+ @Transient
private MessageDigester passwordEncoder;
/**
*
*/
public User(User aUser) {
- super(aUser);
name = aUser.name;
password = aUser.password;
groups = new TreeSet<Group>();
public int compareTo(Object aUser) {
return name.compareTo(((User) aUser).name);
}
+
+ public Long getPrimaryKey() {
+ return primaryKey;
+ }
}