Class ConceptUtil
java.lang.Object
com.ssgllc.fish.service.util.registered.ConceptUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsCodes
(List<String> ids, String conceptCode) Checks if a list of concept identifiers contains a specific concept code.static String
getConcatDisplayValues
(String valueSetCode, Collection<String> conceptIds) Concatenates the display values of concepts within a specified value set based on a collection of their unique identifiers.static String
getConceptCodeFromDescription
(String valueSetCode, String conceptDescription) Retrieves the unique code of a concept based on its description within a specified value set.static String
getConceptCodeFromDisplay
(String valueSetCode, String conceptDisplay) Retrieves the unique code of a concept based on its display value within a specified value set.static String
getConceptCodeFromId
(String valueSetCode, String conceptId) Retrieves the unique code of a concept based on its unique identifier within a specified value set.static String
getConceptCodeFromIdOnly
(String conceptId) Retrieves the unique code of a concept based on its unique identifier, without specifying a value set.static String
getConceptDescriptionFromId
(String valueSetCode, String conceptId) Retrieves the description of a concept based on its unique identifier within a specified value set.static String
getConceptDisplayFromCode
(String valueSetCode, String conceptCode) Retrieves the display value of a concept based on its unique code within a specified value set.static String
getConceptDisplayFromId
(String valueSetCode, String conceptId) Retrieves the display value of a concept based on its unique identifier within a specified value set.static String
getConceptDisplayFromIdOnly
(String conceptId) Retrieves the display value of a concept based on its unique identifier, without specifying a value set.static com.ssgllc.fish.service.dto.gen.ConceptDTO
getConceptFromCode
(String valueSetCode, String conceptCode) Retrieves aConceptDTO
based on its unique code within a specified value set.static com.ssgllc.fish.service.dto.gen.ConceptDTO
getConceptFromDisplay
(String valueSetCode, String conceptDisplay) Retrieves aConceptDTO
based on its display value within a specified value set.static com.ssgllc.fish.service.dto.gen.ConceptDTO
getConceptFromId
(String valueSetCode, String conceptId) Retrieves aConceptDTO
based on its unique identifier within a specified value set.static com.ssgllc.fish.service.dto.gen.ConceptDTO
getConceptFromIdOnly
(String conceptId) Retrieves aConceptDTO
based on its unique identifier, without specifying a value set.static String
getConceptIdFromCode
(String valueSetCode, String conceptCode) Retrieves the unique identifier of a concept based on its unique code within a specified value set.static String
getConceptIdFromDisplay
(String valueSetCode, String conceptDisplay) Retrieves the unique identifier of a concept based on its display value within a specified value set.static String
getConceptIdFromId
(String valueSetId, String conceptCode) Retrieves the unique identifier of a concept based on its unique code within a specified value set identifier.static com.ssgllc.fish.domain.gen.Concept
getConceptRefFromCode
(String valueSetCode, String conceptCode) Retrieves aConcept
reference based on its unique code within a specified value set.static Set
<com.ssgllc.fish.service.dto.gen.ConceptDTO> getConcepts
(String valueSetCode) Retrieves allConceptDTO
objects within a specified value set.static Set
<com.ssgllc.fish.service.dto.gen.ConceptDTO> getConceptsInGroup
(String valueSetCode, String group) Retrieves a set ofConceptDTO
that belong to a specific group within a value set.static com.ssgllc.fish.domain.gen.Concept
getInitializedConceptFromCode
(String valueSetCode, String conceptCode) Retrieves an initializedConcept
based on its unique code within a specified value set.static String
getValueSetIdFromCodeOnly
(String valueSetCode) Retrieves the unique identifier of a value set based on its code.static boolean
isConceptInGroup
(String valueSetCode, String conceptId, String group) Checks if a concept belongs to a specific group within a value set based on its unique identifier.static boolean
isConceptInGroupFromCode
(String valueSetCode, String conceptCode, String group) Checks if a concept belongs to a specific group within a value set based on its unique code.static boolean
isValidConcept
(String conceptId, String valueSetCode) Checks if a concept is valid within a specified value set based on its unique identifier.static boolean
isValidConceptFromCode
(String valueSetCode, String conceptCode) Checks if a concept is valid within a specified value set based on its unique code.static boolean
isValidConceptFromDisplay
(String valueSetCode, String conceptDisplay) Checks if a concept is valid within a specified value set based on its display value.static String
mapConceptCode
(String fromValueSetCode, String inputCode) Maps a concept code from a specified value set to its display value, or returns the input code if the mapping is not found.static String
mapConceptCodeNull
(String fromValueSetCode, String inputCode) Maps a concept code from a specified value set to its display value, or returns null if the mapping is not found.static boolean
valuesetIsLoaded
(String valueSetCode) Checks if a value set is loaded based on its unique code.
-
Constructor Details
-
ConceptUtil
public ConceptUtil()
-
-
Method Details
-
getConceptFromCode
public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromCode(String valueSetCode, String conceptCode) Retrieves aConceptDTO
based on its unique code within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The
ConceptDTO
corresponding to the specified concept code within the value set.
Groovy example:
return conceptUtil.getConceptFromCode("FieldDataType", "STRING")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getConceptFromCode("FieldDataType", "STRING").display
Returns:
"String"
-
getConcepts
Retrieves allConceptDTO
objects within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.- Returns:
- A set of all
ConceptDTO
objects within the specified value set.
Groovy example:
return conceptUtil.getConcepts("FieldDataType")
Returns:
[ { "code": "REFONEONE", "display": "Ref One One" }, { "code": "DATE", "display": "Date" }, ... ]
SpEL example:
#getConcepts("FieldDataType").![display]
Returns:
[ "Ref One One", "Date", "Any Blob", "Big Decimal", "Value Set Many", "Instant", "Ref One", "Long", "Blob", "Ref Many Many", "Text Blob", "Ref Many", "Value Set", "Image Blob", "Double", "Boolean", "Float", "Integer", "String" ]
-
getConceptsInGroup
public static Set<com.ssgllc.fish.service.dto.gen.ConceptDTO> getConceptsInGroup(String valueSetCode, String group) Retrieves a set ofConceptDTO
that belong to a specific group within a value set.- Parameters:
valueSetCode
- The code identifying the value set.group
- The name of the group within the value set to filter the concepts by.- Returns:
- A set of
ConceptDTO
that are part of the specified group, or the original set if the group is null.
Groovy example:
return conceptUtil.getConceptsInGroup("FieldDataType", "Numeric")
Returns:
[ { "code": "BIGDECIMAL", "display": "Big Decimal" }, { "code": "DOUBLE", "display": "Double" }, { "code": "FLOAT", "display": "Float" }, { "code": "INTEGER", "display": "Integer" } ]
SpEL example:
#getConceptsInGroup("FieldDataType", "Numeric").![display]
Returns:
[ "Big Decimal", "Double", "Float", "Integer" ]
Note: If either the 'group' is null or the 'valueSetCode' does not yield any concepts, the method returns the original set of concepts.
-
getConceptRefFromCode
public static com.ssgllc.fish.domain.gen.Concept getConceptRefFromCode(String valueSetCode, String conceptCode) Retrieves aConcept
reference based on its unique code within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The
Concept
reference corresponding to the specified concept code within the value set.
Groovy example:
return conceptUtil.getConceptRefFromCode("FieldDataType", "STRING")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getConceptRefFromCode("FieldDataType", "STRING").display
Returns:
"String"
-
getInitializedConceptFromCode
public static com.ssgllc.fish.domain.gen.Concept getInitializedConceptFromCode(String valueSetCode, String conceptCode) Retrieves an initializedConcept
based on its unique code within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The initialized
Concept
corresponding to the specified concept code within the value set.
Groovy example:
return conceptUtil.getInitializedConceptFromCode("FieldDataType", "STRING")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getInitializedConceptFromCode("FieldDataType", "STRING").display
Returns:
"String"
-
getConceptFromId
public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromId(String valueSetCode, String conceptId) Retrieves aConceptDTO
based on its unique identifier within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptId
- The unique identifier of the concept within the value set.- Returns:
- The
ConceptDTO
corresponding to the specified concept identifier within the value set.
Groovy example:
return conceptUtil.getConceptFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getConceptFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074").display
Returns:
"String"
-
getConceptFromIdOnly
Retrieves aConceptDTO
based on its unique identifier, without specifying a value set.- Parameters:
conceptId
- The unique identifier of the concept.- Returns:
- The
ConceptDTO
corresponding to the specified concept identifier.
Groovy example:
return conceptUtil.getConceptFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getConceptFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074").display
Returns:
"String"
-
getConceptFromDisplay
public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromDisplay(String valueSetCode, String conceptDisplay) Retrieves aConceptDTO
based on its display value within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptDisplay
- The display value of the concept within the value set.- Returns:
- The
ConceptDTO
corresponding to the specified display value within the value set.
Groovy example:
return conceptUtil.getConceptFromDisplay("FieldDataType", "String")
Returns:
{ "code": "STRING", "display": "String" }
SpEL example:
#getConceptFromDisplay("FieldDataType", "String").code
Returns:
"STRING"
-
getValueSetIdFromCodeOnly
Retrieves the unique identifier of a value set based on its code.- Parameters:
valueSetCode
- The code identifying the value set.- Returns:
- The unique identifier of the value set corresponding to the specified code.
Groovy example:
return conceptUtil.getValueSetIdFromCodeOnly("FieldDataType")
Returns:
"0ace438c-7b0f-1fac-8190-267e3236005e"
SpEL example:
#getValueSetIdFromCodeOnly("FieldDataType")
Returns:
"0ace438c-7b0f-1fac-8190-267e3236005e"
-
getConceptIdFromCode
Retrieves the unique identifier of a concept based on its unique code within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The unique identifier of the concept corresponding to the specified concept code within the value set.
Groovy example:
return conceptUtil.getConceptIdFromCode("FieldDataType", "STRING")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
SpEL example:
#getConceptIdFromCode("FieldDataType", "STRING")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
-
getConceptIdFromId
Retrieves the unique identifier of a concept based on its unique code within a specified value set identifier.- Parameters:
valueSetId
- The unique identifier of the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The unique identifier of the concept corresponding to the specified concept code within the value set identifier.
Groovy example:
return conceptUtil.getConceptIdFromId("0ace438c-7b0f-1fac-8190-267e3236005e", "STRING")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
SpEL example:
#getConceptIdFromId("0ace438c-7b0f-1fac-8190-267e3236005e", "STRING")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
-
getConceptIdFromDisplay
Retrieves the unique identifier of a concept based on its display value within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptDisplay
- The display value of the concept within the value set.- Returns:
- The unique identifier of the concept corresponding to the specified display value within the value set.
Groovy example:
return conceptUtil.getConceptIdFromDisplay("FieldDataType", "String")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
SpEL example:
#getConceptIdFromDisplay("FieldDataType", "String")
Returns:
"0ace438c-7b0f-1fac-8190-267e32390074"
-
getConceptCodeFromDisplay
Retrieves the unique code of a concept based on its display value within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptDisplay
- The display value of the concept within the value set.- Returns:
- The unique code of the concept corresponding to the specified display value within the value set.
Groovy example:
return conceptUtil.getConceptCodeFromDisplay("FieldDataType", "String")
Returns:
"STRING"
SpEL example:
#getConceptCodeFromDisplay("FieldDataType", "String")
Returns:
"STRING"
-
getConceptCodeFromDescription
Retrieves the unique code of a concept based on its description within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptDescription
- The description of the concept within the value set.- Returns:
- The unique code of the concept corresponding to the specified description within the value set.
Groovy example:
return conceptUtil.getConceptCodeFromDescription("FieldDataType", "String data type")
Returns:
"STRING"
SpEL example:
#getConceptCodeFromDescription("FieldDataType", "String data type")
Returns:
"STRING"
-
getConceptCodeFromId
Retrieves the unique code of a concept based on its unique identifier within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptId
- The unique identifier of the concept within the value set.- Returns:
- The unique code of the concept corresponding to the specified concept identifier within the value set.
Groovy example:
return conceptUtil.getConceptCodeFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"STRING"
SpEL example:
#getConceptCodeFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"STRING"
-
getConceptCodeFromIdOnly
Retrieves the unique code of a concept based on its unique identifier, without specifying a value set.- Parameters:
conceptId
- The unique identifier of the concept.- Returns:
- The unique code of the concept corresponding to the specified concept identifier.
Groovy example:
return conceptUtil.getConceptCodeFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"STRING"
SpEL example:
#getConceptCodeFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"STRING"
-
getConceptDisplayFromId
Retrieves the display value of a concept based on its unique identifier within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptId
- The unique identifier of the concept within the value set.- Returns:
- The display value of the concept corresponding to the specified concept identifier within the value set.
Groovy example:
return conceptUtil.getConceptDisplayFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"String"
SpEL example:
#getConceptDisplayFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"String"
-
getConceptDisplayFromCode
Retrieves the display value of a concept based on its unique code within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
- The display value of the concept corresponding to the specified concept code within the value set, or null if not found.
Groovy example:
return conceptUtil.getConceptDisplayFromCode("FieldDataType", "STRING")
Returns:
"String"
SpEL example:
#getConceptDisplayFromCode("FieldDataType", "STRING")
Returns:
"String"
-
mapConceptCode
Maps a concept code from a specified value set to its display value, or returns the input code if the mapping is not found.- Parameters:
fromValueSetCode
- The code identifying the value set from which to map the concept code.inputCode
- The input concept code to be mapped.- Returns:
- The display value of the concept if found, otherwise the input code. If the display value is
"<BLANK>"
, an empty string is returned.
Groovy example:
return conceptUtil.mapConceptCode("FieldDataType", "STRING")
Returns:
"String"
SpEL example:
#mapConceptCode("FieldDataType", "STRING")
Returns:
"String"
-
mapConceptCodeNull
Maps a concept code from a specified value set to its display value, or returns null if the mapping is not found.- Parameters:
fromValueSetCode
- The code identifying the value set from which to map the concept code.inputCode
- The input concept code to be mapped.- Returns:
- The display value of the concept if found, otherwise null. If the display value is
"<BLANK>"
, an empty string is returned.
Groovy example:
return conceptUtil.mapConceptCodeNull("FieldDataType", "STRING")
Returns:
"String"
SpEL example:
#mapConceptCodeNull("FieldDataType", "STRING")
Returns:
"String"
-
getConceptDisplayFromIdOnly
Retrieves the display value of a concept based on its unique identifier, without specifying a value set.- Parameters:
conceptId
- The unique identifier of the concept.- Returns:
- The display value of the concept corresponding to the specified concept identifier.
Groovy example:
return conceptUtil.getConceptDisplayFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"String"
SpEL example:
#getConceptDisplayFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"String"
-
getConceptDescriptionFromId
Retrieves the description of a concept based on its unique identifier within a specified value set.- Parameters:
valueSetCode
- The code identifying the value set.conceptId
- The unique identifier of the concept within the value set.- Returns:
- The description of the concept corresponding to the specified concept identifier within the value set.
Groovy example:
return conceptUtil.getConceptDescriptionFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"This is a description."
SpEL example:
#getConceptDescriptionFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")
Returns:
"This is a description."
-
containsCodes
Checks if a list of concept identifiers contains a specific concept code.- Parameters:
ids
- A list of concept identifiers.conceptCode
- The concept code to be checked.- Returns:
true
if the list contains the specified concept code, otherwisefalse
.
Groovy example:
return conceptUtil.containsCodes(["0ace438c-7b0f-1fac-8190-267e32390074"], "STRING")
Returns:
true
SpEL example:
#containsCodes({"0ace438c-7b0f-1fac-8190-267e32390074"}, "STRING")
Returns:
true
-
isValidConcept
Checks if a concept is valid within a specified value set based on its unique identifier.- Parameters:
conceptId
- The unique identifier of the concept.valueSetCode
- The code identifying the value set.- Returns:
true
if the concept is valid within the specified value set, otherwisefalse
.
Groovy example:
return conceptUtil.isValidConcept("0ace438c-7b0f-1fac-8190-267e32390074", "FieldDataType")
Returns:
true
SpEL example:
#isValidConcept("0ace438c-7b0f-1fac-8190-267e32390074", "FieldDataType")
Returns:
true
-
isConceptInGroup
Checks if a concept belongs to a specific group within a value set based on its unique identifier.- Parameters:
valueSetCode
- The code identifying the value set.conceptId
- The unique identifier of the concept within the value set.group
- The name of the group to check.- Returns:
true
if the concept belongs to the specified group, otherwisefalse
.
Groovy example:
return conceptUtil.isConceptInGroup("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074", "Numeric")
Returns:
false
SpEL example:
#isConceptInGroup("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074", "Numeric")
Returns:
false
-
isConceptInGroupFromCode
public static boolean isConceptInGroupFromCode(String valueSetCode, String conceptCode, String group) Checks if a concept belongs to a specific group within a value set based on its unique code.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.group
- The name of the group to check.- Returns:
true
if the concept belongs to the specified group, otherwisefalse
.
Groovy example:
return conceptUtil.isConceptInGroupFromCode("FieldDataType", "STRING", "Numeric")
Returns:
false
SpEL example:
#isConceptInGroupFromCode("FieldDataType", "STRING", "Numeric")
Returns:
false
-
isValidConceptFromCode
Checks if a concept is valid within a specified value set based on its unique code.- Parameters:
valueSetCode
- The code identifying the value set.conceptCode
- The unique code of the concept within the value set.- Returns:
true
if the concept is valid within the specified value set, otherwisefalse
.
Groovy example:
return conceptUtil.isValidConceptFromCode("FieldDataType", "STRING")
Returns:
true
SpEL example:
#isValidConceptFromCode("FieldDataType", "STRING")
Returns:
true
-
isValidConceptFromDisplay
Checks if a concept is valid within a specified value set based on its display value.- Parameters:
valueSetCode
- The code identifying the value set.conceptDisplay
- The display value of the concept within the value set.- Returns:
true
if the concept is valid within the specified value set, otherwisefalse
.
Groovy example:
return conceptUtil.isValidConceptFromDisplay("FieldDataType", "String")
Returns:
true
SpEL example:
#isValidConceptFromDisplay("FieldDataType", "String")
Returns:
true
-
getConcatDisplayValues
Concatenates the display values of concepts within a specified value set based on a collection of their unique identifiers.- Parameters:
valueSetCode
- The code identifying the value set.conceptIds
- A collection of unique identifiers of the concepts.- Returns:
- A string of concatenated display values, sorted and separated by commas. Returns an empty string if the value set code or collection of concept IDs is empty.
Groovy example:
return conceptUtil.getConcatDisplayValues("FieldDataType", ["0ace438c-7b0f-1fac-8190-267e32390074", "0ace438c-7b0f-1fac-8190-267e32390073"])
Returns:
"Integer,String"
SpEL example:
#getConcatDisplayValues("FieldDataType", {"0ace438c-7b0f-1fac-8190-267e32390074", "0ace438c-7b0f-1fac-8190-267e32390073"})
Returns:
"Integer,String"
-
valuesetIsLoaded
Checks if a value set is loaded based on its unique code.- Parameters:
valueSetCode
- The code identifying the value set.- Returns:
true
if the value set is loaded, otherwisefalse
.
Groovy example:
return conceptUtil.valuesetIsLoaded("FieldDataType")
Returns:
true
SpEL example:
#valuesetIsLoaded("FieldDataType")
Returns:
true
-