Search in sources :

Example 11 with SnomedIdentifier

use of com.b2international.snowowl.snomed.cis.SnomedIdentifier 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();
}
Also used : Reservation(com.b2international.snowowl.snomed.cis.reservations.Reservation) ImmutableSet(com.google.common.collect.ImmutableSet) SnomedIdentifier(com.b2international.snowowl.snomed.cis.SnomedIdentifier)

Aggregations

SnomedIdentifier (com.b2international.snowowl.snomed.cis.SnomedIdentifier)11 Test (org.junit.Test)10 Reservation (com.b2international.snowowl.snomed.cis.reservations.Reservation)3 Index (com.b2international.index.Index)1 Mappings (com.b2international.index.mapping.Mappings)1 ComponentCategory (com.b2international.snowowl.core.terminology.ComponentCategory)1 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)1 SnomedIdentifierConfiguration (com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration)1 SctId (com.b2international.snowowl.snomed.cis.domain.SctId)1 ItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy)1 SnomedIdentifierReservationServiceImpl (com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl)1 DefaultSnomedIdentifierService (com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Set (java.util.Set)1