|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openmrs.BaseOpenmrsObject
org.openmrs.Concept
public class Concept
A Concept object can represent either a question or an answer to a data point. That data point is
usually an Obs.
A Concept can have multiple names and multiple descriptions within one locale and across multiple
locales.
To save a Concept to the database, first build up the Concept object in java, then pass that
object to the ConceptService.
To get a Concept that is stored in the database, call a method in the 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()
ConceptName,
ConceptNameTag,
ConceptDescription,
ConceptAnswer,
ConceptSet,
ConceptMap,
ConceptService,
Serialized Form| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
Concept()
default constructor |
|
Concept(ConceptNumeric cn)
Deprecated. |
|
Concept(java.lang.Integer conceptId)
/** Convenience constructor with conceptid to save to setConceptId(Integer). |
|
| Method Summary | |
|---|---|
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 |
boolean |
equals(java.lang.Object obj)
|
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.Collection<ConceptAnswer> |
getAnswers()
|
java.util.Collection<ConceptAnswer> |
getAnswers(boolean includeRetired)
If includeRetired is true, then the returned object is the actual stored list of
ConceptAnswers (which may be null.) |
ConceptName |
getBestName(java.util.Locale locale)
Returns the best compatible name for a locale. |
ConceptName |
getBestShortName(java.util.Locale locale)
Returns the best compatible short name for a locale. |
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 |
java.lang.Integer |
getId()
|
ConceptName |
getName()
Returns a name in the current User's chosen locale via Context.getLocale(). |
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. |
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)
Gets the explicitly preferred name for a country. |
ConceptName |
getPreferredNameInLanguage(java.lang.String language)
Gets the explicitly preferred name in a language. |
java.lang.Boolean |
getRetired()
Deprecated. Use the "proper" isRetired method. |
User |
getRetiredBy()
|
java.lang.String |
getRetireReason()
|
java.lang.Boolean |
getSet()
|
ConceptName |
getShortestName(java.util.Locale locale,
java.lang.Boolean exact)
Returns the preferred 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)
Gets the explicitly specified short name for a country. |
ConceptName |
getShortNameInLanguage(java.lang.String language)
Gets the explicitly specified short name in a language. |
ConceptName |
getShortNameInLocale(java.util.Locale locale)
Gets the explicitly specified short name for a locale. |
java.util.Collection<ConceptAnswer> |
getSortedAnswers(java.util.Locale locale)
TODO describe use cases |
java.util.Collection<ConceptName> |
getSynonyms(java.util.Locale locale)
Gets the synonyms in the given locale. |
java.lang.String |
getVersion()
|
int |
hashCode()
|
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 |
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 |
setId(java.lang.Integer id)
|
void |
setNames(java.util.Collection<ConceptName> names)
|
void |
setPreferredName(java.util.Locale locale,
ConceptName preferredName)
Sets the preferred name for a locale. |
void |
setRetired(java.lang.Boolean retired)
|
void |
setRetiredBy(User retiredBy)
|
void |
setRetireReason(java.lang.String retireReason)
|
void |
setSet(java.lang.Boolean set)
|
void |
setShortName(java.util.Locale locale,
ConceptName shortName)
Sets the short name for a locale. |
void |
setVersion(java.lang.String version)
|
java.lang.String |
toString()
|
| Methods inherited from class org.openmrs.BaseOpenmrsObject |
|---|
getUuid, setUuid |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.openmrs.OpenmrsObject |
|---|
getUuid, setUuid |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
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
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 setpublic Concept(ConceptNumeric cn)
cn - | Method Detail |
|---|
public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public java.util.Collection<ConceptAnswer> getAnswers()
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
ConceptAnswers (which may be null.)
includeRetired - true/false whether to also include the retired answers
public void setAnswers(java.util.Collection<ConceptAnswer> answers)
answers
answers - The answers to set.public void addAnswer(ConceptAnswer conceptAnswer)
conceptAnswer - public boolean removeAnswer(ConceptAnswer conceptAnswer)
conceptAnswer - answer to remove
public User getChangedBy()
getChangedBy in interface Auditablepublic void setChangedBy(User changedBy)
setChangedBy in interface AuditablechangedBy - 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 Auditablepublic void setCreator(User creator)
setCreator in interface Auditablecreator - The creator to set.public java.util.Date getDateChanged()
getDateChanged in interface Auditablepublic void setDateChanged(java.util.Date dateChanged)
setDateChanged in interface AuditabledateChanged - The dateChanged to set.public java.util.Date getDateCreated()
getDateCreated in interface Auditablepublic void setDateCreated(java.util.Date dateCreated)
setDateCreated in interface AuditabledateCreated - The dateCreated to set.
public void setPreferredName(java.util.Locale locale,
ConceptName preferredName)
locale - the locale for which to set the preferred namepreferredName - name which is preferred in the localepublic ConceptName getPreferredNameForCountry(java.lang.String country)
country - ISO-3166 two letter country code
public ConceptName getPreferredNameInLanguage(java.lang.String language)
language - ISO-639 two letter language code
public ConceptName findNameTaggedWith(ConceptNameTag conceptNameTag)
conceptNameTag - the tag for which to look
public ConceptName getName(java.util.Locale locale)
locale - the locale to fetch for
to get all the names for a locale,,
for the preferred name (if any),,
to get the best match for a locale.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),
to get the best match for a locale
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,
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),,
to get the best match for a locale.public ConceptName getPreferredName(java.util.Locale forLocale)
forLocale - locale for which to return a preferred name
public ConceptName getBestName(java.util.Locale locale)
locale - the language and country in which the name is used
ConceptName, never nullpublic java.util.Collection<ConceptName> getNames(java.util.Locale locale)
locale - locale for which names should be returned
public java.util.List<ConceptName> getCompatibleNames(java.util.Locale desiredLocale)
desiredLocale - locale with which the names should be compatible
public ConceptName getBestShortName(java.util.Locale locale)
locale - the language and country in which the short name is used
public void setShortName(java.util.Locale locale,
ConceptName shortName)
getShortNameInLanguage(String)
.
locale - the locale for which to set the short nameshortName - name which is preferred in the localepublic ConceptName getShortNameForCountry(java.lang.String country)
country - ISO-3166 two letter country code
public ConceptName getShortNameInLanguage(java.lang.String language)
language - ISO-639 two letter language code
public ConceptName getShortNameInLocale(java.util.Locale locale)
locale - locale for which to return a short name
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 name
public 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 Retireablepublic void setRetiredBy(User retiredBy)
setRetiredBy in interface RetireableretiredBy - the retiredBy to setpublic java.util.Date getDateRetired()
getDateRetired in interface Retireablepublic void setDateRetired(java.util.Date dateRetired)
setDateRetired in interface RetireabledateRetired - the dateRetired to setpublic java.lang.String getRetireReason()
getRetireReason in interface Retireablepublic void setRetireReason(java.lang.String retireReason)
setRetireReason in interface RetireableretireReason - 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 remove
public java.lang.Boolean isRetired()
isRetired in interface Retireablepublic java.lang.Boolean getRetired()
isRetired()public void setRetired(java.lang.Boolean retired)
setRetired in interface Retireableretired - The retired to set.public java.util.Collection<ConceptName> getSynonyms(java.util.Locale locale)
locale -
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()
toString in class java.lang.ObjectObject.toString()public java.util.List<Concept> findPossibleValues(java.lang.String searchText)
Attributable
findPossibleValues in interface Attributable<Concept>searchText - String to search on
Attributable.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 deserialize
Attributable.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.lang.Integer getId()
getId in interface OpenmrsObjectOpenmrsObject.getId()public void setId(java.lang.Integer id)
setId in interface OpenmrsObjectid - - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
|
OpenMRS-trunk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||