@FullTextFilterDefs(value=@FullTextFilterDef(name="termsFilterFactory",impl=TermsFilterFactory.class)) public class Concept extends BaseOpenmrsObject implements Auditable, Retireable, Serializable, Attributable<Concept>, Customizable<ConceptAttribute>
Obs
. ConceptService
.ConceptService
to
fetch an object. To get child objects off of that Concept, further calls to the
ConceptService
or the database are not needed. e.g. To get the list of answers that are
stored to a concept, get the concept, then call getAnswers()
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Constructor and Description |
---|
Concept()
default constructor
|
Concept(Integer conceptId)
Convenience constructor with conceptid to save to
setConceptId(Integer) . |
Modifier and Type | Method and Description |
---|---|
void |
addAnswer(ConceptAnswer conceptAnswer)
Add the given ConceptAnswer to the list of answers for this Concept
|
void |
addAttribute(ConceptAttribute attribute)
Adds an attribute.
|
void |
addConceptMapping(ConceptMap newConceptMap)
Add the given ConceptMap object to this concept's list of concept mappings.
|
void |
addDescription(ConceptDescription description)
Add the given description to the list of descriptions for this Concept
|
void |
addName(ConceptName conceptName)
Add the given ConceptName to the list of names for this Concept
|
void |
addSetMember(Concept setMember)
Appends the concept to the end of the existing list of concept members for this Concept
|
void |
addSetMember(Concept setMember,
int index)
Add the concept to the existing member to the list of set members in the given location.
|
ConceptName |
findNameTaggedWith(ConceptNameTag conceptNameTag)
A convenience method to get the concept-name (if any) which has a particular tag.
|
List<Concept> |
findPossibleValues(String searchText)
Deprecated.
|
Collection<ConceptAttribute> |
getActiveAttributes() |
List<ConceptAttribute> |
getActiveAttributes(CustomValueDescriptor ofType) |
Set<Locale> |
getAllConceptNameLocales()
Convenience method that returns a set of all the locales in which names have been added for
this concept.
|
Collection<ConceptAnswer> |
getAnswers() |
Collection<ConceptAnswer> |
getAnswers(boolean includeRetired)
If
includeRetired is true, then the returned object is the actual stored list of
ConceptAnswer s |
Set<ConceptAttribute> |
getAttributes() |
User |
getChangedBy() |
List<ConceptName> |
getCompatibleNames(Locale desiredLocale)
Returns all names from compatible locales.
|
ConceptClass |
getConceptClass() |
Integer |
getConceptId() |
Collection<ConceptMap> |
getConceptMappings() |
Collection<ConceptSet> |
getConceptSets() |
User |
getCreator() |
ConceptDatatype |
getDatatype() |
Date |
getDateChanged() |
Date |
getDateCreated() |
Date |
getDateRetired() |
ConceptDescription |
getDescription()
Finds the description of the concept using the current locale in Context.getLocale().
|
ConceptDescription |
getDescription(Locale locale)
Finds the description of the concept in the given locale.
|
ConceptDescription |
getDescription(Locale locale,
boolean exact)
Returns the preferred description for a locale.
|
Collection<ConceptDescription> |
getDescriptions() |
String |
getDisplayString()
Gets a descriptive String used for display purposes This is meant as an alternative to using
the toString() to display this object to a user
|
ConceptName |
getFullySpecifiedName(Locale locale)
Convenience method that returns the fully specified name in the locale
|
Integer |
getId() |
Collection<ConceptName> |
getIndexTerms()
Gets the list of all non-retired concept names which are index terms for this concept
|
Collection<ConceptName> |
getIndexTermsForLocale(Locale locale)
Gets the list of all non-retired concept names which are index terms in a given locale
|
ConceptName |
getName()
Returns concept name, the look up for the appropriate name is done in the following order;
First name found in any locale that is explicitly marked as preferred while searching
available locales in order of preference (the locales are traversed in their order as they
are listed in the 'locale.allowed.list' including english global property).
|
ConceptName |
getName(Locale locale)
Returns a name in the given locale.
|
ConceptName |
getName(Locale locale,
boolean exact)
Returns a name in the given locale.
|
ConceptName |
getName(Locale locale,
ConceptNameType ofType,
ConceptNameTag havingTag)
Returns concept name depending of locale, type (short, fully specified, etc) and tag.
|
Collection<ConceptName> |
getNames() |
Collection<ConceptName> |
getNames(boolean includeVoided) |
Collection<ConceptName> |
getNames(Locale locale)
Returns all names available in a specific locale.
|
List<Concept> |
getPossibleValues()
Deprecated.
|
ConceptName |
getPreferredName(Locale forLocale)
Returns the name which is explicitly marked as preferred for a given locale.
|
Boolean |
getRetired()
This method delegates to
isRetired() . |
User |
getRetiredBy() |
String |
getRetireReason() |
Boolean |
getSet() |
List<Concept> |
getSetMembers()
Get all the concept members of current concept
|
List<Concept> |
getSetMembers(boolean includeRetired)
If includeRetired is true, then the returned object is the list of all the concept
set members of current concept, else retired concept set members are excluded.
|
ConceptName |
getShortestName(Locale locale,
Boolean exact)
Returns the short form name for a locale, or if none has been identified, the shortest name
available in the locale.
|
ConceptName |
getShortNameInLocale(Locale locale)
Gets the explicitly specified short name for a locale.
|
Collection<ConceptName> |
getShortNames()
Gets a collection of short names for this concept from all locales.
|
Collection<ConceptName> |
getSynonyms()
Gets all the non-retired synonyms.
|
Collection<ConceptName> |
getSynonyms(Locale locale)
Gets the synonyms in the given locale.
|
String |
getVersion() |
boolean |
hasName(String name,
Locale locale)
Checks whether this concept has the given string in any of the names in the given locale
already.
|
Concept |
hydrate(String reference)
Deserialize the given string into a full object
|
boolean |
isComplex()
Child Class ConceptComplex overrides this method and returns true.
|
boolean |
isNamed(String name) |
boolean |
isNumeric()
Whether this concept is numeric or not.
|
Boolean |
isRetired()
Deprecated.
as of 2.0, use
getRetired() |
Boolean |
isSet()
Deprecated.
as of 2.0, use
getSet() |
boolean |
removeAnswer(ConceptAnswer conceptAnswer)
Remove the given answer from the list of answers for this Concept
|
boolean |
removeConceptMapping(ConceptMap conceptMap)
Remove the given ConceptMap from the list of mappings for this Concept
|
boolean |
removeDescription(ConceptDescription description)
Remove the given description from the list of descriptions for this Concept
|
boolean |
removeName(ConceptName conceptName)
Remove the given name from the list of names for this Concept
|
String |
serialize()
Turns this concept into a very simple serialized string
|
void |
setAnswers(Collection<ConceptAnswer> answers)
Set this Concept as having the given
answers ; This method assumes that the
sort_weight has already been set. |
void |
setAttributes(Set<ConceptAttribute> attributes) |
void |
setChangedBy(User changedBy) |
void |
setConceptClass(ConceptClass conceptClass) |
void |
setConceptId(Integer conceptId) |
void |
setConceptMappings(Collection<ConceptMap> conceptMappings) |
void |
setConceptSets(Collection<ConceptSet> conceptSets) |
void |
setCreator(User creator) |
void |
setDatatype(ConceptDatatype conceptDatatype) |
void |
setDateChanged(Date dateChanged) |
void |
setDateCreated(Date dateCreated) |
void |
setDateRetired(Date dateRetired) |
void |
setDescriptions(Collection<ConceptDescription> descriptions)
Sets the collection of descriptions for this Concept.
|
void |
setFullySpecifiedName(ConceptName fullySpecifiedName)
Sets the specified name as the fully specified name for the locale and the current fully
specified (if any) ceases to be the fully specified name for the locale.
|
void |
setId(Integer id) |
void |
setNames(Collection<ConceptName> names) |
void |
setPreferredName(ConceptName preferredName)
Sets the preferred name /in this locale/ to the specified conceptName and its Locale, if
there is an existing preferred name for this concept in the same locale, this one will
replace the old preferred name.
|
void |
setRetired(Boolean retired) |
void |
setRetiredBy(User retiredBy) |
void |
setRetireReason(String retireReason) |
void |
setSet(Boolean set) |
void |
setShortName(ConceptName shortName)
Sets the specified name as the short name for the locale and the current shortName(if any)
ceases to be the short name for the locale.
|
void |
setVersion(String version) |
String |
toString()
Returns a string equal to the value of: ClassName{hashCode=...,
uuid=...}
|
equals, getUuid, hashCode, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
public Concept()
public Concept(Integer conceptId)
setConceptId(Integer)
. This
effectively creates a concept stub that can be used to make other calls. Because the
BaseOpenmrsObject.equals(Object)
and BaseOpenmrsObject.hashCode()
methods rely on conceptId, this allows a stub
to masquerade as a full concept as long as other objects like getAnswers()
and
getNames()
are not needed/called.conceptId
- the concept id to setpublic Collection<ConceptAnswer> getAnswers()
public Collection<ConceptAnswer> getAnswers(boolean includeRetired)
includeRetired
is true, then the returned object is the actual stored list of
ConceptAnswer
sincludeRetired
- true/false whether to also include the retired answerspublic void setAnswers(Collection<ConceptAnswer> answers)
answers
; This method assumes that the
sort_weight has already been set.answers
- The answers to set.public void addAnswer(ConceptAnswer conceptAnswer)
conceptAnswer
- Should add the ConceptAnswer to Concept
Should not fail if answers list is null
Should not fail if answers contains ConceptAnswer already
Should set the sort weight to the max plus one if not providedpublic boolean removeAnswer(ConceptAnswer conceptAnswer)
conceptAnswer
- answer to removepublic User getChangedBy()
getChangedBy
in interface Changeable
public void setChangedBy(User changedBy)
setChangedBy
in interface Changeable
changedBy
- The changedBy to set.public ConceptClass getConceptClass()
public void setConceptClass(ConceptClass conceptClass)
conceptClass
- The conceptClass to set.@Deprecated public Boolean isSet()
getSet()
public void setSet(Boolean set)
set
- whether or not this concept is a setpublic Boolean getSet()
public ConceptDatatype getDatatype()
public void setDatatype(ConceptDatatype conceptDatatype)
conceptDatatype
- The conceptDatatype to set.public Integer getConceptId()
public void setConceptId(Integer conceptId)
conceptId
- The conceptId to set.public User getCreator()
getCreator
in interface Creatable
public void setCreator(User creator)
setCreator
in interface Creatable
creator
- The creator to set.public Date getDateChanged()
getDateChanged
in interface Changeable
public void setDateChanged(Date dateChanged)
setDateChanged
in interface Changeable
dateChanged
- The dateChanged to set.public Date getDateCreated()
getDateCreated
in interface Creatable
public void setDateCreated(Date dateCreated)
setDateCreated
in interface Creatable
dateCreated
- The dateCreated to set.public void setPreferredName(ConceptName preferredName)
preferredName
- The name to be marked as preferred in its locale
Should only allow one preferred name
Should add the name to the list of names if it not among them before
Should fail if the preferred name to set to is an index termpublic ConceptName findNameTaggedWith(ConceptNameTag conceptNameTag)
conceptNameTag
- the tag for which to lookpublic ConceptName getName(Locale locale)
locale
- the locale to fetch forto get all the names for a locale,
,
for the preferred name (if any)
public ConceptName getName()
ConceptName
in the current locale or any locale if none foundto get all the names for a locale
,
for the preferred name (if any)
Should return the name explicitly marked as locale preferred if any is present
Should return the fully specified name in a locale if no preferred name is set
Should return null if the only added name is an index term
Should return name in broader locale in case none is found in specific one
public boolean hasName(String name, Locale locale)
name
- the ConceptName.name to compare tolocale
- the locale to look in (null to check all locales)public ConceptName getName(Locale locale, ConceptNameType ofType, ConceptNameTag havingTag)
ofType
- find a name of this type (optional)havingTag
- find a name with this tag (optional)locale
- find a name with this locale (required)public ConceptName getName(Locale locale, boolean exact)
locale
- the language and country in which the name is usedexact
- true/false to return only exact locale (no default locale)to get all the names for a locale,
,
for the preferred name (if any)
Should return exact name locale match given exact equals true
Should return loose match given exact equals false
Should return null if no names are found in locale given exact equals true
Should return any name if no locale match given exact equals false
Should return name in broader locale in case none is found in specific one
public ConceptName getPreferredName(Locale forLocale)
forLocale
- locale for which to return a preferred namepublic ConceptName getFullySpecifiedName(Locale locale)
locale
- locale from which to look up the fully specified namepublic Collection<ConceptName> getNames(Locale locale)
locale
- locale for which names should be returnedpublic List<ConceptName> getCompatibleNames(Locale desiredLocale)
desiredLocale
- locale with which the names should be compatiblepublic void setFullySpecifiedName(ConceptName fullySpecifiedName)
fullySpecifiedName
- the new fully specified name to set
Should set the concept name type of the specified name to fully specified
Should convert the previous fully specified name if any to a synonym
Should add the name to the list of names if it not among them beforepublic void setShortName(ConceptName shortName)
shortName
- the new shortName to set
Should set the concept name type of the specified name to short
Should convert the previous shortName if any to a synonym
Should add the name to the list of names if it not among them before
Should void old short name if new one is blank (do not save blanks!)public ConceptName getShortNameInLocale(Locale locale)
locale
- locale for which to find a short namepublic Collection<ConceptName> getShortNames()
public ConceptName getShortestName(Locale locale, Boolean exact)
locale
- the language and country in which the short name is usedexact
- true/false to return only exact locale (no default locale)public boolean isNamed(String name)
name
- A namepublic Collection<ConceptName> getIndexTerms()
public Collection<ConceptName> getIndexTermsForLocale(Locale locale)
locale
- the locale for the index terms to returnpublic Collection<ConceptName> getNames()
public Collection<ConceptName> getNames(boolean includeVoided)
includeVoided
- Include voided ConceptNames if true.public void setNames(Collection<ConceptName> names)
names
- The names to set.public void addName(ConceptName conceptName)
conceptName
- Should replace the old preferred name with a current one
Should replace the old fully specified name with a current one
Should replace the old short name with a current one
Should mark the first name added as fully specifiedpublic boolean removeName(ConceptName conceptName)
conceptName
- public ConceptDescription getDescription()
public ConceptDescription getDescription(Locale locale)
locale
- public ConceptDescription getDescription(Locale locale, boolean exact)
locale
- the language and country in which the description is usedexact
- true/false to return only exact locale (no default locale)public User getRetiredBy()
getRetiredBy
in interface Retireable
public void setRetiredBy(User retiredBy)
setRetiredBy
in interface Retireable
retiredBy
- the retiredBy to setpublic Date getDateRetired()
getDateRetired
in interface Retireable
public void setDateRetired(Date dateRetired)
setDateRetired
in interface Retireable
dateRetired
- the dateRetired to setpublic String getRetireReason()
getRetireReason
in interface Retireable
public void setRetireReason(String retireReason)
setRetireReason
in interface Retireable
retireReason
- the retireReason to setpublic Collection<ConceptDescription> getDescriptions()
public void setDescriptions(Collection<ConceptDescription> descriptions)
descriptions
- the collection of descriptionspublic void addDescription(ConceptDescription description)
description
- the description to addpublic boolean removeDescription(ConceptDescription description)
description
- the description to remove@Deprecated public Boolean isRetired()
getRetired()
isRetired
in interface Retireable
public Boolean getRetired()
isRetired()
. This is only needed for jstl syntax like
${concept.retired} because the return type is a Boolean object instead of a boolean
primitive type.getRetired
in interface Retireable
Retireable.isRetired()
public void setRetired(Boolean retired)
setRetired
in interface Retireable
retired
- The retired to set.public Collection<ConceptName> getSynonyms(Locale locale)
locale
- public Collection<ConceptName> getSynonyms()
public String getVersion()
public void setVersion(String version)
version
- The version to set.public Collection<ConceptSet> getConceptSets()
public void setConceptSets(Collection<ConceptSet> conceptSets)
conceptSets
- The conceptSets to set.public boolean isNumeric()
public Collection<ConceptMap> getConceptMappings()
public void setConceptMappings(Collection<ConceptMap> conceptMappings)
conceptMappings
- the conceptMappings to setpublic void addConceptMapping(ConceptMap newConceptMap)
newConceptMap
- public boolean isComplex()
ConceptComplex.isComplex()
. Otherwise this method returns false.public boolean removeConceptMapping(ConceptMap conceptMap)
conceptMap
- public String toString()
BaseOpenmrsObject
ClassName{hashCode=..., uuid=...}
If the uuid
field is null
, it returns:
ClassName{hashCode=...}Should include hashCode if uuid is null Should include uuid if not null
toString
in class BaseOpenmrsObject
Object.toString()
@Deprecated public List<Concept> findPossibleValues(String searchText)
Attributable
findPossibleValues
in interface Attributable<Concept>
searchText
- String to search onAttributable.findPossibleValues(java.lang.String)
@Deprecated public List<Concept> getPossibleValues()
Attributable
getPossibleValues
in interface Attributable<Concept>
Attributable.getPossibleValues()
public Concept hydrate(String reference)
Attributable
hydrate
in interface Attributable<Concept>
reference
- String to deserializeAttributable.hydrate(java.lang.String)
public String serialize()
serialize
in interface Attributable<Concept>
Attributable.serialize()
public String getDisplayString()
Attributable
getDisplayString
in interface Attributable<Concept>
Attributable.getDisplayString()
public Set<Locale> getAllConceptNameLocales()
public Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
public List<Concept> getSetMembers()
public List<Concept> getSetMembers(boolean includeRetired)
includeRetired
- true/false whether to also include/exclude the retired conceptspublic void addSetMember(Concept setMember)
setMember
- Concept to add to the
Should add concept as a conceptSet
Should append concept to the existing list of conceptSet
Should place the new concept last in the list
Should assign the calling component as parent to the ConceptSetpublic void addSetMember(Concept setMember, int index)
setMember
- the Concept to add as a child of this Conceptindex
- where in the list of set members to put this setMembergetSortedConceptSets()
public Set<ConceptAttribute> getAttributes()
getAttributes
in interface Customizable<ConceptAttribute>
Customizable.getAttributes()
public Collection<ConceptAttribute> getActiveAttributes()
getActiveAttributes
in interface Customizable<ConceptAttribute>
Customizable.getActiveAttributes()
public List<ConceptAttribute> getActiveAttributes(CustomValueDescriptor ofType)
getActiveAttributes
in interface Customizable<ConceptAttribute>
Customizable.getActiveAttributes(org.openmrs.customdatatype.CustomValueDescriptor)
public void setAttributes(Set<ConceptAttribute> attributes)
attributes
- the attributes to setpublic void addAttribute(ConceptAttribute attribute)
Customizable
addAttribute
in interface Customizable<ConceptAttribute>
Customizable.addAttribute(Attribute)
Copyright © 2024 OpenMRS Inc.. All rights reserved.