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