Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimTypeBo |
|
| 0.0;0 | ||||
KimTypeBo$_from_closure1 |
|
| 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.type | |
17 | ||
18 | import org.kuali.rice.kim.api.type.KimType | |
19 | import org.kuali.rice.kim.api.type.KimTypeContract | |
20 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
21 | ||
22 | class KimTypeBo extends PersistableBusinessObjectBase implements KimTypeContract { | |
23 | String id | |
24 | String serviceName | |
25 | String namespaceCode | |
26 | String name | |
27 | List<KimTypeAttributeBo> attributeDefinitions | |
28 | boolean active | |
29 | ||
30 | /** | |
31 | * Converts a mutable bo to its immutable counterpart | |
32 | * @param bo the mutable business object | |
33 | * @return the immutable object | |
34 | */ | |
35 | static KimType to(KimTypeBo bo) { | |
36 | 0 | if (bo == null) { |
37 | 0 | return null |
38 | } | |
39 | ||
40 | 0 | return KimType.Builder.create(bo).build(); |
41 | } | |
42 | ||
43 | /** | |
44 | * Converts a immutable object to its mutable counterpart | |
45 | * @param im immutable object | |
46 | * @return the mutable bo | |
47 | */ | |
48 | static KimTypeBo from(KimType im) { | |
49 | 0 | if (im == null) { |
50 | 0 | return null |
51 | } | |
52 | ||
53 | 0 | KimTypeBo bo = new KimTypeBo() |
54 | 0 | bo.id = im.id |
55 | 0 | bo.serviceName = im.serviceName |
56 | 0 | bo.namespaceCode = im.namespaceCode |
57 | 0 | bo.name = im.name |
58 | 0 | bo.attributeDefinitions = im.attributeDefinitions != null ? im.attributeDefinitions.collect { KimTypeAttributeBo.from(it) } : new ArrayList() |
59 | 0 | bo.active = im.active |
60 | 0 | bo.versionNumber = im.versionNumber |
61 | 0 | bo.objectId = im.objectId |
62 | ||
63 | 0 | return bo |
64 | } | |
65 | } |