use of com.b2international.snowowl.snomed.core.domain.InactivationProperties in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeThenRebaseOtherTask.
@Test
public void mergeThenRebaseOtherTask() throws Exception {
final String conceptA = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
final IBranchPath b = BranchPathUtils.createPath(branchPath, "b");
branching.createBranch(a).statusCode(201);
branching.createBranch(b).statusCode(201);
Map<?, ?> inactivationRequest = ImmutableMap.builder().put("active", false).put("inactivationProperties", new InactivationProperties(Concepts.DUPLICATE, List.of(new AssociationTarget(Concepts.REFSET_SAME_AS_ASSOCIATION, Concepts.FULLY_SPECIFIED_NAME)))).put("commitComment", "Inactivated concept").build();
updateComponent(a, SnomedComponentType.CONCEPT, conceptA, inactivationRequest).statusCode(204);
final String conceptB = createNewConcept(b);
merge(a, branchPath, "Merge branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
SnomedConcept conceptAOnParent = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptA, "members(),relationships()").statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptAOnParent.getRelationships()).hasSize(1);
assertThat(conceptAOnParent.getMembers()).hasSize(2);
merge(branchPath, b, "Rebase branch B").body("status", equalTo(Merge.Status.COMPLETED.name()));
SnomedConcept conceptAOnBranchB = getComponent(b, SnomedComponentType.CONCEPT, conceptA, "members(),relationships()").statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptAOnBranchB.getRelationships()).hasSize(1);
assertThat(conceptAOnBranchB.getMembers()).hasSize(2);
getComponent(b, SnomedComponentType.CONCEPT, conceptB, "relationships()").statusCode(200).extract().as(SnomedConcept.class);
}
use of com.b2international.snowowl.snomed.core.domain.InactivationProperties in project snow-owl by b2ihealthcare.
the class SnomedComponentInactivationApiTest method reuseConceptAndDescriptionInactivationIndicators.
@Test
public void reuseConceptAndDescriptionInactivationIndicators() throws Exception {
// create a concept
String conceptId = createNewConcept(branchPath);
SnomedConcept concept = getConcept(conceptId, "descriptions()");
// add pending move to concept and descriptions
Map<?, ?> pendingMoveUpdate = ImmutableMap.of("inactivationProperties", new InactivationProperties(Concepts.PENDING_MOVE, null), "commitComment", "Set to Pending Move");
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, pendingMoveUpdate).statusCode(204);
for (SnomedDescription description : concept.getDescriptions()) {
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, description.getId(), pendingMoveUpdate).statusCode(204);
}
// XXX intentionally using the members() expand here to check duplication
SnomedConcept pendingMoveConcept = getConcept(conceptId, "members(),descriptions(expand(members()))");
// verify and collect inactivation indicator members
SnomedReferenceSetMember conceptInactivationIndicatorMember = getIndicatorMember(pendingMoveConcept, Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR);
SnomedReferenceSetMember fsnInactivationIndicatorMember = null;
SnomedReferenceSetMember ptInactivationIndicatorMember = null;
for (SnomedDescription description : pendingMoveConcept.getDescriptions()) {
if (Concepts.FULLY_SPECIFIED_NAME.equals(description.getTypeId())) {
fsnInactivationIndicatorMember = getIndicatorMember(description, Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR);
} else if (Concepts.SYNONYM.equals(description.getTypeId())) {
ptInactivationIndicatorMember = getIndicatorMember(description, Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR);
} else {
throw new UnsupportedOperationException();
}
}
Map<?, ?> inactivationConceptRequest = ImmutableMap.builder().put("active", false).put("inactivationProperties", new InactivationProperties(Concepts.DUPLICATE, null)).put("commitComment", "Inactivated concept").build();
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, inactivationConceptRequest).statusCode(204);
// XXX intentionally using the members() expand here to check duplication/member issues
SnomedConcept inactivatedConcept = getConcept(conceptId, "members(),descriptions(expand(members()))");
SnomedReferenceSetMember afterInactivationConceptInactivationIndicatorMember = getIndicatorMember(inactivatedConcept, Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR);
SnomedReferenceSetMember afterInactivationFsnInactivationIndicatorMember = null;
SnomedReferenceSetMember afterInactivationPtInactivationIndicatorMember = null;
for (SnomedDescription description : inactivatedConcept.getDescriptions()) {
if (Concepts.FULLY_SPECIFIED_NAME.equals(description.getTypeId())) {
afterInactivationFsnInactivationIndicatorMember = getIndicatorMember(description, Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR);
} else if (Concepts.SYNONYM.equals(description.getTypeId())) {
afterInactivationPtInactivationIndicatorMember = getIndicatorMember(description, Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR);
} else {
throw new UnsupportedOperationException();
}
}
assertEquals(conceptInactivationIndicatorMember.getId(), afterInactivationConceptInactivationIndicatorMember.getId());
assertEquals(null, afterInactivationConceptInactivationIndicatorMember.getEffectiveTime());
assertEquals(false, afterInactivationConceptInactivationIndicatorMember.isReleased());
assertEquals(Concepts.DUPLICATE, afterInactivationConceptInactivationIndicatorMember.getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID));
assertEquals(fsnInactivationIndicatorMember.getId(), afterInactivationFsnInactivationIndicatorMember.getId());
assertEquals(null, afterInactivationFsnInactivationIndicatorMember.getEffectiveTime());
assertEquals(false, afterInactivationFsnInactivationIndicatorMember.isReleased());
assertEquals(Concepts.CONCEPT_NON_CURRENT, afterInactivationFsnInactivationIndicatorMember.getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID));
assertEquals(ptInactivationIndicatorMember.getId(), afterInactivationPtInactivationIndicatorMember.getId());
assertEquals(null, afterInactivationPtInactivationIndicatorMember.getEffectiveTime());
assertEquals(false, afterInactivationPtInactivationIndicatorMember.isReleased());
assertEquals(Concepts.CONCEPT_NON_CURRENT, afterInactivationPtInactivationIndicatorMember.getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID));
}
use of com.b2international.snowowl.snomed.core.domain.InactivationProperties in project snow-owl by b2ihealthcare.
the class SnomedDescriptionApiTest method updateIndicatorAfterInactivation.
@Test
public void updateIndicatorAfterInactivation() {
String descriptionToInactivate = createNewDescription(branchPath);
assertInactivation(branchPath, descriptionToInactivate, new InactivationProperties(Concepts.DUPLICATE, Collections.emptyList()));
assertInactivation(branchPath, descriptionToInactivate, new InactivationProperties(Concepts.OUTDATED, Collections.emptyList()));
}
use of com.b2international.snowowl.snomed.core.domain.InactivationProperties in project snow-owl by b2ihealthcare.
the class SnomedDescriptionApiTest method updateInactivationIndicatorOnActiveReleasedDescription.
@Test
public void updateInactivationIndicatorOnActiveReleasedDescription() throws Exception {
String descriptionToInactivate = createNewDescription(branchPath);
assertInactivation(branchPath, descriptionToInactivate, new InactivationProperties(Concepts.PENDING_MOVE, Collections.emptyList()));
// release component
createCodeSystemAndVersion(branchPath, "SNOMEDCT-RELDESC-INACTIVATIONINDICATOR", "v1", LocalDate.parse("2018-07-01"));
SnomedDescription description = assertInactivation(branchPath, descriptionToInactivate, new InactivationProperties(Concepts.CONCEPT_NON_CURRENT, Collections.emptyList())).extract().as(SnomedDescription.class);
List<SnomedReferenceSetMember> inactivationIndicators = description.getMembers().stream().filter(member -> Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR.equals(member.getRefsetId())).collect(Collectors.toList());
final SnomedReferenceSetMember inactivationIndicator = Iterables.getOnlyElement(inactivationIndicators);
assertEquals(Concepts.CONCEPT_NON_CURRENT, inactivationIndicator.getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID));
assertNull(inactivationIndicator.getEffectiveTime());
}
use of com.b2international.snowowl.snomed.core.domain.InactivationProperties in project snow-owl by b2ihealthcare.
the class SnomedDescriptionApiTest method inactivateWithIndicator.
@Test
public void inactivateWithIndicator() {
String descriptionId = createNewDescription(branchPath);
assertInactivation(branchPath, descriptionId, new InactivationProperties(Concepts.DUPLICATE, Collections.emptyList()));
}
Aggregations