| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.r2.core.class1.enumerationmanagement.model; |
| 17 | |
|
| 18 | |
import java.util.List; |
| 19 | |
|
| 20 | |
import javax.persistence.CascadeType; |
| 21 | |
import javax.persistence.Column; |
| 22 | |
import javax.persistence.Entity; |
| 23 | |
import javax.persistence.FetchType; |
| 24 | |
import javax.persistence.ManyToMany; |
| 25 | |
import javax.persistence.Table; |
| 26 | |
import javax.persistence.UniqueConstraint; |
| 27 | |
|
| 28 | |
import org.kuali.student.r2.common.entity.MetaEntity; |
| 29 | |
import org.kuali.student.r2.core.enumerationmanagement.dto.EnumContextValueInfo; |
| 30 | |
import org.kuali.student.r2.core.enumerationmanagement.infc.EnumContextValue; |
| 31 | |
|
| 32 | |
@Entity |
| 33 | |
@Table(name="KSEN_CTX_T", uniqueConstraints={@UniqueConstraint(columnNames={"CTX_KEY", "CTX_VAL"})}) |
| 34 | |
public class EnumContextValueEntity extends MetaEntity { |
| 35 | |
|
| 36 | |
@Column(name="CTX_KEY") |
| 37 | |
String contextKey; |
| 38 | |
|
| 39 | |
@Column(name="CTX_VAL") |
| 40 | |
String contextValue; |
| 41 | |
|
| 42 | |
@ManyToMany(mappedBy="contextValueEntities", fetch = FetchType.LAZY,cascade = CascadeType.ALL) |
| 43 | |
List<EnumeratedValueEntity> enumeratedValueList; |
| 44 | |
|
| 45 | 0 | public EnumContextValueEntity() { |
| 46 | 0 | } |
| 47 | |
|
| 48 | |
public EnumContextValueEntity(EnumContextValue enumContextValue) { |
| 49 | 0 | super(enumContextValue); |
| 50 | 0 | this.setContextKey(enumContextValue.getKey()); |
| 51 | 0 | this.setContextValue(enumContextValue.getValue()); |
| 52 | 0 | } |
| 53 | |
|
| 54 | |
public String getContextKey() { |
| 55 | 0 | return contextKey; |
| 56 | |
} |
| 57 | |
|
| 58 | |
public void setContextKey(String type) { |
| 59 | 0 | this.contextKey = type; |
| 60 | 0 | } |
| 61 | |
|
| 62 | |
public String getContextValue() { |
| 63 | 0 | return contextValue; |
| 64 | |
} |
| 65 | |
|
| 66 | |
public void setContextValue(String value) { |
| 67 | 0 | this.contextValue = value; |
| 68 | 0 | } |
| 69 | |
|
| 70 | |
public List<EnumeratedValueEntity> getEnumeratedValueList() { |
| 71 | 0 | return enumeratedValueList; |
| 72 | |
} |
| 73 | |
public void setEnumeratedValueList( |
| 74 | |
List<EnumeratedValueEntity> enumeratedValueList) { |
| 75 | 0 | this.enumeratedValueList = enumeratedValueList; |
| 76 | 0 | } |
| 77 | |
|
| 78 | |
public EnumContextValueInfo toDto() { |
| 79 | 0 | EnumContextValueInfo context = new EnumContextValueInfo(); |
| 80 | 0 | context.setMeta(super.toDTO()); |
| 81 | 0 | context.setKey(this.getContextKey()); |
| 82 | 0 | context.setValue(this.getContextValue()); |
| 83 | 0 | return context; |
| 84 | |
} |
| 85 | |
|
| 86 | |
} |