org.openmrs
Class Concept

java.lang.Object
  extended by org.openmrs.BaseOpenmrsObject
      extended by org.openmrs.Concept
All Implemented Interfaces:
java.io.Serializable, Attributable<Concept>, Auditable, OpenmrsObject, Retireable
Direct Known Subclasses:
ConceptComplex, ConceptDerived, ConceptNumeric

public class Concept
extends BaseOpenmrsObject
implements Auditable, Retireable, java.io.Serializable, Attributable<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()

See Also:
ConceptName, 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
 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 ConceptAnswers (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

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Concept

public Concept()
default constructor


Concept

public Concept(java.lang.Integer conceptId)
Convenience constructor with conceptid to save to 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.

Parameters:
conceptId - the concept id to set

Concept

@Deprecated
public Concept(ConceptNumeric cn)
Deprecated. 

Possibly used for decapitating a ConceptNumeric (to remove the row in concept_numeric)

Parameters:
cn -
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)
Expected behavior:
not fail if given obj has null conceptid, not fail if given obj is null, not fail if concept id is null, confirm two new concept objects are equal

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Expected behavior:
not fail if concept id is null

getAnswers

public java.util.Collection<ConceptAnswer> getAnswers()
Returns:
Returns the non-retired answers.
Expected behavior:
not return retired answers, not return null if no answers defined

getSortedAnswers

@Deprecated
public java.util.Collection<ConceptAnswer> getSortedAnswers(java.util.Locale locale)
Deprecated. 

TODO describe use cases

Parameters:
locale -
Returns:
the answers for this concept sorted according to ConceptAnswerComparator

getAnswers

public 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.)

Parameters:
includeRetired - true/false whether to also include the retired answers
Returns:
Returns the answers for this Concept
Expected behavior:
return actual answers object if given includeRetired is true

setAnswers

public 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.

Parameters:
answers - The answers to set.

addAnswer

public void addAnswer(ConceptAnswer conceptAnswer)
Add the given ConceptAnswer to the list of answers for this Concept

Parameters:
conceptAnswer -
Expected behavior:
add the ConceptAnswer to Concept, not fail if answers list is null, not fail if answers contains ConceptAnswer already, set the sort weight to the max plus one if not provided

removeAnswer

public boolean removeAnswer(ConceptAnswer conceptAnswer)
Remove the given answer from the list of answers for this Concept

Parameters:
conceptAnswer - answer to remove
Returns:
true if the entity was removed, false otherwise
Expected behavior:
not fail if answers is empty, not fail if given answer does not exist in list

getChangedBy

public User getChangedBy()
Specified by:
getChangedBy in interface Auditable
Returns:
Returns the changedBy.

setChangedBy

public void setChangedBy(User changedBy)
Specified by:
setChangedBy in interface Auditable
Parameters:
changedBy - The changedBy to set.

getConceptClass

public ConceptClass getConceptClass()
Returns:
Returns the conceptClass.

setConceptClass

public void setConceptClass(ConceptClass conceptClass)
Parameters:
conceptClass - The conceptClass to set.

isSet

public java.lang.Boolean isSet()
whether or not this concept is a set


setSet

public void setSet(java.lang.Boolean set)
Parameters:
set - whether or not this concept is a set

getSet

public java.lang.Boolean getSet()

getDatatype

public ConceptDatatype getDatatype()
Returns:
Returns the conceptDatatype.

setDatatype

public void setDatatype(ConceptDatatype conceptDatatype)
Parameters:
conceptDatatype - The conceptDatatype to set.

getConceptId

public java.lang.Integer getConceptId()
Returns:
Returns the conceptId.

setConceptId

public void setConceptId(java.lang.Integer conceptId)
Parameters:
conceptId - The conceptId to set.

getCreator

public User getCreator()
Specified by:
getCreator in interface Auditable
Returns:
Returns the creator.

setCreator

public void setCreator(User creator)
Specified by:
setCreator in interface Auditable
Parameters:
creator - The creator to set.

getDateChanged

public java.util.Date getDateChanged()
Specified by:
getDateChanged in interface Auditable
Returns:
Returns the dateChanged.

setDateChanged

public void setDateChanged(java.util.Date dateChanged)
Specified by:
setDateChanged in interface Auditable
Parameters:
dateChanged - The dateChanged to set.

getDateCreated

public java.util.Date getDateCreated()
Specified by:
getDateCreated in interface Auditable
Returns:
Returns the dateCreated.

setDateCreated

public void setDateCreated(java.util.Date dateCreated)
Specified by:
setDateCreated in interface Auditable
Parameters:
dateCreated - The dateCreated to set.

setPreferredName

@Deprecated
public void setPreferredName(java.util.Locale locale,
                                        ConceptName preferredName)
Deprecated. use setPreferredName(ConceptName)


setPreferredName

public 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. Also, the name is added to the concept if it is not already among the concept names.

Parameters:
preferredName - The name to be marked as preferred in its locale
Expected behavior:
only allow one preferred name, add the name to the list of names if it not among them before, fail if the preferred name to set to is an index term

getPreferredNameForCountry

@Deprecated
public ConceptName getPreferredNameForCountry(java.lang.String country)
Deprecated. use getPreferredName(Locale)

Gets the name explicitly marked as preferred in a locale with a matching country code.

Parameters:
country - ISO-3166 two letter country code
Returns:
the preferred name, or null if no match is found

getPreferredNameInLanguage

@Deprecated
public ConceptName getPreferredNameInLanguage(java.lang.String language)
Deprecated. use getPreferredName(Locale)

Gets the name explicitly marked as preferred in a locale with a matching language code.

Parameters:
country - ISO-3166 two letter language code
Returns:
the preferred name, or null if no match is found

findNameTaggedWith

public ConceptName findNameTaggedWith(ConceptNameTag conceptNameTag)
A convenience method to get the concept-name (if any) which has a particular tag. This does not guarantee that the returned name is the only one with the tag.

Parameters:
conceptNameTag - the tag for which to look
Returns:
the tagged name, or null if no name has the tag

getName

public ConceptName getName(java.util.Locale locale)
Returns a name in the given locale. If a name isn't found with an exact match, a compatible locale match is returned. If no name is found matching either of those, the first name defined for this concept is returned.

Parameters:
locale - the locale to fetch for
Returns:
ConceptName attributed to the Concept in the given locale
Since:
1.5
See Also:
to get all the names for a locale,, for the preferred name (if any)

getName

public ConceptName getName()
Returns concept name, the look up for the appropriate name is done in the following order;

Returns:
ConceptName in the current locale or any locale if none found
Since:
1.5
See Also:
to get all the names for a locale, for the preferred name (if any)
Expected behavior:
return the name explicitly marked as locale preferred if any is present, return the fully specified name in a locale if no preferred name is set, return null if the only added name is an index term, return name in broader locale incase none is found in specific one

hasName

public 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.

Parameters:
name - the ConceptName.name to compare to
locale - the locale to look in (null to check all locales)
Returns:
true/false whether the name exists already

getName

public ConceptName getName(java.util.Locale locale,
                           boolean exact)
Returns a name in the given locale. If a name isn't found with an exact match, a compatible locale match is returned. If no name is found matching either of those, the first name defined for this concept is returned.

Parameters:
locale - the language and country in which the name is used
exact - true/false to return only exact locale (no default locale)
Returns:
the closest name in the given locale, or the first name
See Also:
to get all the names for a locale,, for the preferred name (if any)
Expected behavior:
return exact name locale match given exact equals true, return loose match given exact equals false, return null if no names are found in locale given exact equals true, return any name if no locale match given exact equals false

getPreferredName

public ConceptName getPreferredName(java.util.Locale forLocale)
Returns the name which is explicitly marked as preferred for a given locale.

Parameters:
forLocale - locale for which to return a preferred name
Returns:
preferred name for the locale, or null if no preferred name is specified
Expected behavior:
return the concept name explicitly marked as locale preferred, return the fully specified name if no name is explicitly marked as locale preferred

getBestName

@Deprecated
public ConceptName getBestName(java.util.Locale locale)
Deprecated. use getName(Locale, boolean) with a second parameter of "false"


getFullySpecifiedName

public ConceptName getFullySpecifiedName(java.util.Locale locale)
Convenience method that returns the fully specified name in the locale

Parameters:
locale - locale from which to look up the fully specified name
Returns:
the name explicitly marked as fully specified for the locale
Expected behavior:
return the name marked as fully specified for the given locale

getNames

public java.util.Collection<ConceptName> getNames(java.util.Locale locale)
Returns all names available in a specific locale.

This is recommended when managing the concept dictionary.

Parameters:
locale - locale for which names should be returned
Returns:
Collection of ConceptNames with the given locale

getCompatibleNames

public java.util.List<ConceptName> getCompatibleNames(java.util.Locale desiredLocale)
Returns all names from compatible locales. A locale is considered compatible if it is exactly the same locale, or if either locale has no country specified and the language matches.

This is recommended when presenting possible names to the use.

Parameters:
desiredLocale - locale with which the names should be compatible
Returns:
Collection of compatible names
Expected behavior:
exclude incompatible country locales, exclude incompatible language locales

getBestShortName

@Deprecated
public ConceptName getBestShortName(java.util.Locale locale)
Deprecated. use getShortNameInLocale(Locale) or getShortestName(Locale, Boolean)


setShortName

@Deprecated
public void setShortName(java.util.Locale locale,
                                    ConceptName shortName)
Deprecated. use setShortName(ConceptName)


setFullySpecifiedName

public 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.

Parameters:
newFullySpecifiedName - the new fully specified name to set
Expected behavior:
set the concept name type of the specified name to fully specified, convert the previous fully specified name if any to a synonym, add the name to the list of names if it not among them before

setShortName

public 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.

Parameters:
shortName - the new shortName to set
Expected behavior:
set the concept name type of the specified name to short, convert the previous shortName if any to a synonym, add the name to the list of names if it not among them before

getShortNameForCountry

@Deprecated
public ConceptName getShortNameForCountry(java.lang.String country)
Deprecated. use getShortNameInLocale(Locale) or getShortestName(Locale, Boolean)

This method is deprecated, it always returns the shortName from the locale with a matching country code.

Parameters:
country - ISO-3166 two letter country code
Returns:
the short name, or null if none has been explicitly set

getShortNameInLanguage

@Deprecated
public ConceptName getShortNameInLanguage(java.lang.String language)
Deprecated. use getShortNameInLocale(Locale) or getShortestName(Locale, Boolean)

This method is deprecated, it always returns the shortName from the locale with a matching language code.

Parameters:
country - ISO-3166 two letter language code
Returns:
the short name, or null if none has been explicitly set

getShortNameInLocale

public ConceptName getShortNameInLocale(java.util.Locale locale)
Gets the explicitly specified short name for a locale.

Parameters:
locale - locale for which to find a short name
Returns:
the short name, or null if none has been explicitly set

getShortNames

public java.util.Collection<ConceptName> getShortNames()
Gets a collection of short names for this concept from all locales.

Returns:
a collection of all short names for this concept

getShortNamesForLocale

@Deprecated
public java.util.Collection<ConceptName> getShortNamesForLocale(java.util.Locale locale)
Deprecated. because each concept has only one short name per locale.

This method is deprecated, it returns a list with only one shortName for the locale if any is found, otherwise the list will be empty.

Parameters:
the - locale where to find the shortName
Returns:
a list containing a single shortName for the locale if any is found
See Also:
getShortNameInLocale(Locale)

getShortestName

public 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. If exact is false, the shortest name from any locale is returned

Parameters:
locale - the language and country in which the short name is used
exact - true/false to return only exact locale (no default locale)
Returns:
the appropriate short name, or null if not found
Expected behavior:
return the name marked as the shortName for the locale if it is present, return the shortest name in a given locale for a concept if exact is true, return the shortest name for the concept from any locale if exact is false, return null if their are no names in the specified locale and exact is true

isNamed

public boolean isNamed(java.lang.String name)
Parameters:
name - A name
Returns:
whether this concept has the given name in any locale

getIndexTerms

public java.util.Collection<ConceptName> getIndexTerms()
Gets the list of all non-retired concept names which are index terms for this concept

Returns:
a collection of concept names which are index terms for this concept
Since:
1.7

getIndexTermsForLocale

public 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

Parameters:
locale - the locale for the index terms to return
Returns:
a collection of concept names which are index terms in the given locale
Since:
1.7

getNames

public java.util.Collection<ConceptName> getNames()
Returns:
Returns the names.

getNames

public java.util.Collection<ConceptName> getNames(boolean includeVoided)
Parameters:
includeVoided - Include voided ConceptNames if true.
Returns:
Returns the names.

setNames

public void setNames(java.util.Collection<ConceptName> names)
Parameters:
names - The names to set.

addName

public void addName(ConceptName conceptName)
Add the given ConceptName to the list of names for this Concept

Parameters:
conceptName -
Expected behavior:
replace the old preferred name with a current one, replace the old fully specified name with a current one, replace the old short name with a current one, mark the first name added as fully specified

removeName

public boolean removeName(ConceptName conceptName)
Remove the given name from the list of names for this Concept

Parameters:
conceptName -
Returns:
true if the entity was removed, false otherwise

getDescription

public ConceptDescription getDescription()
Finds the description of the concept using the current locale in Context.getLocale(). Returns null if none found.

Returns:
ConceptDescription attributed to the Concept in the given locale

getDescription

public ConceptDescription getDescription(java.util.Locale locale)
Finds the description of the concept in the given locale. Returns null if none found.

Parameters:
locale -
Returns:
ConceptDescription attributed to the Concept in the given locale

getDescription

public ConceptDescription getDescription(java.util.Locale locale,
                                         boolean exact)
Returns the preferred description for a locale.

Parameters:
locale - the language and country in which the description is used
exact - true/false to return only exact locale (no default locale)
Returns:
the appropriate description, or null if not found
Expected behavior:
return match on locale exactly, return match on language only, not return match on language only if exact match exists, not return language only match for exact matches

getRetiredBy

public User getRetiredBy()
Specified by:
getRetiredBy in interface Retireable
Returns:
the retiredBy

setRetiredBy

public void setRetiredBy(User retiredBy)
Specified by:
setRetiredBy in interface Retireable
Parameters:
retiredBy - the retiredBy to set

getDateRetired

public java.util.Date getDateRetired()
Specified by:
getDateRetired in interface Retireable
Returns:
the dateRetired

setDateRetired

public void setDateRetired(java.util.Date dateRetired)
Specified by:
setDateRetired in interface Retireable
Parameters:
dateRetired - the dateRetired to set

getRetireReason

public java.lang.String getRetireReason()
Specified by:
getRetireReason in interface Retireable
Returns:
the retireReason

setRetireReason

public void setRetireReason(java.lang.String retireReason)
Specified by:
setRetireReason in interface Retireable
Parameters:
retireReason - the retireReason to set

getDescriptions

public java.util.Collection<ConceptDescription> getDescriptions()
Returns:
Returns the descriptions.

setDescriptions

public void setDescriptions(java.util.Collection<ConceptDescription> descriptions)
Sets the collection of descriptions for this Concept.

Parameters:
descriptions - the collection of descriptions

addDescription

public void addDescription(ConceptDescription description)
Add the given description to the list of descriptions for this Concept

Parameters:
description - the description to add

removeDescription

public boolean removeDescription(ConceptDescription description)
Remove the given description from the list of descriptions for this Concept

Parameters:
description - the description to remove
Returns:
true if the entity was removed, false otherwise

isRetired

public java.lang.Boolean isRetired()
Specified by:
isRetired in interface Retireable
Returns:
Returns the retired.

getRetired

@Deprecated
public java.lang.Boolean getRetired()
Deprecated. Use the "proper" isRetired method.

This method exists to satisfy spring and hibernates slightly bung use of Boolean object getters and setters.

See Also:
isRetired()

setRetired

public void setRetired(java.lang.Boolean retired)
Specified by:
setRetired in interface Retireable
Parameters:
retired - The retired to set.

getSynonyms

public java.util.Collection<ConceptName> getSynonyms(java.util.Locale locale)
Gets the synonyms in the given locale. Returns a list of names from the same language, or an empty list if none found.

Parameters:
locale -
Returns:
Collection of ConceptNames which are synonyms for the Concept in the given locale

getSynonyms

public java.util.Collection<ConceptName> getSynonyms()
Gets all the non-retired synonyms.

Returns:
Collection of ConceptNames which are synonyms for the Concept or an empty list if none is found
Since:
1.7

getVersion

public java.lang.String getVersion()
Returns:
Returns the version.

setVersion

public void setVersion(java.lang.String version)
Parameters:
version - The version to set.

getConceptSets

public java.util.Collection<ConceptSet> getConceptSets()
Returns:
Returns the conceptSets.

setConceptSets

public void setConceptSets(java.util.Collection<ConceptSet> conceptSets)
Parameters:
conceptSets - The conceptSets to set.

isNumeric

public boolean isNumeric()
Whether this concept is numeric or not. This will always return false for concept objects. ConceptNumeric.isNumeric() will then always return true.

Returns:
false

getConceptMappings

public java.util.Collection<ConceptMap> getConceptMappings()
Returns:
the conceptMappings for this concept

setConceptMappings

public void setConceptMappings(java.util.Collection<ConceptMap> conceptMappings)
Parameters:
conceptMappings - the conceptMappings to set

addConceptMapping

public void addConceptMapping(ConceptMap newConceptMap)
Add the given ConceptMap object to this concept's list of concept mappings. If there is already a corresponding ConceptMap object for this concept already, this one will not be added.

Parameters:
newConceptMap -

isComplex

public boolean isComplex()
Child Class ConceptComplex overrides this method and returns true. See ConceptComplex.isComplex(). Otherwise this method returns false.

Returns:
false
Since:
1.5

removeConceptMapping

public boolean removeConceptMapping(ConceptMap conceptMap)
Remove the given ConceptMap from the list of mappings for this Concept

Parameters:
conceptMap -
Returns:
true if the entity was removed, false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

findPossibleValues

public java.util.List<Concept> findPossibleValues(java.lang.String searchText)
Description copied from interface: Attributable
Search for possible values of this object using the given search string

Specified by:
findPossibleValues in interface Attributable<Concept>
Parameters:
searchText - String to search on
Returns:
List of possible objects that can be assigned
See Also:
Attributable.findPossibleValues(java.lang.String)

getPossibleValues

public java.util.List<Concept> getPossibleValues()
Description copied from interface: Attributable
Find all possible values of this object. For example, if this object is a Location, the database is delved into and all Location objects should be returned

Specified by:
getPossibleValues in interface Attributable<Concept>
Returns:
List of objects that can be assigned
See Also:
Attributable.getPossibleValues()

hydrate

public Concept hydrate(java.lang.String s)
Description copied from interface: Attributable
Deserialize the given string into a full object

Specified by:
hydrate in interface Attributable<Concept>
Parameters:
s - String to deserialize
Returns:
hydrated object
See Also:
Attributable.hydrate(java.lang.String)

serialize

public java.lang.String serialize()
Turns this concept into a very very simple serialized string

Specified by:
serialize in interface Attributable<Concept>
Returns:
String representing this object (Usually an identifier or primary key)
See Also:
Attributable.serialize()

getDisplayString

public java.lang.String getDisplayString()
Description copied from interface: Attributable
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

Specified by:
getDisplayString in interface Attributable<Concept>
Returns:
String acceptable to display on a page
See Also:
Attributable.getDisplayString()

getAllConceptNameLocales

public 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.

Returns:
a set of all locales for names for this concept
Since:
1.7
Expected behavior:
return all locales for conceptNames for this concept without duplicates

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
Returns:
id - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.getId()

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface OpenmrsObject
Parameters:
id - - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.setId(java.lang.Integer)

getSetMembers

public java.util.List<Concept> getSetMembers()
Get all the concept members of current concept

Returns:
List the Concepts that are members of this Concept's set
Since:
1.7
Expected behavior:
return concept set members sorted according to the sort weight, return all the conceptMembers of current Concept, return unmodifiable list of conceptMember list

addSetMember

public void addSetMember(Concept setMember)
Appends the concept to the end of the existing list of concept members for this Concept

Parameters:
setMember - Concept to add to the
Since:
1.7
Expected behavior:
add concept as a conceptSet, append concept to the existing list of conceptSet, place the new concept last in the list, assign the calling component as parent to the ConceptSet

addSetMember

public void addSetMember(Concept setMember,
                         int index)
Add the concept to the existing member to the list of set members in the given location.

index of 0 is before the first concept
index of -1 is after last.
index of 1 is after the first but before the second, etc

Parameters:
setMember - the Concept to add as a child of this Concept
index - where in the list of set members to put this setMember
Since:
1.7
See Also:
getSortedConceptSets()
Expected behavior:
assign the given concept as a ConceptSet, insert the concept before the first with zero index, insert the concept at the end with negative one index, insert the concept in the third slot, assign the calling component as parent to the ConceptSet, add the concept to the current list of conceptSet

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change