Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KrmsTypeBo |
|
| 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.krms.impl.repository | |
17 | ||
18 | import org.kuali.rice.core.api.mo.common.active.MutableInactivatable | |
19 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
20 | import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinitionContract | |
21 | ||
22 | public class KrmsTypeBo extends PersistableBusinessObjectBase implements MutableInactivatable, KrmsTypeDefinitionContract { | |
23 | ||
24 | def String id | |
25 | def String name | |
26 | def String namespace | |
27 | def String serviceName | |
28 | def boolean active | |
29 | def List<KrmsTypeAttributeBo> attributes | |
30 | /** | |
31 | * Converts a mutable bo to it's immutable counterpart | |
32 | * @param bo the mutable business object | |
33 | * @return the immutable object | |
34 | */ | |
35 | static org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition to(KrmsTypeBo bo) { | |
36 | 0 | if (bo == null) { return null } |
37 | 0 | return org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition.Builder.create(bo).build(); |
38 | } | |
39 | ||
40 | /** | |
41 | * Converts a immutable object to it's mutable bo counterpart | |
42 | * @param im immutable object | |
43 | * @return the mutable bo | |
44 | */ | |
45 | static KrmsTypeBo from(org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition im) { | |
46 | 0 | if (im == null) { return null } |
47 | ||
48 | 0 | KrmsTypeBo bo = new KrmsTypeBo() |
49 | 0 | bo.id = im.id |
50 | 0 | bo.name = im.name |
51 | 0 | bo.namespace = im.namespace |
52 | 0 | bo.serviceName = im.serviceName |
53 | 0 | bo.active = (im.active == null) ? true : im.active; |
54 | 0 | bo.attributes = new ArrayList<KrmsTypeAttributeBo>() |
55 | 0 | for( attr in im.attributes ){ |
56 | 0 | bo.attributes.add(KrmsTypeAttributeBo.from(attr)) |
57 | } | |
58 | 0 | bo.versionNumber = im.versionNumber |
59 | 0 | return bo |
60 | } | |
61 | ||
62 | } |