001/** 002 * Copyright 2005-2017 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.useroptions; 017 018import javax.persistence.Cacheable; 019import javax.persistence.Column; 020import javax.persistence.Entity; 021import javax.persistence.Id; 022import javax.persistence.IdClass; 023import javax.persistence.Table; 024import javax.persistence.Version; 025 026import org.kuali.rice.kew.api.preferences.Preferences; 027 028 029/** 030 * An option defined for a user. These are used to store user {@link Preferences}. 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034@IdClass(UserOptionsId.class) 035@Entity 036@Table(name="KREW_USR_OPTN_T") 037@Cacheable(false) 038public class UserOptions implements Comparable<UserOptions> { 039 040 @Id 041 @Column(name="PRNCPL_ID") 042 private String workflowId; 043 044 @Id 045 @Column(name="PRSN_OPTN_ID") 046 private String optionId; 047 048 @Column(name="VAL") 049 private String optionVal; 050 051 @Version 052 @Column(name="VER_NBR") 053 private Integer lockVerNbr; 054 055 public Integer getLockVerNbr() { 056 return lockVerNbr; 057 } 058 059 public String getOptionId() { 060 return optionId; 061 } 062 063 public String getOptionVal() { 064 return optionVal; 065 } 066 067 public String getWorkflowId() { 068 return workflowId; 069 } 070 071 public void setLockVerNbr(Integer integer) { 072 lockVerNbr = integer; 073 } 074 075 public void setOptionId(String string) { 076 optionId = string; 077 } 078 079 public void setOptionVal(String string) { 080 optionVal = string; 081 } 082 083 public void setWorkflowId(String string) { 084 workflowId = string; 085 } 086 087 /** 088 * Compares the given object is an instance of this class, then determines comparison based on the option id. 089 * @param o the object to compare with 090 * @return The value 0 if the option ID is equal; a value less than 0 if 091 * the Option ID is greater than this object's; and a value greater than 0 if the argument's 092 * Option ID less than this object's. 093 */ 094 @Override 095 public int compareTo(UserOptions o) { 096 return getOptionId().compareTo(o.getOptionId()); 097 } 098 099} 100