/** * Convenience method for checking whether this is a a synonym. * * @return true if the name is tagged as a synonym, false otherwise * @since Version 1.7 */ public Boolean isSynonym() { return getConceptNameType() == null; }
/** * Convenience method for determining whether this is a short name. * * @return true if the name is marked as a short name, otherwise false */ public Boolean isShort() { return ConceptNameType.SHORT.equals(getConceptNameType()); }
/** * Convenience method for determining whether this is an index Term for a given locale. * * @param locale The locale in which this concept name should belong as an index term * @return true if the name is marked as an index term, otherwise false */ public Boolean isIndexTermInLocale(Locale locale) { return getConceptNameType() != null && getConceptNameType().equals(ConceptNameType.INDEX_TERM) && locale.equals(getLocale()); }
/** * Checks whether the concept name is explicitly marked as fully specified * * @return true if the name is marked as 'fully specified' otherwise false * @since Version 1.7 */ public Boolean isFullySpecifiedName() { return ConceptNameType.FULLY_SPECIFIED.equals(getConceptNameType()); }
/** * Convenience method for checking whether this is an index Term. * * @return true if the name is marked as an index term, otherwise false * @since Version 1.7 */ public Boolean isIndexTerm() { return ConceptNameType.INDEX_TERM.equals(getConceptNameType()); }
/** * Convenience method for determining whether this is a synonym in a given locale. * * @param locale The locale in which this synonym should belong * @return true if the concept name is marked as a synonym in the given locale, otherwise false */ public Boolean isSynonymInLocale(Locale locale) { return getConceptNameType() == null && locale.equals(getLocale()); }
public void setName(String name) { if (name != null && StringUtils.isBlank(name) && StringUtils.isNotBlank(this.name) && this.getConceptNameType().equals(ConceptNameType.SHORT)) { this.setVoided(true); } else { this.name = name; } }
c->(ofType==null || ofType.equals(c.getConceptNameType())) && (havingTag==null || c.hasTag(havingTag)) ).collect(Collectors.toList());
pStmt.setString(2, (conceptName.getConceptNameType() != null) ? conceptName.getConceptNameType().toString() : null); pStmt.setBoolean(3, conceptName.getLocalePreferred());
/** * @see Concept#setShortName(ConceptName) */ @Test public void setShortName_shouldConvertThePreviousShortNameIfAnyToASynonym() { Concept concept = createConcept(1, Context.getLocale()); ConceptName oldShortName = concept.getShortNameInLocale(Context.getLocale()); //sanity check Assert.assertEquals(ConceptNameType.SHORT, oldShortName.getConceptNameType()); concept.setShortName(new ConceptName("some name", Context.getLocale())); Assert.assertEquals(null, oldShortName.getConceptNameType()); }
/** * @see Concept#setFullySpecifiedName(ConceptName) */ @Test public void setFullySpecifiedName_shouldConvertThePreviousFullySpecifiedNameIfAnyToASynonym() { Concept concept = createConcept(1, Context.getLocale()); ConceptName oldFullySpecifiedName = concept.getFullySpecifiedName(Context.getLocale()); //sanity check Assert.assertEquals(ConceptNameType.FULLY_SPECIFIED, oldFullySpecifiedName.getConceptNameType()); concept.setFullySpecifiedName(new ConceptName("some name", Context.getLocale())); Assert.assertEquals(null, oldFullySpecifiedName.getConceptNameType()); }
&& !ConceptNameType.FULLY_SPECIFIED.equals(conceptName.getConceptNameType())) { conceptName.setConceptNameType(ConceptNameType.FULLY_SPECIFIED); } else {
/** * @see Concept#setFullySpecifiedName(ConceptName) */ @Test public void setFullySpecifiedName_shouldSetTheConceptNameTypeOfTheSpecifiedNameToFullySpecified() { Concept concept = new Concept(); ConceptName cn = new ConceptName("some name", Context.getLocale()); concept.setFullySpecifiedName(cn); Assert.assertEquals(ConceptNameType.FULLY_SPECIFIED, cn.getConceptNameType()); }
/** * @see Concept#getFullySpecifiedName(Locale) */ @Test public void getFullySpecifiedName_shouldReturnTheNameMarkedAsFullySpecifiedForTheGivenLocale() { Locale primaryLocale = Locale.US; Concept testConcept = createConcept(1, primaryLocale); ConceptName fullySpecifiedName_FR = createConceptName(3, "Docteur", new Locale("fr"), ConceptNameType.FULLY_SPECIFIED, true); testConcept.addName(fullySpecifiedName_FR); Assert.assertEquals(primaryLocale, testConcept.getFullySpecifiedName(primaryLocale).getLocale()); Assert.assertEquals(ConceptNameType.FULLY_SPECIFIED, testConcept.getFullySpecifiedName(primaryLocale).getConceptNameType()); }
/** * @see Concept#setShortName(ConceptName) */ @Test public void setShortName_shouldSetTheConceptNameTypeOfTheSpecifiedNameToShort() { Concept concept = new Concept(); ConceptName cn = new ConceptName("some name", Context.getLocale()); ConceptName FullySpecName = new ConceptName("fully spec name", Context.getLocale()); concept.addName(FullySpecName); concept.setShortName(cn); Assert.assertEquals(ConceptNameType.SHORT, cn.getConceptNameType()); }
@Override public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("locale", getObject().getLocale()); assertPropEquals("localePreferred", getObject().getLocalePreferred()); assertPropEquals("conceptNameType", getObject().getConceptNameType()); }
@Override public void validateFullRepresentation() throws Exception { super.validateFullRepresentation(); assertPropEquals("name", getObject().getName()); assertPropEquals("locale", getObject().getLocale()); assertPropEquals("localePreferred", getObject().getLocalePreferred()); assertPropEquals("conceptNameType", getObject().getConceptNameType()); assertPropPresent("auditInfo"); }