use of com.b2international.snowowl.snomed.cis.reservations.Reservation in project snow-owl by b2ihealthcare.
the class SnomedIdentifierReservationServiceImplTest method whenReservingASingleSnomedIdentifier_ThenServiceMustStoreIt.
@Test
public void whenReservingASingleSnomedIdentifier_ThenServiceMustStoreIt() throws Exception {
final Reservation reservation = Reservations.single(Concepts.ROOT_CONCEPT);
this.reservationService.create(SINGLE_RESERVATION, reservation);
assertThat(this.reservationService.getReservations()).contains(reservation);
assertThat(this.reservationService.getReservation(SINGLE_RESERVATION)).isEqualTo(reservation);
}
use of com.b2international.snowowl.snomed.cis.reservations.Reservation in project snow-owl by b2ihealthcare.
the class SnomedIdentifierReservationServiceImpl method isReserved.
@Override
public Set<String> isReserved(Set<String> componentIdsToCheck) {
final ImmutableSet.Builder<String> reservedIds = ImmutableSet.builder();
final Set<SnomedIdentifier> identifiersToCheck = componentIdsToCheck.stream().map(SnomedIdentifiers::create).collect(Collectors.toSet());
for (Reservation reservation : getReservations()) {
reservation.intersection(identifiersToCheck).stream().map(SnomedIdentifier::toString).forEach(reservedIds::add);
}
return reservedIds.build();
}
Aggregations