Search in sources :

Example 11 with SnomedIdentifierReservationServiceImpl

use of com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl in project snow-owl by b2ihealthcare.

the class DefaultSnomedIdentifierServiceRegressionTest method issue_SO_2138_testItemIdWraparound.

@Test
public void issue_SO_2138_testItemIdWraparound() throws Exception {
    final ISnomedIdentifierReservationService reservationService = new SnomedIdentifierReservationServiceImpl();
    final SequentialItemIdGenerationStrategy idGenerationStrategy = new SequentialItemIdGenerationStrategy(reservationService);
    idGenerationStrategy.getOrCreateCounter(INT_NAMESPACE, ComponentCategory.CONCEPT).setCounter(999999999999999L);
    final ISnomedIdentifierService identifiers = new DefaultSnomedIdentifierService(store, idGenerationStrategy, reservationService, new SnomedIdentifierConfiguration());
    // Register a few existing SCTIDs to see if sorting works
    identifiers.register(ImmutableSet.of("999999999999997008", "999999999999998003", "100005", "101009"));
    List<String> actualIds = ImmutableList.copyOf(identifiers.generate(INT_NAMESPACE, ComponentCategory.CONCEPT, 2));
    List<String> expectedIds = ImmutableList.of("102002", "103007");
    assertEquals(expectedIds, actualIds);
}
Also used : SequentialItemIdGenerationStrategy(com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy) SnomedIdentifierReservationServiceImpl(com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl) ISnomedIdentifierReservationService(com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService) DefaultSnomedIdentifierService(com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService) ISnomedIdentifierService(com.b2international.snowowl.snomed.cis.ISnomedIdentifierService) SnomedIdentifierConfiguration(com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration) Test(org.junit.Test)

Example 12 with SnomedIdentifierReservationServiceImpl

use of com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl in project snow-owl by b2ihealthcare.

the class SnomedIdentifierPlugin method init.

@Override
public void init(final SnowOwlConfiguration configuration, final Environment env) throws Exception {
    checkIdGenerationSource(configuration);
    final ISnomedIdentifierReservationService reservationService = new SnomedIdentifierReservationServiceImpl();
    env.services().registerService(ISnomedIdentifierReservationService.class, reservationService);
    registerDefaultReservations(env, reservationService);
}
Also used : SnomedIdentifierReservationServiceImpl(com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl) ISnomedIdentifierReservationService(com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService)

Aggregations

SnomedIdentifierReservationServiceImpl (com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl)12 SnomedIdentifierConfiguration (com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration)11 ISnomedIdentifierReservationService (com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService)11 DefaultSnomedIdentifierService (com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService)10 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)9 SequentialItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy)9 Test (org.junit.Test)9 ItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy)7 Mappings (com.b2international.index.mapping.Mappings)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Before (org.junit.Before)2 Index (com.b2international.index.Index)1 ComponentCategory (com.b2international.snowowl.core.terminology.ComponentCategory)1 SnomedIdentifier (com.b2international.snowowl.snomed.cis.SnomedIdentifier)1 CisSnomedIdentifierService (com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService)1 SctId (com.b2international.snowowl.snomed.cis.domain.SctId)1 Reservation (com.b2international.snowowl.snomed.cis.reservations.Reservation)1 Set (java.util.Set)1