| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.core.impl.component; |
| 17 | |
|
| 18 | |
|
| 19 | |
import javax.persistence.Column |
| 20 | |
import javax.persistence.Entity |
| 21 | |
import javax.persistence.FetchType |
| 22 | |
import javax.persistence.Id |
| 23 | |
import javax.persistence.IdClass |
| 24 | |
import javax.persistence.JoinColumn |
| 25 | |
import javax.persistence.ManyToOne |
| 26 | |
import javax.persistence.Table |
| 27 | |
|
| 28 | |
import org.hibernate.annotations.Type |
| 29 | |
import org.kuali.rice.core.api.component.Component |
| 30 | |
import org.kuali.rice.core.api.component.ComponentContract |
| 31 | |
import org.kuali.rice.core.impl.namespace.NamespaceBo |
| 32 | |
import org.kuali.rice.core.api.mo.common.active.MutableInactivatable |
| 33 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
| 34 | |
|
| 35 | |
@IdClass(ComponentId.class) |
| 36 | |
@Entity |
| 37 | |
@Table(name="KRCR_CMPNT_T") |
| 38 | |
public class ComponentBo extends PersistableBusinessObjectBase implements ComponentContract, MutableInactivatable { |
| 39 | |
|
| 40 | |
private static final long serialVersionUID = 1L; |
| 41 | |
|
| 42 | |
@Id |
| 43 | |
@Column(name="NMSPC_CD") |
| 44 | |
String namespaceCode; |
| 45 | |
|
| 46 | |
@Id |
| 47 | |
@Column(name="CMPNT_CD") |
| 48 | |
String code; |
| 49 | |
|
| 50 | |
@Column(name="NM") |
| 51 | |
String name; |
| 52 | |
|
| 53 | |
@Type(type="yes_no") |
| 54 | |
@Column(name="ACTV_IND") |
| 55 | |
boolean active = true; |
| 56 | |
|
| 57 | |
@ManyToOne(fetch=FetchType.LAZY) |
| 58 | |
@JoinColumn(name="NMSPC_CD", insertable=false, updatable=false) |
| 59 | |
NamespaceBo namespace; |
| 60 | |
|
| 61 | |
@Override |
| 62 | |
String getComponentSetId() { |
| 63 | 0 | return null; |
| 64 | |
} |
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
static Component to(ComponentBo bo) { |
| 72 | 0 | if (bo == null) { |
| 73 | 0 | return null |
| 74 | |
} |
| 75 | |
|
| 76 | 0 | return Component.Builder.create(bo).build(); |
| 77 | |
} |
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
static ComponentBo from(Component im) { |
| 85 | 0 | if (im == null) { |
| 86 | 0 | return null |
| 87 | |
} |
| 88 | |
|
| 89 | 0 | ComponentBo bo = new ComponentBo() |
| 90 | 0 | bo.code = im.code |
| 91 | 0 | bo.name = im.name |
| 92 | 0 | bo.active = im.active |
| 93 | 0 | bo.namespaceCode = im.namespaceCode |
| 94 | 0 | bo.versionNumber = im.versionNumber |
| 95 | 0 | bo.objectId = im.objectId |
| 96 | |
|
| 97 | 0 | return bo; |
| 98 | |
} |
| 99 | |
} |
| 100 | |
|