Search in sources :

Example 11 with ISnomedIdentifierReservationService

use of com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService 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 ISnomedIdentifierReservationService

use of com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService 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

ISnomedIdentifierReservationService (com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService)12 SnomedIdentifierReservationServiceImpl (com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl)11 SnomedIdentifierConfiguration (com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration)10 SequentialItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy)9 DefaultSnomedIdentifierService (com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService)9 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)8 Test (org.junit.Test)8 ItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy)6 Before (org.junit.Before)2 Mappings (com.b2international.index.mapping.Mappings)1 CisSnomedIdentifierService (com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1