View Javadoc
1   /******************************************************************************
2    * UserAttribute.java - Define one row in the User table of the database
3    * 
4    * BuckoVidLib - The BuckoSoft Video Library
5    * Copyright(c) 2015 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.BuckoVidLib.domain;
9   
10  import java.io.Serializable;
11  
12  import com.buckosoft.BuckoVidLib.util.HashCodeUtil;
13  
14  /** Define one row in the User table of the database.<br>
15   * By persisting the User attributes as a series of key/value entries (instead of a table row) we can define new attributes without redefining the table.<br>
16   * These are really private to {@link com.buckosoft.BuckoVidLib.domain.User}
17   * @author dick
18   * @since 2015-05-02
19   */
20  public class UserAttribute implements Serializable {
21  	private static final long serialVersionUID = 1L;
22  
23  	private	int		userId;
24  	private	String	key;
25  	private	String	value;
26  
27  
28  	/** Bean constructor */
29  	public UserAttribute() {}
30  	
31  	/** Convienence constructor
32  	 * @param userId The userId to set
33  	 * @param key The key to set
34  	 * @param value The value to set
35  	 */
36  	public UserAttribute(int userId, String key, String value) {
37  		this.userId = userId;
38  		this.key = key;
39  		this.value = value;
40  	}
41  	
42  	/* (non-Javadoc)
43  	 * @see java.lang.Object#equals(java.lang.Object)
44  	 */
45  	@Override
46  	public boolean equals(Object obj) {
47  		UserAttribute ua = (UserAttribute)obj;
48  		return(this.userId == ua.userId && this.key.equals(ua.key));
49  	}
50  	/* (non-Javadoc)
51  	 * @see java.lang.Object#hashCode()
52  	 */
53  	@Override
54  	public int hashCode() {
55  		int result = HashCodeUtil.SEED;
56  		result = HashCodeUtil.hash(result, userId);
57  		result = HashCodeUtil.hash(result, key);
58  		return(result);
59  	}
60  	/**
61  	 * @return the userId
62  	 */
63  	public int getUserId() {
64  		return userId;
65  	}
66  	/**
67  	 * @param userId the userId to set
68  	 */
69  	public void setUserId(int userId) {
70  		this.userId = userId;
71  	}
72  	/**
73  	 * @return the key
74  	 */
75  	public String getKey() {
76  		return key;
77  	}
78  	/**
79  	 * @param key the key to set
80  	 */
81  	public void setKey(String key) {
82  		this.key = key;
83  	}
84  	/**
85  	 * @return the value
86  	 */
87  	public String getValue() {
88  		return value;
89  	}
90  	/**
91  	 * @param value the value to set
92  	 */
93  	public void setValue(String value) {
94  		this.value = value;
95  	}
96  	
97  
98  }