/** * @return Returns the retired. * * @deprecated as of 2.0, use {@link #getRetired()} */ @Override @Deprecated @JsonIgnore public Boolean isRetired() { return getRetired(); }
this.setDateCreated(c.getDateCreated()); this.setSet(c.getSet()); this.setRetired(c.getRetired()); this.setRetiredBy(c.getRetiredBy()); this.setRetireReason(c.getRetireReason());
/** * @see java.lang.Comparable#compareTo(java.lang.Object) * Note: this comparator imposes orderings that are inconsistent with equals. */ @Override @SuppressWarnings("squid:S1210") public int compareTo(ConceptSet cs) { int value = OpenmrsUtil.compareWithNullAsLowest(concept.getRetired(), cs.concept.getRetired()); if (value == 0) { value = OpenmrsUtil.compareWithNullAsLowest(this.getSortWeight(), cs.getSortWeight()); } return value; }
assertThat(copyConcept.getDateChanged(), is(originalConcept.getDateChanged())); assertThat(copyConcept.getChangedBy(), is(originalConcept.getChangedBy())); assertThat(copyConcept.getRetired(), is(originalConcept.getRetired())); assertThat(copyConcept.getRetiredBy(), is(originalConcept.getRetiredBy())); assertThat(copyConcept.getDateRetired(), is(originalConcept.getDateRetired()));
/** * If <code>includeRetired</code> is true, then the returned object is the actual stored list of * {@link ConceptAnswer}s * * @param includeRetired true/false whether to also include the retired answers * @return Returns the answers for this Concept * @should return the same as getAnswers() if includeRetired is true * @should not return retired answers if includeRetired is false */ public Collection<ConceptAnswer> getAnswers(boolean includeRetired) { if (includeRetired) { return getAnswers(); } else { return getAnswers().stream() .filter(a -> !a.getAnswerConcept().getRetired()) .collect(Collectors.toSet()); } }
/** * @see org.openmrs.api.ConceptService#getConceptByMapping(java.lang.String, java.lang.String, * java.lang.Boolean) */ @Override @Transactional(readOnly = true) public Concept getConceptByMapping(String code, String sourceName, Boolean includeRetired) throws APIException { List<Concept> concepts = Context.getConceptService().getConceptsByMapping(code, sourceName, includeRetired); if (concepts.isEmpty()) { return null; } // we want to throw an exception if there is more than one non-retired concept; // since the getConceptByMapping DAO method returns a list with all non-retired concept // sorted to the front of the list, we can test if there is more than one retired concept // by testing if the second concept in the list is retired or not else if (concepts.size() > 1 && !concepts.get(1).getRetired()) { throw new APIException("Concept.error.multiple.non.retired", new Object[] { code, sourceName }); } else { return concepts.get(0); } }
/** * @see org.openmrs.api.ConceptService#retireConcept(org.openmrs.Concept, java.lang.String) */ @Override public Concept retireConcept(Concept concept, String reason) throws APIException { if (!StringUtils.hasText(reason)) { throw new IllegalArgumentException(Context.getMessageSourceService().getMessage("general.voidReason.empty")); } // only do this if the concept isn't retired already if (!concept.getRetired()) { checkIfLocked(); concept.setRetired(true); concept.setRetireReason(reason); return dao.saveConcept(concept); } return concept; }
if (name.getConcept().getRetired()) { return false; if (candidateName.getConcept().getRetired()) { continue;
/** * @see ConceptServiceImpl#retireConcept(Concept,String) */ @Test public void retireConcept_shouldRetireTheGivenConcept() { String retireReason = "dummy reason"; Concept concept = conceptService.getConcept(3); assertFalse(concept.getRetired()); conceptService.retireConcept(concept, retireReason); assertTrue(concept.getRetired()); assertEquals(retireReason, concept.getRetireReason()); }
/** * Constructor from Concept. * * @param c */ public ConceptComplex(Concept c) { this.setAnswers(c.getAnswers(true)); this.setChangedBy(c.getChangedBy()); this.setConceptClass(c.getConceptClass()); this.setConceptId(c.getConceptId()); this.setConceptSets(c.getConceptSets()); this.setCreator(c.getCreator()); this.setDatatype(c.getDatatype()); this.setDateChanged(c.getDateChanged()); this.setDateCreated(c.getDateCreated()); this.setSet(c.getSet()); this.setNames(c.getNames()); this.setDescriptions(c.getDescriptions()); this.setConceptMappings(c.getConceptMappings()); this.setRetired(c.getRetired()); this.setVersion(c.getVersion()); this.setUuid(c.getUuid()); this.handler = ""; }
@Test public void validate_shouldPassIfTheDuplicateNameInTheLocaleForTheConceptBeingValidatedIsVoided() { ConceptName otherName = conceptService.getConceptName(1439); //sanity check since names should only be unique amongst preferred and fully specified names Assert.assertTrue(otherName.isFullySpecifiedName() || otherName.isPreferred()); Assert.assertFalse(otherName.getVoided()); Assert.assertFalse(otherName.getConcept().getRetired()); //change to a duplicate name in the same locale ConceptName duplicateName = conceptService.getConceptName(2477); duplicateName.setName(otherName.getName()); Concept concept = duplicateName.getConcept(); concept.setPreferredName(duplicateName); //ensure that the name has been marked as preferred in its locale Assert.assertEquals(duplicateName, concept.getPreferredName(duplicateName.getLocale())); Assert.assertTrue(duplicateName.isPreferred()); duplicateName.setVoided(true); Errors errors = new BindException(concept, "concept"); validator.validate(concept, errors); Assert.assertFalse(errors.hasErrors()); }