Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimAttributeBo |
|
| 0.0;0 |
1 | /** | |
2 | * Copyright 2005-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 | package org.kuali.rice.kim.impl.common.attribute | |
17 | ||
18 | import org.kuali.rice.kim.api.common.attribute.KimAttribute | |
19 | import org.kuali.rice.kim.api.common.attribute.KimAttributeContract | |
20 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
21 | ||
22 | class KimAttributeBo extends PersistableBusinessObjectBase implements KimAttributeContract { | |
23 | private static final long serialVersionUID = 1L; | |
24 | ||
25 | String id | |
26 | String componentName | |
27 | String attributeName | |
28 | String namespaceCode | |
29 | String attributeLabel | |
30 | boolean active | |
31 | ||
32 | /** | |
33 | * Converts a mutable bo to its immutable counterpart | |
34 | * @param bo the mutable business object | |
35 | * @return the immutable object | |
36 | */ | |
37 | static KimAttribute to(KimAttributeBo bo) { | |
38 | 0 | if (bo == null) { |
39 | 0 | return null |
40 | } | |
41 | ||
42 | 0 | return KimAttribute.Builder.create(bo).build(); |
43 | } | |
44 | ||
45 | /** | |
46 | * Converts a immutable object to its mutable counterpart | |
47 | * @param im immutable object | |
48 | * @return the mutable bo | |
49 | */ | |
50 | static KimAttributeBo from(KimAttribute im) { | |
51 | 2 | if (im == null) { |
52 | 2 | return null |
53 | } | |
54 | ||
55 | 0 | KimAttributeBo bo = new KimAttributeBo() |
56 | 0 | bo.id = im.id |
57 | 0 | bo.componentName = im.componentName |
58 | 0 | bo.attributeName = im.attributeName |
59 | 0 | bo.namespaceCode = im.namespaceCode |
60 | 0 | bo.attributeLabel = im.attributeLabel |
61 | 0 | bo.active = im.active |
62 | 0 | bo.versionNumber = im.versionNumber |
63 | 0 | bo.objectId = im.objectId |
64 | ||
65 | 0 | return bo |
66 | } | |
67 | } |