Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SO-4633: Ensure description inactivator member inactivation is possible #753

Open
wants to merge 4 commits into
base: 7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
SO-4633: Ensure description inactivator member inactivation is possible
  • Loading branch information
AAAlinaaa committed Feb 2, 2021
commit d551d1b659c16df0ddfe531e454d033204e93d02
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ protected final boolean ensureMemberActive(final TransactionContext context, fin

}
}

protected final boolean ensureStatusChanged(final TransactionContext context, final SnomedReferenceSetMember existingMember,
final SnomedComponentDocument componentToUpdate, final SnomedRefSetMemberIndexEntry.Builder updatedMember) {
if (!existingMember.isActive() && componentToUpdate.isActive()) {
if (LOG.isDebugEnabled()) { LOG.debug("Reactivating {} member {}.", getMemberType(), existingMember.getId()); }
updatedMember.active(true);
updateModule(context, existingMember, updatedMember, context.service(ModuleIdProvider.class).apply(componentToUpdate));
unsetEffectiveTime(existingMember, updatedMember);
return true;
} else if (existingMember.isActive() && !componentToUpdate.isActive()) {
if (LOG.isDebugEnabled()) { LOG.debug("Inactivating {} member {}.", getMemberType(), existingMember.getId()); }
updatedMember.active(false);
updateModule(context, existingMember, updatedMember, context.service(ModuleIdProvider.class).apply(componentToUpdate));
unsetEffectiveTime(existingMember, updatedMember);
return true;
} else {
if (LOG.isDebugEnabled()) { LOG.debug("{} member {} already {}, not updating.", getMemberType(), existingMember.getId(), componentToUpdate.isActive() ? "active" : "inactive"); }
return false;
}
}

protected final boolean removeOrDeactivate(final TransactionContext context, final SnomedReferenceSetMember existingMember, final SnomedRefSetMemberIndexEntry.Builder updatedMember) {
if (!existingMember.isReleased()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected void doExecute(TransactionContext context, SnomedComponentDocument com
if (Objects.equals(existingValueId, inactivationValueId)) {

// Exact match, just make sure that the member is active
changed = ensureMemberActive(context, existingMember, updatedMember);
changed = ensureStatusChanged(context, existingMember, componentToUpdate, updatedMember);

} else if (!CLEAR.equals(inactivationValueId)) {
// Re-use this member, if the intention was not to remove the existing value
Expand Down