1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.routeheader;
17
18 import org.kuali.rice.core.api.util.xml.XmlJotter;
19
20 import javax.persistence.Basic;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.FetchType;
24 import javax.persistence.Id;
25 import javax.persistence.Lob;
26 import javax.persistence.NamedQuery;
27 import javax.persistence.Table;
28 import java.io.Serializable;
29
30 @Entity
31 @Table(name="KREW_DOC_HDR_CNTNT_T")
32 @NamedQuery(name="DocumentRouteHeaderValueContent.FindByDocumentId", query="select d from DocumentRouteHeaderValueContent as d where d.documentId = :documentId")
33 public class DocumentRouteHeaderValueContent implements Serializable {
34
35
36
37
38 private static final long serialVersionUID = 1L;
39 @Id
40 @Column(name="DOC_HDR_ID")
41 private String documentId;
42 @Lob
43 @Basic(fetch=FetchType.LAZY)
44 @Column(name="DOC_CNTNT_TXT")
45 private String documentContent;
46
47 public DocumentRouteHeaderValueContent() {}
48
49 public DocumentRouteHeaderValueContent(String documentId) {
50 this.documentId = documentId;
51 }
52
53 public String getDocumentContent() {
54 return documentContent;
55 }
56 public void setDocumentContent(String documentContent) {
57 this.documentContent = documentContent;
58 }
59 public String getDocumentId() {
60 return documentId;
61 }
62 public void setDocumentId(String documentId) {
63 this.documentId = documentId;
64 }
65
66 public static org.kuali.rice.kew.api.document.DocumentContent to(DocumentRouteHeaderValueContent content) {
67 if (content == null) {
68 return null;
69 }
70 org.kuali.rice.kew.api.document.DocumentContent.Builder builder = org.kuali.rice.kew.api.document.DocumentContent.Builder.create(content.getDocumentId());
71
72 builder.setApplicationContent("");
73 builder.setAttributeContent("");
74 builder.setSearchableContent("");
75 DocumentContent documentContent = new StandardDocumentContent(content.getDocumentContent());
76 if (documentContent.getApplicationContent() != null) {
77 builder.setApplicationContent(XmlJotter.jotNode(documentContent.getApplicationContent()));
78 }
79 if (documentContent.getAttributeContent() != null) {
80 builder.setAttributeContent(XmlJotter.jotNode(documentContent.getAttributeContent()));
81 }
82 if (documentContent.getSearchableContent() != null) {
83 builder.setSearchableContent(XmlJotter.jotNode(documentContent.getSearchableContent()));
84 }
85 return builder.build();
86 }
87
88 }
89