• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-core / 41717837886

03 Nov 2026 08:59PM UTC coverage: 68.971% (+0.05%) from 68.922%
41717837886

push

github

ibacher
TRUNK-6863: Remove the generation token before clearing a node's cache locally (#6791)

1 of 1 new or added line in 1 file covered. (100.0%)

413 existing lines in 30 files now uncovered.

26445 of 38342 relevant lines covered (68.97%)

0.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.17
/api/src/main/java/org/openmrs/ConceptReferenceTerm.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs;
11

12
import java.util.LinkedHashSet;
13
import java.util.Set;
14

15
import org.hibernate.envers.Audited;
16
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.DocumentId;
17
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
18
import org.openmrs.util.CollectionUtil;
19

20
/**
21
 * A concept reference term is typically name for a concept by which it is referred in another
22
 * institution like ICD9, ICD10, SNOMED that keeps a concept dictionary or any other OpenMRS
23
 * implementation
24
 *
25
 * @since 1.9
26
 */
27
@Audited
28
public class ConceptReferenceTerm extends BaseChangeableOpenmrsMetadata {
29
        
30
        private static final long serialVersionUID = 1L;
31
        
32
        @DocumentId
33
        private Integer conceptReferenceTermId;
34
        
35
        private ConceptSource conceptSource;
36
        
37
        //The unique code used to identify the reference term in it's reference terminology
38
        @GenericField
39
        private String code;
40
        
41
        private String version;
42
        
43
        private Set<ConceptReferenceTermMap> conceptReferenceTermMaps;
44
        
45
        /** default constructor */
46
        public ConceptReferenceTerm() {
1 ✔
47
        }
1 ✔
48
        
49
        /** constructor with conceptReferenceTermId */
50
        public ConceptReferenceTerm(Integer conceptReferenceTermId) {
1 ✔
51
                this.conceptReferenceTermId = conceptReferenceTermId;
1 ✔
52
        }
1 ✔
53
        
54
        /**
55
         * Convenience constructor with the required fields filled in
56
         *
57
         * @param source the ConceptSource belongs in
58
         * @param code the code within that concept
59
         * @param name the user readable name of this term
60
         * @since 1.9.2, 1.10.0
61
         */
62
        public ConceptReferenceTerm(ConceptSource source, String code, String name) {
1 ✔
63
                this.conceptSource = source;
1 ✔
64
                this.code = code;
1 ✔
65
                setName(name);
1 ✔
66
        }
1 ✔
67
        
68
        /**
69
         * @return the conceptReferenceTermId
70
         */
71
        public Integer getConceptReferenceTermId() {
72
                return conceptReferenceTermId;
1 ✔
73
        }
74
        
75
        /**
76
         * @param conceptReferenceTermId the conceptReferenceTermId to set
77
         */
78
        public void setConceptReferenceTermId(Integer conceptReferenceTermId) {
79
                this.conceptReferenceTermId = conceptReferenceTermId;
1 ✔
80
        }
1 ✔
81
        
82
        /**
83
         * @return the conceptSource
84
         */
85
        public ConceptSource getConceptSource() {
86
                return conceptSource;
1 ✔
87
        }
88
        
89
        /**
90
         * @param conceptSource the conceptSource to set
91
         */
92
        public void setConceptSource(ConceptSource conceptSource) {
93
                this.conceptSource = conceptSource;
1 ✔
94
        }
1 ✔
95
        
96
        /**
97
         * @return the code
98
         */
99
        public String getCode() {
100
                return code;
1 ✔
101
        }
102
        
103
        /**
104
         * @param code the code to set
105
         */
106
        public void setCode(String code) {
107
                this.code = code;
1 ✔
108
        }
1 ✔
109
        
110
        /**
111
         * @return the version
112
         */
113
        public String getVersion() {
114
                return version;
1 ✔
115
        }
116
        
117
        /**
118
         * @param version the version to set
119
         */
120
        public void setVersion(String version) {
121
                this.version = version;
1 ✔
122
        }
1 ✔
123
        
124
        /**
125
         * @return the conceptReferenceTermMaps
126
         */
127
        public Set<ConceptReferenceTermMap> getConceptReferenceTermMaps() {
128
                if (conceptReferenceTermMaps == null) {
1 ✔
129
                        conceptReferenceTermMaps = new LinkedHashSet<>();
1 ✔
130
                }
131
                return conceptReferenceTermMaps;
1 ✔
132
        }
133
        
134
        /**
135
         * @param conceptReferenceTermMaps the conceptReferenceTermMaps to set
136
         */
137
        public void setConceptReferenceTermMaps(Set<ConceptReferenceTermMap> conceptReferenceTermMaps) {
138
                this.conceptReferenceTermMaps = CollectionUtil.setCollection(this.conceptReferenceTermMaps,
1 ✔
139
                    conceptReferenceTermMaps);
140
        }
1 ✔
141
        
142
        /**
143
         * @see org.openmrs.OpenmrsObject#getId()
144
         */
145
        @Override
146
        public Integer getId() {
147
                return getConceptReferenceTermId();
1 ✔
148
        }
149
        
150
        /**
151
         * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
152
         */
153
        @Override
154
        public void setId(Integer id) {
UNCOV
155
                setConceptReferenceTermId(id);
×
UNCOV
156
        }
×
157
        
158
        /**
159
         * Add the given {@link ConceptReferenceTermMap} object to this concept reference term's list of
160
         * concept reference term maps. If there is already a corresponding ConceptReferenceTermMap
161
         * object for this concept reference term already, this one will not be added.
162
         *
163
         * @param conceptReferenceTermMap
164
         * <strong>Should</strong> not add a map where termB is itself
165
         * <strong>Should</strong> set termA as the term to which a mapping is being added
166
         * <strong>Should</strong> not add duplicate concept reference term maps
167
         */
168
        public void addConceptReferenceTermMap(ConceptReferenceTermMap conceptReferenceTermMap) {
169
                if (conceptReferenceTermMap != null && conceptReferenceTermMap.getTermB() != null
1 ✔
170
                        && !this.equals(conceptReferenceTermMap.getTermB())) {
1 ✔
171
                        //can't map a term to itself
172
                        conceptReferenceTermMap.setTermA(this);
1 ✔
173
                        if (conceptReferenceTermMaps == null) {
1 ✔
174
                                conceptReferenceTermMaps = new LinkedHashSet<>();
1 ✔
175
                        }
176
                        if (!conceptReferenceTermMaps.contains(conceptReferenceTermMap)) {
1 ✔
177
                                conceptReferenceTermMaps.add(conceptReferenceTermMap);
1 ✔
178
                        }
179
                }
180
        }
1 ✔
181
        
182
        /**
183
         * Remove the given ConceptReferenceTermMap from the list of conceptReferenceTermMaps for this
184
         * {@link ConceptReferenceTerm}
185
         *
186
         * @param conceptReferenceTermMap
187
         * @return true if the entity was removed, false otherwise
188
         */
189
        public boolean removeConceptReferenceTermMap(ConceptReferenceTermMap conceptReferenceTermMap) {
UNCOV
190
                if (conceptReferenceTermMaps != null) {
×
UNCOV
191
                        return conceptReferenceTermMaps.remove(conceptReferenceTermMap);
×
192
                }
193
                
UNCOV
194
                return false;
×
195
        }
196
        
197
        /**
198
         * @see java.lang.Object#toString()
199
         */
200
        @Override
201
        public String toString() {
202
                if (getCode() != null && getName() != null) {
1 ✔
203
                        return getName() + "(" + getCode() + ")";
1 ✔
204
                } else if (getCode() == null) {
×
205
                        return getName();
×
UNCOV
206
                } else if (getName() == null) {
×
UNCOV
207
                        return getCode();
×
208
                }
209
                
UNCOV
210
                return "";
×
211
        }
212
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc