SharedIdGenerator extends BaleenResource { public String generateForAnnotation(final BaleenAnnotation annotation) { final String externalId = annotation.getExternalId(); return generateForExternalId(externalId); }  boolean resetIfNewJCas(final JCas jCas); String generateForAnnotation(final BaleenAnnotation annotation); String generateForExternalId(final String externalId); static final String RESOURCE_KEY; }
@Test public void testSameAnnotationSameUUID() throws UIMAException { final SharedIdGenerator generator = createSharedIdGenerator(); final JCas jCas = JCasSingleton.getJCasInstance(); final Person p2 = new Person(jCas); p2.setBegin(0); p2.setEnd(10); final Person p1 = new Person(jCas); p1.setBegin(0); p1.setEnd(9); final String p1UUID = generator.generateForAnnotation(p1); final String p2UUID = generator.generateForAnnotation(p2); assertNotEquals(p1UUID, p2UUID); assertEquals(p1UUID, generator.generateForAnnotation(p1)); assertEquals(p2UUID, generator.generateForAnnotation(p2)); }