View Javadoc
1   /**
2    * Copyright 2005-2014 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.kew.docsearch;
17  
18  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
19  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
20  
21  import javax.persistence.CascadeType;
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.FetchType;
25  import javax.persistence.GeneratedValue;
26  import javax.persistence.Id;
27  import javax.persistence.Inheritance;
28  import javax.persistence.InheritanceType;
29  import javax.persistence.JoinColumn;
30  import javax.persistence.ManyToOne;
31  import javax.persistence.NamedQueries;
32  import javax.persistence.NamedQuery;
33  import javax.persistence.Transient;
34  
35  @Entity
36  @Inheritance(strategy= InheritanceType.TABLE_PER_CLASS)
37  @NamedQueries({
38          @NamedQuery(name="SearchableAttributeValue.HasSearchableAttributeValue",
39                  query = "SELECT sa from SearchableAttributeBase sa WHERE "
40                          + "(sa.searchableAttributeKey = :searchableAttributeKey AND sa.documentId = :documentId)"),
41          @NamedQuery(name="SearchableAttributeValue.FindSearchableAttributesByDocumentId",
42          query = "SELECT sa FROM SearchableAttributeBase sa WHERE sa.documentId = :documentId")
43  })
44  public abstract class SearchableAttributeBase implements SearchableAttributeValue {
45  
46      @Id
47      @GeneratedValue(generator = "KREW_SRCH_ATTR_S")
48      @PortableSequenceGenerator(name = "KREW_SRCH_ATTR_S")
49      @Column(name="DOC_HDR_EXT_ID")
50      private String searchableAttributeValueId;
51  
52      @Column(name="KEY_CD")
53      private String searchableAttributeKey;
54  
55      @Column(name="DOC_HDR_ID")
56      private String documentId;
57      @ManyToOne(fetch= FetchType.EAGER, cascade={CascadeType.PERSIST})
58      @JoinColumn(name="DOC_HDR_ID", insertable=false, updatable=false)
59      private DocumentRouteHeaderValue routeHeader;
60  
61      @Transient
62      protected String ojbConcreteClass; // attribute needed for OJB polymorphism - do not alter!
63  
64      @Override
65      public String getDocumentId() {
66          return documentId;
67      }
68  
69      @Override
70      public void setDocumentId(String documentId) {
71          this.documentId = documentId;
72      }
73  
74      @Override
75      public String getSearchableAttributeValueId() {
76          return searchableAttributeValueId;
77      }
78  
79      @Override
80      public void setSearchableAttributeValueId(String searchableAttributeValueId) {
81          this.searchableAttributeValueId = searchableAttributeValueId;
82      }
83  
84      @Override
85      public String getSearchableAttributeKey() {
86          return searchableAttributeKey;
87      }
88  
89      @Override
90      public void setSearchableAttributeKey(String searchableAttributeKey) {
91          this.searchableAttributeKey = searchableAttributeKey;
92      }
93  
94      @Override
95      public String getOjbConcreteClass() {
96          return ojbConcreteClass;
97      }
98  
99      @Override
100     public void setOjbConcreteClass(String ojbConcreteClass) {
101         this.ojbConcreteClass = ojbConcreteClass;
102     }
103 
104     @Override
105     public DocumentRouteHeaderValue getRouteHeader() {
106         return routeHeader;
107     }
108 
109     @Override
110     public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
111         this.routeHeader = routeHeader;
112     }
113 
114 }