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.*;
26  
27  import org.apache.commons.lang3.builder.ToStringBuilder;
28  import org.apache.commons.lang3.builder.ToStringStyle;
29  
30  @Entity
31  @Table(name = "HFJ_RES_PARAM_PRESENT", indexes = {
32  		@Index(name = "IDX_RESPARMPRESENT_RESID", columnList = "RES_ID")
33  }, uniqueConstraints = {
34  		@UniqueConstraint(name = "IDX_RESPARMPRESENT_SPID_RESID", columnNames = { "SP_ID", "RES_ID" })
35  })
36  public class SearchParamPresent implements Serializable {
37  
38  	private static final long serialVersionUID = 1L;
39  
40  	@Id
41  	@SequenceGenerator(name = "SEQ_RESPARMPRESENT_ID", sequenceName = "SEQ_RESPARMPRESENT_ID")
42  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_RESPARMPRESENT_ID")
43  	@Column(name = "PID")
44  	private Long myId;
45  
46  	@Column(name = "SP_PRESENT", nullable = false)
47  	private boolean myPresent;
48  
49  	@ManyToOne()
50  	@JoinColumn(name = "RES_ID", referencedColumnName = "RES_ID", nullable = false, foreignKey = @ForeignKey(name = "FK_RESPARMPRES_RESID"))
51  	private ResourceTable myResource;
52  
53  	@ManyToOne()
54  	@JoinColumn(name = "SP_ID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_RESPARMPRES_SPID"))
55  	private SearchParam mySearchParam;
56  
57  	/**
58  	 * Constructor
59  	 */
60  	public SearchParamPresent() {
61  		super();
62  	}
63  	
64  	public ResourceTable getResource() {
65  		return myResource;
66  	}
67  
68  	public SearchParam getSearchParam() {
69  		return mySearchParam;
70  	}
71  
72  	public boolean isPresent() {
73  		return myPresent;
74  	}
75  
76  	public void setPresent(boolean thePresent) {
77  		myPresent = thePresent;
78  	}
79  
80  	public void setResource(ResourceTable theResourceTable) {
81  		myResource = theResourceTable;
82  	}
83  
84  	public void setSearchParam(SearchParam theSearchParam) {
85  		mySearchParam = theSearchParam;
86  	}
87  
88  	@Override
89  	public String toString() {
90  		ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
91  		
92  		b.append("res_pid", myResource.getIdDt().toUnqualifiedVersionless().getValue());
93  		b.append("param", mySearchParam.getParamName());
94  		b.append("present", myPresent);
95  		return b.build();
96  	}
97  
98  }