001 /**
002 *
003 */
004 package de.jw.cloud42.core.domain;
005
006
007 import java.util.List;
008
009 import javax.persistence.CascadeType;
010 import javax.persistence.Column;
011 import javax.persistence.Entity;
012 import javax.persistence.FetchType;
013 import javax.persistence.OneToMany;
014 import javax.persistence.OneToOne;
015 import javax.persistence.UniqueConstraint;
016
017
018
019 import org.hibernate.annotations.Cascade;
020
021 /**
022 *
023 * Represents an user (of the webapp).
024 *
025 * @author fbitzer
026 *
027 */
028 @Entity
029 public class User extends AutoIdObject{
030
031
032 private String name;
033 private String password;
034
035 private String regionUrl;
036
037 public String getRegionUrl() {
038 return regionUrl;
039 }
040
041 public void setRegionUrl(String regionUrl) {
042 this.regionUrl = regionUrl;
043 }
044
045 private List<KeypairMapping> keys;
046
047
048 /**
049 * the user's AWS credentials.
050 */
051 private AwsCredentials credentials;
052
053 /**
054 * @return the name
055 */
056 @Column(unique=true)
057 public String getName() {
058 return name;
059 }
060
061 /**
062 * @param name the name to set
063 */
064 public void setName(String name) {
065 this.name = name;
066 }
067
068 /**
069 * @return the password
070 */
071 public String getPassword() {
072 return password;
073 }
074
075 /**
076 * @param password the password to set
077 */
078 public void setPassword(String password) {
079 this.password = password;
080 }
081
082 /**
083 * @return the crendentials
084 */
085
086 @OneToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
087 @Cascade({org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
088 public AwsCredentials getCredentials() {
089 return credentials;
090 }
091
092 /**
093 * @param crendentials the crendentials to set
094 */
095 public void setCredentials(AwsCredentials credentials) {
096 this.credentials = credentials;
097 }
098
099 /**
100 * @return the keys
101 */
102 @OneToMany(fetch=FetchType.EAGER)
103 public List<KeypairMapping> getKeys() {
104 return keys;
105 }
106
107 /**
108 * @param keys the keys to set
109 */
110 public void setKeys(List<KeypairMapping> keys) {
111 this.keys = keys;
112 }
113
114
115
116 }