public class Concept extends BaseOpenmrsObject implements Auditable, Retireable, 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(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.
|
boolean |
equals(Object obj) |
ConceptName |
findNameTaggedWith(ConceptNameTag conceptNameTag)
A convenience method to get the concept-name (if any) which has a particular tag.
|
List<Concept> |
findPossibleValues(String searchText)
Search for possible values of this object using the given search string
|
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 (which may be null.) |
ConceptName |
getBestName(Locale locale)
Deprecated.
use
getName(Locale, boolean) with a second parameter of "false" |
ConceptName |
getBestShortName(Locale locale)
Deprecated.
|
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).
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(Locale locale)
Returns a name in the given locale.
|
ConceptName |
getName(Locale locale,
boolean exact)
Returns a name in the given locale.
|
Collection<ConceptName> |
getNames() |
Collection<ConceptName> |
getNames(boolean includeVoided) |
Collection<ConceptName> |
getNames(Locale locale)
Returns all names available in a specific locale.
|
List<Concept> |
getPossibleValues()
Find all possible values of this object.
|
ConceptName |
getPreferredName(Locale forLocale)
Returns the name which is explicitly marked as preferred for a given locale.
|
ConceptName |
getPreferredNameForCountry(String country)
Deprecated.
|
ConceptName |
getPreferredNameInLanguage(String language)
Deprecated.
|
Boolean |
getRetired()
Deprecated.
Use the "proper" isRetired method.
|
User |
getRetiredBy() |
String |
getRetireReason() |
Boolean |
getSet() |
List<Concept> |
getSetMembers()
Get all the concept members of current concept
|
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 |
getShortNameForCountry(String country)
Deprecated.
|
ConceptName |
getShortNameInLanguage(String language)
Deprecated.
|
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> |
getShortNamesForLocale(Locale locale)
Deprecated.
because each concept has only one short name per locale.
|
Collection<ConceptAnswer> |
getSortedAnswers(Locale locale)
Deprecated.
|
Collection<ConceptName> |
getSynonyms()
Gets all the non-retired synonyms.
|
Collection<ConceptName> |
getSynonyms(Locale locale)
Gets the synonyms in the given locale.
|
String |
getVersion() |
int |
hashCode() |
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 s)
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() |
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
|
String |
serialize()
Turns this concept into a very 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 |
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 |
setPreferredName(Locale locale,
ConceptName preferredName)
Deprecated.
|
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 |
setShortName(Locale locale,
ConceptName shortName)
Deprecated.
|
void |
setVersion(String version) |
String |
toString() |
getUuid, 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
equals(Object)
and 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 boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public Collection<ConceptAnswer> getAnswers()
@Deprecated public Collection<ConceptAnswer> getSortedAnswers(Locale locale)
locale
- public Collection<ConceptAnswer> getAnswers(boolean includeRetired)
includeRetired
is true, then the returned object is the actual stored list of
ConceptAnswer
s (which may be null.)includeRetired
- 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
- 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 Boolean isSet()
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 Auditable
public void setCreator(User creator)
setCreator
in interface Auditable
creator
- The creator to set.public Date getDateChanged()
getDateChanged
in interface Auditable
public void setDateChanged(Date dateChanged)
setDateChanged
in interface Auditable
dateChanged
- The dateChanged to set.public Date getDateCreated()
getDateCreated
in interface Auditable
public void setDateCreated(Date dateCreated)
setDateCreated
in interface Auditable
dateCreated
- The dateCreated to set.@Deprecated public void setPreferredName(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(String country)
getPreferredName(Locale)
country
- ISO-3166 two letter country code@Deprecated public ConceptName getPreferredNameInLanguage(String language)
getPreferredName(Locale)
country
- ISO-3166 two letter language codepublic 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)
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, 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(Locale forLocale)
forLocale
- locale for which to return a preferred name@Deprecated public ConceptName getBestName(Locale locale)
getName(Locale, boolean)
with a second parameter of "false"public 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 compatible@Deprecated public ConceptName getBestShortName(Locale locale)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
@Deprecated public void setShortName(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(String country)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
country
- ISO-3166 two letter country code@Deprecated public ConceptName getShortNameInLanguage(String language)
getShortNameInLocale(Locale)
or
getShortestName(Locale, Boolean)
country
- ISO-3166 two letter language codepublic ConceptName getShortNameInLocale(Locale locale)
locale
- locale for which to find a short namepublic Collection<ConceptName> getShortNames()
@Deprecated public Collection<ConceptName> getShortNamesForLocale(Locale locale)
the
- locale where to find the shortNamegetShortNameInLocale(Locale)
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
- public 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 removepublic Boolean isRetired()
isRetired
in interface Retireable
@Deprecated public Boolean getRetired()
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()
toString
in class Object
Object.toString()
public List<Concept> findPossibleValues(String searchText)
Attributable
findPossibleValues
in interface Attributable<Concept>
searchText
- String to search onAttributable.findPossibleValues(java.lang.String)
public List<Concept> getPossibleValues()
Attributable
getPossibleValues
in interface Attributable<Concept>
Attributable.getPossibleValues()
public Concept hydrate(String s)
Attributable
hydrate
in interface Attributable<Concept>
s
- 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 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 LLC.. All Rights Reserved.