View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.server.applicationstate.entity;
17  
18  import java.util.List;
19  
20  import javax.persistence.CascadeType;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.Id;
24  import javax.persistence.JoinTable;
25  import javax.persistence.NamedQueries;
26  import javax.persistence.NamedQuery;
27  import javax.persistence.OneToMany;
28  import javax.persistence.PrePersist;
29  import javax.persistence.Table;
30  import javax.persistence.UniqueConstraint;
31  
32  import org.kuali.student.common.util.UUIDHelper;
33  
34  @Deprecated
35  @Entity
36  @Table(name = "KSAP_APP_STATE_T", 
37         uniqueConstraints={@UniqueConstraint(columnNames={"APPLICATION_ID", "REFERENCE_KEY", "REFERENCE_TYPE", "USER_ID"})})
38  @NamedQueries( {
39          @NamedQuery(name = "ApplicationState.getApplicationStateByAppRefUserId", query = "SELECT appState FROM ApplicationState appState WHERE appState.applicationId =:applicationId AND appState.referenceKey =:referenceKey AND appState.referenceType =:referenceType AND appState.userId =:userId")
40  } )
41  public class ApplicationState {
42  
43  	@Id
44      @Column(name = "ID")
45  	private String id;
46  	
47  	@Column(name = "APPLICATION_ID", nullable=false)
48  	private String applicationId;
49  
50  	@Column(name = "REFERENCE_KEY", nullable=false)
51  	private String referenceKey;
52  
53  	@Column(name = "REFERENCE_TYPE", nullable=false)
54  	private String referenceType;
55  
56  	@Column(name = "USER_ID", nullable=false)
57  	private String userId;
58  
59  	@OneToMany(cascade = CascadeType.ALL)
60  	@JoinTable(name="KS_APP_ST_JN_KEY_VALUE")	
61  	private List<KeyValuePair> keyValueList;
62  
63  	/**
64  	 * AutoGenerate the Id
65  	 */
66  	@PrePersist
67  	public void prePersist() {
68  		this.id = UUIDHelper.genStringUUID(this.id);
69  	}
70  
71  	public String getId() {
72  		return id;
73  	}
74  
75  	public void setId(String id) {
76  		this.id = id;
77  	}
78  
79  	public String getApplicationId() {
80  		return applicationId;
81  	}
82  
83  	public void setApplicationId(String applicationId) {
84  		this.applicationId = applicationId;
85  	}
86  	
87  	public String getReferenceKey() {
88  		return referenceKey;
89  	}
90  	
91  	public void setReferenceKey(String referenceKey) {
92  		this.referenceKey = referenceKey;
93  	}
94  	
95  	public String getReferenceType() {
96  		return referenceType;
97  	}
98  	
99  	public void setReferenceType(String referenceType) {
100 		this.referenceType = referenceType;
101 	}
102 	
103 	public String getUserId() {
104 		return userId;
105 	}
106 	
107 	public void setUserId(String userId) {
108 		this.userId = userId;
109 	}
110 
111 	public List<KeyValuePair> getKeyValueList() {
112 		return keyValueList;
113 	}
114 
115 	public void setKeyValueList(List<KeyValuePair> keyValueList) {
116 		this.keyValueList = keyValueList;
117 	}
118 
119 	@Override
120 	public String toString() {
121 		return "ApplicationState[id=" + id + ", applicationId=" + applicationId 
122 				+ ", referenceKey=" + referenceKey + ", referenceType="
123 				+ referenceType + ", userId=" + userId + "]";
124 	}
125 }