| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.documentlink; |
| 17 | |
|
| 18 | |
import java.io.Serializable; |
| 19 | |
|
| 20 | |
import javax.persistence.Column; |
| 21 | |
import javax.persistence.Entity; |
| 22 | |
import javax.persistence.GeneratedValue; |
| 23 | |
import javax.persistence.Id; |
| 24 | |
import javax.persistence.Table; |
| 25 | |
|
| 26 | |
import org.hibernate.annotations.GenericGenerator; |
| 27 | |
import org.hibernate.annotations.Parameter; |
| 28 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
| 29 | |
import org.kuali.rice.kew.api.document.DocumentLinkContract; |
| 30 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
@Entity |
| 40 | |
@Table(name="KREW_DOC_LNK_T") |
| 41 | |
|
| 42 | 0 | public class DocumentLink implements Serializable, DocumentLinkContract { |
| 43 | |
|
| 44 | |
private static final long serialVersionUID = 551926904795633010L; |
| 45 | |
|
| 46 | |
@Id |
| 47 | |
@GeneratedValue(generator="KREW_DOC_LNK_S") |
| 48 | |
@GenericGenerator(name="KREW_DOC_LNK_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
| 49 | |
@Parameter(name="sequence_name",value="KREW_DOC_LNK_S"), |
| 50 | |
@Parameter(name="value_column",value="id") |
| 51 | |
}) |
| 52 | |
@Column(name="DOC_LNK_ID") |
| 53 | |
private String docLinkId; |
| 54 | |
@Column(name="ORGN_DOC_ID") |
| 55 | |
private String orgnDocId; |
| 56 | |
@Column(name="DEST_DOC_ID") |
| 57 | |
private String destDocId; |
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
public String getDocLinkId() { |
| 63 | 0 | return this.docLinkId; |
| 64 | |
} |
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
public void setDocLinkId(String docLinkId) { |
| 70 | 0 | this.docLinkId = docLinkId; |
| 71 | 0 | } |
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
public String getOrgnDocId() { |
| 77 | 0 | return this.orgnDocId; |
| 78 | |
} |
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
public void setOrgnDocId(String orgnDocId) { |
| 84 | 0 | this.orgnDocId = orgnDocId; |
| 85 | 0 | } |
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
public String getDestDocId() { |
| 91 | 0 | return this.destDocId; |
| 92 | |
} |
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
public void setDestDocId(String destDocId) { |
| 98 | 0 | this.destDocId = destDocId; |
| 99 | 0 | } |
| 100 | |
|
| 101 | |
|
| 102 | |
public void beforeInsert(){ |
| 103 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
| 104 | 0 | } |
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
@Override |
| 109 | |
public String getId() { |
| 110 | 0 | if (getDocLinkId() == null) { |
| 111 | 0 | return null; |
| 112 | |
} |
| 113 | 0 | return getDocLinkId().toString(); |
| 114 | |
} |
| 115 | |
|
| 116 | |
@Override |
| 117 | |
public String getOriginatingDocumentId() { |
| 118 | 0 | return getOrgnDocId(); |
| 119 | |
} |
| 120 | |
|
| 121 | |
@Override |
| 122 | |
public String getDestinationDocumentId() { |
| 123 | 0 | return getDestDocId(); |
| 124 | |
} |
| 125 | |
|
| 126 | |
public static org.kuali.rice.kew.api.document.DocumentLink to(DocumentLink documentLinkBo) { |
| 127 | 0 | if (documentLinkBo == null) { |
| 128 | 0 | return null; |
| 129 | |
} |
| 130 | 0 | return org.kuali.rice.kew.api.document.DocumentLink.Builder.create(documentLinkBo).build(); |
| 131 | |
} |
| 132 | |
|
| 133 | |
public static DocumentLink from(org.kuali.rice.kew.api.document.DocumentLink documentLink) { |
| 134 | 0 | if (documentLink == null) { |
| 135 | 0 | return null; |
| 136 | |
} |
| 137 | 0 | DocumentLink documentLinkBo = new DocumentLink(); |
| 138 | 0 | if (documentLink.getId() != null) { |
| 139 | 0 | documentLinkBo.setDocLinkId(documentLink.getId()); |
| 140 | |
} |
| 141 | 0 | documentLinkBo.setOrgnDocId(documentLink.getOriginatingDocumentId()); |
| 142 | 0 | documentLinkBo.setDestDocId(documentLink.getDestinationDocumentId()); |
| 143 | 0 | return documentLinkBo; |
| 144 | |
} |
| 145 | |
|
| 146 | |
} |