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