View Javadoc

1   /**
2    * Copyright 2005-2013 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    @NamedQuery(name="UserOptions.FindEmailUserOptionsByType", query="select uo from UserOptions uo where (uo.optionId = :optionId or uo.optionId like :optionIdLike) and uo.optionVal = :optionValue")
44  })
45  public class UserOptions implements Comparable {
46  
47  	@Id
48  	@Column(name="PRNCPL_ID",insertable=false,updatable=false)
49  	private String workflowId;
50  	@Id
51  	@Column(name="PRSN_OPTN_ID",insertable=false,updatable=false)
52  	private String optionId;
53  	@Column(name="VAL")
54  	private String optionVal;
55  	@Version
56  	@Column(name="VER_NBR")
57  	private Integer lockVerNbr;
58  
59  	/**
60  	 * @return
61  	 */
62  	public Integer getLockVerNbr() {
63  		return lockVerNbr;
64  	}
65  
66  	/**
67  	 * @return
68  	 */
69  	public String getOptionId() {
70  		return optionId;
71  	}
72  
73  	/**
74  	 * @return
75  	 */
76  	public String getOptionVal() {
77  		return optionVal;
78  	}
79  
80  	/**
81  	 * @return
82  	 */
83  	public String getWorkflowId() {
84  		return workflowId;
85  	}
86  
87  	/**
88  	 * @param integer
89  	 */
90  	public void setLockVerNbr(Integer integer) {
91  		lockVerNbr = integer;
92  	}
93  
94  	/**
95  	 * @param string
96  	 */
97  	public void setOptionId(String string) {
98  		optionId = string;
99  	}
100 
101 	/**
102 	 * @param string
103 	 */
104 	public void setOptionVal(String string) {
105 		optionVal = string;
106 	}
107 
108 	/**
109 	 * @param string
110 	 */
111 	public void setWorkflowId(String string) {
112 	    workflowId = string;
113 	}
114 
115 	
116     public int compareTo(Object o) {
117         if (o instanceof UserOptions) {
118             return this.getOptionId().compareTo(((UserOptions)o).getOptionId());
119         }
120         return 0;
121     }
122 }
123