View Javadoc
1   package ca.uhn.fhir.jpa.term;
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 org.apache.commons.lang3.builder.EqualsBuilder;
24  import org.apache.commons.lang3.builder.HashCodeBuilder;
25  import org.hl7.fhir.r4.model.Coding;
26  import org.hl7.fhir.r4.model.UriType;
27  
28  public class TranslationQuery {
29  	private Coding myCoding;
30  	private Long myResourceId;
31  	private UriType mySource;
32  	private UriType myTarget;
33  	private UriType myTargetSystem;
34  
35  	public TranslationQuery() {
36  		super();
37  
38  		myCoding = new Coding();
39  	}
40  
41  	public Coding getCoding() {
42  		return myCoding;
43  	}
44  
45  	public void setCoding(Coding theCoding) {
46  		myCoding = theCoding;
47  	}
48  
49  	public boolean hasResourceId() {
50  		return myResourceId != null;
51  	}
52  
53  	public Long getResourceId() {
54  		return myResourceId;
55  	}
56  
57  	public void setResourceId(Long theResourceId) {
58  		myResourceId = theResourceId;
59  	}
60  
61  	public boolean hasSource() {
62  		return mySource != null && mySource.hasValue();
63  	}
64  
65  	public UriType getSource() {
66  		return mySource;
67  	}
68  
69  	public void setSource(UriType theSource) {
70  		mySource = theSource;
71  	}
72  
73  	public boolean hasTarget() {
74  		return myTarget != null && myTarget.hasValue();
75  	}
76  
77  	public UriType getTarget() {
78  		return myTarget;
79  	}
80  
81  	public void setTarget(UriType theTarget) {
82  		myTarget = theTarget;
83  	}
84  
85  	public boolean hasTargetSystem() {
86  		return myTargetSystem != null && myTargetSystem.hasValue();
87  	}
88  
89  	public UriType getTargetSystem() {
90  		return myTargetSystem;
91  	}
92  
93  	public void setTargetSystem(UriType theTargetSystem) {
94  		myTargetSystem = theTargetSystem;
95  	}
96  
97  	@Override
98  	public boolean equals(Object o) {
99  		if (this == o) return true;
100 
101 		if (!(o instanceof TranslationQuery)) return false;
102 
103 		TranslationQuery that = (TranslationQuery) o;
104 
105 		return new EqualsBuilder()
106 			.append(getCoding().getCode(), that.getCoding().getCode())
107 			.append(getCoding().getSystem(), that.getCoding().getSystem())
108 			.append(getCoding().getVersion(), that.getCoding().getVersion())
109 			.append(getResourceId(), that.getResourceId())
110 			.append(getSource(), that.getSource())
111 			.append(getTarget(), that.getTarget())
112 			.append(getTargetSystem(), that.getTargetSystem())
113 			.isEquals();
114 	}
115 
116 	@Override
117 	public int hashCode() {
118 		return new HashCodeBuilder(17, 37)
119 			.append(getCoding().getCode())
120 			.append(getCoding().getSystem())
121 			.append(getCoding().getVersion())
122 			.append(getResourceId())
123 			.append(getSource())
124 			.append(getTarget())
125 			.append(getTargetSystem())
126 			.toHashCode();
127 	}
128 }