1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.coreservice.impl.namespace;
17
18 import org.apache.commons.lang.builder.HashCodeBuilder;
19 import org.apache.commons.lang.builder.EqualsBuilder;
20 import org.kuali.rice.coreservice.api.namespace.Namespace;
21 import org.kuali.rice.coreservice.framework.namespace.NamespaceEbo;
22 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
24
25 import javax.persistence.Column;
26 import javax.persistence.Convert;
27 import javax.persistence.Entity;
28 import javax.persistence.Id;
29 import javax.persistence.Table;
30
31 @Entity
32 @Table(name="KRCR_NMSPC_T")
33 public class NamespaceBo extends PersistableBusinessObjectBase implements NamespaceEbo {
34
35 private static final long serialVersionUID = 1L;
36
37 @Column(name="APPL_ID")
38 private String applicationId;
39
40 @Id
41 @Column(name="NMSPC_CD")
42 private String code;
43
44 @Column(name="NM")
45 private String name;
46
47 @Column(name="ACTV_IND")
48 @Convert(converter = BooleanYNConverter.class)
49 private boolean active = true;
50
51 @Override
52 public String getApplicationId() {
53 return applicationId;
54 }
55
56 public void setApplicationId(String applicationId) {
57 this.applicationId = applicationId;
58 }
59
60 @Override
61 public String getCode() {
62 return code;
63 }
64
65 public void setCode(String code) {
66 this.code = code;
67 }
68
69 @Override
70 public String getName() {
71 return name;
72 }
73
74 public void setName(String name) {
75 this.name = name;
76 }
77
78 @Override
79 public boolean isActive() {
80 return active;
81 }
82
83 public void setActive(boolean active) {
84 this.active = active;
85 }
86
87
88
89
90
91
92 public static Namespace to(NamespaceBo bo) {
93 if (bo == null) {
94 return null;
95 }
96
97 return Namespace.Builder.create(bo).build();
98 }
99
100
101
102
103
104
105 public static NamespaceBo from(Namespace im) {
106 if (im == null) {
107 return null;
108 }
109
110 NamespaceBo bo = new NamespaceBo();
111 bo.applicationId = im.getApplicationId();
112 bo.active = im.isActive();
113 bo.code = im.getCode();
114 bo.name = im.getName();
115 bo.versionNumber = im.getVersionNumber();
116 bo.objectId = im.getObjectId();
117
118 return bo;
119 }
120
121 @Override
122 public boolean equals(Object o) {
123 if (this == o) {
124 return true;
125 }
126
127 if (o == null || getClass() != o.getClass()) {
128 return false;
129 }
130
131 return EqualsBuilder.reflectionEquals(o, this);
132 }
133
134 @Override
135 public int hashCode() {
136 return HashCodeBuilder.reflectionHashCode(this);
137 }
138
139 }