public class Concept extends BaseOpenmrsObject implements Auditable, Retireable, java.io.Serializable, Attributable<Concept>
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(ConceptNumeric cn)
Deprecated.
|
Concept(java.lang.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 |
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.
|
java.util.List<Concept> |
findPossibleValues(java.lang.String searchText)
Search for possible values of this object using the given search string
|
java.util.Set<java.util.Locale> |
getAllConceptNameLocales()
Convenience method that returns a set of all the locales in which names have been added for
this concept.
|
java.util.Collection<ConceptAnswer> |
getAnswers() |
java.util.Collection<ConceptAnswer> |
getAnswers(boolean includeRetired)
If
includeRetired is true, then the returned object is the actual stored list of
ConceptAnswer s |
ConceptName |
getBestName(java.util.Locale locale)
Deprecated.
use
getName(Locale, boolean) with a second parameter of "false" |
ConceptName |
getBestShortName(java.util.Locale locale)
Deprecated.
|
User |
getChangedBy() |
java.util.List<ConceptName> |
getCompatibleNames(java.util.Locale desiredLocale)
Returns all names from compatible locales.
|
ConceptClass |
getConceptClass() |
java.lang.Integer |
getConceptId() |
java.util.Collection<ConceptMap> |
getConceptMappings() |
java.util.Collection<ConceptSet> |
getConceptSets() |
User |
getCreator() |
ConceptDatatype |
getDatatype() |
java.util.Date |
getDateChanged() |
java.util.Date |
getDateCreated() |
java.util.Date |
getDateRetired() |
ConceptDescription |
getDescription()
Finds the description of the concept using the current locale in Context.getLocale().
|
ConceptDescription |
getDescription(java.util.Locale locale)
Finds the description of the concept in the given locale.
|
ConceptDescription |
getDescription(java.util.Locale locale,
boolean exact)
Returns the preferred description for a locale.
|
java.util.Collection<ConceptDescription> |
getDescriptions() |
java.lang.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(java.util.Locale locale)
Convenience method that returns the fully specified name in the locale
|
java.lang.Integer |
getId() |
java.util.Collection<ConceptName> |
getIndexTerms()
Gets the list of all non-retired concept names which are index terms for this concept
|
java.util.Collection<ConceptName> |
getIndexTermsForLocale(java.util.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).
First "Fully Specified" name found while searching available locales in order of
preference.
The first fully specified name found while searching through all names for the concept
The first synonym found while searching through all names for the concept.
The first random name found(except index terms) while searching through all names.
|
ConceptName |
getName(java.util.Locale locale)
Returns a name in the given locale.
|
ConceptName |
getName(java.util.Locale locale,
boolean exact)
Returns a name in the given locale.
|
ConceptName |
getName(java.util.Locale locale,
ConceptNameType ofType,
ConceptNameTag havingTag)
Returns concept name depending of locale, type (short, fully specified, etc) and tag.
|
java.util.Collection<ConceptName> |
getNames() |
java.util.Collection<ConceptName> |
getNames(boolean includeVoided) |
java.util.Collection<ConceptName> |
getNames(java.util.Locale locale)
Returns all names available in a specific locale.
|
java.util.List<Concept> |
getPossibleValues()
Find all possible values of this object.
|
ConceptName |
getPreferredName(java.util.Locale forLocale)
Returns the name which is explicitly marked as preferred for a given locale.
|
ConceptName |
getPreferredNameForCountry(java.lang.String country)
Deprecated.
|
ConceptName |
getPreferredNameInLanguage(java.lang.String language)
Deprecated.
|
java.lang.Boolean |
getRetired()
Deprecated.
Use the "proper" isRetired method.
|
User |
getRetiredBy() |
java.lang.String |
getRetireReason() |
java.lang.Boolean |
getSet() |
java.util.List<Concept> |
getSetMembers()
Get all the concept members of current concept
|
ConceptName |
getShortestName(java.util.Locale locale,
java.lang.Boolean exact)
Returns the short form name for a locale, or if none has been identified, the shortest name
available in the locale.
|
ConceptName |
getShortNameForCountry(java.lang.String country)
Deprecated.
|
ConceptName |
getShortNameInLanguage(java.lang.String language)
Deprecated.
|
ConceptName |
getShortNameInLocale(java.util.Locale locale)
Gets the explicitly specified short name for a locale.
|
java.util.Collection<ConceptName> |
getShortNames()
Gets a collection of short names for this concept from all locales.
|
java.util.Collection<ConceptName> |
getShortNamesForLocale(java.util.Locale locale)
Deprecated.
because each concept has only one short name per locale.
|
java.util.Collection<ConceptAnswer> |
getSortedAnswers(java.util.Locale locale)
Deprecated.
|
java.util.Collection<ConceptName> |
getSynonyms()
Gets all the non-retired synonyms.
|
java.util.Collection<ConceptName> |
getSynonyms(java.util.Locale locale)
Gets the synonyms in the given locale.
|
java.lang.String |
getVersion() |
boolean |
hasName(java.lang.String name,
java.util.Locale locale)
Checks whether this concept has the given string in any of the names in the given locale
already.
|
Concept |
hydrate(java.lang.String s)
Deserialize the given string into a full object
|
boolean |
isComplex()
Child Class ConceptComplex overrides this method and returns true.
|
boolean |
isNamed(java.lang.String name) |
boolean |
isNumeric()
Whether this concept is numeric or not.
|
java.lang.Boolean |
isRetired() |
java.lang.Boolean |
isSet()
whether or not this concept is a set
|
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
|
java.lang.String |
serialize()
Turns this concept into a very very simple serialized string
|
void |
setAnswers(java.util.Collection<ConceptAnswer> answers)
Set this Concept as having the given
answers ; This method assumes that the
sort_weight has already been set. |
void |
setChangedBy(User changedBy) |
void |
setConceptClass(ConceptClass conceptClass) |
void |
setConceptId(java.lang.Integer conceptId) |
void |
setConceptMappings(java.util.Collection<ConceptMap> conceptMappings) |
void |
setConceptSets(java.util.Collection<ConceptSet> conceptSets) |
void |
setCreator(User creator) |
void |
setDatatype(ConceptDatatype conceptDatatype) |
void |
setDateChanged(java.util.Date dateChanged) |
void |
setDateCreated(java.util.Date dateCreated) |
void |
setDateRetired(java.util.Date dateRetired) |
void |
setDescriptions(java.util.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(java.lang.Integer id) |
void |
setNames(java.util.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 |
setPreferredName(java.util.Locale locale,
ConceptName preferredName)
Deprecated.
|
void |
setRetired(java.lang.Boolean retired) |
void |
setRetiredBy(User retiredBy) |
void |
setRetireReason(java.lang.String retireReason) |
void |
setSet(java.lang.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 |
setShortName(java.util.Locale locale,
ConceptName shortName)
Deprecated.
|
void |
setVersion(java.lang.String version) |
java.lang.String |
toString()
Returns a string consisting of the name of the class of which the object is an instance and
the
uuid field surrounded by [ and ] . |
equals, getUuid, hashCode, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
public Concept()
public Concept(java.lang.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 set@Deprecated public Concept(ConceptNumeric cn)
cn
- public java.util.Collection<ConceptAnswer> getAnswers()
@Deprecated public java.util.Collection<ConceptAnswer> getSortedAnswers(java.util.Locale locale)
locale
- public java.util.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(java.util.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
- public boolean removeAnswer(ConceptAnswer conceptAnswer)
conceptAnswer
- answer to removepublic User getChangedBy()
getChangedBy
in interface Auditable
public void setChangedBy(User changedBy)
setChangedBy
in interface Auditable
changedBy
- The changedBy to set.public ConceptClass getConceptClass()
public void setConceptClass(ConceptClass conceptClass)
conceptClass
- The conceptClass to set.public java.lang.Boolean isSet()
public void setSet(java.lang.Boolean set)
set
- whether or not this concept is a setpublic java.lang.Boolean getSet()
public ConceptDatatype getDatatype()
public void setDatatype(ConceptDatatype conceptDatatype)
conceptDatatype
- The conceptDatatype to set.public java.lang.Integer getConceptId()
public void setConceptId(java.lang.Integer conceptId)
conceptId
- The conceptId to set.public User getCreator()
getCreator
in interface Auditable
public void setCreator(User creator)
setCreator
in interface Auditable
creator
- The creator to set.public java.util.Date getDateChanged()
getDateChanged
in interface Auditable
public void setDateChanged(java.util.Date dateChanged)
setDateChanged
in interface Auditable
dateChanged
- The dateChanged to set.public java.util.Date getDateCreated()
getDateCreated
in interface Auditable
public void setDateCreated(java.util.Date dateCreated)
setDateCreated
in interface Auditable
dateCreated
- The dateCreated to set.@Deprecated public void setPreferredName(java.util.Locale locale, ConceptName preferredName)
setPreferredName(ConceptName)
public void setPreferredName(ConceptName preferredName)
preferredName
- The name to be marked as preferred in its locale@Deprecated public ConceptName getPreferredNameForCountry(java.lang.String country)
getPreferredName(Locale)
country
- ISO-3166 two letter country code@Deprecated public ConceptName getPreferredNameInLanguage(java.lang.String language)
getPreferredName(Locale)
country
- ISO-3166 two letter language codepublic ConceptName findNameTaggedWith(ConceptNameTag conceptNameTag)
conceptNameTag
- the tag for which to lookpublic ConceptName getName(java.util.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)
public boolean hasName(java.lang.String name, java.util.Locale locale)
name
- the ConceptName.name to compare tolocale
- the locale to look in (null to check all locales)public ConceptName getName(java.util.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(java.util.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)
public ConceptName getPreferredName(java.util.Locale forLocale)
forLocale
- locale for which to return a preferred name@Deprecated public ConceptName getBestName(java.util.Locale locale)
getName(Locale, boolean)
with a second parameter of "false"public ConceptName getFullySpecifiedName(java.util.Locale locale)
locale
- locale from which to look up the fully specified namepublic java.util.Collection<ConceptName> getNames(java.util.Locale locale)
locale
- locale for which names should be returnedpublic java.util.List<ConceptName> getCompatibleNames(java.util.Locale desiredLocale)
desiredLocale
- locale with which the names should be compatible@Deprecated public ConceptName getBestShortName(java.util.Locale locale)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
@Deprecated public void setShortName(java.util.Locale locale, ConceptName shortName)
setShortName(ConceptName)
public void setFullySpecifiedName(ConceptName fullySpecifiedName)
newFullySpecifiedName
- the new fully specified name to setpublic void setShortName(ConceptName shortName)
shortName
- the new shortName to set@Deprecated public ConceptName getShortNameForCountry(java.lang.String country)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
country
- ISO-3166 two letter country code@Deprecated public ConceptName getShortNameInLanguage(java.lang.String language)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
country
- ISO-3166 two letter language codepublic ConceptName getShortNameInLocale(java.util.Locale locale)
locale
- locale for which to find a short namepublic java.util.Collection<ConceptName> getShortNames()
@Deprecated public java.util.Collection<ConceptName> getShortNamesForLocale(java.util.Locale locale)
the
- locale where to find the shortNamegetShortNameInLocale(Locale)
public ConceptName getShortestName(java.util.Locale locale, java.lang.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(java.lang.String name)
name
- A namepublic java.util.Collection<ConceptName> getIndexTerms()
public java.util.Collection<ConceptName> getIndexTermsForLocale(java.util.Locale locale)
locale
- the locale for the index terms to returnpublic java.util.Collection<ConceptName> getNames()
public java.util.Collection<ConceptName> getNames(boolean includeVoided)
includeVoided
- Include voided ConceptNames if true.public void setNames(java.util.Collection<ConceptName> names)
names
- The names to set.public void addName(ConceptName conceptName)
conceptName
- public boolean removeName(ConceptName conceptName)
conceptName
- public ConceptDescription getDescription()
public ConceptDescription getDescription(java.util.Locale locale)
locale
- public ConceptDescription getDescription(java.util.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 java.util.Date getDateRetired()
getDateRetired
in interface Retireable
public void setDateRetired(java.util.Date dateRetired)
setDateRetired
in interface Retireable
dateRetired
- the dateRetired to setpublic java.lang.String getRetireReason()
getRetireReason
in interface Retireable
public void setRetireReason(java.lang.String retireReason)
setRetireReason
in interface Retireable
retireReason
- the retireReason to setpublic java.util.Collection<ConceptDescription> getDescriptions()
public void setDescriptions(java.util.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 removepublic java.lang.Boolean isRetired()
isRetired
in interface Retireable
@Deprecated public java.lang.Boolean getRetired()
isRetired()
public void setRetired(java.lang.Boolean retired)
setRetired
in interface Retireable
retired
- The retired to set.public java.util.Collection<ConceptName> getSynonyms(java.util.Locale locale)
locale
- public java.util.Collection<ConceptName> getSynonyms()
public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version
- The version to set.public java.util.Collection<ConceptSet> getConceptSets()
public void setConceptSets(java.util.Collection<ConceptSet> conceptSets)
conceptSets
- The conceptSets to set.public boolean isNumeric()
public java.util.Collection<ConceptMap> getConceptMappings()
public void setConceptMappings(java.util.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 java.lang.String toString()
BaseOpenmrsObject
uuid
field surrounded by [
and ]
. In other words,
this method returns a string equal to the value of: getClass().getName() + '[' + uuid + ']'
If the uuid
field is null
, it delegates to
Object.toString()
toString
in class BaseOpenmrsObject
Object.toString()
public java.util.List<Concept> findPossibleValues(java.lang.String searchText)
Attributable
findPossibleValues
in interface Attributable<Concept>
searchText
- String to search onAttributable.findPossibleValues(java.lang.String)
public java.util.List<Concept> getPossibleValues()
Attributable
getPossibleValues
in interface Attributable<Concept>
Attributable.getPossibleValues()
public Concept hydrate(java.lang.String s)
Attributable
hydrate
in interface Attributable<Concept>
s
- String to deserializeAttributable.hydrate(java.lang.String)
public java.lang.String serialize()
serialize
in interface Attributable<Concept>
Attributable.serialize()
public java.lang.String getDisplayString()
Attributable
getDisplayString
in interface Attributable<Concept>
Attributable.getDisplayString()
public java.util.Set<java.util.Locale> getAllConceptNameLocales()
public java.lang.Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(java.lang.Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
public java.util.List<Concept> getSetMembers()
public void addSetMember(Concept setMember)
setMember
- Concept to add to thepublic 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()
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.