001 /** 002 * Copyright 2005-2012 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 */ 016 package org.kuali.rice.kew.useroptions; 017 018 import javax.persistence.Column; 019 import javax.persistence.Entity; 020 import javax.persistence.Id; 021 import javax.persistence.IdClass; 022 import javax.persistence.NamedQueries; 023 import javax.persistence.NamedQuery; 024 import javax.persistence.Table; 025 import javax.persistence.Version; 026 027 import org.kuali.rice.kew.api.preferences.Preferences; 028 029 030 /** 031 * An option defined for a user. These are used to store user {@link Preferences}. 032 * 033 * @author Kuali Rice Team (rice.collab@kuali.org) 034 */ 035 @IdClass(org.kuali.rice.kew.useroptions.UserOptionsId.class) 036 @Entity 037 @Table(name="KREW_USR_OPTN_T") 038 @NamedQueries({ 039 @NamedQuery(name="UserOptions.FindByUserQualified", query="select uo from UserOptions uo where uo.workflowId = :workflowId and uo.optionId like :optionId"), 040 @NamedQuery(name="UserOptions.FindByWorkflowId", query="select uo from UserOptions uo where uo.workflowId = :workflowId"), 041 @NamedQuery(name="UserOptions.FindByOptionValue", query="select uo from UserOptions uo where uo.optionId = :optionId and uo.optionVal = :optionValue"), 042 @NamedQuery(name="UserOptions.FindByOptionId", query="select uo from UserOptions uo where uo.optionId = :optionId and uo.workflowId = :workflowId"), 043 @NamedQuery(name="UserOptions.FindEmailUserOptionsByType", query="select uo from UserOptions uo where (uo.optionId = :optionId or uo.optionId like :optionIdLike) and uo.optionVal = :optionValue") 044 }) 045 public class UserOptions implements Comparable { 046 047 @Id 048 @Column(name="PRNCPL_ID",insertable=false,updatable=false) 049 private String workflowId; 050 @Id 051 @Column(name="PRSN_OPTN_ID",insertable=false,updatable=false) 052 private String optionId; 053 @Column(name="VAL") 054 private String optionVal; 055 @Version 056 @Column(name="VER_NBR") 057 private Integer lockVerNbr; 058 059 /** 060 * @return 061 */ 062 public Integer getLockVerNbr() { 063 return lockVerNbr; 064 } 065 066 /** 067 * @return 068 */ 069 public String getOptionId() { 070 return optionId; 071 } 072 073 /** 074 * @return 075 */ 076 public String getOptionVal() { 077 return optionVal; 078 } 079 080 /** 081 * @return 082 */ 083 public String getWorkflowId() { 084 return workflowId; 085 } 086 087 /** 088 * @param integer 089 */ 090 public void setLockVerNbr(Integer integer) { 091 lockVerNbr = integer; 092 } 093 094 /** 095 * @param string 096 */ 097 public void setOptionId(String string) { 098 optionId = string; 099 } 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