View Javadoc
1   package ca.uhn.fhir.jpa.entity;
2   
3   /*
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.io.Serializable;
24  
25  import javax.persistence.Column;
26  import javax.persistence.Entity;
27  import javax.persistence.ForeignKey;
28  import javax.persistence.GeneratedValue;
29  import javax.persistence.GenerationType;
30  import javax.persistence.Id;
31  import javax.persistence.JoinColumn;
32  import javax.persistence.ManyToOne;
33  import javax.persistence.SequenceGenerator;
34  import javax.persistence.Table;
35  
36  //@formatter:off
37  @Entity
38  @Table(name = "HFJ_SEARCH_INCLUDE")
39  //@formatter:on
40  public class SearchInclude implements Serializable {
41  
42  	private static final long serialVersionUID = 1L;
43  
44  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SEARCH_INC")
45  	@SequenceGenerator(name = "SEQ_SEARCH_INC", sequenceName = "SEQ_SEARCH_INC")
46  	@Id
47  	@Column(name = "PID")
48  	private Long myId;
49  
50  	@Column(name = "REVINCLUDE", insertable = true, updatable = false, nullable = false)
51  	private boolean myReverse;
52  
53  	public boolean isReverse() {
54  		return myReverse;
55  	}
56  
57  	@Column(name = "SEARCH_INCLUDE", length = 200, insertable = true, updatable = false, nullable = false)
58  	private String myInclude;
59  
60  	@ManyToOne
61  	@JoinColumn(name = "SEARCH_PID", referencedColumnName = "PID", foreignKey = @ForeignKey(name = "FK_SEARCHINC_SEARCH"), insertable = true, updatable = false, nullable = false)
62  	private Search mySearch;
63  
64  	@Column(name="SEARCH_PID", insertable=false, updatable=false, nullable=false)
65  	private Long mySearchPid;
66  
67  	@Column(name = "INC_RECURSE", insertable = true, updatable = false, nullable = false)
68  	private boolean myRecurse;
69  
70  	/**
71  	 * Constructor
72  	 */
73  	public SearchInclude() {
74  		// nothing
75  	}
76  
77  	/**
78  	 * Constructor
79  	 */
80  	public SearchInclude(Search theSearch, String theInclude, boolean theReverse, boolean theRecurse) {
81  		mySearch = theSearch;
82  		myInclude = theInclude;
83  		myReverse = theReverse;
84  		myRecurse = theRecurse;
85  	}
86  
87  	@Override
88  	public boolean equals(Object theObj) {
89  		if (!(theObj instanceof SearchInclude)) {
90  			return false;
91  		}
92  		if (myId == null) {
93  			return false;
94  		}
95  		return myId.equals(((SearchInclude) theObj).myId);
96  	}
97  
98  	public String getInclude() {
99  		return myInclude;
100 	}
101 
102 	@Override
103 	public int hashCode() {
104 		return myId == null ? 0 : myId.hashCode();
105 	}
106 
107 	public boolean isRecurse() {
108 		return myRecurse;
109 	}
110 
111 }