Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ComponentEbo |
|
| 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.core.framework.component | |
17 | ||
18 | import org.kuali.rice.core.api.component.Component | |
19 | import org.kuali.rice.core.api.component.ComponentContract | |
20 | import org.kuali.rice.krad.bo.ExternalizableBusinessObject | |
21 | import org.kuali.rice.core.api.mo.common.active.MutableInactivatable | |
22 | ||
23 | //@ToString | |
24 | class ComponentEbo implements ComponentContract, MutableInactivatable, ExternalizableBusinessObject { | |
25 | ||
26 | private static final long serialVersionUID = 1L; | |
27 | ||
28 | String namespaceCode | |
29 | String code | |
30 | String name | |
31 | String componentSetId | |
32 | boolean active = true | |
33 | Long versionNumber | |
34 | String objectId | |
35 | ||
36 | /** | |
37 | * Converts a mutable ebo to its immutable counterpart | |
38 | * @param bo the mutable business object | |
39 | * @return the immutable object | |
40 | */ | |
41 | static Component to(ComponentEbo bo) { | |
42 | 0 | if (bo == null) { |
43 | 0 | return null |
44 | } | |
45 | ||
46 | 0 | return Component.Builder.create(bo).build(); |
47 | } | |
48 | ||
49 | /** | |
50 | * Converts a immutable object to its mutable counterpart | |
51 | * @param im immutable object | |
52 | * @return the mutable bo | |
53 | */ | |
54 | static ComponentEbo from(Component im) { | |
55 | 0 | if (im == null) { |
56 | 0 | return null |
57 | } | |
58 | ||
59 | 0 | ComponentEbo bo = new ComponentEbo() |
60 | 0 | bo.code = im.code |
61 | 0 | bo.name = im.name |
62 | 0 | bo.componentSetId = im.componentSetId |
63 | 0 | bo.active = im.active |
64 | 0 | bo.namespaceCode = im.namespaceCode |
65 | 0 | bo.objectId = im.objectId |
66 | 0 | return bo; |
67 | } | |
68 | ||
69 | @Override | |
70 | void refresh() { } | |
71 | } |