Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
StyleBo |
|
| 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.impl.style | |
17 | ||
18 | import org.kuali.rice.core.api.style.Style | |
19 | import org.kuali.rice.core.api.style.StyleContract | |
20 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
21 | ||
22 | /** | |
23 | * A BusinessObject implementation of the StyleContract which is mapped to the | |
24 | * database for persistence. | |
25 | * | |
26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
27 | */ | |
28 | class StyleBo extends PersistableBusinessObjectBase implements StyleContract { | |
29 | ||
30 | private static final long serialVersionUID = 2020611019976731725L | |
31 | ||
32 | Long styleId | |
33 | String name | |
34 | String xmlContent | |
35 | boolean active = true | |
36 | ||
37 | /** | |
38 | * Converts the given StyleBo to a Style object. | |
39 | * | |
40 | * @param styleBo the StyleBo to convert | |
41 | * @return the resulting Style object, or null if the given styleBo was null | |
42 | */ | |
43 | static Style to(StyleBo styleBo) { | |
44 | 0 | if (styleBo == null) { |
45 | 0 | return null |
46 | } | |
47 | 0 | return Style.Builder.create(styleBo).build() |
48 | } | |
49 | ||
50 | /** | |
51 | * Constructs a StyleBo from the given Style. | |
52 | * | |
53 | * @param style the Style to convert | |
54 | * @return the resulting StyleBo object, or null if the given style was null | |
55 | */ | |
56 | static StyleBo from(Style style) { | |
57 | 0 | if (style == null) { |
58 | 0 | return null |
59 | } | |
60 | 0 | StyleBo styleBo = new StyleBo() |
61 | 0 | styleBo.setStyleId(style.getStyleId()) |
62 | 0 | styleBo.setName(style.getName()) |
63 | 0 | styleBo.setXmlContent(style.getXmlContent()) |
64 | 0 | styleBo.setActive(style.isActive()) |
65 | 0 | styleBo.setVersionNumber(style.getVersionNumber()) |
66 | 0 | styleBo.setObjectId(style.getObjectId()) |
67 | 0 | return styleBo |
68 | } | |
69 | ||
70 | } |