| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.core.impl.style; |
| 18 | |
|
| 19 | |
import javax.persistence.Basic; |
| 20 | |
import javax.persistence.Column; |
| 21 | |
import javax.persistence.Entity; |
| 22 | |
import javax.persistence.FetchType; |
| 23 | |
import javax.persistence.GeneratedValue; |
| 24 | |
import javax.persistence.Id; |
| 25 | |
import javax.persistence.Lob; |
| 26 | |
import javax.persistence.Table; |
| 27 | |
|
| 28 | |
import org.hibernate.annotations.GenericGenerator; |
| 29 | |
import org.hibernate.annotations.Parameter; |
| 30 | |
import org.kuali.rice.core.api.style.Style; |
| 31 | |
import org.kuali.rice.core.api.style.StyleContract; |
| 32 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
@Entity |
| 41 | |
@Table(name="KREW_STYLE_T") |
| 42 | |
|
| 43 | |
public class StyleBo extends PersistableBusinessObjectBase implements StyleContract { |
| 44 | |
|
| 45 | |
private static final long serialVersionUID = 2020611019976731725L; |
| 46 | |
|
| 47 | |
@Id |
| 48 | |
@GeneratedValue(generator="KREW_EDL_S") |
| 49 | |
@GenericGenerator(name="KREW_EDL_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
| 50 | |
@Parameter(name="sequence_name",value="KREW_EDL_S"), |
| 51 | |
@Parameter(name="value_column",value="id") |
| 52 | |
}) |
| 53 | |
@Column(name="STYLE_ID") |
| 54 | |
private Long styleId; |
| 55 | |
|
| 56 | |
@Column(name="NM") |
| 57 | |
private String name; |
| 58 | |
|
| 59 | |
@Lob |
| 60 | |
@Basic(fetch=FetchType.LAZY) |
| 61 | |
@Column(name="XML") |
| 62 | |
private String xmlContent; |
| 63 | |
|
| 64 | |
@Column(name="ACTV_IND") |
| 65 | |
private boolean active; |
| 66 | |
|
| 67 | 3 | public StyleBo() { |
| 68 | |
|
| 69 | 3 | this.active = true; |
| 70 | 3 | } |
| 71 | |
|
| 72 | |
@Override |
| 73 | |
public Long getStyleId() { |
| 74 | 3 | return styleId; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setStyleId(Long styleId) { |
| 78 | 3 | this.styleId = styleId; |
| 79 | 3 | } |
| 80 | |
|
| 81 | |
@Override |
| 82 | |
public String getName() { |
| 83 | 7 | return name; |
| 84 | |
} |
| 85 | |
|
| 86 | |
public void setName(String name) { |
| 87 | 3 | this.name = name; |
| 88 | 3 | } |
| 89 | |
|
| 90 | |
@Override |
| 91 | |
public String getXmlContent() { |
| 92 | 3 | return xmlContent; |
| 93 | |
} |
| 94 | |
|
| 95 | |
public void setXmlContent(String xmlContent) { |
| 96 | 3 | this.xmlContent = xmlContent; |
| 97 | 3 | } |
| 98 | |
|
| 99 | |
@Override |
| 100 | |
public boolean isActive() { |
| 101 | 3 | return active; |
| 102 | |
} |
| 103 | |
|
| 104 | |
public void setActive(boolean active) { |
| 105 | 5 | this.active = active; |
| 106 | 5 | } |
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
public static Style to(StyleBo styleBo) { |
| 115 | 2 | if (styleBo == null) { |
| 116 | 0 | return null; |
| 117 | |
} |
| 118 | 2 | return Style.Builder.create(styleBo).build(); |
| 119 | |
} |
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
public static StyleBo from(Style style) { |
| 128 | 3 | if (style == null) { |
| 129 | 0 | return null; |
| 130 | |
} |
| 131 | 3 | StyleBo styleBo = new StyleBo(); |
| 132 | 3 | styleBo.setStyleId(style.getStyleId()); |
| 133 | 3 | styleBo.setName(style.getName()); |
| 134 | 3 | styleBo.setXmlContent(style.getXmlContent()); |
| 135 | 3 | styleBo.setActive(style.isActive()); |
| 136 | 3 | styleBo.setVersionNumber(style.getVersionNumber()); |
| 137 | 3 | styleBo.setObjectId(style.getObjectId()); |
| 138 | 3 | return styleBo; |
| 139 | |
} |
| 140 | |
|
| 141 | |
} |