Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimAttributeBo |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright 2006-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.kuali.rice.kim.impl.common.attribute | |
18 | ||
19 | import org.kuali.rice.kim.api.common.attribute.KimAttribute | |
20 | import org.kuali.rice.kim.api.common.attribute.KimAttributeContract | |
21 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
22 | ||
23 | class KimAttributeBo extends PersistableBusinessObjectBase implements KimAttributeContract { | |
24 | private static final long serialVersionUID = 1L; | |
25 | ||
26 | String id | |
27 | String componentName | |
28 | String attributeName | |
29 | String namespaceCode | |
30 | String attributeLabel | |
31 | boolean active | |
32 | ||
33 | /** | |
34 | * Converts a mutable bo to its immutable counterpart | |
35 | * @param bo the mutable business object | |
36 | * @return the immutable object | |
37 | */ | |
38 | static KimAttribute to(KimAttributeBo bo) { | |
39 | 0 | if (bo == null) { |
40 | 0 | return null |
41 | } | |
42 | ||
43 | 0 | return KimAttribute.Builder.create(bo).build(); |
44 | } | |
45 | ||
46 | /** | |
47 | * Converts a immutable object to its mutable counterpart | |
48 | * @param im immutable object | |
49 | * @return the mutable bo | |
50 | */ | |
51 | static KimAttributeBo from(KimAttribute im) { | |
52 | 2 | if (im == null) { |
53 | 2 | return null |
54 | } | |
55 | ||
56 | 0 | KimAttributeBo bo = new KimAttributeBo() |
57 | 0 | bo.id = im.id |
58 | 0 | bo.componentName = im.componentName |
59 | 0 | bo.attributeName = im.attributeName |
60 | 0 | bo.namespaceCode = im.namespaceCode |
61 | 0 | bo.attributeLabel = im.attributeLabel |
62 | 0 | bo.active = im.active |
63 | 0 | bo.versionNumber = im.versionNumber |
64 | 0 | bo.objectId = im.objectId |
65 | ||
66 | 0 | return bo |
67 | } | |
68 | } |