|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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
,
ConceptDescription
,
ConceptAnswer
,
ConceptSet
,
ConceptMap
,
ConceptService
,
Serialized FormField 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 |
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(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.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 (which may be null.) |
ConceptName |
getBestName(java.util.Locale locale)
Deprecated. use getName(Locale, boolean) with a second parameter of "false" |
ConceptName |
getBestShortName(java.util.Locale locale)
Deprecated. use getShortNameInLocale(Locale) or
getShortestName(Locale, Boolean) |
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. |
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. use getPreferredName(Locale) |
ConceptName |
getPreferredNameInLanguage(java.lang.String language)
Deprecated. use getPreferredName(Locale) |
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. use getShortNameInLocale(Locale) or
getShortestName(Locale, Boolean) |
ConceptName |
getShortNameInLanguage(java.lang.String language)
Deprecated. use getShortNameInLocale(Locale) or
getShortestName(Locale, Boolean) |
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()
|
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 ; 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. use setPreferredName(ConceptName) |
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. use setShortName(ConceptName) |
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 set@Deprecated public Concept(ConceptNumeric cn)
cn
- Method Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
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
s (which may be null.)
includeRetired
- true/false whether to also include the retired answers
public 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 remove
public 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 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)
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, 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 name
public 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
@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 code
public ConceptName getShortNameInLocale(java.util.Locale locale)
locale
- locale for which to find a short name
public java.util.Collection<ConceptName> getShortNames()
@Deprecated public java.util.Collection<ConceptName> getShortNamesForLocale(java.util.Locale locale)
the
- locale where to find the shortName
getShortNameInLocale(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 name
public java.util.Collection<ConceptName> getIndexTerms()
public java.util.Collection<ConceptName> getIndexTermsForLocale(java.util.Locale locale)
locale
- the locale for the index terms to return
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 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 remove
public 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()
toString
in class java.lang.Object
Object.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.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()
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |