View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.useroptions;
17  
18  import javax.persistence.Column;
19  import javax.persistence.Entity;
20  import javax.persistence.Id;
21  import javax.persistence.IdClass;
22  import javax.persistence.NamedQueries;
23  import javax.persistence.NamedQuery;
24  import javax.persistence.Table;
25  import javax.persistence.Version;
26  
27  import org.kuali.rice.kew.api.preferences.Preferences;
28  
29  
30  /**
31   * An option defined for a user.  These are used to store user {@link Preferences}.
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @IdClass(org.kuali.rice.kew.useroptions.UserOptionsId.class)
36  @Entity
37  @Table(name="KREW_USR_OPTN_T")
38  @NamedQueries({
39    @NamedQuery(name="UserOptions.FindByUserQualified", query="select uo from UserOptions uo where uo.workflowId = :workflowId and uo.optionId like :optionId"), 
40    @NamedQuery(name="UserOptions.FindByWorkflowId",  query="select uo from UserOptions uo where uo.workflowId = :workflowId"),
41    @NamedQuery(name="UserOptions.FindByOptionValue", query="select uo from UserOptions uo where uo.optionId = :optionId and uo.optionVal = :optionValue"),
42    @NamedQuery(name="UserOptions.FindByOptionId", query="select uo from UserOptions uo where uo.optionId = :optionId and uo.workflowId = :workflowId")
43  })
44  public class UserOptions implements Comparable {
45  
46  	@Id
47  	@Column(name="PRNCPL_ID",insertable=false,updatable=false)
48  	private String workflowId;
49  	@Id
50  	@Column(name="PRSN_OPTN_ID",insertable=false,updatable=false)
51  	private String optionId;
52  	@Column(name="VAL")
53  	private String optionVal;
54  	@Version
55  	@Column(name="VER_NBR")
56  	private Integer lockVerNbr;
57  
58  	/**
59  	 * @return
60  	 */
61  	public Integer getLockVerNbr() {
62  		return lockVerNbr;
63  	}
64  
65  	/**
66  	 * @return
67  	 */
68  	public String getOptionId() {
69  		return optionId;
70  	}
71  
72  	/**
73  	 * @return
74  	 */
75  	public String getOptionVal() {
76  		return optionVal;
77  	}
78  
79  	/**
80  	 * @return
81  	 */
82  	public String getWorkflowId() {
83  		return workflowId;
84  	}
85  
86  	/**
87  	 * @param integer
88  	 */
89  	public void setLockVerNbr(Integer integer) {
90  		lockVerNbr = integer;
91  	}
92  
93  	/**
94  	 * @param string
95  	 */
96  	public void setOptionId(String string) {
97  		optionId = string;
98  	}
99  
100 	/**
101 	 * @param string
102 	 */
103 	public void setOptionVal(String string) {
104 		optionVal = string;
105 	}
106 
107 	/**
108 	 * @param string
109 	 */
110 	public void setWorkflowId(String string) {
111 	    workflowId = string;
112 	}
113 
114 	
115     public int compareTo(Object o) {
116         if (o instanceof UserOptions) {
117             return this.getOptionId().compareTo(((UserOptions)o).getOptionId());
118         }
119         return 0;
120     }
121 }
122