You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cmda.apache.org by xi...@apache.org on 2015/09/05 02:20:50 UTC

[46/50] [abbrv] incubator-cmda git commit: Change User model

Change User model

Project: http://git-wip-us.apache.org/repos/asf/incubator-cmda/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cmda/commit/33b4c3e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cmda/tree/33b4c3e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cmda/diff/33b4c3e2

Branch: refs/heads/master
Commit: 33b4c3e2c527c5fdb94621bd8130d09130ab612f
Parents: f6aa032
Author: mingqi830 <mq...@andrew.cmu.edu>
Authored: Fri Sep 4 16:45:24 2015 -0700
Committer: mingqi830 <mq...@andrew.cmu.edu>
Committed: Fri Sep 4 16:45:24 2015 -0700

----------------------------------------------------------------------
 app/models/User.java | 209 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 186 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/33b4c3e2/app/models/User.java
----------------------------------------------------------------------
diff --git a/app/models/User.java b/app/models/User.java
index 04cc9d3..becc703 100644
--- a/app/models/User.java
+++ b/app/models/User.java
@@ -14,28 +14,191 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package models;
 
-//import javax.persistence.*;
-//import play.db.ebean.*;
-//import com.avaje.ebean.*;
-//
-//@Entity
-//public class User extends Model {
-//
-//    @Id
-//    public String email;
-//    public String name;
-//    public String password;
-//    
-//    public User(String email, String name, String password) {
-//      this.email = email;
-//      this.name = name;
-//      this.password = password;
-//    }
-//
-//    public static Finder<String,User> find = new Finder<String,User>(
-//        String.class, User.class
-//    ); 
-//}
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+import play.data.validation.Constraints;
+
+@Entity
+public class User {
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.AUTO)
+	private long id;
+
+	private String userName;
+	@Constraints.Required
+	private String password;
+	@Constraints.Required
+	private String firstName;
+	@Constraints.Required
+	private String lastName;
+	private String middleInitial;
+	private String affiliation;
+	private String title;
+	@Constraints.Required
+	private String email;
+	private String mailingAddress;
+	private String phoneNumber;
+	private String faxNumber;
+	private String researchFields;
+	private String highestDegree;
+
+	// @OneToMany(mappedBy = "user", cascade={CascadeType.ALL})
+	// private Set<ClimateService> climateServices = new
+	// HashSet<ClimateService>();
+
+	public User() {
+	}
+
+	public User(String userName, String password, String firstName,
+			String lastName, String middleInitial, String affiliation,
+			String title, String email, String mailingAddress,
+			String phoneNumber, String faxNumber, String researchFields,
+			String highestDegree) {
+		super();
+		this.userName = userName;
+		this.password = password;
+		this.firstName = firstName;
+		this.lastName = lastName;
+		this.middleInitial = middleInitial;
+		this.affiliation = affiliation;
+		this.title = title;
+		this.email = email;
+		this.mailingAddress = mailingAddress;
+		this.phoneNumber = phoneNumber;
+		this.faxNumber = faxNumber;
+		this.researchFields = researchFields;
+		this.highestDegree = highestDegree;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public String getMiddleInitial() {
+		return middleInitial;
+	}
+
+	public String getAffiliation() {
+		return affiliation;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public String getMailingAddress() {
+		return mailingAddress;
+	}
+
+	public String getPhoneNumber() {
+		return phoneNumber;
+	}
+
+	public String getFaxNumber() {
+		return faxNumber;
+	}
+
+	public String getResearchFields() {
+		return researchFields;
+	}
+
+	public String getHighestDegree() {
+		return highestDegree;
+	}
+	
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	public void setMiddleInitial(String middleInitial) {
+		this.middleInitial = middleInitial;
+	}
+
+	public void setAffiliation(String affiliation) {
+		this.affiliation = affiliation;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public void setMailingAddress(String mailingAddress) {
+		this.mailingAddress = mailingAddress;
+	}
+
+	public void setPhoneNumber(String phoneNumber) {
+		this.phoneNumber = phoneNumber;
+	}
+
+	public void setFaxNumber(String faxNumber) {
+		this.faxNumber = faxNumber;
+	}
+
+	public void setResearchFields(String researchFields) {
+		this.researchFields = researchFields;
+	}
+
+	public void setHighestDegree(String highestDegree) {
+		this.highestDegree = highestDegree;
+	}
+
+	@Override
+	public String toString() {
+		return "User [id=" + id + ", userName=" + userName + ", password="
+				+ password + ", firstName=" + firstName + ", lastName="
+				+ lastName + ", middleInitial=" + middleInitial
+				+ ", affiliation=" + affiliation + ", title=" + title
+				+ ", email=" + email + ", mailingAddress=" + mailingAddress
+				+ ", phoneNumber=" + phoneNumber + ", faxNumber=" + faxNumber
+				+ ", researchFields=" + researchFields + ", highestDegree="
+				+ highestDegree + "]";
+	}
+
+}
+