| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StyleBo |
|
| 0.0;0 |
| 1 | /* | |
| 2 | * Copyright 2005-2008 The Kuali Foundation | |
| 3 | * | |
| 4 | * | |
| 5 | * Licensed under the Educational Community License, Version 2.0 (the "License") | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.opensource.org/licenses/ecl2.php | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.kuali.rice.core.impl.style | |
| 18 | ||
| 19 | import org.kuali.rice.core.api.style.Style | |
| 20 | import org.kuali.rice.core.api.style.StyleContract | |
| 21 | import org.kuali.rice.krad.bo.PersistableBusinessObjectBase | |
| 22 | ||
| 23 | /** | |
| 24 | * A BusinessObject implementation of the StyleContract which is mapped to the | |
| 25 | * database for persistence. | |
| 26 | * | |
| 27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 28 | */ | |
| 29 | class StyleBo extends PersistableBusinessObjectBase implements StyleContract { | |
| 30 | ||
| 31 | private static final long serialVersionUID = 2020611019976731725L | |
| 32 | ||
| 33 | Long styleId | |
| 34 | String name | |
| 35 | String xmlContent | |
| 36 | boolean active = true | |
| 37 | ||
| 38 | /** | |
| 39 | * Converts the given StyleBo to a Style object. | |
| 40 | * | |
| 41 | * @param styleBo the StyleBo to convert | |
| 42 | * @return the resulting Style object, or null if the given styleBo was null | |
| 43 | */ | |
| 44 | static Style to(StyleBo styleBo) { | |
| 45 | 2 | if (styleBo == null) { |
| 46 | 0 | return null |
| 47 | } | |
| 48 | 2 | return Style.Builder.create(styleBo).build() |
| 49 | } | |
| 50 | ||
| 51 | /** | |
| 52 | * Constructs a StyleBo from the given Style. | |
| 53 | * | |
| 54 | * @param style the Style to convert | |
| 55 | * @return the resulting StyleBo object, or null if the given style was null | |
| 56 | */ | |
| 57 | static StyleBo from(Style style) { | |
| 58 | 3 | if (style == null) { |
| 59 | 0 | return null |
| 60 | } | |
| 61 | 3 | StyleBo styleBo = new StyleBo() |
| 62 | 3 | styleBo.setStyleId(style.getStyleId()) |
| 63 | 3 | styleBo.setName(style.getName()) |
| 64 | 3 | styleBo.setXmlContent(style.getXmlContent()) |
| 65 | 3 | styleBo.setActive(style.isActive()) |
| 66 | 3 | styleBo.setVersionNumber(style.getVersionNumber()) |
| 67 | 3 | styleBo.setObjectId(style.getObjectId()) |
| 68 | 3 | return styleBo |
| 69 | } | |
| 70 | ||
| 71 | } |