if (cn.isShort()) { cn.setConceptNameType(ConceptNameType.FULLY_SPECIFIED); reportUpdatedName(cn, "ConceptName with id " + cn.getConceptNameId() + " (" + cn.getName()
+ "' in locale '" + conceptNameLocale.getDisplayName() + "' has been dropped as the preferred name because it is a search term"); } else if (nameInLocale.isShort()) { nameInLocale.setLocalePreferred(false); reportUpdatedName(nameInLocale, "Preferred name '" + nameInLocale.getName() if (nameInLocale.isShort()) { if (!shortNameForLocaleFound) { shortNameForLocaleFound = true; reportUpdatedName(conceptName, "ConceptName with id " + conceptName.getConceptNameId() + " (" + conceptName.getName() + ") is no longer marked as preferred because it had no locale"); if (conceptName.isFullySpecifiedName() || conceptName.isShort()) { conceptName.setConceptNameType(null); reportUpdatedName(conceptName, "The name '" + conceptName.getName() + "' in locale '"
+ "' shouldn't be an index term"); errors.reject("Concept.error.preferredName.is.indexTerm"); } else if (nameInLocale.isShort()) { log.warn("Preferred name in locale '" + conceptNameLocale.toString() + "' shouldn't be a short name"); if (nameInLocale.isShort()) { if (!shortNameForLocaleFound) { shortNameForLocaleFound = true; if (!nameInLocale.isShort() && !validNamesFoundInLocale.add(nameInLocale.getName().toLowerCase())) { throw new DuplicateConceptNameException("'" + nameInLocale.getName() + "' is a duplicate name in locale '" + conceptNameLocale.toString() + "' for the same concept");
fullySpecName.setConceptNameType(null); } else if (conceptName.isShort() && conceptName.getLocale() != null) { ConceptName shortName = getShortNameInLocale(conceptName.getLocale()); if (shortName != null) {
/** * @see Concept#addName(ConceptName) */ @Test public void addName_shouldReplaceTheOldShortNameWithACurrentOne() { Concept concept = new Concept(); ConceptName oldShortName = new ConceptName("some name", Context.getLocale()); oldShortName.setConceptNameType(ConceptNameType.SHORT); concept.addName(oldShortName); ConceptName newShortName = new ConceptName("new name", Context.getLocale()); newShortName.setConceptNameType(ConceptNameType.SHORT); concept.addName(newShortName); Assert.assertEquals(false, oldShortName.isShort()); Assert.assertEquals("new name", concept.getShortNameInLocale(Context.getLocale()).getName()); }