View Javadoc
1   /**
2    * Copyright 2005-2015 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.Cacheable;
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.Id;
22  import javax.persistence.IdClass;
23  import javax.persistence.Table;
24  import javax.persistence.Version;
25  
26  import org.kuali.rice.kew.api.preferences.Preferences;
27  
28  
29  /**
30   * An option defined for a user.  These are used to store user {@link Preferences}.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  @IdClass(UserOptionsId.class)
35  @Entity
36  @Table(name="KREW_USR_OPTN_T")
37  @Cacheable(false)
38  public class UserOptions implements Comparable<UserOptions> {
39  
40  	@Id
41  	@Column(name="PRNCPL_ID")
42  	private String workflowId;
43  
44  	@Id
45  	@Column(name="PRSN_OPTN_ID")
46  	private String optionId;
47  
48  	@Column(name="VAL")
49  	private String optionVal;
50  
51  	@Version
52  	@Column(name="VER_NBR")
53  	private Integer lockVerNbr;
54  
55  	public Integer getLockVerNbr() {
56  		return lockVerNbr;
57  	}
58  
59  	public String getOptionId() {
60  		return optionId;
61  	}
62  
63  	public String getOptionVal() {
64  		return optionVal;
65  	}
66  
67  	public String getWorkflowId() {
68  		return workflowId;
69  	}
70  
71  	public void setLockVerNbr(Integer integer) {
72  		lockVerNbr = integer;
73  	}
74  
75  	public void setOptionId(String string) {
76  		optionId = string;
77  	}
78  
79  	public void setOptionVal(String string) {
80  		optionVal = string;
81  	}
82  
83  	public void setWorkflowId(String string) {
84  	    workflowId = string;
85  	}
86  
87      /**
88       * Compares the given object is an instance of this class, then determines comparison based on the option id.
89       * @param o the object to compare with
90       * @return The value 0 if the option ID is equal; a value less than 0 if
91       * the Option ID is greater than this object's; and a value greater than 0 if the argument's
92       * Option ID less than this object's.
93       */
94      @Override
95      public int compareTo(UserOptions o) {
96          return getOptionId().compareTo(o.getOptionId());
97      }
98  
99  }
100